akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int x = saori.saori_hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		if(Math.abs(x-a) < Math.abs(x-b)){
			System.out.println("A");
		} else {
			System.out.println("B");
		}
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

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

int n,m,x;
int c[15],a[15][15];
int mn=(int)2e9;


void solve() 
{
    cin>>n>>m>>x;
    REP(i,n){
        cin>>c[i];
        REP(j,m)cin>>a[i][j];
    }
    int mn=(int)2e9;
    for(int b=0;b<(1<<n);b++){
        vector<int>sum(m,0);
        int all=0;
        REP(i,n){
            if(b&(1<<i)){
                all+=c[i];
                REP(j,m){
                    sum[j]+=a[i][j];
                }
            }
        }
        bool f=0;
        REP(i,m){
            if(sum[i]<x){
                f=1;
                break;
            }
        }
        if(f==1)continue;
        mn=min(mn,all);
    }
    cout<<(mn==(int)2e9?-1:mn)<<endl;
}

int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stdio.h>
#include <math.h>


using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef pair<int, int> pii;

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define Rep(i, n) for(int i=n; i >= 0; i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える


int main() {
	int x, y;
	cin >> x >> y;
	//x := head, y:= sum
	bool temp = false;

	for (int i = 0; i <= x; i++) {
		if (2 * x + 2 * i == y) {
			temp = true;
			break;
		}
	}

	if (temp) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n,a) for(int i=n;i>=a;i--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
#define pcnt(n) __builtin_popcount(n)
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const double PI = acos(-1);

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a;
    long double b;
    cin>>a>>b;
    int ans = (int)(floor(a*b));
    cout<<ans<<endl;
}

Measured memory_bytes: 3764
#include <cstdio>
#include <algorithm>
int N, a[501], O[250001], L[501], R[501], C[501], A[501];
std::pair < int, int > p[501];
int main()
{
	scanf("%d", &N);
	for (int i = 1; i <= N; i++)
	{
		scanf("%d", a + i);
		O[a[i]] = i;
		L[i] = i - 1;
		R[i] = N - i;
		p[i] = { a[i], i };
	}
	std::sort(p + 1, p + N + 1);
	for (int i = 1, c = 1; i <= N * N; i++)
		if (!O[i])
		{
			while (c <= N && !L[p[c].second])
				c++;
			if (c > N)
				break;
			O[i] = p[c].second;
			L[p[c].second]--;
		}
	for (int i = N * N, c = N; i; i--)
		if (!O[i])
		{
			while (c && !R[p[c].second])
				c--;
			if (!c)
				break;
			O[i] = p[c].second;
			R[p[c].second]--;
		}
	for (int i = 1; i <= N * N; i++)
		if (++C[O[i]] == O[i])
			A[O[i]] = i;
	for (int i = 1; i <= N; i++)
		if (A[i] != a[i] || C[i] != N)
		{
			puts("No");
			return 0;
		}
	puts("Yes");
	for (int i = 1; i <= N * N; i++)
		printf("%d%c", O[i], " \n"[i == N * N]);
	return 0;
}


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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) { a = b; return true; } return false;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) { a = b; return true; } return false;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(1){
        int n,m;cin>>n>>m;
        if(n==0&&m==0)break;
        vector<int>a(n);
        for(int i=0;i<n;i++){
            cin>>a[i];
        }
        int ma=0;
        for(int i=0;i<n;i++){
                for(int j=i+1;j<n;j++){
                if(a[i]+a[j]<=m)ma=max(a[i]+a[j],ma);
            }
        }
        if(ma==0)cout<<"NONE"<<endl;
        else cout<<ma<<endl;
    }
}


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

int main(){
    
    int a, b;
    
    cout << fixed << setprecision(12);
    
    cin >> a >> b;
    
    cout << a / b << " ";
    cout << a % b << " ";
    cout << ( double )a / b << endl;
    
    
    return 0;
}


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

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int left, right;
    left = A + B;
    right = C + D;

    if(left == right){
        cout << "Balanced" << endl;
    }else if(left > right){
        cout << "Left" << endl;
    }else{
        cout << "Right" << endl;
    }
}

Measured memory_bytes: 3640
import numpy as np

def main():
  N, K = map(int, input().split())
  h = list(map(int, input().split()))

  INF = 10**10

  dp = [INF]*N
  dp[0] = 0

  dp = np.array(dp)
  h = np.array(h)

  for i in range(N):
    T = min(N,i+K+1)
    dp[i+1:T] = np.minimum(dp[i+1:T], dp[i] + abs(h[i+1:T]-h[i]))

  print(dp[N-1])
  
if __name__ == '__main__':
    main()

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

int main(){
    int h1, m1, h2, m2, k;
    cin  >> h1 >> m1 >> h2 >> m2 >> k;
    cout << (h2 - h1) * 60 + (m2 - m1) - k << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <vector>
#include <limits>

using namespace std;
#define INF 1e18

int main() {
    int N, W;
    int w, v;
    scanf("%d%d", &N, &W);
    vector<int> wt(N), vl(N);
    int sum_val = 0;
    for (int i = 0; i < N; ++i) {
        scanf("%d%d", &w, &v);
        wt[i] = w;
        vl[i] = v;
        sum_val += v;
    }
    vector<long long>dp(sum_val+1, INF);
    dp[0] = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = sum_val; j >= vl[i]; --j) {
            dp[j] = min(dp[j], dp[j - vl[i]] + wt[i]);
        }
    }
    int ans = 0;
    for (int j = sum_val; j >= 0; --j) {
        if (dp[j] <= W) {
            ans = j;
            break;
        }
    }
    cout << ans;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<cassert>
#include<stack>
#include<algorithm>
#define MAX 505
#define BLOCK 0

using namespace std;

struct Rectangle{ int height;  int pos; };

int getLargestRectangle( int size, int buffer[]){
    //stack<Rectangle> S;
    Rectangle S[1000];
    int top = 0;
    int maxv = 0;
    buffer[size] = 0;
    
    for ( int i = 0; i <= size; i++ ){
        Rectangle rect;
        rect.height = buffer[i];
        rect.pos = i;
        if ( top == 0 ){
            //S.push( rect );
	    S[++top] = rect;
        } else {
            if ( S[top].height < rect.height ){
                //S.push( rect );
		S[++top] = rect;
	    } else if ( S[top].height > rect.height ) {
                 int target = i;
                 while ( top > 0 && S[top].height >= rect.height){
                     //Rectangle pre = S.top(); S.pop();
		     Rectangle pre = S[top--];
                     int area = pre.height * (i - pre.pos);
                     maxv = max( maxv, area);
                     target = pre.pos;
                 }
                 rect.pos = target;
                 //S.push(rect);
		 S[++top] = rect;
             }
         }
     }
     return maxv;
 }

int H, W;
int buffer[MAX][MAX];
int T[MAX][MAX];
 
int getLargestRectangle(){
    for ( int i = 0; i < H; i++ ){
	for ( int j = 0; j < W; j++ ){
	    T[i][j] = 0;
	}
    }
     
    for ( int j = 0; j < W; j++ ){
	int sequence = 0;
	for ( int i = 0; i < H; i++ ){
	    if ( buffer[i][j] == BLOCK ){
		sequence = T[i][j] = 0;
	    } else {
		T[i][j] = ++sequence;
	    }
	}
    }
    
    int maxv = 0;
    for ( int i = 0; i < H; i++ ){
	maxv = max( maxv, getLargestRectangle( W, T[i] ) );
    }
    
    return maxv;
}

int main(void){
    char ch;
    while(1){
	scanf("%d %d", &H, &W);
	if ( H == 0 && W == 0) break;
	scanf("%c", &ch);
	char ch;
	for ( int i = 0; i < H; i++ ){
	    for ( int j = 0; j < W; j++ ){
		scanf("%c", &ch);
		if ( ch == '*' ) buffer[i][j] = 0;
		else buffer[i][j] = 1;
	    }
	    scanf("%c", &ch);
	}
	cout << getLargestRectangle() << endl;
    }
    
    return 0;
}

Measured memory_bytes: 2880
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n,k;
vi a;

int main(){
	cin>>n>>k;
	a=vi(n);
	for(auto &i:a) cin>>i;
	for(int i=0;i<k&&a!=vi(n,n);i++){
		vi b(n);
		for(int j=0;j<n;j++){
			int l=j-a[j],r=j+a[j]+1;
			l=max(l,0);
			b[l]++;
			if(r<n) b[r]--;
		}
		for(int j=1;j<n;j++) b[j]+=b[j-1];
		a=b;
	}
	for(int i=0;i<n;i++) cout<<a[i]<<" \n"[i==n-1];
}

Measured memory_bytes: 4844
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args)
	{
		Scanner s=new Scanner(System.in);
		
		long n=s.nextLong();
		long m=s.nextLong();
		
		long sum=0;
		
		for(int i=0;i<m;i++)
		{
			sum=sum+s.nextLong();
		}
		
		System.out.println(Math.max(-1,n-sum));
		
	}
	
}

Measured memory_bytes: 46136
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7

def mapline(t = int):
    return map(t, sysread().split())
def mapread(t = int):
    return map(t, read().split())

def run():
    N, *A = mapread()

    dp = [defaultdict(lambda:0) for _ in range(N+1)]
    dp[0][(0,0,0)] = 1
    for i in range(N):
        a = A[i]
        k = i + 1
        for key in dp[k-1].keys():
            for ii, v in enumerate(key):
                if v == a:
                    tmp = list(key)
                    tmp[ii] += 1
                    dp[k][tuple(tmp)] += dp[k-1][key] % mod
    ans = 0
    for key in dp[N].keys():
        ans = (ans + dp[N][key]) % mod
    #print(dp)
    print(ans)


if __name__ == "__main__":
    run()


Measured memory_bytes: 143872
# 最大公約数
def gcd(a,b):
    if a < b:
        a,b = b,a
    if a % b == 0:
        return b
    else:
        return gcd(b,(a % b))

N,X = map(int,input().split())
x = input().split()
for i in range(N):
    x[i] = int(x[i])

marge = [abs(X - x[i]) for i in range(N)]
D = marge[0]
for i in range(1,N):
    D = gcd(D,marge[i])

print(D)

Measured memory_bytes: 11096
#include <bits/stdc++.h>
using namespace std;
#define rep(n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for (int i=0;i<(n);i++)
#define rep3(i,a,b) for (int i=a;i<(b);i++)
#define out(ans) cout << ans << endl;
#define outs(ans) cout << ans;
using ll = long long;

int main(){

    //imput n, a(n), b(n)
    int n,k;
    cin >> n>>k;

    //main process

    out(n-k+1)


    return 0;
}








Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 2e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

ll calc(ll x) {
    if (x < 0) return 0;
    ll ret = 0;
    for (ll i = 0; i < 41; i++) {
        ll t = 1LL << (i + 1);
        ll cnt = (x / t) * (t / 2);
        cnt += max(0LL, (x % t) - (t / 2 - 1));
        if (cnt % 2 == 1) ret += (1LL << i);
    }
    return ret;
}

int main() {
    ll a, b;
    cin >> a >> b;

    ll ans = calc(a - 1) ^ calc(b);
    cout << ans << endl;
    return 0;
}


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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

void solve() {
  long long n, p; scanf("%lld%lld", &n, &p);
  long long ans = 1;
  for (long long i = 2; i*i <= p; ++i) {
    long long cnt = 0;
    for (long long j = i; p%j == 0 && j <= p; j *= i) {
      ++cnt;
    }
    if (cnt < n) continue;
    ans = i;
  }
  if (n == 1) ans = p;
  printf("%lld", ans);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

const int N=3000+5;

int n;
ld p[N];
ld dp[N][2*N];

int f(int x)
{
    return x+n;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>p[i];
    }
    dp[1][f(1)]=p[1];
    dp[1][f(-1)]=1-p[1];
    for(int i=2;i<=n;i++)
    {
        for(int now=-i;now<=i;now++)
        {
            ld s=dp[i-1][f(now-1)]*p[i]+dp[i-1][f(now+1)]*(1-p[i]);
            dp[i][f(now)]=s;
        }
    }
    ld s=0;
    for(int i=1;i<=n;i++)
    {
        s+=dp[n][f(i)];
    ///    cout<<dp[n][f(i)]<<"\n";
    }
    cout<<fixed<<setprecision(9)<<s<<"\n";
    return 0;
}


Measured memory_bytes: 280064
using System;
using System.Linq;

namespace _0038
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string y = Console.ReadLine();
                if (y == null) { break; }
                int[] a = y.Split(',').Select(int.Parse).ToArray();
                Array.Sort(a);
                int g = a[0], h = a[1], j = a[2], k = a[3], l = a[4];
                
                if ((a[0] == a[1] && a[1] == a[2] && a[2] == a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])) { Console.WriteLine("four card"); }
                else if ((a[0] == a[1] && a[1] == a[2] && a[3] == a[4]) || (a[2] == a[3] && a[3] == a[4] && a[1] == a[0])) { Console.WriteLine("full house"); }
                else if ((h == g + 1 && j == h + 1 && k == j + 1 && l == k + 1) || (h == 10 && j == 11 && k == 12 && l == 13 && g == 1)) { Console.WriteLine("straight"); }
                else if ((g == h && h == j) || (h == j && j == k) || (j == k && k == l)) { Console.WriteLine("three card"); }
                else if ((g == h && k == j) || (g == h && k == l) || (h == j && k == l)) { Console.WriteLine("two pair"); }
                else if (g == h || h == j || j == k || k == l) { Console.WriteLine("one pair"); }
                else
                {
                    Console.WriteLine("null");
                }
            }

        }
    }
}

Measured memory_bytes: 9344
#include <cstdio>

int main()
{
	int hash[100001];
	int i;
	int n;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		int a;
		scanf("%d", &a);
		hash[a] = i+1;
	}

	for (i = 1; i < n+1; i++) {
		printf("%d ", hash[i]);
	}
	return 0;
}


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

int main() {

    int N;
    cin >> N;
    map<int,int> M;
    for(int i = 0; i < N; i++){
        int a;
        cin >> a;
        M[i+1] = a;
    }
    int ans = 0;
    for(auto m : M){
        if(M[m.second] == m.first){
            ans++;
        }
    }
    cout << ans/2 << endl;

    return 0;
}

Measured memory_bytes: 8316
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;

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 P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main() {
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  ll ans = 0;
  if (a >= k) {
    ans = k;
  } else if (a + b >= k) {
    ans = a;
  } else if (a + b + c >= k){
    ans = a - (k - (a + b));
  } else {
    ans = a - c;
  }
  P(ans);
  return 0;
}

Measured memory_bytes: 3640
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    s, t = map(str, input().decode().split())
    s = list(s)
    t = list(t)
    ans = []
    for i in range(n):
        ans.append(s[i])
        ans.append(t[i])
    print(*ans, sep='')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define For(i, a, b) for (int i = int(a); i < int(b); i++)
#define Dor(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define Foz(i, a) For(i, 0, a)
#define Doz(i, a) Dor(i, 0, a)
#define Trav(e, v) for (auto& e : v)
#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<ii>;
template <typename T> bool ckmin (T& a, T b) { return (b < a) ? a = b, 1 : 0; }
template <typename T> bool ckmax (T& a, T b) { return (b > a) ? a = b, 1 : 0; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (string& e) { return "\"" + e + "\""; }
string to_string (char e) { return "\'" + string(1, e) + "\'"; }
string to_string (bool e) { return e ? "true" : "false"; }
template <typename T> string to_string (T e) {
	string s = "[ ";
	for (auto& x : e) s += to_string(x) + " ";
	return s + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e) {
	return "(" + to_string(e.first) + ", " + to_string(e.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
 	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	ll h; cin >> h;
	vector<ll> v;
	while (h) { v.pb(h); h /= 2; }
	ll ans = 0, x = 1;
	Foz(i, sz(v)) { ans += x; x <<= 1; }
	cout << ans << '\n';
}



Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<algorithm> // sort,reverse,min,lower_bound
using namespace std;
#define df 0
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long int li;
// print_item
template<typename T>
void print_item(T x) {cout << x;}
// pair 型の print (map 含む)
template<typename F,typename S>
void print_item(pair<F,S> x);
// map 型
template<typename F,typename S>
void print(map<F,S>& vec,string str="");

// 汎用
void print(auto& vec,string str="");

void make(const vector<li>& vec,vector<li>& ret){
  map<li,int> mp;
  li s=0; int n=vec.size()/3;
  rep(i,n){
    mp[vec[i]]++;
    s+=vec[i];
  }
  vector<li> fmr;
  ret.push_back(s);
  rep(i,n){
    li a=vec[n+i];
    mp[a]++;
    s+=a;
    a=mp.begin()->first;
    if((--mp[a])<=0)mp.erase(a);
    s-=a;
    ret.push_back(s);
  }
}

int main(){
  if(df) printf("*debug mode*\n");
  int n; cin >>n;
  vector<li> vect(3*n);
  for(auto& x:vect) cin >>x;
  if(df)print(vect,"vec");
  vector<li> fmr,ltr;
  make(vect,fmr);
  if(df)print(fmr,"fmr");
  reverse(vect.begin(),vect.end());
  li ans=0;
  for(auto& x:vect) {x*=-1; ans+=x;}
  make(vect,ltr);
  if(df)print(ltr,"ltr");
  rep(i,n+1){
    li temp=fmr[i]+ltr[n-i];
    if(df)printf("%ld%+ld\n",fmr[i],ltr[n-i]);
    if(temp>ans) ans=temp;
  }
  cout << ans;
}

// pair 型の print (map 含む)
template<typename F,typename S>
void print_item(pair<F,S> x) {
  printf("(");
  print_item(x.first);
  printf(",");
  print_item(x.second);
  printf(")");
}



void print(auto& vec,string str){
  if(str!="") cout << str << ":";
  for(auto x: vec) {print_item(x); cout << " ";}
  cout << endl;
}

// map 型
template<typename F,typename S>
void print(map<F,S>& vec,string str){
  if(str!="") cout << str << ":";
  for(auto x: vec) {print_item(x); cout << " ";}
  cout << endl;
}

/// confirm df==0 ///


Measured memory_bytes: 11128
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;
static const long long mod = 1000000007;

int main() {
  cout << fixed << setprecision(15);

  ll h, w, k;
  cin >> h >> w >> k;

  vector<string> mp(h);
  rep(i, h) cin >> mp[i];

  ll ans = 0;
  rep(sh, 1 << h) rep(sw, 1 << w){
    ll tmp = 0;
    rep(i, h) rep(j, w){
      bool ok = (((sh >> i) & 1) && ((sw >> j) & 1)) && mp[i][j] == '#';
      if(ok) tmp++;
    }
    if(tmp == k) ans++;
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3636
n=int(input())
a=list(map(int,input().split()))
a_max=max(a)
a_min=min(a)
if n==1:
    print(0)
else:
    ans=4000000
    for i in range(a_min,a_max+1):
        buf=0
        for j in range(n):
            buf+=(a[j]-i)**2
        ans=min(ans,buf)
    print(ans)

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

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

typedef long long ll;
using namespace std;

int main() {
  int n,a,b;
  
  scanf("%d", &n);
  scanf("%d", &a);
  scanf("%d", &b);

  n = a*n;
  if(n < b){
    printf("%d\n", n);
  }
  else printf("%d\n", b);
  

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
    int N, result, exc;
	cin >> N;
    vector<int> res(8, 0);
    result = exc = 0;
    for (int i = 0; i < N; i++) {
        int ai;
        cin >> ai;
        if (ai >= 1 && ai <= 399) {
            res[0]++;
        } else if (ai >= 400 && ai <= 799) {
            res[1]++;
        } else if (ai >= 800 && ai <= 1199) {
            res[2]++;
        } else if (ai >= 1200 && ai <= 1599) {
            res[3]++;
        } else if (ai >= 1600 && ai <= 1999) {
            res[4]++;
        } else if (ai >= 2000 && ai <= 2399) {
            res[5]++;
        } else if (ai >= 2400 && ai <= 2799) {
            res[6]++;
        } else if (ai >= 2800 && ai <= 3199) {
            res[7]++;
        } else {
            exc++;
        }
    }

    for (int i = 0; i < 8; i++) {
        if (res[i] != 0) {
            result++;
        }
    }
    if (result == 0 && exc >= 1) {
        result = 1;
        exc = exc - 1;
    }
    cout << result << " " << result + exc << endl;
}

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

int main() {
    ll n, a, b;
    cin >> n >> a >> b;

    ll ans;
    if ((b - a) % 2 == 0)
        ans = (b - a) / 2;
    else
        ans = min(a - 1, n - b) + 1 + (b - a - 1) / 2;

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String b = sc.next();
        sc.close();
        switch(b) {
        case "A":
        	System.out.println("T");
        	break;
        case "T":
        	System.out.println("A");
        	break;
        case "G":
        	System.out.println("C");
        	break;
        case "C":
        	System.out.println("G");
        	break;
        default:
        	break;
        }
        
    }
}

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

public class Solution
{
    public static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var counts = new int[100001];

        foreach (var a in A)
        {
            counts[a]++;
        }
        var sum = A.Sum();

        var answer = new List<long>();
        var Q = int.Parse(Console.ReadLine());
        for (int q = 0; q < Q; q++)
        {
            var vals = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            var B = vals[0];
            var C = vals[1];

            sum += (C - B) * counts[B];
            counts[C] += counts[B];
            counts[B] = 0;
            answer.Add(sum);
        }

        Console.WriteLine(string.Join(Environment.NewLine, answer));
    }
}

Measured memory_bytes: 48508
N,K = map(int,input().split(' '))
S = list(input())

first = S[0]
flg = False
for index in range(1,N):
    if S[index] == first and flg:
        flg = False
        K -= 1
    elif S[index] != first:
        S[index] = first
        flg = True
    
    if K == 0:
        break
 
count = 0
for index in range(1,N):
    if S[index] == S[index -1]:
        count += 1
    

print(count)




Measured memory_bytes: 4084
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <stack>
#include <math.h>
using namespace std;
//常に心してかかれ
//簡単なことを簡単にできるように練習する
//びっくりするくらいつまらないことで詰まってることも多い
int n;//問題で設定された呼び出し階層の深さ
class dot{
public:
	double x;
	double y;

	dot(double X,double Y){
		x=X;
		y=Y;
	}
};

void makeDots(dot A,dot B,int m){//m:この関数の呼び出し元の呼び出し階層
	double tmp_x;
	double tmp_y;

	tmp_x = A.x + (B.x - A.x)/3;
	tmp_y = A.y + (B.y - A.y)/3;

	dot P(tmp_x,tmp_y);

	tmp_x = sqrt(3.0)*(B.x - A.x) - (B.y-A.y);
	tmp_y = (B.x - A.x) + sqrt(3.0)*(B.y - A.y);
	tmp_x = tmp_x/(2*sqrt(3.0));
	tmp_y = tmp_y/(2*sqrt(3.0));
	tmp_x +=A.x;
	tmp_y +=A.y;

	dot Q(tmp_x,tmp_y);

	tmp_x = A.x + 2*(B.x - A.x)/3;
	tmp_y = A.y + 2*(B.y - A.y)/3;

	dot R(tmp_x,tmp_y);

	m++;
	if(m == n){
		cout <<A.x <<" " <<A.y <<endl;
		cout <<P.x <<" " <<P.y <<endl;
		cout <<Q.x <<" " <<Q.y <<endl;
		cout <<R.x <<" " <<R.y <<endl;
		return;
	}

	makeDots(A,P,m);
	makeDots(P,Q,m);
	makeDots(Q,R,m);
	makeDots(R,B,m);

}

int main(){
	dot A(0,0);
	dot B(100,0);

	cin >>n;

	if(n == 0){
		cout <<"0.00000000 0.00000000" <<endl;
		cout <<"100.00000000 0.00000000" <<endl;
		return 0;
	}
	makeDots(A,B,0);

	cout <<100 <<" " <<0 <<endl;
	return 0;
}

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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

string X;
int ssum;

int main() {
    cin >> X;
    int N = X.length();
    ll ans = 0;
    REP(i, N) {
        if(X[i] == 'S') {
            ssum++;
        } else if(ssum > 0) {
            ssum--;
            ans += 2;
        }
    }
    cout << N - ans << "\n";
}


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

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

    int ans = 0;
    for (int i=0; i<N; i++){
        int temp = 0;
        for (int j=0; j<N; j++){
            if (j<i) temp += A1[j];
            else if (j==i) temp += A1[j] + A2[j];
            else temp += A2[j];
        }

        if (temp > ans) ans = temp;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    N, M = MI()
    n = [2] * N
    m = [1] * M
    arr = n + m
    ans = 0

    for pair in list(itertools.combinations(arr, 2)):
        if (pair[0] + pair[1]) % 2 == 0:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 40556
N = int(input())
A = [[0 for _ in range(9)] for _ in range(9)]
for i in range(1, N+1):
    S = str(i)
    if S[-1] == '0':
        continue
    A[int(S[0])-1][int(S[-1])-1] += 1
ans = 0
for i in range(9):
    for j in range(9):
        ans += A[i][j]*A[j][i]
print(ans)

Measured memory_bytes: 9104
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a;
  cin >> a;
  int x;
  cin >>x;
  for(int i = 0; i<x;i++){
      string b;
      int y, z;
      cin >> b >> y >> z;
      if(b=="print"){
          for(int j=y;j<=z;j++){
              cout << a[j];
          }
          cout << endl;
      }else if(b=="reverse"){
          for(int j = z;j >= y;j--){
              for(int k=y;k<j;k++){
                char m = a[k];
                a[k] = a[k+1];
                a[k+1] = m;
              }
          }
      }else if(b=="replace"){
          string c;
          cin >> c;
         int l = 0;
          for(int j = y;j<=z;j++){
           
              a[j] = c[l];
            l++;
          }
      }
  }
}




Measured memory_bytes: 3164
#include <stdio.h>

int main( void ) 
{
	int r,c;
	int matrix[101][101];
	int cols[101]={0};
	int i,j,k;
	int res=0,sum=0;
	
	scanf( "%d%d", &r, &c );
	for( i=0; i<r; i++ ) {
		for( j=0; j<c; j++ ) {
			scanf( "%d", &matrix[i][j] );
		}
	}
	
	
	sum=0;
	for( i=0; i<r; i++ ) {
		res=0;
		for( j=0; j<c; j++ ) {
			printf( "%d ", matrix[i][j] );
			res+=matrix[i][j];
			cols[j]+=matrix[i][j];
		}
		sum+=res;
		printf( "%d\n", res );	
		if( r-1 == i ) {
			res=0;
			for( k=0; k<c; k++ ) {
				printf( "%d ", cols[k] );
				res+=cols[k];
			}
			printf( "%d\n", res );	
		}
	}
	

	return 0;
}

Measured memory_bytes: 640
alphabets=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
n=int(input())
current=0
length=0
while current<n:
  current+=26**(length+1)
  length+=1
current-=26**(length)
n-=current+1
ans=[]
for i in range(length):
  ans.append(alphabets[((n%(26**(i+1)))-n%(26**i))//(26**i)])
ans.reverse()
print(''.join(ans))

Measured memory_bytes: 61756
<?php
fscanf(STDIN,"%d",$n);
$a=explode(' ',trim(fgets(STDIN)));

if(in_array(0,$a)){
    echo 0;
    exit;
}

$ans = 1;
foreach($a as $value){
    $ans *= $value;
}

if($ans>pow(10,18)){
    echo -1;
    exit;
}

echo $ans;

Measured memory_bytes: 25548
#include<iostream>
using namespace std;
int main(){
  int n,m;
  int dp[65536];
  int t[16][17];
  while(1){
    cin>>n;
    if(n==0)break;
    m=1;
    for(int i=0;i<n;i++){
      m*=2;
      for(int j=0;j<=n;j++)cin>>t[i][j];
    }
    for(int i=1;i<m;i++)dp[i]=2000000;     
    dp[0]=0;
    for(int i=1;i<m;i++){
      for(int j=0,k=1;j<n;j++,k*=2){
       	if((i%(k*2))/k==1){
	  int p=i,mn=t[j][0],c=0;
	  while(p){
	    if(p%2==1&&c!=j)mn=min(mn,t[j][c+1]);
	    p/=2;
	    c++;
	  }
	  dp[i]=min(dp[i],dp[i-k]+mn);
	}
      }
    }
    cout<<dp[m-1]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1416
N = int(input())
ab = [list(map(int, input().split())) for _ in range(N)]

ba = []
for i, j in ab:
    ba.append([j, i])

ab.sort()
ba.sort(reverse = True)

if N % 2 == 1:
    n = (N+1) // 2 - 1
    ans = ba[n][0] - ab[n][0] + 1
    
else:
    n = N // 2 - 1
    ans = (ba[n][0] + ba[n+1][0]) - (ab[n][0] + ab[n+1][0]) + 1

print(ans)

Measured memory_bytes: 63636
n=int(input())
MAX=(10**4)
cntl=[0]*(MAX+1)

for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      if x**2+y**2+z**2+x*y+y*z+x*z>MAX:
        break
      cntl[x**2+y**2+z**2+x*y+y*z+x*z]+=1
for i in range(1,n+1):
  print(cntl[i])

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

long long f0(long long n) {
    if (n % 2 == 0) {
        if (n % 4 == 0) return n;
        else return n ^ 1;
    } else {
        return ((n + 1) / 2) % 2;
    }
}

int main() {
    long long A, B; cin >> A >> B;
    if (A == 0) cout << f0(B) << endl;
    else  cout << (f0(A-1) ^ f0(B)) << endl;
}


Measured memory_bytes: 256
a,b=map(int,input().split())
flag=False
for i in range(0,a+1):
    for j in range(0,a+1):
        if((i+j)==a):
            if(((i*2)+(j*4))==b):
                flag=True
if(flag==True):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9196
import java.util.*;

class Main{
    public static void main(String[] args){
        int  x,y,z,c;
        Scanner in = new Scanner(System.in);
        x = in.nextInt();
        y = in.nextInt();
        z = in.nextInt();
        c = 0;
        while( x <= y ){
            if( z%x == 0){
                c = c + 1;
            }
            x = x + 1;
        }
        System.out.println(c);
    }
}
 

Measured memory_bytes: 17328
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>

using namespace std;
using pii=pair<int,int>;
using ll=long long;

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

    ll l,r;
    cin>>l>>r;

    ll answer=LLONG_MAX;
    for(ll i=l; i<=r && i<l+2019; i++){
        for(ll j=i+1; j<=r && j<l+2019; j++){
            answer=min(answer,((i*j)%2019));
        }
    }

    cout<<answer;

    return 0;
}


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

bool isPrime(int x) { for(int i=2; i*i<=x; i++) if(x%i==0) return false; return true; }

int main() {
  
  int n;
  while(cin >> n, n) {
    int ans = 0;
    for(int i=0; !isPrime(n+i); i++, ans++);
    for(int i=0; !isPrime(n-i); i++, ans++);
    cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

typedef pair<int,int> pii;

int main(){
    int n, t;
    cin >> n >> t;
    vector<pii> v;
    for(int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;
        v.push_back({a,b});
    }
    sort(v.begin(), v.end());
    vector<int> dp(6005, 0);
    int ans = 0;
    for(int i = 0; i < n; i++){
        ans = max(ans, v[i].second+dp[t-1]);
        for(int j = t-1+v[i].first; j >= v[i].first; j--){
            dp[j] = max(dp[j], dp[j-v[i].first]+v[i].second);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main( )
{
    char a;
    cin>>a;
    if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u')     
	 cout<<"vowel"<<endl;
    else cout<<"consonant"<<endl;
    return 0; 
} 

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

#define N 10000

int main(void){
  int n, q, A[N], num;
  int cnt=0;
  
  scanf("%d", &n);
  for(int i=0; i<n; i++) scanf("%d", A+i);
  
  scanf("%d", &q);
  for(int i=0; i<q; i++){
    scanf("%d", &num);
    for(int j=0; j<n; j++){
      if(num == A[j]){
	cnt++;
	break;
      }
    }
  }

  printf("%d\n", cnt);
  
  return 0;
}



Measured memory_bytes: 3268
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int A,B,C;
  cin >> A >> B >> C;
  cout <<((A*B*C)==175?"YES":"NO") << endl;
  return 0;
}

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

using namespace std;

using ll = long long;

constexpr int MOD = 1e9 + 7;
int n;
vector<vector<int>> adj;
vector<vector<int>> dp;

ll Solve(const int p, const int v, bool is_select) {
    if (dp[v][is_select] != -1) return dp[v][is_select];

    ll res1 = 1, res2 = 1;
    for (int u : adj[v])
        if (u != p) {
            res1 = (res1 * Solve(v, u, true)) % MOD; // v を選ばない
            if (is_select) // v を選ぶ
                res2 = (res2 * Solve(v, u, false)) % MOD;
        }
    if (is_select) dp[v][is_select] = (res1 + res2) % MOD;
    else dp[v][is_select] = res1 % MOD;

    return dp[v][is_select];
}

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

    cin >> n;
    adj.resize(n);
    for (int i = 0, x, y; i < n - 1; ++i) {
        cin >> x >> y;
        adj[x - 1].push_back(y - 1);
        adj[y - 1].push_back(x - 1);
    }

    dp.resize(n, vector<int>(2, -1));
    cout << Solve(-1, 0, true) << endl;

    return 0;
}


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

int main() {
	int a, b;
	cin >> a >> b;

	if (a >= 13) {
		cout << b << endl;
	}
	else if (6<=a&&a<13) {
		cout << b/2 << endl;
	}
	else if (a<=5) {
		cout << 0 << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
const int mod = 1e9+7;

//エラストテネスの篩
struct sieve_of_Eratosthenes {
    vector<bool> prime;
    sieve_of_Eratosthenes(int m) {init(m);}
    void init(int m) {
        prime.resize(m+1,true);
        prime[1] = false;
        for (int i = 2; i <= m; i++) {
            if (prime[i]) {
                for (int j = 2*i; j <= m; j += i) prime[j] = false;
            }
        }
    }
};

vint x;

int dfs(int n, int sum) {
    if (sum > 75) return 0;
    if (n == x.size()) {
        if (sum == 75) return 1;
        else return 0;
    }
    int res = 0;
    REP(i,x[n]+1) {
        res += dfs(n+1,sum*i);
    }
    return res;
}

int main() {
    int n; cin >> n;
    sieve_of_Eratosthenes se(n);
    for (int i = 2; i <= n; i++) {
        if (se.prime[i]) {
            int a = i;
            int sum = 0;
            while (a <= n) {
                sum += n/a;
                a *= i;
            }
            x.push_back(sum+1);
        }
    }
    cout << dfs(0,1) << endl;
}

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

int main() {
    string S;
    cin >> S;
    int N = S.size();
    string s1 = S.substr(0, N / 2);
    string s2 = S.substr(N / 2 + 1, N / 2);
    if (s1 == s2) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

typedef long long ll;
#define all(x) (x).begin(),(x).end()

void solve(){
    int r;
    cin >> r;

    cout << r * r << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

using namespace std;

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
#define anD &&
#define oR ||

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

int main() {
	int a, b, c;
	cin >> a >> b >> c;

	if (a < b anD b < c)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 1156