akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];/*dictionary*/

/*char to int*/
int getChar(char ch){
    if (ch=='A') return 1;
    else if (ch=='C') return 2;
    else if (ch=='G') return 3;
    else if (ch=='T') return 4;
    else return 0;
}

/*str to int 5進法表記で復元できる*/
long long getKey(char str[]){
    long long sum=0,p=1,i;
    for (i=0;i<strlen(str);i++){
        sum+=p*(getChar(str[i]));
        p*=5;
    }
    return sum;
}

/*hash function*/
int h1(int key){return key%M;}
int h2(int key){return 1+(key%(M-1));}

int find(char str[]){
    long long key,i,h;
    key=getKey(str);
    for (i=0;;i++){
        h=(h1(key)+i*h2(key))%M;
        if(strcmp(H[h],str)==0) return 1;/*implicit break*/
        else if (strlen(H[h])==0) return 0;
    }
    return 0;
}

int insert(char str[]){
    long long key,i,h;
    key=getKey(str);
    for (i=0;;i++){
        h=(h1(key)+i*h2(key))%M;
        if (strcmp(H[h],str)==0) return 1;
        else if (strlen(H[h])==0){
            strcpy(H[h],str);
            return 0;
        }
    }
}

int main(){
    int i,n,h;
    char str[L],com[9];
    for (i=0;i<M;i++) H[i][0]='\0';
    scanf("%d",&n);
    for (i=0;i<n;i++){
        scanf("%s %s",com,str);
        
        if (com[0]=='i'){
            insert(str);
        }else{
            if (find(str)){
                printf("yes\n");
            }else{
                printf("no\n");
            }
        }
    }
    return 0;
}


Measured memory_bytes: 16080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;

int N, M, Q, S;
/*
int bit_search(vector<int> a, vector<int> b, vector<int> c, vector<int> d) {
    int sum = 0;
    for (int bit = 0; bit < (1 << M); ++bit) {
        if (__builtin_popcount(bit) == N) {
            int cnt = 0;
            for (int i = 0; i < N; i++) {
                if (bit & (1 << i)) { 
                    cnt++;
                    for (int j = 0; j < Q; j++) {
                        if (cnt == a.at(j)) {
                            int tmp = 0;
                            for (int k = 0; k < N; k++) {
                                if (bit & (1 << k)) tmp++;
                                if (tmp == b.at(j)) {
                                    if ((k - i) == c.at(j)) sum += d.at(j);
                                    else break;
                                }
                            }
                        }
                    }
                } else continue;
            }
        } else continue;
    }
    return sum;
}
*/

int dfs(int cnt, int num, vector<int> K, vector<int> a, vector<int> b, vector<int> c, vector<int> d) {
    int sum = 0;
    if (cnt < S) {
        if (num < N && (cnt - num) < M - 1) {
            cnt++;
            sum = max(sum, dfs(cnt, num, K, a, b, c, d));
            num++;
            K.at(cnt - 1) = 1;
            sum = max(sum, dfs(cnt, num, K, a, b, c, d));
        } else if (num >= N) {
            cnt++;
            sum = max(sum, dfs(cnt, num, K, a, b, c, d));
        } else if ((cnt - num) >= M - 1) {
            cnt++;
            num++;
            K.at(cnt - 1) = 1;
            sum = max(sum, dfs(cnt, num, K, a, b, c, d));
        }
    } else {
        vector<int> Y;
        int j = 1;
        for (int i = 0; i < S; i++) {
            if (K.at(i) == 1) Y.push_back(j);
            else j++;
        }
        for (int i = 0; i < Q; i++) {
            if (Y.at(b.at(i) - 1) - Y.at(a.at(i) - 1) == c.at(i)) sum += d.at(i);
        }
    }
    return sum;
}

int main(){
    cin >> N >> M >> Q;
    S = N + M - 1;
    vector<int> a(Q), b(Q), c(Q), d(Q);
    for (int i = 0; i < Q; i++) {
        cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);
        //a.at(i)--;
        //b.at(i)--;
    }

    vector<int> K(S, 0);
    //vector<int> dp(N, 0);
    //int sum = bit_search(a, b, c, d);
    //cout << sum << endl;

    int sum = dfs(0, 0, K, a, b, c, d);
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
using namespace std;
#define INF 1000000007
#define LINF 1000000000000000007
#define MOD 1000000007
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout << #X << ": " << X << " ";
#define ARDEB(i, X) cout << #X << "[" << i << "]: " << X[i] << " ";
#define END cout << endl;
#else
#define DEB(X) \
    {          \
    }
#define ARDEB(i, X) \
    {               \
    }
#define END \
    {       \
    }
#endif
typedef pair<int, int> P;
struct edge{int to,cost;};
typedef long long ll;


signed main()
{
    int a,p;
    cin>>a>>p;
    cout<<(a*3+p)/2<<endl;
 
}


Measured memory_bytes: 768
E[10002],W[10002],M,R,i=-1,j;
main(N){
	for(scanf("%d%d",&N,&M),getchar();++i<M;getchar())for(j=0;++j<=N;)getchar()-87?E[j]++:W[j]++;
	for(M*=j=N;--j;W[j]+=W[j+1])E[N-j+1]+=E[N-j];
	for(j=-1;++j<=N;)M>E[j]+W[j+1]?M=E[R=j]+W[j+1]:1;
	R=!printf("%d %d\n",R,R+1);
}

Measured memory_bytes: 672
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a, sum;
		int[] coins = {500, 100, 50, 10, 5, 1};
		while((a = 1000 - sc.nextInt()) != 1000){
			sum = 0;
			for(int coin:coins){
				sum += a / coin;
				a = a % coin;
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 25924
n = int(input())
point = []
for i in range(n):
    a, b = map(int, input().split())
    point.append([a+b, a, b])
point.sort(reverse=True)
takahashi = 0
aoki = 0
for i in range(n):
    if i%2==0:
        takahashi += point[i][1]
    else:
        aoki += point[i][2]
print(takahashi-aoki)

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

int main(){
    int n,m,l;
    int A[101][101], B[101][101];
    
    cin>>n>>m>>l;
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++) {
            cin>>A[i][j];
        }
    }
    for(int i=1; i<=m; i++){
        for(int j=1; j<=l; j++) {
            cin>>B[i][j];
        }
    }
    for(int i=1; i<=n; i++){
        for(int j=1; j<=l; j++){
            long long sum=0;
            for(int k=1; k<=m; k++){
                sum+=A[i][k]*B[k][j];
            }
            
            if(j==1){
                cout<<sum;
            } else {
                cout<<" "<<sum;
            }
        }
        cout<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3156
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================

ll N, X;
vll S;
vll P;

ll saiki(ll L, ll n) // レベルiの下からj枚食べるときのパティの数
{
	if (L == 0 && n == 1)
	{
		return 1;
	}
	else if (n <= 1 || L < 0)
	{
		return 0;
	}
	else if (1 < n && n <= 1 + S[L - 1])
	{
		return saiki(L - 1, n - 1);
	}
	else if (n == 1 + S[L - 1] + 1)
	{
		return saiki(L - 1, n - 2) + 1;
	}
	else if (1 + S[L - 1] + 1 < n && n <= 1 + S[L - 1] + 1 + S[L-1])
	{
		return saiki(L - 1, S[L - 1]) + 1 + saiki(L - 1, n - (1 + S[L - 1] + 1));
	}
	else
	{
		return saiki(L - 1, S[L - 1]) * 2 + 1;
	}




}



int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================

	cin >> N >> X;

	for (int i = 0; i <= N; i++)
	{
		S.emplace_back(ll(pow(2, i + 2)) - 3);
		P.emplace_back(ll(pow(2, i + 1)) - 1);
	}


	cout << saiki(N, X);






}





Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <bitset>
#include <stack>
#include <regex>

#define mod 1000000007
#define INF2 9999999999
#define INF (1 << 30)
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define P pair<int, int>

using namespace std;
using ll = int64_t;

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

void solve(){
    int r;
    cin >> r;
    if(r < 1200){
        cout << "ABC" << endl;
    }else if(r >= 1200 && r < 2800){
        cout << "ARC" << endl;
    }else{
        cout << "AGC" << endl;
    }
}

int main(){
    solve();
    return 0;
}

Measured memory_bytes: 256
N, L = (map(int, input().split()))

N_taste = N * L + N * (N + 1) / 2 - N

min = 1000000000000000
min_val = 0
for i in range(1, N + 1):
	if min > abs(L + i - 1):
		min = abs(L + i - 1)
		min_val = L + i - 1
		
print(int(N_taste - min_val))

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b;
  cin >> a >> b;
  vary(ll,A,a,0);
  vary(ll,B,b,0);
  set<ll> s;
  rep(i,a){
    cin >> A[i];
  }
  rep(i,b){
    cin >> B[i];
    s.insert(B[i]);
  }
  rep(i,a){
    if(s.find(A[i]) == s.end()){
      A[i] = 0;
    }
  }
  A.erase(remove_if(all(A),[](int i){return i == 0;}),A.end());
  //   rep(i,A.size()){
  //     cout << A[i]<<endl;
  //   }
  ll ans = 0,len = 0;
  if(A.size()){
    rep(j,B.size()){
      rep(i,A.size()){
        if(A[i] == B[j]){
          ll k = 0;
          len = 0;
          while((i + k) < (ll)A.size() && (j+len) < (ll)B.size()){
            if(A[i+k] == B[j+len]){
              ++len;
            }
            ++k;
          }
          ans = max(ans,len);
        }
      }
    }
    cout << ans << endl;
  }
  else
    cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 3320
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#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()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n, m;
    cin >> n >> m;
    vector<vector<ll>> g(n);
    REP(i, m) {
        ll a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<ll> path;
    vector<bool> used(n);
    auto dfs = [&](auto &&self, ll v, ll p) -> void {
        path.push_back(v);
        used[v] = true;
        for(auto to: g[v]) {
            if(!used[to]) {
                self(self, to, v);
                break;
            }
        }
    };

    vector<ll> ans;
    ll idx0 = 0, idx1 = g[0][0];
    used[idx0] = used[idx1] = true;

    dfs(dfs, idx0, -1);
    dump(path);
    reverse(ALL(path));
    ans = path;

    path.clear();
    dfs(dfs, idx1, -1);
    dump(path);
    for(auto i: path) ans.push_back(i);

    cout << ans.size() << "\n";
    REP(i, ans.size()) cout << ans[i]+1 << (i+1==ans.size() ? '\n' : ' ');

    return 0;
}

Measured memory_bytes: 10060
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n, k;
  cin >> n >> k;

  while(k--){
    int a, b;
    cin >> a >> b;
    cout << (min( min( n - a + 1, a), min(  n - b + 1, b)) + 2) % 3 + 1 << endl;
  }
  
  return(0);
}

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

int main() {
    int N, Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    vector<int> cnt(N);
    for (int i = 1; i < N; i++) {
        if (S[i - 1] == 'A' && S[i] == 'C') cnt[i]++;
    }
    for (int i = 1; i < N; i++)
        cnt[i] +=  cnt[i - 1];

    for (int i = 0; i < Q; i++) {
        int l, r;
        cin >> l >> r;
        l--; r--;
        cout << cnt[r] - cnt[l] << endl;
    }
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  string s;
  cin >> s;
  int ans = 0;
  for(int i = 0; i < s.size(); i++) {
    for(int j = i; j < s.size(); j++) {
      bool ok = true;
      int cnt = 0;
      for(int k = i; k <= j; k++) {
	if(s[k] == 'A' || s[k] == 'T' || s[k] == 'C' || s[k] == 'G') cnt++;
	else ok = false;
      }
      if(ok) ans = max(ans, cnt);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())

arr = list(map(int, input().split()))

dp = [float('inf')]*n

dp[0] = 0
dp[1] = abs(arr[0]-arr[1])

for i in range(2, n):
    for j in range(i-1, max(-1, i-k-1), -1):
        dp[i] = min(dp[i], dp[j]+abs(arr[i]-arr[j]))

print(dp[-1])


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

int main() {
	int n;
	cin >> n;
	int mx = 0;
	int sum = 0;
	
	int p[n];
	for (int i = 0; i < n; i++) {
		cin >> p[i];
		int m = p[i];
		mx = max(m, mx);
		sum += p[i];
	}
	
	cout << sum - mx / 2;
}
	


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

h, w, k = [int(item) for item in input().split()]
field = []
for i in range(h):
    field.append(input().rstrip())

ans = [[None] * w for _ in range(h)]

cnt = 0
for j, line in enumerate(field):
    init_line = False
    if "#" in line:
        cnt += 1
        for i, item in enumerate(line):
            if item == "#":
                if init_line:
                    cnt += 1
                else:
                    init_line = True
                ans[j][i] = cnt
                back = 1 
                while j - back >= 0 and ans[j-back][i] == None:
                    ans[j-back][i] = cnt
                    back += 1
            else:
                ans[j][i] = cnt
                back = 1 
                while j - back >= 0 and ans[j-back][i] == None:
                    ans[j-back][i] = cnt
                    back += 1

for j, line in enumerate(ans):
    for i, item in enumerate(line):
        if item == None:
            ans[j][i] = ans[j-1][i]
for line in ans:
    print(" ".join([str(item) for item in line]))

Measured memory_bytes: 44396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()

int N;

int main() {
  cin >> N;
  vector<int> W(N);
  rep(i, N) cin >> W[i];

  int ans = 1e9;
  vector<int> S(N + 1, 0);
  rep(i, N) S[i + 1] = S[i] + W[i];
  rep(i, N - 1) ans = min(ans, abs(2 * S[i + 1] - S[N]));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main{
	public static void main(String[] args){
		solve();
	}
	public static void solve(){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int k = sc.nextInt();
		ArrayList<String> list = new ArrayList<String>();
		HashMap<String, Integer> map = new HashMap<String, Integer>();
		for(int i=0;i<s.length();i++){
			for(int j=1;j<=5;j++){
				if(i+j>s.length()){
					break;
				}
				String t = s.substring(i, i+j);
				if(!map.containsKey(t)){
					map.put(t, 1);
					list.add(t);
				}
			}
		}
		Collections.sort(list);
		System.out.println(list.get(k-1));
	}
}


Measured memory_bytes: 24276
/*

2004年のとある日付を入力し、その日の曜日を出力せよ。
2004年1月1日は木曜日である。

やり方：
	・日付を入力。
	・「a年b月c日(d曜日)からスタートし、x年y月z日の曜日を0〜6で返す関数」を使って、曜日を求める。
	・出力して終わり。

結果：Run time error

何がおかしいのだろう。
サンプルと同じ結果にはなるのだが。

*/
#include <stdio.h>

int wdays(int a, int b, int c, int d, int x, int y, int z);

int main()
{
	int x;
	int y;
	int i=0;
	int week=4;
	int youbi;
	int sp;
	while(1){
		scanf("%d %d",&x,&y);
		if(x==0){
			break;
		}
		youbi=wdays00(2004, 1, 1, week, 2004, x, y);
		if(youbi==0){
			printf("Sunday\n");
		}
		else if(youbi==1){
			printf("Monday\n");
		}
		else if(youbi==2){
			printf("Tuesday\n");
		}
		else if(youbi==3){
			printf("Wednesday\n");
		}
		else if(youbi==4){
			printf("Thursday\n");
		}
		else if(youbi==5){
			printf("Friday\n");
		}
		else if(youbi==6){
			printf("Saturday\n");
		}
	}
	return 0;
}

int wdays00(int a,int b, int c, int d, int x, int y, int z)
{	
	int i;
	int days=0;
	while(1){
		if(a==x&&b==y&&c==z){
			break;
		};
		if(b==12){
			if(c==31){
				b=1;
				a++;
				c=0;
			}
		}
		if(b==4||b==6||b==9||b==11){
			if(c==30){
				c=0;
				b++;
			}
		}
		else if(b!=2&&b!=12){
			if(c==31){
				c=0;
				b++;
			}
		}
		if(b==2){
			if(a%400==0){
				if(c==29){
					c=0;
					b++;
				}
			}
			else if(a%100==0){
				if(c==28){
					c=0;
					b++;
				}
			}
			else if(a%4==0){
				if(c==29){
					c=0;
					b++;
				}
			}
			else{
				if(c==28){
					c=0;
					b++;
				}
			}
		}
		c++;
		d++;
		if(d==7){
			d=0;
		}
		days++;
	}
	return d;
}

Measured memory_bytes: 584
fun main (args : Array<String>) {
	val n = readLine()
	val N : Int = n!!.toInt()
	var l = readLine()!!.split(" ")
	var list1 : MutableList<Int> = mutableListOf()
	var list2 : MutableList<Int> = mutableListOf()
	for (i in 0..N - 1) {
		list1.add(l[i].toInt())
		list2.add(l[i].toInt())
	}
	list2.sort()
	var count : Int = 0
	for (i in 0..N - 1) {
		if (list1[i] != list2[i]) {
			count++
		}
	}
	return if (count <= 2) {
		println("YES")
	} else {
		println("NO")
	}
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int sq(int a){ return a*a; }

int f(vector<int>& a, int n){
    int res = 0;
    for(auto el : a){
        res += sq(n-el);
    }
    return res;
}

template <typename T>
istream& operator>> (istream &f, vector<T> &a){
    for(auto &el : a){ f >> el; }
    return f;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    cin >> a;
    int res = INT32_MAX;
    for(int i = -100; i <= 100; ++i){
        res = min(res, f(a, i));
    }
    cout << res;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[200005],b[200005];
int main(){
    int n,num=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=n;i>=1;i--){
        int j=i*2;b[i]=a[i];
        while(j<=n){
            b[i]^=b[j];
            j+=i;
        }
        if(b[i]) num++;
    }
    cout<<num<<endl;
    for(int i=1;i<=n;i++){
        if(b[i]) cout<<i<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 2432
list1=[]
list2=[]
for i in range(10):
    n=int(input())
    list1.append(n)
for x in range(10):
    a=int(input())
    list2.append(a)
list1.sort()
list1.reverse()

list2.sort()
list2.reverse()
print(f'{(list1[0]+list1[1]+list1[2])} {(list2[0]+list2[1]+list2[2])}')


Measured memory_bytes: 5612
def modpow(a,n,p):
    if n==0:
        return 1
    x=modpow(a,n//2,p)
    x=(x*x)%p
    if (n%2)==1:
        x=(x*a)%p
    return x%p
def modinv(a,p):
    return modpow(a,p-2,p)
import math
import fractions
import collections
import itertools
import pprint
N,M,K=map(int,input().split())
fracmod=[1]*(2*10**5+10)
invfracmod=[1]*(2*10**5+10)
p=998244353
for i in range(1,2*10**5+10):
    fracmod[i]=(fracmod[i-1]*i)%p
for i in range(2*10**5+10):
    invfracmod[i]=modinv(fracmod[i],p)
ans=0
for i in range(K+1):
    ans=(ans+(M*pow(M-1,N-1-i,p)*fracmod[N-1]*invfracmod[i]*invfracmod[N-1-i])%p)%p
print(ans)

Measured memory_bytes: 81216
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7

S = input()
N = len(S)
K = INT()

se = set()
for i in range(N):
    for j in range(i+1, min(i+6, N+1)):
        T = S[i:j]
        se.add(T)
ans = sorted(se)
print(ans[K-1])


Measured memory_bytes: 39920
#include<stdio.h>
#include<stdlib.h>
#pragma warning(disable:4996)

int main() {

	int n = 0, value = 0;
	

	scanf("%d", &n);

	for (int i = 1; i <= 9; i++) {

		if (n % i == 0) {

			if (n / i <= 9) {
				value = 1;
				break;
			}
		}
	}

	if (value == 1)
		printf("Yes");
	else
		printf("No");

	//system("PAUSE");
	return 0;
}

Measured memory_bytes: 128
#!/bin/bash
read shit
array=($(echo $shit | tr " " "\n"))
a=array[0]
b=array[1]
c=array[2]
if [[ $a -eq $b ]] && [[ $b -ne $c ]]; then
	echo "Yes"
	exit
fi
if [[ $b -eq $c ]] && [[ $c -ne $a ]]; then
	echo "Yes"
	exit
fi
if [[ $c -eq $a ]] && [[ $a -ne $b ]]; then
	echo "Yes"
	exit
fi
echo "No"

Measured memory_bytes: 632
/**
*    created: 24.07.2020 15:26:12
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int a, b; cin >> a >> b;
    vector<int> f, l;
    if (b - a <= 4) {
        int ans = 0;
        rep2(i,a,b+1) ans ^= i;
        cout << ans << endl;
        return 0;
    }
    while (a % 4 != 0) {
        f.push_back(a);
        a++;
    }
    while (b % 4 != 3) {
        l.push_back(b);
        b--;
    }
    int ans = 0;
    if (f.size() != 0) for (auto p : f) ans ^= p;
    if (l.size() != 0) for (auto p : l) ans ^= p;
    cout << ans << endl;
    return 0;
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	string s;
	cin >> s;
	int N = s.size();

	vector <int> ans(N, 0);
	//Rの寄与
	int cnt = 0;
	for (int ii = 0; ii < N; ++ii){
		if (s[ii] == 'R'){
			cnt++;
		} else {
			ans[ii] += cnt / 2;
			ans[ii-1] += (cnt+1) / 2;
			cnt = 0;
		}
	}

	//Lの寄与
	cnt = 0;
	for (int ii = N-1; ii >= 0; --ii){
		if (s[ii] == 'L'){
			cnt++;
		} else {
			ans[ii] += cnt / 2;
			ans[ii+1] += (cnt+1) / 2;
			cnt = 0;
		}
	}

	for (int ii = 0; ii < N; ++ii){
		cout << ans[ii] << " ";
	}
	cout << "\n";


	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,j,x=0;
    map<int,int>p;
    cin>>n;
    int a[n+2],c[n+2];
    for(i=1; i<n; i++)
    {
        cin>>x;
        p[x]++;
    }
    for(i=1; i<=n; i++)
    {
        cout<<p[i]<<endl;
    }

}


Measured memory_bytes: 12972
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var s = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).OrderByDescending(v => v).ToArray();
			for(int i=0;i<s.Length;i++)
			{
				Console.Write("{0}{1}", i != 0 ? " " : "", s[i]);
			}
			Console.WriteLine();
		}
	}
}

Measured memory_bytes: 6436
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
ll mod = 1000000007;
ll mod9 = 1000000009;

signed main(){
    ll n;
    cin>>n;
    vector<string> s(n);
    rep(i,n) cin>>s[i];
    sort(s.begin(),s.end());
    s.erase(unique(s.begin(), s.end()), s.end());
    ll ans = s.size();
    cout<<ans<<endl;
}


Measured memory_bytes: 9516
#include <iostream>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll gcd(ll a, ll b){
	return ((b)?gcd(b,a%b):a);
}

int main(void){
	ll i,j,k,n,ans=0ll;
	std::cin >> n;
	for(i=1; i<=n; ++i){
		for(j=1; j<=n; ++j){
			for(k=1; k<=n; ++k){
				ans += gcd(i,gcd(j,k));
			}
		}
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>

#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::vector;

struct Divisor
{
  long val;
  long count;
};

static long min_x_plus_y;
static vector<Divisor> v;

static void
brute_force(int index, long x, long y)
{
  if (index < v.size())
  {
    Divisor &d = v[index];
    for (long count_x = 0; count_x <= d.count; count_x++)
    {
      long new_x = x;
      long new_y = y;
      for (long n = 0; n < d.count; n++)
      {
        if (n < count_x)
        {
          new_x *= d.val;
        }
        else
        {
          new_y *= d.val;
        }
      }
      brute_force(index + 1, new_x, new_y);
    }
  }
  else
  {
    if (x + y < min_x_plus_y)
    {
      min_x_plus_y = x + y;
    }
  }
}

int
main()
{
  long N;
  cin >> N;
  long n = N;
  for (long val = 2; val * val <= n; val++)
  {
    if (n % val == 0)
    {
      Divisor d;
      d.val = val;
      for (d.count = 0; n % val == 0; d.count++, n /= val)
      {
      }
      v.push_back(d);
    }
  }
  if (1 < n)
  {
    Divisor d;
    d.val = n;
    d.count = 1;
    v.push_back(d);
  }
  min_x_plus_y = N + 1;
  brute_force(0, 1, 1);
  cout << (min_x_plus_y - 2) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int ans = min(b/a, c);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
int main()
{
	int n,i,x=0,y=0;
	long long a[100000],b=1;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%lld",&a[i]);
		if(a[i]==0) x=1;
	}
	if(x==1) printf("0\n");
	else{
		for(i=0;i<n;i++){
			if(a[i]<=1000000000000000000/b) b*=a[i];
			else{
				y=1;
				break;
			}
		}
		if(y==1) printf("-1\n");
		else printf("%lld\n",b);
	}
	return 0;
}

Measured memory_bytes: 2516
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string s = sc.Next();

        int length = s.Length;
        int[] nums = new int[length];
        for (int i = 0; i < length; i++)
        {
            nums[i] = int.Parse(s[i].ToString());
        }

        long answer = 0;
        for (int i = 0; i < Math.Pow(2, length - 1); i++)
        {
            long sum = 0;
            long current = nums[0];
            for (int j = 0; j < length - 1; j++)
            {
                if ((1 & (i >> j)) == 1)
                {
                    sum += current;
                    current = nums[j + 1];
                }
                else
                {
                    current *= 10;
                    current += nums[j + 1];
                }
                if (j == length - 2)
                {
                    sum += current;
                }
            }
            answer += sum;
        }
        if (length == 1)
        {
            answer = nums[0];
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27828
//ALDS1_5A
#include <cstdio>

int n;

int solve(int i,int m,int* A){
 if(m==0) return 1;
 if(i>=n) return 0;
 int res=solve(i+1,m,A) || solve(i+1,m-A[i],A);
 return res;
}

int main(){
 int q,M,i;
 scanf("%d",&n);
 int A[n];
 for(i=0;i<n;i++) scanf("%d",&A[i]);
 scanf("%d",&q);
 for(i=0;i<q;i++){
  scanf("%d",&M);
  if(solve(0,M,A)) printf("yes\n");
  else printf("no\n");
 }
 return 0;
}

Measured memory_bytes: 1008
n, m = map(int, input().split())
keep = [0] * (n + 1)
kep = [-1] * (n + 1)

for i in range(m):
    a = int(input())
    kep[a] = 0
keep[0] = 1
keep[1] = 0 if kep[1] == 0 else 1
for j in range(0, n - 1):
    keep[j + 2] = [0, keep[j] + keep[j + 1]][kep[j + 2]] % 1000000007
print(keep[n])


Measured memory_bytes: 7648
#include<bits/stdc++.h>
using namespace std;
#define ll long long
bool visited[100001]={0};
vector< ll > g[100001];
ll ans[100001]={0};
ll max1=0;
ll d[100001]={0};
void dfs(ll x)
{
    visited[x]=1;
    for(int i=0;i<g[x].size();i++)
    {
        if(visited[g[x][i]]==0)
        {
            dfs(g[x][i]);

        }
        ans[x]=max(ans[x],ans[g[x][i]]+1);
        max1=max(max1,ans[x]);
    }

}
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        ll x,y;
        cin>>x>>y;
        g[y].push_back(x);
        d[x]=1;
    }
    for(int i=1;i<=n;i++)
    {
        if(d[i]==0)
            dfs(i);
    }
    cout<<max1;
    return 0;
}

Measured memory_bytes: 12032
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn is_prime(n: u32) -> bool {
    if n < 2 {
        return false;
    }
    let mid = ((n as f64).sqrt() as u32) + 1;
    for i in 2..mid {
        if n % i == 0 {
            return false;
        }
    }
    true
}

use std::collections::BinaryHeap;

fn main() {
    let nh: Vec<u32> = read_vec();
    let n = nh[0];
    let mut h = nh[1];
    let mut avec: BinaryHeap<u32> = BinaryHeap::new();
    let mut bvec: BinaryHeap<u32> = BinaryHeap::new();

    for _ in 0..n {
        let ab: Vec<u32> = read_vec();
        avec.push(ab[0]);
        bvec.push(ab[1]);
    }

    let mut cnt: u32 = 0;
    let a = avec.pop().unwrap();
    while !bvec.is_empty() {
        let tmp = bvec.pop().unwrap();
        if tmp < a {
            break;
        }
        if tmp >= h {
            cnt += 1;
            h = 0;
            break;
        }
        cnt += 1;
        h -= tmp;
    }
    cnt += (h + a - 1) / a;
    println!("{}", cnt);
}


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

int main(){
    int N;
    cin >> N;
    int hotels[N];
    for(int i = 0; i < N; i++){
        cin >> hotels[i];
    }
    int L;
    cin >> L;
    int doubling[20][N];
    for(int i = 0; i < N; i++){
        doubling[0][i] = int(upper_bound(hotels, hotels + N, hotels[i] + L) - hotels - 1);
    }
    for(int i = 1; i < 20; i++){
        for(int j = 0; j < N; j++){
            doubling[i][j] = doubling[i - 1][doubling[i - 1][j]];
        }
    }
    int Q;
    cin >> Q;
    for(int i = 0; i < Q; i++){
        int start, goal;
        cin >> start >> goal;
        int left_point = min(start - 1, goal - 1), right_point = max(start - 1, goal - 1);
        int left = -1, right = N - 1; // (left, right]
        while(left + 1 < right){
            int middle = (left + right) / 2;
            int position = left_point;
            for(int j = 0; j < 20; j++){
                if((middle >> j) & 1){
                    position = doubling[j][position];
                }
            }
            if(position >= right_point){
                right = middle;
            }else{
                left = middle;
            }
        }
        cout << right << endl;
    }
}


Measured memory_bytes: 9088
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int k;
    int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    scanf("%d",&k);
    printf("%d",a[k-1]);
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String[] c =a.split("");
        int bad = 0;
        for (int i = 0; i <= 2; i++) {
            if(c[i].equals(c[i+1])){
                bad++;
            }
        }
        if (bad >= 1) {
            System.out.println("Bad");
        } else {
            System.out.println("Good");
        }
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

vector<int> primeFactors(ll n) {
    ll k = n;
    vector<int> result;
    for (int i = 2; i * i <= n; i++) {
        while (k % i == 0) {
            result.push_back(i);
            k = k / i;
        }
    }
    if (k > 1) {
        result.push_back(k);
    }
    return result;
}

int main() {
    ll n;
    cin >> n;
    vector<int> factors = primeFactors(n);
    cout << n << ":";
    for (int i : factors) {
        cout << " " << i;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3160
n=int(input())
al=list(map(int,input().split()))
flag=True
for i in range(n):
    v=al[i]
    if v%2==0:
        if (v%3==0) or (v%5==0):
            pass
        else:
            flag=False
            break
if flag:
    print("APPROVED")
else:
    print("DENIED")


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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 最大公約数（a > b）
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

int gcd(int a, int b, int c) {
  int tmp = gcd(a, b);
  return gcd(max(tmp, c), min(tmp, c));
}

int main() {
  int K;
  cin >> K;

  ll ans = 0;
  for (int i = 1; i <= K; i++) {
    for (int j = 1; j <= K; j++) {
      for (int k = 1; k <= K; k++) {
        int a[3] = {i, j, k};
        sort(a, a + 3);
        ans += gcd(a[2], a[1], a[0]);
      }
    }
  }

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

Measured memory_bytes: 3648
#ifndef _UNICODE
#define _UNICODE
#endif
#ifndef UNICODE
#define UNICODE
#endif

#include <stdio.h>
#include <wchar.h>

#include <algorithm>
#include <bitset>
#include <complex>
#include <cstring>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <unordered_map>

using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define P second
#define SZ(X) ((int64_t)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define S1(X) scanf("%d", &(X))
#define S2(X, Y) scanf("%d%d", &(X), &(Y))
#define S3(X, Y, Z) scanf("%lld%lld%lld", &(X), &(Y), &(Z))
#define P1(X) printf("%lld", (X))
#define P2(X) printf("%lld\n", (X))
#define _ printf(" ");
#define __ printf("\n");
#define LEN(X) strlen(X)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define MOD 1000000007
#define EPS 1e-9
#define gcd(a, b) __gcd(a, b)
#define IOS ios_base::sync_with_stdio(0);
#define EACH(I, V) for (auto I : V)
#define REP(I, N) for (int64_t I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int64_t I = (A); I < (B); ++I)
#define REPPP(i, begin, end)                                                   \
  for (__typeof(end) i = (begin) - ((begin) > (end));                          \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

template<class T>
size_t choose(T a, T b, size_t src1, size_t src2) {
#if defined(__clang__) && defined(__x86_64)
  size_t res = src1;
  asm("cmpq %1, %2; cmovaeq %4, %0"
  :
  "=q" (res)
  :
  "q" (a),
  "q" (b),
  "q" (src1),
  "q" (src2),
  "0" (res)
  :
  "cc");
  return res;
#else
  return b >= a ? src2 : src1;
#endif
}

#define FOR(x, xs) for (__typeof( (xs).begin() ) x = (xs).begin(); x != (xs).end(); x++)

int64_t u = pow(10, 11) * 2;
int v = pow(u, 2.0 / 3);
int w = sqrt(u);

int64_t sum = 0;
vector<bool> isPrime(v + 1);

int nextPrime(int p) {
  while (!isPrime[++p]) {
  }
  return p;
}

vector<int64_t> divisors(vector<int64_t> &ps) {
  vector<int64_t> ds(1, 1), tmp; // 1 is divisor
  int64_t q = 1;
  FOR(p, ps) {
    if (*p != q) {
      tmp.clear();
      FOR(d, ds) {
        tmp.push_back(*d);
      } // tmp <- ds
    }
    FOR(t, tmp) {
      *t *= *p; // tmp <- map (p*) tmp
      ds.push_back(*t);
    }
    q = *p;
  }
  sort(ds.begin(), ds.end());
  return ds;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k, d, a;
  cin >> n >> k;
  set<int> _set;
  for (int i = 0; i < k; i++) {
    cin >> d;
    for (int j = 0; j < d; j++) {
      cin >> a;
      if (!(_set.count(a))) {
        _set.insert(a);
      }
    }
  }
  cout << n - _set.size() << '\n';
}


Measured memory_bytes: 6868
#include <iostream>

int main(){
  int n;
  std::string s;
  int x=0,max=0;
  std::cin >> n >> s;

  for(std::string::iterator it=s.begin(); it!=s.end(); ++it){
    char c;
    c = *it;
    if(c == 'I'){
      x++;
      if(max < x){
        max = x;
      }
    }else if(c == 'D'){
      x--;
    }
  }
  std::cout << max << std::endl;
  return 0;
}


Measured memory_bytes: 256
#B
import math
h,w=map(int,input().split())
if h==1 or w==1:
    print(1)
elif h%2==0 and w%2==0:
    print(int(h*w/2))
elif h%2==0 and w%2!=0:
    print(int(h*(w-1)/2+math.floor(h/2)))
elif h%2!=0 and w%2==0:
    print(int(w*(h-1)/2+math.floor(w/2)))
else:
    print(int((w-1)*(h-1)/2+math.floor(h/2)+math.floor(w/2)+1))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	if(1 != a && 1 != b) cout << 1 << endl;
	else if(2 != a && 2 != b) cout << 2 << endl;
	else cout << 3 << endl;
	return 0;
}

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

#define int long long
#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define endl "\n"
#define ends " "
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
#define debugV(v) cerr << #v << ": [ "; for(int __ = 0; __ < v.size(); __++) cerr << v[__] << ((__ != v.size() - 1) ? ", " : ends); cerr << ']' << endl
#define debugVP(v) cerr << #v << ": [ "; for(int ___ = 0; ___ < v.size(); ___++) cerr << '{' << v[___].first << ", " << v[___].second << '}' << ((___ != v.size() - 1) ? ", " : ends); cerr << ']' << endl
#define debugA(a, n) cerr << #a << ": [ "; for(int ____ = 0; ____ < n; ____++) cerr << a[____] << ((____ != n - 1) ? ", " : ends); cerr << ']' << endl
#define print(args...) fprintf (stderr, args)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
const int INF = 1e9, MOD = INF + 7;

/////////////////////////////////////////////////////////////////////

const int N = 1e5 + 20;

int a[N], dp[N];

int32_t main(){

    sync;

    int n, k; cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];
    dp[0] = 0;
	for(int i = 1; i <= k; i++) for(int j = 0; j < n; j++) if (a[j] <= i && !dp[i - a[j]]) dp[i] = 1;
	cout << (dp[k] ? "First" : "Second") << endl;

    return 0;
}

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

typedef long long ll;

#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define AA(i) cout << i << endl;
#define AS(i) cout << i << " ";

const int INF = 1001001001;

using namespace std;

int main() {

    int h, a;
    cin >> h >> a;

    int ans = h / a;
    if (h % a != 0) 
        ans++;

    AA(ans);
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <climits>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cassert>
#include <vector>
#define all(x) x.begin() , x.end()
#define fi first
#define se second
#define pb push_back
#define umax( x , y ) x = max( x , (y) )
#define umin( x , y ) x = min( x , (y) )
#define set multiset
#define null NULL
#define ort (b+s)/2

using namespace std;

typedef long long Lint;
typedef long double db;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef pair<db,db> dd;
typedef pair<int,string> is;

const int maxn = 600020;
const int K = 320;
const int MOd = 1e9 + 7;

Lint ar[maxn], a, k;
vector<Lint> v;

Lint f( Lint x ) {
	Lint ans = 0;
	for(int i=1;i<=a;i++) {
		if( ar[i] == 0 ) {
			if( 0 <= x )
				ans += a;
		} else if( ar[i] > 0 ) {
			Lint h = x/ar[i];
			// -3/4 || -4/4
			if( x < 0 && x%ar[i] != 0 ) h--;
			int t = upper_bound( all( v ), h ) - v.begin();
			ans += t;//printf("asdasd %lld\n",h);
		} else {
			// 4, -3
			Lint h = x/ar[i];
			// -3, -2
			if( x < 0 && (-x)%(-ar[i]) != 0 ) h++;
			int t = v.end()-lower_bound( all( v ), h );
			//printf("asd %lld\n",h);
			ans += t;
		}
		if( ar[i]*ar[i] <= x ) ans--;
		//printf("%d --> %d (%lld)\n",i,ans,ar[i]);
	}
	//printf("x=%lld --> ans=%lld\n",x,ans);
	return ans/2;
}

void solve() {
	scanf("%lld %lld",&a,&k);
	for(int i=1;i<=a;i++) {
		scanf("%lld",&ar[i]);
		v.pb( ar[i] );
	}
	sort( ar+1, ar+1+a );
	sort( all( v ) );
	Lint l = -1e18, r = 1e18;
	f(r);
	while( l < r ) {
		Lint m = (l+r)/2;
		if( l + 1 == r ) m = l;

		if( f( m ) < k ) l = m+1;
		else r = m;
	}
	cout << r << endl;
}

int main(  ) {


    int n = 1;
    //scanf("%d",&n);
    while( n-- ) solve();

    return 0;
}


Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL -1
using namespace std;
const int64_t MOD = 1e9 + 7;

int main() {
	string O, E;
	cin >> O >> E;

	int len = O.size();
	string S;
	for (int i = 0; i < len; i++) {
		S += O.at(i);
		if (i < E.size()) S += E.at(i);
	}

	cout << S << endl;
}

Measured memory_bytes: 3568
import java.util.*;
public class Main
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
long n=sc.nextLong();
int c=0;
long s=100;
while(s<n)
{
long f=s/100;
c++;
s=s+f;
}
System.out.println(c);
}
}


Measured memory_bytes: 27072