akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int i=1;
		int n = sc.nextInt();
		do{
			int x=i;
			if(x%3 == 0){
				System.out.print(" "+i);
			}
			else {
				while(true){
					if(x%10==3){
        				System.out.print(" "+i);
						break;
					}
					x/=10;
					if(x!=0)continue;
					else break;
				}
			}
		}while(++i<=n);
			System.out.println();
	}
}

Measured memory_bytes: 28776
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  int ans=b-a;
  cout<<b+ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int M = scanner.nextInt();

    int left = 0;
    int right = N;
    for (int i = 0; i < M; i++) {
      left = Math.max(left, scanner.nextInt());
      right = Math.min(right, scanner.nextInt());
    }
    System.out.println(Math.max(right - left + 1, 0));
  }
}


Measured memory_bytes: 64328
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, A, B = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

if abs(A - B) % 2 == 0:
    print(abs(A - B) // 2)
    exit()

a = min(A - 1, N - B) + 1 + (B - A - 1) // 2

print(a)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long ll;

int main(){
  int N;
  cin>>N;
  vector<ll> a(N);
  for(int i=0;i<N;i++)
    cin>>a[i];
  for(int i=1;i<N;i++)
    a[i] += a[i-1];
  vector<ll> b(a);

  ll ansp = 0;
  ll n = 0;
  for(int i=0;i<N;i++){
    ll c = 0;
    if(i%2){
      if(a[i] <= 0){
        c = 1 - a[i];
        n += c;
        ansp += c;
      }
    }
    else{
      if(a[i] >= 0){
        c = 1 + a[i];
        n -= c;
        ansp += c;
      }
    }
    if(i<N-1)
      a[i+1] += n;
  }

  ll ansm = 0;
  n = 0;
  for(int i=0;i<N;i++){
    ll c = 0;
    if(i%2 == 0){
      if(b[i] <= 0){
        c = 1 - b[i];
        n += c;
        ansm += c;
      }
    }
    else{
      if(b[i] >= 0){
        c = 1 + b[i];
        n -= c;
        ansm += c;
      }
    }
    if(i<N-1)
      b[i+1] += n;
  }
  cout<<min(ansp,ansm)<<endl;
  return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner s = new Scanner(System.in);
		String a = s.next();
		try{
		String b = a.substring(0,4);
		
		if (b.equals("YAKI"))
		{
			System.out.println("Yes");
		} else
		{
			System.out.println("No");
		}
		}
		catch(StringIndexOutOfBoundsException e)
		{
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

map<ll, ll> prime_factorize(ll N) {
    map<ll, ll> res;
    for (ll i = 2; i * i <= N; ++i) {
        while (N % i == 0) {
            res[i]++;
            N /= i;
        }
    }
    if (N != 1) res[N] = 1;
    return res;
}

void Main() {
    ll A, B;
    cin >> A >> B;
    map<ll, ll> res = prime_factorize(gcd(A, B));
    // 素因数分解したとき，素数を貪欲に選ぶのが最も数は稼げるはず
    cout << res.size() + 1 << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define ld long double

int main() 
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
	
    int n;
    cin >> n;
    cout << (int) pow(n, 2);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

using i64 = int64_t;

i64 gcd(i64 m, i64 n) {
    return (n == 0 ? m : gcd(n, m % n));
}

i64 lcm(i64 m, i64 n) {
    return m / gcd(m, n) * n;
}

int main(){
    i64 n, m;
    cin >> n >> m;
    vector<i64> v;
    i64 num = 1;
    for(int i=0;i<n;++i){
        i64 a;
        cin >> a;
        v.push_back(a/2);
        num = lcm(a/2, num);
    }
    for(int i=0;i<n;++i){
        if((num / v[i]) % 2 == 0){
            cout << 0 << endl;
            return 0;
        }
    }

    cout << (m/num+1)/2 << endl;

    return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

bool ans[3][3];

int main(){
    int a[3][3];
    
    rep(i, 3)rep(j, 3)cin >> a[i][j];
    int n;
    cin >> n;
    rep(i, n){
        int b;
        cin >> b;
        rep(j, 3)rep(k, 3){
            if(b==a[j][k]){
                ans[j][k]=true;
            }
        }
    }

    rep(i, 3){
        bool tmp=true;
        rep(j, 3){
            tmp &= ans[i][j];
        }
        if(tmp){
            cout << "Yes" << endl;
            return 0;
        }
    }

    rep(i, 3){
        bool tmp=true;
        rep(j, 3){
            tmp &= ans[j][i];
        }
        if(tmp){
            cout << "Yes" << endl;
            return 0;
        }
    }

    if(ans[0][0]&&ans[1][1]&&ans[2][2] || ans[0][2]&&ans[1][1]&&ans[2][0]){
        cout << "Yes" << endl;
        return 0;
    }
    
    cout << "No" << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> c(h);
    for(int i = 0; i < h; i++) cin >> c[i];

    /*for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cout << c[i][j] << ' ';
        }
        cout << endl;
    }*/

    int ans = 0;
    for(int bit_i = 0; bit_i < (1<<h); bit_i++){
        for(int bit_j = 0; bit_j < (1<<w); bit_j++){
            vector<string> d(c);

            for(int i = 0; i < h; i++){
                if(bit_i >> i & 1){
                    for(int k = 0; k < w; k++){
                        d[i][k] = '.';
                    }
                }
            }
            for(int j = 0; j < w; j++){
                if(bit_j >> j & 1){
                    for(int k = 0; k < h; k++){
                        d[k][j] = '.';
                    }
                }
            }

            int b = 0;
            for(int i = 0; i < h; i++){
                for(int j = 0; j < w; j++){
                    if(d[i][j] == '#') b++;
                }
            }
            if(b == k) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>

using namespace std;

int main()
{
long long a[10];
cin>>a[1]>>a[2]>>a[3];
sort(a+1,a+4);
if((a[1]%2==0)||(a[2]%2==0)||(a[3]%2==0))cout<<0;
else cout<<a[1]*a[2];
return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace abc168c
{
    class Program
    {
        static void Main(string[] args)
        {
            //==========================================================================================================================
            //1) input
            List<int> input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            int a = input[0];
            int b = input[1];
            int h = input[2];
            int m = input[3];

            double radA = 2.0 * Math.PI / 720 * (60 * h + m);
            double radB = 2.0 * Math.PI / 60 * m;



            //==========================================================================================================================
            //2) output
            double output = Math.Sqrt(Math.Pow(a, 2) + Math.Pow(b, 2) - 2 * a * b * Math.Cos(Math.Abs(radB - radA)));
            Console.WriteLine(output);
        }
    }
}


Measured memory_bytes: 28712
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<list>
#include<vector>
#include<stdio.h>
#include<iomanip>
using namespace std;

int main(){

	int n,p=0;
	cin >> n;
	int a[n];
	for(int j=0;j<n;j++){
		cin >> a[j];
	}
	sort(a,a+n);

	for(int i=0;i<n;i=i+2){
		p=p+a[i];
	}
	for(int k=1;k<n;k=k+2){
		p=p-a[k];
	}
	
	cout << abs(p) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define fr(i,k,n) for (int i = k; i < n; ++i)
#define fri(i,k,n) for (int i = k; i >= n; --i)
#define INF (int)1e9
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define all(arr) arr.begin(),arr.end()

void boost(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void solve(){
	ll n,k;
	cin>>n>>k;
	ll ans=0;
	if(k%2==0){
		ll y=k/2;
		y=(n/y);
		y-=(n/k);
		ans+=(y*y*y);
		// cout<<ans<<endl;
	}
	ll x=n/k;
	// cout<<x<<endl;
	ans+=(x*x*x);
	cout<<ans<<endl;
	return;
}

int main()
{
	boost();
	
	int tc=1;
	//cin>>tc;
	while(tc--)
		solve();
	return 0;
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = n - 1; i >= 0; i--) {
            a[i] = sc.nextInt();
        }
        printArray(a);
    }

    private static void printArray(int[] arr) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < arr.length; i++) {
            sb.append(arr[i]);
            if (i != arr.length - 1) {
                sb.append(" ");
            }
        }
        System.out.println(sb);
    }
}

Measured memory_bytes: 26292
def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)

def lcm(a, b):
    return int(a * b / int(gcd(a, b)))

def solve():
    n = input()
    nums = list(map(int, input().split()))
    c_m = lcm(nums[0], nums[1])
    for n in nums[2:]:
        c_m = lcm(c_m, n)
    print(c_m)

solve()

Measured memory_bytes: 7784
#include <bits/stdc++.h>
using namespace std; 
long long a,b,c;
long long gcd(long long x,long long y){
	if(y==0)return x;
	return gcd(y,x%y);
}
int main() { 
    //freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>a>>b;
	c=gcd(a,b);
	cout<<a*b/c<<endl;
    return 0; 
}/*
*/

Measured memory_bytes: 256
a,b,h,m=map(int, input().split())


import math

a_rad = math.radians((h+m/60)/12 * 360)

b_rad = math.radians(m/60 * 360)

print(math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(a_rad - b_rad)))

Measured memory_bytes: 9496
#include <bits/stdc++.h>
using namespace std;
const int MOD = pow(10,9)+7;
int main(){
  int H,W;
  cin >> H >> W;
  char c;
  vector<int> A(W);
  A[0] = 1;
  for(int i = 0; i < H; ++i){
    for(int j = 0; j < W; ++j){
      cin >> c;
      if(c == '#') A[j] = -1;
      else if(j != 0){
        if(A[j] == -1) A[j] = A[j-1];
      	else if(A[j-1] != -1) A[j] = (A[j]+A[j-1])%MOD;
      }
    }
  }
  if(A[W-1] == -1) cout << 0;
  else cout << A[W-1];
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

string S;
int K;
ll dp[101][4][2];

ll rec(int idx, int k, bool upmost) {
  ll& ret = dp[idx][k][upmost];

  if (ret >= 0) return ret;
  if (idx == S.size()) { return k == 0; }

  ret = 0;

  if (upmost) {
    if (idx > 0) {
      ret += rec(idx + 1, k, S[idx] == 0);
    }
    else {
      ret += rec(idx + 1, k, 0);
    }
    if (k) {
      REP(d, 1, S[idx] + 1) {
        ret += rec(idx + 1, k - 1, S[idx] == d);
      }
    }
  }
  else {
    ret += rec(idx + 1, k, 0);
    if (k) {
      REP(d, 1, 10) {
        ret += rec(idx + 1, k - 1, 0);
      }
    }
  }

  return ret;
}

int main() {
  cin >> S >> K;
  rep(i, S.size()) S[i] -= '0';
  rep(i, 101) rep(j, 4) rep(k, 2) dp[i][j][k] = -1;
  cout << rec(0, K, 1) << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define F first
#define S second
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define PI 3.141592653589
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 1000000000
#define N 200005  //check the limits, man
int main()
{
    int n,m,i,j,k,a;
    in2(n,k);
    string str;
    cin >> str;
    reverse(all(str));
    vi ans,v;
    rep(i,n+1)
        if(str[i]=='0')v.pb(i);
    i=0;
    while(i<n)
    {
        j=upper(v,i+k);
        a=v[j-1];
        if(i==a)
        {
            out(-1);
            return 0;
        }
        ans.pb(a-i);
        i=a;
    }
    m=ans.size();
    reverse(all(ans));
    dbg(ans,i,m);
}




Measured memory_bytes: 1592
#include <iostream>
using namespace std;

int main()
{
  int N;
  cin >> N;
  static int v[100010];
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    ++v[a];
    --v[b+1];
  }
  int ans = 0;
  int acc = 0;
  for (int i = 0; i <= N+1; i++) {
    acc += v[i];
    if (acc >= i-1) {
      ans = i-1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1548
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh
int count(ll x){
	int cnt = 0;
	while(x != 0){
		cnt++;
		x /= 10;
	}
	return cnt;
}
int main()
{
	string s;
	cin >> s;
	set< char > st;
	for(int i = 0 ; i < (int)s.size() ; i++)
	{
		st.insert(s[i]);
	}
	if(s.size() == st.size())
		cout << "yes" << endl;
	else 
		cout << "no" << endl;
	return 0;
} 




Measured memory_bytes: 256
#改行を二次配列でとる
arr = Array.new
while line = $stdin.gets
arr << line.chomp.split.map(&:to_i)
end

n = arr[0][0]
d = arr[0][1]
arr.delete_at(0)
ans = 0
n.times{|t|
n.times{|m|
  sum = 0
  d.times{|l|
    sum += ((arr[t][l] - arr[m][l]).abs)**2
  }
  if (sum**(1/2.0) - (sum**(1/2.0)).to_i) == 0 then
    ans +=1
  end
}
}

print (ans - n)/2

Measured memory_bytes: 3836
import numpy as np
n, l = input().split()
n = int(n)
l = int(l)

taste = np.array([l + i for i in range(n)], dtype=np.int)
taste_abs = np.abs(taste)
i = np.argmin(taste_abs)

s = 0
for j in range(n):
    if j != i:
        s += taste[j]

print(s)

Measured memory_bytes: 21548
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();
        sc.nextLine();
        int i=1;
        for(;;){
            N/=K;
            if(N==0)break;
            i++;
        }
        System.out.println(i);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;


int main()
{
	string S;
	cin >> S;

	int ans = S.size();

	for (int i = 0; i < 2; i++) {
		
		int cnt = 0;

		for (int j = 0; j < S.size(); j++) {
			// 0,2,4,...
			if (j % 2 == 0 && S[j] != (char)(i + '0')) cnt++;
			// 1,3,5,...
			if (j % 2 == 1 && S[j] == (char)(i + '0')) cnt++;
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//約数列挙(√N)
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
//素因数分解(√N)
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
//素数テーブル(NloglogN)
vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}
//二項係数(K)
template< typename T >
T binomial(int64_t N, int64_t K) {
  if(K < 0 || N < K) return 0;
  T ret = 1;
  for(T i = 1; i <= K; ++i) {
    ret *= N--;
    ret /= i;
  }
  return ret;
}
//二項係数テーブル(N^2)
template< typename T >
vector< vector< T > > binomial_table(int N) {
  vector< vector< T > > mat(N + 1, vector< T >(N + 1));
  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= i; j++) {
      if(j == 0 || j == i) mat[i][j] = 1;
      else mat[i][j] = mat[i - 1][j - 1] + mat[i - 1][j];
    }
  }
  return mat;
}
int main(){
  int n;
  cin >> n;
  set<int> a;
  rep(i,n){
    int b;
    cin >> b;
    a.insert(b);
  }
  cout << a.size() << endl;
}
  
  

Measured memory_bytes: 3592
n =  int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
fill = 0
cnt = 0
for f in range(n):
    fill = fill + b[a[f] - 1]
    if(f != 0 and a[f] == a[f-1] + 1):
        fill = fill + c[a[f-1]-1]
        cnt = cnt + 1
    else:
        cnt = cnt + 1
print(fill)

Measured memory_bytes: 9136
#include <bits/stdc++.h>
#define  mp make_pair
#define  pb push_back
using namespace std;

int main() {
	int n,m;
	cin>>n>>m;
	vector<pair<int,int>> v;
	for(int i=0;i<m;++i) {
		int x,y;
		cin>>x>>y;
		v.pb(mp(x,y));
	}
	int a[100009];
	memset(a,0,sizeof a);
	for(int i=0;i<m;++i) {
		a[v[i].first]++;
		a[v[i].second+1]--;
	}
	int c = 0;
	for(int i=1;i<=n;++i) {
		a[i] += a[i-1];
		if(a[i] == m) {
			c++;
		}
	}
	cout<<c;
	return 0;
	
}

Measured memory_bytes: 1524
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------

string s,t;
int dp[3010][3010];

signed main(){
    cin >> s;
    cin >> t;
    int sl = sz(s);
    int tl = sz(t);
    REP(i,sl){
        REP(j,tl){
            dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
            dp[i+1][j+1] = s[i] == t[j] ? 
                max(dp[i+1][j+1], dp[i][j] + 1) :
                dp[i+1][j+1];
        }
    }

    string ret = string("\n");
    while(sl && tl){
        if (s[sl-1] == t[tl-1]) {
            sl--; tl--;
            ret = s[sl] + ret;
        } else if (dp[sl][tl-1] == dp[sl][tl]){
            tl--;
        } else {
            sl--;
        }
    }
    cout << ret;
}

Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S,T;
  cin>>S>>T;
  for(unsigned int i=0 ; i<S.length();i++){
    if(S.at(i)!=T.at(i)){cout<<"No"<<endl;return 0;}
  }
  if(T.at(T.length()-1)>='a'&&T.at(T.length()-1)<='z')cout<<"Yes"<<endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)

int main() {
  int N; cin >> N;
  vector<int> h(N);
  rep(i, 0, N) cin >> h[i];
  int ans = 0;
  int left = 0;
  while(1) {
    while(left < N && !h[left]) left++;
    if(left == N) break;
    int right = left;
    while(right < N && h[right]) right++;
    rep(i, left, right) h[i]--;
    ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
/*
g++ -std=c++14 -o2 -Wall ABC.cpp -o .\ABC.out
.\ABC.out
*/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main(){
  vector<pair<int,int> > a;
  int n;
  cin >> n;
  for (int i=0;i<n;++i) {
    int temp;
    cin >> temp;
    a.push_back(make_pair(temp, (i+1)));
  }
  sort(a.begin(),a.end());
  for(int i=0;i<n;++i) {
    cout << a[i].second;
    if (i==n-1) cout << "\n";
    else cout << " ";
  }
  return 0;
}


Measured memory_bytes: 1780
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll=long long;

int main() {
	int n;
	cin>>n;
	vector<int> p(n),q(n),r(n);
	rep(i,n)r[i]=i+1;
	rep(i,n)cin>>p[i];
	rep(i,n)cin>>q[i];
	
	int nanbanp=0,nanbanq=0;
	int count=0;
	do{
		count++;
		if(r==p)nanbanp=count;
		if(r==q)nanbanq=count;
	}while(next_permutation(r.begin(),r.end()));
	
	cout<<abs(nanbanp-nanbanq)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll a,b;
	cin>>a>>b;
	if(a==1||b==1){
		cout << 1;
		return 0;
	}
	cout << (a*b+2-1)/2;
	// your code goes here
	return 0;
}

Measured memory_bytes: 3604
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<math.h>
#include<string>
#include <cctype>
#include <cstdlib>
#include<bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1ll<<60;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

using namespace std;
using ll = long long;
typedef pair<int, int> P;
const ll B = 1000000000000000000;

int main(){
    int n; cin >> n;
    ll a[n];
    ll result = a[0];
    rep(i, n){
        cin >> a[i];
        if(a[i]==0){
            out(0);
            return 0;
        }
    }
    result = a[0];
    reps(i, 1, n){
        if(a[i] > B/result){
            out(-1);
            return 0;
        }
        result *= a[i];
    }

    out(result);
}


Measured memory_bytes: 4424
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 1000000007; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


signed main() {
  int H, W; 
  cin >> H >> W;

  vector<string> s(H);
  REP(i, H) cin >> s[i];

  queue<pair<int, int>> q;
  vector<vector<int>> dist(H, vector<int>(W, INF));
  dist[0][0] = 0;
  if(s[0][0] == '#') dist[0][0]++;
  int dx[2] = {1, 0};
  int dy[2] = {0, 1};

  q.push(make_pair(0, 0));

  while(!q.empty()){
    auto p = q.front(); q.pop();
    int x = p.first;
    int y = p.second;

    REP(i, 2){
      int xx = x+dx[i];
      int yy = y+dy[i];
      if(OUT(0, xx, H)) continue;
      if(OUT(0, yy, W)) continue;

      int d = dist[x][y];
      if(s[xx][yy] != s[x][y]) d++;
      if(dist[xx][yy] <= d) continue;
      dist[xx][yy] = d;
      q.push(make_pair(xx, yy));
    }
  }

  cout << (dist[H-1][W-1]+1)/2 << endl;

  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)

int main()
{
    ll a, b, c;
    cin >> a >> b >> c;
    if (c - a - b < 0)
    {
        cout << "No"<< "\n";
    }
    else if ((ll)4 * a * b < (c - a - b) * (c - a - b))
    {
        cout << "Yes"<< "\n";
    }
    else
    {
        cout << "No"<< "\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main(){
  int N; cin >> N;
  vector<long long> A(N);
  for(int i = 0; i < N; i++) cin >> A[i];
  sort(A.begin(),A.end());
  
  long long ans = 0, sum = 0;

  for(int i = 0; i < N; i++){
    if(sum * 2 < A[i]){
      ans = 0;
    }
    sum += A[i];
    ++ans;
  }
  cout << ans << endl;
  return 0;
}






Measured memory_bytes: 4040
//問4 2717 佐久間　翼
import java.util.Scanner;
public class Main{
    
    public void solve(){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int hoz=1;
        int ichi=0;
        while(N!=0){
            for(int cnt=0;cnt<N;cnt++){
                int k=sc.nextInt();
                if(k>=2){
                    hoz++;
                }else if(k==1){
                    ichi++;
                }
            }
            if(hoz>=2){
                System.out.println(hoz+ichi);
            }else{
                System.out.println("NA");
            }
            hoz=1;
            ichi=0;
            N=sc.nextInt();
        }
    }
    public static void main(String[]args){
        Main obj = new Main();
        obj.solve();
    }
}

Measured memory_bytes: 158524
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<ld> vld;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); ++i)
#define ALL(v) (v).begin(), (v).end()
#define endl "\n"

ll INF = 1e9;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "YES" << endl;}
void no(){ cout << "NO" << endl;}

//-----------------------------------------

//-----------------------------------------
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  ll n;
  cin >> n;
  vll x(n);
  REP(i,n) cin >> x[i];
  ll ans = INF;

  for(ll p = -1; p <= 101; p++){
    ll sum = 0;
    REP(j,n) sum += (x[j] - p) * (x[j] - p);
    ans = min(ans,sum);
  }
  cout << ans <<endl;



  return 0;
}



Measured memory_bytes: 3656
#include <iostream>

int main(){
    int N;
    long ans = 0;
    std::cin >> N;

    for(auto i = 1; i <= N; i++){
        if(i % 3 != 0 && i % 5 != 0){
            ans += i;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
  map<int,int> m,m2;
  int n; cin >> n;
  
  rep(i,n){
    int x; cin >> x;
    if(i%2) m2[x]++;
    else m[x]++;
  }
  
  vector<pair<int, int>> L,R;
  
  for (auto a:m){
    L.push_back(make_pair(a.second,a.first));
  }
  for (auto a:m2){
    R.push_back(make_pair(a.second,a.first));
  }
  
  sort(L.begin(),L.end(),greater<pair<int,int>>());
  sort(R.begin(),R.end(),greater<pair<int,int>>());
  
  if(L[0].second != R[0].second){
    cout << n - L[0].first - R[0].first;
  }
  else{
    cout << n - max(L[0].first + R[1].first, L[1].first + R[0].first);
  }
}

Measured memory_bytes: 6136
#include<iostream>
using namespace std;
int main()
{
	long long int n,c=1,m,t,temp;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>t;
		if(t>c)
		{
			temp=c;
			c=t;
			t=temp;
		}
		long long int k,l;
		k=t;
		l=c;
		while(t!=0)
		{
			temp=c%t;
			c=t;
			t=temp;
		}
		c=k/c*l;
	}	
	cout<<c<<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str = br.readLine();
		String data[] = { "abc", "acb", "bac", "bca", "cab", "cba" };
		for (int i = 0; i < 6; i++) {
			if (data[i].equals(str)) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		System.out.println("No");
	}
}

Measured memory_bytes: 21332
#include <iostream>
#include <vector>
#include <map>
#include <list>
#include <algorithm>
#include <cassert>
#include <string>
#include <climits>

using namespace std;
using ll = long long;

int gcd(int x, int y)
{
	while (x % y != 0) {
		int tmp = 0;
		tmp = x % y;
		x = y;
		y = tmp;
	}

	return y;
}

int main()
{
	int N;
	cin >> N;
	int A[N];
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A, A+N);

	int res = gcd(A[0], A[1]);
	for (int i = 2; i < N; i++) {
		res = gcd(res, A[i]);
	}

	cout << res << endl;
}



Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // AtCoder *s* Contest
        String line = sc.nextLine();
        
        String[] ws = line.split(" ");
        System.out.println("A" + ws[1].charAt(0) + "C");
    }
}


Measured memory_bytes: 21716
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n; cin>>n;
    int a,b,c,d; cin>>a>>b>>c>>d;
    a--; b--; c--; d--;
    string s,ans="Yes"; cin>>s;
    if(c<d){
        for(int i=b+1;i<d-1;i++){
            if(s[i]=='#' && s[i+1]=='#') ans="No";
        }
        for(int i=a+1;i<c-1;i++){
            if(s[i]=='#' && s[i+1]=='#') ans="No";
        }
        cout<<ans<<endl;
    }
    else{
        ans="No";
        for(int i=b;i<=d;i++){
            if(s[i-1]=='.' && s[i]=='.' && s[i+1]=='.') ans="Yes";
        }
        if(ans=="No") cout<<ans<<endl;
        else{
            for(int i=a+1;i<c-1;i++){
                if(s[i]=='#' && s[i+1]=='#') ans="No";
            }
            cout<<ans<<endl;
        }
    }
}



Measured memory_bytes: 3684
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
	int n, q, b, e;
	std::vector<long> a;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif


#if INPUT_FROM_FILE
	ifs >> n;
#else
	std::cin >> n;
#endif

	a.resize(n, 0);
	for(int i = 0; i < n; i++){
#if INPUT_FROM_FILE
		ifs >> a[i];
#else
		std::cin >> a[i];
#endif
	}


#if INPUT_FROM_FILE
	ifs >> q;
#else
	std::cin >> q;
#endif

	for(int i = 0; i < q; i++){
#if INPUT_FROM_FILE
		ifs >> b >> e;
#else
		std::cin >> b >> e;
#endif

		std::reverse(a.begin() + b, a.begin() + e);
	}

	std::cout << a[0];
	for(int i = 1; i < a.size(); i++){
		std::cout << " " << a[i];
	}
	std::cout << std::endl;
	return 0;
}



Measured memory_bytes: 3104
using System;

namespace C
{
    class Program
    {
        private static long Solve(long n)
        {
            long either = (long)Math.Sqrt(n);            
            while (either > 0)
            {
                if (n % either == 0)
                {
                    var other = (long)(n / either);
                    return either + other - 2;
                }
                
                --either;
            }
            return n - 1;
        }

        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            Console.WriteLine(Solve(n));
        }
    }
}


Measured memory_bytes: 13140
package main

import (
        "bufio"
        "fmt"
        "os"
        "strconv"
        "strings"
)

////////////////////////////////////////
///        templates                 ///
////////////////////////////////////////

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
        sc.Scan()
        return sc.Text()
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readBigLine() string {
        buf := make([]byte, 0, 1000000)
        for {
                l, p, e := rdr.ReadLine()
                if e != nil {
                        panic(e)
                }
                buf = append(buf, l...)
                if !p {
                        break
                }
        }
        return string(buf)
}

func strSprit(str string) []string {
        cols := strings.Split(str, " ")
        return cols
}

func parseInt(str string) int {
        n, _ := strconv.Atoi(str)
        return n
}

func intSprit(str string) []int {
        strs := strSprit(str)
        cols := make([]int, len(strs))
        for i, v := range strs {
                cols[i] = parseInt(v)
        }
        return cols
}

////////////////////////////////////////
///        end templates             ///
////////////////////////////////////////

func main() {
        line := nextLine()

        N := parseInt(line)

        sum := 0
        max := 0
        for i := 0; i < N; i++ {
                l := nextLine()
                n := parseInt(l)
                sum += n
                if max < n {
                        max = n
                }
        }
        sum -= max
        sum += max / 2

        fmt.Println(sum)
}


Measured memory_bytes: 640
#include<iostream>
#include<cctype>
#include<queue>
#include<cstdio>
#include<cmath>
#include<sstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<ctime>
#include<cstdlib>
#include<map>
#include<utility>
#include<iomanip>
#include<set>
#include<stack>
//#include<Windows.h>
using namespace std;
typedef long long ll;typedef pair<int,int> pii;
typedef pair<ll,ll> pll;typedef vector<string> vss;
typedef vector<int> vii;typedef vector<pii> vpi;
typedef vector<ll> vll;typedef vector<pll> vpl;
typedef unsigned long long ul;typedef queue<int> qii;typedef queue<pii> qpi;
int a[10005],n,m,ans;
char c;
string s;
vector<int> v;
int main()
{
	cin>>s;
	if(s.size()<4) puts("No");
	else if(s[0]!='Y'||s[1]!='A'||s[2]!='K'||s[3]!='I') puts("No");
	else puts("Yes");
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(a) for a in input().split()]
p = 0
for a in A[1:]:
    p ^= a
ans = [p]
l = A[0]
for i in range(1, N):
    k = l
    l = A[i]
    h = k ^ l
    ans.append(ans[i-1] ^ h)

for a in ans:
    print(a, end=' ')
print()

Measured memory_bytes: 31364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string s,t;
	cin>>s;
	t="keyence";
	ll ans=0;
	for(int i=0;i<s.size();i++){
		if(s[i]==t[ans]){
			ans++;
		}
		else{
			break;
		}
		if(ans==7){
			cout<<"YES";
			return 0;
		}
	}
	ll ans2=0;
	if(ans!=7){
		for(int i=s.size()-1;i>=0;i--){
			if(s[i]==t[6-ans2]){
				ans2++;
			}
			else{
				break;
			}
			if(ans+ans2==7){
				cout <<"YES";
				return 0;
			}
		}
	}
	cout << "NO";
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<functional>
#include<numeric>

using namespace std;

typedef long long ll;

int main(){
	int n, m; scanf("%d %d", &n, &m);
	ll x[1000], y[1000], z[1000];
	for(int i = 0; i < n; i++) scanf("%lld %lld %lld", &x[i], &y[i], &z[i]);
	ll res = -(1LL << 61);
	for(int s = 0; s < 8; s++){
		int c[3];
		for(int i = 0; i < 3; i++) c[i] = ((s >> i) & 1) == 1 ? -1 : 1;
		ll t[1000];
		for(int i = 0; i < n; i++) t[i] = c[0] * x[i] + c[1] * y[i] + c[2] * z[i];
		sort(t, t + n, greater<ll>());
		res = max(res, accumulate(t, t + m, 0LL));
	}
	printf("%lld\n", res);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int main() {
  string s, t;
  cin >> s >> t;

  for (int i = 0; i < s.size(); i++) {
    rotate(s.rbegin(), s.rbegin() + 1, s.rend());
    if (s == t) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;

public class Main {
    static long n;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextLong();
        sc.close();

        ArrayList<Long> list = new ArrayList<>();

        dfs(list, 0);

        Iterator<Long> itr = list.iterator();

        while (itr.hasNext()) {
            String s = itr.next().toString();
            if (!(s.contains("3") && s.contains("5") && s.contains("7"))) {
                itr.remove();
            }
        }

        System.out.print(list.size());
    }

    public static void dfs(ArrayList<Long> list, long x) {
        if (x <= n) {
            list.add(x);
        } else {
            return;
        }

        dfs(list, x * 10 + 3);
        dfs(list, x * 10 + 5);
        dfs(list, x * 10 + 7);
    }
}

Measured memory_bytes: 25940
S = input()
T = input()
ans = 1000000
for i in range(len(S)-len(T)+1):
    U = S[i:i + len(T)]
    score = 0
    for j in range(len(T)):
        if U[j] != T[j]:
            score += 1
    ans = min(ans, score)

print(ans)


Measured memory_bytes: 9108
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( ll i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

ll ans;
vector<ll> sa, sb;
ll a[200005], b[200005];


int main(void) {
    ll n, m, k;
    cin >> n >> m >> k;

    rep(i, 1, n+1) cin >> a[i];
    rep(i, 1, m+1) cin >> b[i];

    sa.pb(0);
    sb.pb(0);
    rep(i, 1, n+1) sa.pb(sa[i-1]+a[i]);  
    rep(i, 1, m+1) sb.pb(sb[i-1]+b[i]);  

    for (ll i=0; i<=n; i++) {
        ll sum = sa[i];
        if (sum>k) break;
        ll x = upper_bound(sb.bg, sb.en, k-sum) - sb.bg;
        x--;

        ans = max(ans, i+x);
        
        
    }

  
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 10988
#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    int n, k, r, s, p;
    string t, m = "";
    cin >> n >> k >> r >> s >> p >> t;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        if(i < k) {
            if(t[i] == 'r') ans += p;
            if(t[i] == 'p') ans += s;
            if(t[i] == 's') ans += r;
            m += '1';
        }
        else {
            if(t[i] != t[i-k]) {
                if(t[i] == 'r') ans += p;
                if(t[i] == 'p') ans += s;
                if(t[i] == 's') ans += r;
                m += '1';
            }
            else {
                if(m[i-k] == '1') m += '0';
                else {
                    if(t[i] == 'r') ans += p;
                    if(t[i] == 'p') ans += s;
                    if(t[i] == 's') ans += r;
                    m += '1';
                }
            }
        }
    }
    
    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 640
#define ___IHIs1y 	
#define ___hpjc70oXK8 (i&1) 
#define ___LSSUCc3cvx5 (i=1;
#define ___1UeJbriRi5MV 0 
#define ___JBO99OiEUW 0;
#define ___3xHS90v ;
#define ___pkdZc = 
#define ___A5HaSpEeYM [i 
#define ___rHLF1Gns ];
#define ___DK8DN6YcH a 
#define ___icNvMk a[i];
#define ___ofRUueC ans 
#define ___ZQMrUeUOY ans+= 
#define ___J8qfO7adI ans-= 
#define ___KiwzljY cin>>a[i];
#define ___x0Dt3Patj cin>>n;
#define ___rQ3aaLWiJH cout<<ans;
#define ___JuHkSoDioT6T else 
#define ___8jVTp61m for 
#define ___HaWe4PLrw i++)
#define ___GkiZg i++){if 
#define ___ArZoR i<=n;
#define ___oFGuMxI int 
#define ___ta5CcmmJ0L main()
#define ___MfwFVcObjYHVU n,a[105],i;
#define ___VWStu5wjD namespace 
#define ___NtB2w0keQsy return 
#define ___6EF7E6BBMUO5Ah reverse(a+1,a+n+1);
#define ___IWQXGebVxH sort(a+1,a+n+1);
#define ___gPAp5WkIowC std;
#define ___oNiSqlU2M using 
#define ___BYTEjh {
#define ___x2HDtdQKaX }
#include <iostream> 
#include <algorithm> 
#include<cmath> 
#include<cstring> 
#include<cstdio> 
#include<cstdlib> 
#include<vector> 
#include<iomanip> 
#define sqr(x) (x)*(x) 
___oNiSqlU2M ___VWStu5wjD ___gPAp5WkIowC ___oFGuMxI 
___MfwFVcObjYHVU ___oFGuMxI ___ta5CcmmJ0L ___BYTEjh ___IHIs1y ___x0Dt3Patj ___IHIs1y ___8jVTp61m ___LSSUCc3cvx5 
___ArZoR ___HaWe4PLrw ___IHIs1y ___BYTEjh ___IHIs1y ___IHIs1y ___KiwzljY ___IHIs1y ___x2HDtdQKaX ___IHIs1y ___IWQXGebVxH 
___IHIs1y ___6EF7E6BBMUO5Ah ___IHIs1y ___oFGuMxI ___ofRUueC ___pkdZc ___1UeJbriRi5MV ___3xHS90v ___IHIs1y ___8jVTp61m 
___LSSUCc3cvx5 ___ArZoR ___GkiZg ___hpjc70oXK8 ___ZQMrUeUOY ___DK8DN6YcH ___A5HaSpEeYM ___rHLF1Gns ___JuHkSoDioT6T 
___J8qfO7adI ___icNvMk ___x2HDtdQKaX ___IHIs1y ___rQ3aaLWiJH ___IHIs1y ___NtB2w0keQsy ___JBO99OiEUW ___x2HDtdQKaX 

Measured memory_bytes: 256
n = int(input())

status = True
t = x = y = 0

for i in range(n):
    ti, xi, yi = list(map(int, input().split()))
    dist = abs(xi-x)+abs(yi-y)
    time = ti-t
    if (dist > time):
        status = False
    elif (time - dist) % 2 == 1:
        status = False

    t, x, y = [ti, xi, yi]

print("Yes" if status else "No")

Measured memory_bytes: 9144
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

signed main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int a, b;
  cin >> a >> b;

  vector<string> ans(100, string(100, '.'));
  if(a >= 2) {
    ans[50] = string(100, '#');
    // 白を区切る
    a -= 2;
    int x = 0, y = 48;
    while(a) {
      ans[y][x] = ans[y][x+1] = ans[y+1][x+1] = '#';
      x += 2;
      if(x >= 100) x = 0, y -= 2;
      a--;
    }
    // 黒を区切る
    b--;
    x = 0, y = 52;
    while(b) {
      ans[y][x] = '#';
      x += 2;
      if(x >= 100) x = 0, y += 2;
      b--;
    }
  } else {
    int x = 0, y = 0;
    while(b) {
      ans[y][x] = '#';
      x += 2;
      if(x >= 100) x = 0, y += 2;
      b--;
    }
  }

  cout << 100 << " " << 100 << endl;
  REP(i, 100) cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 256