akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)

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

    int n;
    cin >> n;

    unordered_map<int, int> mp;
    REP(i, n){
        int a;
        cin >> a;
        mp[a - 1]++;
        mp[a]++;
        mp[a + 1]++;
    }

    int maxi = -1e9;
    for(auto x : mp){
        maxi = max(maxi, x.second);
    }

    cout << maxi << endl;  

    return 0;
}

Measured memory_bytes: 4260
#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector <ll>
#define vii vector <int>
#define vpii vector <pii>
#define vpll vector <pll>
#define ff first
#define ss second
#define matrix vector <vll>
#define all(v) v.begin(),v.end()
#define PQ priority_queue
using namespace std;
ll pow(ll a, ll b){
	ll res = 1;
	while(b > 0){
		if(b&1) res*=a;
		b/=2;
		a*=a;
	}
	return res;
}
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	ll y[n+1];
	for(int i = 1; i <= n; i++) cin >> y[i];
	ll x[n+1];
	int ans = 0;
	for(int i = 1; i <= n; i++){
		if(i%2) ans+=y[i];
		else ans-=y[i];
	}
	x[1] = ans;
	for(int i = 2; i <= n; i++){
		x[i] = 2*y[i-1] - x[i-1];
	}
	for(int i = 1; i <= n; i++) cout << x[i] << " ";
	return 0;
}


Measured memory_bytes: 2944
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int k = sc.nextInt();
    int result;
    if (a >= k) result = k;
    else if (a + b >= k) result = a;
    else result = a - (k - a - b);
    System.out.println(result);
  }
}

Measured memory_bytes: 25336
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+10;
int p[N];
int sz[N];
int find(int x) {
	if(p[x]!=x) p[x]=find(p[x]);
	return p[x];
}
int main() {
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++) {
		p[i]=i;
		sz[i] = 1;
	}
	for(int i=0;i<m;i++) {
		int u,v;
		cin>>u>>v;
 	int pa = find(u);
		int pb = find(v);
		if(pa!=pb) {
			sz[pb]+=sz[pa];
			p[pa] = pb;
		}
	}
	int ans=0;
	for(int i=1;i<=n-1;i++) {
		int pa = find(i);
		int pb = find(i+1);
		if(pa!=pb) {
			p[pa] = pb;
			ans++;
		}
	
	}
	cout<<ans<<endl;
	
	return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

const int SIZE = 1e5+100;
ll a,b;

int main(){
    cin >> a >> b;
    ll ans = a+b;
    if(ans%2 == 0){
        cout << ans/2 << endl;
    }
    else{
        cout << "IMPOSSIBLE\n";
    }
}

Measured memory_bytes: 764
N = gets.to_i
PS = gets.chomp.split.map(&:to_i)

MAX = 10**5 + 1
m = Array.new(MAX, false)

count = 0
10.times do
  PS.each_with_index do |p, i|
    m[i] = p if p == i+1
  end
  MAX.times do |i|
    next unless m[i]
    if PS[i+1] != i && m[i] != i+2
      PS[i+1], PS[i] = PS[i], PS[i+1]
      count += 1
      m[i] = false
      m[i+1] = false
    elsif PS[i-1] != i && m[i] != i
      PS[i-1], PS[i] = PS[i], PS[i-1]
      count += 1
      m[i] = false
      m[i-1] = false
    end
  end
end

p count

Measured memory_bytes: 9484
import java.util.HashMap;
import java.util.Scanner;

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

        int N=sc.nextInt();
        int M=sc.nextInt();
        int[] a = new int[N];
       
        int wa=0;
        int ac=0;
//        int a=0;
        for (int i=0; i<M; i++){
            int P = sc.nextInt()-1;
            String S=sc.next();
            if(a[P]==-1){
            }
            else if(S.equals("AC")){
                    wa=wa+a[P];
                    ac++;
                    a[P]=-1;
                }
                else if(S.equals("WA")){
                    a[P]++;
                }

        }

        //for (int i=0;i<M;i++){
            System.out.println(ac+" "+wa);
        //}

        
    }
}


Measured memory_bytes: 65204
N = int(input())
B = list(map(int,input().split()))

copy = B[:]
ans = []
def func():
    while any(B):
        for i in range(N-1,-1,-1):
            if B[i] == 1:
                ans.append(copy[i])
                for j in range(i,N):
                    if B[j] > 0:
                        B[j] -= 1
                break
            elif i == 0:
                return

func()

if any(B):
    print(-1)
else:
    for a in ans:
        print(a)

Measured memory_bytes: 3064
/* 
    @author : srinathbalaji_99
*/


#include<bits/stdc++.h>

#define PB push_back
#define MP make_pair
#define endl '\n'
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define rep(i, a, b, inc) for(long long i = a; i < b; i += inc)
#define REP(i, n) rep(i, 0, n, 1)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define PLL pair<long long, long long>
#define VL vector<long long>
#define VS vector<string>
#define VLL vector<PLL>
#define VVL vector<VL>
#define MPLL map<long long, long long>
#define UMPLL unordered_map<long long, long long>
#define SETL set<long long>
#define MSETL multiset<long long>
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) (a * b)/GCD(a, b)
#define ff first
#define ss second
#define pall(a) REP(i, sizeof(a)/sizeof(a[0]))cout << a[i] << " ";cout << endl;
#define pvall(v) REP(i, v.size())cout << v[i] << " ";cout << endl;
#define gall(a, n) REP(i, n)cin >> a[i];
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

typedef unsigned long long ULL;
typedef long long LL;
typedef long double LD;


using namespace std;

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

int main()
{
    fast();


    LL t,n,i,j,k,x,y,c,m;
    LL a, b;
    cin >> a >> b >> c;
    LL has = a - b;
    cout << max((LL)0, c - has);
}

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

int main(){
    int sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    string ans="";
    for(int i=0;i<(tx-sx);i++) ans+='R';
    for(int i=0;i<(ty-sy);i++) ans+='U';
    for(int i=0;i<(tx-sx);i++) ans+='L';
    for(int i=0;i<(ty-sy)+1;i++) ans+='D';
    for(int i=0;i<(tx-sx)+1;i++) ans+='R';
    for(int i=0;i<(ty-sy)+1;i++) ans+='U';
    ans+='L';ans+='U';
    for(int i=0;i<(tx-sx)+1;i++) ans+='L';
    for(int i=0;i<(ty-sy)+1;i++) ans+='D';
    ans+='R';
    cout<<ans<<endl;

}

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

using namespace std;
#define INF 100001


int napZack01(  const vector<int> &val, 
                const vector<int> &weight, 
                vector<vector<bool> > &state_mat,
                vector<vector<int> > &sum_val){
    int N = (int)sum_val.size() - 1;
    int W = (int)sum_val[0].size() - 1;
    for(int i = 1;i <= N;i++){
        for(int j = 1;j <= W;j++){
            sum_val[i][j] = sum_val[i-1][j];
            if(j - weight[i] >= 0 && sum_val[i][j] < sum_val[i][j-weight[i]] + val[i]){
                sum_val[i][j] = sum_val[i][j-weight[i]]+ val[i];
                state_mat[i][j] = true;
            }
        }
    }
    return sum_val[N][W];
}

int main()
{
    int N,W;
    int v_temp,w_temp;
    scanf("%d %d",&N,&W);
    vector<int> val(N+1,0);
    vector<int> weight(N+1,0);
    vector<vector<int> > sum_val(N+1,vector<int>(W+1,0) );
    vector<vector<bool> > state_mat(N+1,vector<bool>(W+1,false) );
    
    for(int i = 0;i < N;i++){
        scanf("%d %d",&v_temp,&w_temp);
        val[i+1] = v_temp;
        weight[i+1] = w_temp;
    }
    int max_val = napZack01(val,weight,state_mat,sum_val);
    printf("%d\n",max_val);
    return 0;
}




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

int main(){
    int n;
    
    cin>>n;
    if(n%10==2||n%10==4||n%10==5||n%10==7||n%10==9){
    	cout<<"hon"<<endl;
	}else if(n%10==3){
		cout<<"bon"<<endl;
	}else{
		cout<<"pon"<<endl;
	}
    
    return 0;
}

Measured memory_bytes: 3588
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using namespace std;

const int di[6] = {1, 1, 0, -1, -1, 0};
const int dj[6] = {0, 1, 1, 0, -1, -1};

int main(){
    while(true){
        int field[200][200];
        int cfield[200][200];
        int t, n;
        scanf("%d%d", &t, &n);
        if(t == 0 && n == 0) break;
        for(int i = 0; i < 200; i++){
            for(int j = 0; j < 200; j++){
                field[i][j] = cfield[i][j] = 0;
            }
        }
        for(int i = 0; i < n; i++){
            int x, y;
            scanf("%d%d", &x, &y);
            x += 100; y += 100;
            field[x][y] = cfield[x][y] = -1;
        }
        int cx, cy;
        scanf("%d%d", &cx, &cy);
        cx += 100; cy += 100;
        field[cx][cy] = cfield[cx][cy] = 1;
        bool check = true;
        for(int i = 0; i < 200; i++){
            for(int j = 0; j < 200; j++){
                if(field[i][j] != cfield[i][j]){
                    check = false;
                }
            }
        }
        assert(check);
        for(int _ = 0; _ < t; _++){
            for(int i = 5; i < 195; i++){
                for(int j = 5; j < 195; j++){
                    if(field[i][j] > 0){
                        for(int d = 0; d < 6; d++){
                            int ni = i + di[d];
                            int nj = j + dj[d];
                            if(cfield[ni][nj] >= 0){
                                cfield[ni][nj] = 1;
                            }
                        }
                    }
                }
            }
            for(int i = 5; i < 195; i++){
                for(int j = 0; j < 195; j++){
                    field[i][j] = cfield[i][j];
                }
            }
            bool check = true;
            for(int i = 0; i < 200; i++){
                for(int j = 0; j < 200; j++){
                    if(field[i][j] != cfield[i][j]){
                        check = false;
                    }
                }
            }
            assert(check);
        }
        int ans = 0;
        for(int i = 5; i < 195; i++){
            for(int j = 5; j < 195; j++){
                if(field[i][j] > 0){
                    ++ans;
                }
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 1500
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

#define fr(i,b,e) for(int i=(b); i!=(e); ++i)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0; i != N; ++i)
#define co(o) cout << o << endl;
using namespace std;
typedef long int li;
typedef long long ll;


int main(void){
    vector<int> a={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};
    int K;
    cin >> K;
    cout << a.at(K-1) << endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

const int MAX = 101;

int S[MAX][MAX];
int M[MAX][MAX];
int n;

void input(){
  cin >> n;
  for(int i = 1; i <= n; i++)
    for(int j = 1; j <= n; j++) cin >> M[i][j];
}

void solve(){

  for(int i = 1; i <= n; i++)
    for(int j = 1; j <= n; j++)
      S[i][j] = S[i-1][j]+S[i][j-1]-S[i-1][j-1]+M[i][j];

  int ans = S[1][1];

  for(int i = 1; i <= n; i++)
    for(int j = 1; j <= n; j++)
      for(int k = i; k <= n; k++)
	for(int l = j; l <= n; l++)
	  ans = max(ans,S[k][l]-S[i-1][l]-S[k][j-1]+S[i-1][j-1]);

  cout << ans << endl;
}

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

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

struct Tuple4 {
    int y1, x1, y2, x2;
};

int main() {
    int h, w;
    cin >> h >> w;
    int a[h][w];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> a[i][j];
        }
    }
    int count = 0;
    vector<Tuple4> procedure;
    for (int i = 0; i < h - 1; i++) {
        for (int j = 0; j < w; j++) {
            if (a[i][j] % 2 == 1) {
                count++;
                a[i + 1][j]++;
                procedure.push_back(Tuple4{i, j, i + 1, j});
            }
        }
    }
    for (int j = 0; j < w - 1; j++) {
        if (a[h - 1][j] % 2 == 1) {
            count++;
            a[h - 1][j + 1]++;
            procedure.push_back(Tuple4{h - 1, j, h - 1, j + 1});
        }
    }
    cout << count << endl;
    for (Tuple4 t : procedure) {
        cout << (t.y1 + 1) << " " << (t.x1 + 1) << " " << (t.y2 + 1) << " " << (t.x2 + 1) << endl;
    }
    return 0;
}


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

int main(){
  int h, w;
  cin >> h >> w;
  int hw[h][w];
  for(int i=0; i<h; ++i){
    for(int j=0; j<w; ++j){
      cin >> hw[i][j];
    }
  }
  int ans=0;
  vector<tuple<int,int,int,int>> ansv(0);
  for(int i=0; i<h; ++i){
    for(int j=0; j<w-1; ++j){
      if(hw[i][j] %2){
        ++hw[i][j+1];
        ++ans;
        ansv.push_back(make_tuple(i+1,j+1,i+1,j+2));
      }
    }
  }
  for(int i=0; i<h-1; ++i){
    if(hw[i][w-1] %2){
      ++hw[i+1][w-1];
      ++ans;
      ansv.push_back(make_tuple(i+1,w,i+2,w));
    }
  }
  cout << ans << endl;
  for(int i=0; i<(int)ansv.size(); ++i){
    int a, b, c, d;
    a = get<0>(ansv[i]);
    b = get<1>(ansv[i]);
    c = get<2>(ansv[i]);
    d = get<3>(ansv[i]);
    printf("%d %d %d %d\n",a,b,c,d);
  }
}

Measured memory_bytes: 5104
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long A,B,K;
    cin>>A>>B>>K;
    for(int i = 0 ; i < K ;i++){
        if(i%2 == 0){
            if(A%2==1){
                A-=1;
            }
            if(A%2==0){
                A/=2;
                B+=A;
            }
        }else{
           if(B%2==1){
                B-=1;
            }
            if(B%2==0){
                B/=2;
                A+=B;
            }
        }
    }
    cout<<A<<" "<<B<<endl;

    return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int N;cin>>N;
    bool f=false;
    rep(i,N){
        char c;cin>>c;
        f|=c=='Y';
    }
    if(f)cout<<"Four"<<endl;
    else cout<<"Three"<<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 rep2(i, n) for (int i = 1; i <= (int)(n); i++)

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

  vector<int> vec(N);

  for (int i = 0; i < N; i++) cin >> vec.at(i);

  sort(vec.begin(), vec.end());

  int min = 0;

  for (int i = 0; i < K; i++) min += vec.at(i);

  cout << min << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
typedef long long ll;
const int mod = 1e9 + 7;
int main() {

    string s;
    cin >> s;

    bool ok = true;
    for(int i=1; i<4; ++i){
        if(s[i-1] == s[i]){
            ok = false;
        }
    }
    if(ok){
        cout << "Good" << endl;
    }
    else{
        cout << "Bad" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <cmath>
#include <set>
#include<map>
#include<cstring>
#include<iomanip>
#include <string>
#include <vector>	
#include<unordered_map>
#include<unordered_set>
using namespace std;


typedef long long unsigned llu;
typedef long double ld;
#define ll long long
#define PI 3.14159265358979323846
#define For(i, a, b) for (int i = a, sz = (int)b; i < sz; i++)
#define rFor(i, a, b, c) for (int i = (a); i >= (b); i -= (c))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fill(a, b) memset(a, b, sizeof(a))
#define IO ios_base::sync_with_stdio(false), cin.tie(0),cout.tie(0)
const int mod = 1000000007;
const ll inf = 1000000000009;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);}

//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdoutn


int main()
{
	IO;
	int n{},f{},ans{};
	cin>>n;
	For(i,1,n+1)
	{
		if(floor(i*1.08)==n){f=1;ans=i;break;}
	}
	(f)?cout<<ans<<'\n':cout<<":(\n";	
	//system("pause");
	return 0;
}

Measured memory_bytes: 3620
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#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>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
//typedef pair<ll, ll> P;
//typedef pair<ll, pair<ll, ll>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
const ll MOD = 1e9 + 7;
//ll MOD  = 998244353;
vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};


ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}
ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};


int main(void){
  ll a, b, c;
  cin >> a >> b >> c;
  ll ans = INFL;
  if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0){
    cout << 0 << endl;
    return 0;
  }
  ans = min(ans, b * c);
  ans = min(ans, a * b);
  ans = min(ans, a * c);
  printf("%llu\n", ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
#define sz(a) ll(a.size())
void solve(){
	ll n;
	cin>>n;
	if(n%1000==0)
	cout<<0;
	else
	cout<<1000-(n%1000);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll qc=1;
    //cin>>qc;
    for(ll i=1;i<=qc;i++)
	solve();
}


Measured memory_bytes: 3636
#include <stdio.h>
int main()
{
  int S;
  int h;
int m;
int s; 
  scanf("%d", &S);
  h = S / 3600;
  S = S - 3600*h;
  m = S / 60;
  s = S % 60;
  printf("%d:%d:%d\n", h, m, s);
  return 0;
}

Measured memory_bytes: 592
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String a = sc.next();

        int i = a.length() - 1;

        String target = a.substring(i);

        String result;
        if (target.equals("3")) {
            result = "bon";
        } else if (target.equals("0") || target.equals("1") || target.equals("6") || target.equals("8")) {
            result = "pon";
        } else {
            result = "hon";
        }

        System.out.println(result);

    }
}


Measured memory_bytes: 35672
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#pragma warning( disable:4996 )
#define SWAP(a,b) (a += b,b = a - b,a -= b)
#define MIN(a, b) ((a) < (b) ? (a) : (b))


int main(void) {
	int a, p;
	scanf("%d %d", &a, &p);
	printf("%d", (p+3 * a) / 2);
	return 0;
}

Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int[] array = {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};
    int k = scanner.nextInt();

    System.out.println(array[k - 1]);
  }
}


Measured memory_bytes: 22228
#include "stdio.h"
//#include "time.h"
//?????§??????????´???°?????????????????????
// 5<= n <= 10000
//p1=?°????????´???°p2=??§???????´???°

int isprime(int n) {
    int i;
    for(i = 2; i * i <= n; i++) {   //??????????§????????????¨??§??¶??°??§??????????´???°??¨??????
        if(n % i == 0)return 0;    //????????????????????§?´???°??§?????????
    }
    return 1;
}
int main(){
    int i,n,p1,q1;
   //     clock_t start, now;//??£?¨?
    while(1){
        scanf("%d",&n);
     //   start = clock(); // ????§???????
        if(n == 0)break;
        for(i = n;3 <= i;i--){
            if (isprime(i) == 1 && isprime(i - 2) == 1) break;
        }
        p1 = i-2;
        q1 = i;
       // now = clock(); // ????????????
       // printf("%f\n", (double)(now - start) / CLOCKS_PER_SEC);//??¬???
        printf("%d %d\n",p1,q1);
    }
    return 0;
}

Measured memory_bytes: 1028
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define EPS 1e-10
using namespace std;
typedef long long llong;

string s;
bool check() {
	stack<char>S;
	for (string::iterator it = s.begin(); it != s.end(); it++) {
		switch (*it) {
		case '(':S.push(*it); break;
		case ')':if (S.empty() || S.top() != '(')return false; S.pop(); break;
		case '[':S.push(*it); break;
		case ']':if (S.empty() || S.top() != '[')return false; S.pop(); break;
		}
	}
	return S.empty();
}

int main() {
	while (getline(cin, s), s != ".") cout << (check() ? "yes" : "no") << endl;
return 0;
}

Measured memory_bytes: 3176
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

    public static void main(String[] args) throws IOException {

        int num = 0;
        ArrayList<Integer> yaku = new ArrayList<>();

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] line = br.readLine().split(" ");
        int a = Integer.parseInt(line[0]);
        int b = Integer.parseInt(line[1]);
        int c = Integer.parseInt(line[2]);

        for (int x = 1; x <= c; x++) {
            if (c % x == 0) {
                yaku.add(x);
            } else {

            }
        }


            do {
                if (yaku.contains(a)) {
                    num++;
                }

                a++;
                
                

            } while (a-1 != b);
        

        System.out.println(num);

    }

}

Measured memory_bytes: 25520
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
ll m,n;
int main()
{
  cin>>m>>n;
 if(n-m>=2019){
    cout<<0<<endl;
    return 0;
  }
  m%=2019;
  n%=2019;
  if(m>n)
  n+=2019;
  if(m==0||n==0)
    cout<<0<<endl;
else
  {

       ll mins=1e9;
      for(int i=m;i<=n;i++)
      {
          for(int j=i+1;j<=n;j++)
          {
             ll  sum=(ll)i*j%2019;
              mins=min(mins,sum);

          }

      }
      cout<<mins<<endl;
  }
    return 0;
}


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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define INF 1000000007
// cin.eof() 入力個数の問題
int main(){
int n;
cin>>n;
for(int i=1;i<100007;i++){
   double cost;
   cost=(double)i*1.08;
   int ans=cost;
   if(ans==n){
       cout<<i<<endl;
       return 0;
   }
}
cout<<":("<<endl;

  return 0;
}


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

class smart_sieve
{
	intmax_t L, R, M;
	std::vector<int> small;					  // 小さい篩
	std::vector<std::vector<intmax_t>> large; // 大きい篩
	std::vector<intmax_t> aux;				  // aux[i] := large[i] の素因数の積

public:
	smart_sieve(intmax_t L, intmax_t R) : L(L), R(R), M(sqrt(R) + 1)
	{
		small.resize(M);
		std::iota(small.begin(), small.end(), 0);
		large.resize(R - L);
		aux.assign(R - L, 1);

		for (intmax_t i = 2; i * i < R; ++i)
		{
			if (small[i] < i)
				continue;
			small[i] = i;
			for (intmax_t j = i * i; j < M; j += i)
				if (small[j] == j)
					small[j] = i;

			for (intmax_t j = (L + i - 1) / i * i; j < R; j += i)
			{
				intmax_t k = j;
				do
				{
					// aux[j-L] > M で判定した方がいいかも？
					// j / aux[j-L] < M の方がいい？（割り算したくない）
					if (aux[j - L] * aux[j - L] > R)
						break;

					large[j - L].push_back(i);
					aux[j - L] *= i;
					k /= i;
				} while (k % i == 0);
			}
		}
	}

	std::vector<intmax_t> factor(intmax_t n)
	{
		assert(L <= n && n < R);
		std::vector<intmax_t> res = large[n - L];
		n /= aux[n - L];
		if (n >= M)
		{
			// この場合，n は素数となることが示せる（はず）
			// n*n >= R だとオーバーフローしそう？
			res.push_back(n);
			return res;
		}
		while (n > 1)
		{
			res.push_back(small[n]);
			n /= small[n];
		}
		return res;
	}
};

int main()
{
	ll n; cin >> n;
	intmax_t L = n;
	intmax_t R = n + 1;

	smart_sieve ss(L, R);
	auto t = ss.factor(n);
	map<ll, ll> mp;
	for (auto j : t)
		mp[j]++;
	int ans = 0;
	for(auto tt : mp){
		int n = 1;
		while(true){
			tt.second -= n;
			if(tt.second < 0) break;
			ans++;
			n++;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 7224
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  ll mod = 1000000007;
  
  ll ans = 1;
  ll a = 1;
  ll b = 1;
  
  REP(i,n){
    ans = (10*ans) % mod;
    a = (9*a) % mod;
    b = (8*b) % mod;
  }
  
  a = (2 * (a % mod)) % mod;
  ans = (((ans % mod) - (a) + (b % mod))+mod) % mod;
  
  cout << ans << endl;
  ans %= mod;
  
  
}

Measured memory_bytes: 3596
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    ans = 0
    for a in A:
        ans ^= a

    if ans == 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 14100
// can i beat Mod Love? 
#include <bits/stdc++.h>

using namespace std;
#define eps 1e-8
#define close std::ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
typedef long long ll;
ll bin(ll x, ll n, ll MOD) {ll ret = MOD != 1;for (x %= MOD; n; n >>= 1, x = x * x % MOD)if (n & 1) ret = ret * x % MOD;return ret;}
constexpr int INF = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = acos(-1.0);
constexpr ll mod = 1e9+7;
constexpr int maxn = 1e6+100; // remember to calculate.
template <typename T>
void read(T &x) {
    x = 0;
    int f = 1;
    char ch = getchar();
    while (!isdigit(ch)) {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (isdigit(ch)) {
        x = x * 10 + (ch ^ 48);
        ch = getchar();
    }
    x *= f;
    return;
}
template <typename T>
void write(T x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    if (x > 9) write(x / 10);
    putchar(x % 10 + '0');
    return;
}
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &x : v) is >> x;
    return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    if (!v.empty()) {
        os << v.front();
        for (int i = 1; i < v.size(); ++i) os << ' ' << v[i];
    }
    return os;
}

int main()
{
	close;
	int n;
	cin >> n;
	std::vector<int> a(n);
	cin >> a;
	int ans = 0;
	sort(a.begin(),a.end());
	for(int i = 0; i < n; i++){
		for(int j = i+1; j < n; j++){
			for(int k = j+1; k < n; k++){
				if(a[i] != a[j] && a[i] != a[k] && a[j] != a[k] && a[k] < a[i]+a[j] && a[i] > a[k]-a[j])ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int N, suma, sumb;
  cin >> N ;
  vector<int> vec(N);
  
  for(int i = 0; i < N; i++){
  cin >> vec.at(i) ;
  }
  
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  for(int i = 0; i < N-1; i += 2){
  suma += vec.at(i);
  sumb += vec.at(i+1);
  }
  if(N % 2 == 1) suma += vec.at(N-1);
                              
   
  cout << suma - sumb << endl;
  
}


Measured memory_bytes: 256
from numba import njit, i8, void
import numpy as np


mod = 10**9+7
k = int(input())
n = len(input())


@njit(i8(i8), cache=True)
def pow(n):
    l, now, mod, k = np.ones(64, np.int64), 1, 10**9+7, 10**9+5
    l[0] = n
    for i in range(1, 64):
        l[i] = l[i-1]*l[i-1] % mod
    for i in range(64):
        if k & 1:
            now = now*l[i] % mod
        k >>= 1
    return now


@njit(void(i8, i8), cache=True)
def num_calc(n, k):
    fact, mod = np.ones(n+k+1, dtype=np.int64), 10**9+7
    for i in range(2, n+k+1):
        fact[i] = fact[i-1]*i % mod

    power = np.ones(k+1, dtype=np.int64)
    power[0] = fact[n+k]
    for i in range(1, k+1):
        power[i] = power[i-1]*25 % mod

    fact = fact[n+k:n-1:-1]*fact[:k+1] % mod
    ans = 0
    for i in range(k+1):
        ans = (ans+pow(fact[i])*power[i]) % mod
    print(ans)


num_calc(n, k)


Measured memory_bytes: 146400
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define pi 3.14159265358979323846264338327950L
using namespace std;

int main() {
  int64_t D, T, S;
  cin >> D >> T >> S;
  if (T*S>=D) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3636
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{
  stack<int> S1;
  stack<pair<int, int> > S2;
  char ch;
  int sum = 0;
  for ( int i =0;cin >> ch;i++)
    {
      if(ch=='\\') S1.push(i);
      else if (ch == '/' && S1.size()>0)
	{
	  int j=S1.top(); S1.pop();
	  sum +=i-j;
	  int a=i-j;
	  while(S2.size() >0&&S2.top().first >j)
	    {
	      a+=S2.top().second; S2.pop();
	    }
	  S2.push(make_pair(j,a));
	}
    }
  vector<int> ans;
  while (S2.size() >0) {ans.push_back(S2.top().second); S2.pop(); }
    reverse(ans.begin(), ans.end());
    cout << sum << endl;
    cout << ans.size();
    for(int i =0;i<ans.size();i++)
      {
	cout << " ";
	cout << ans[i];
      }
    cout << endl;

    return 0;
}



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

ll gcd(ll x, ll y)
{
	if (y == 0)
		return (x);
	return (gcd(y, x % y));
}

signed main(void)
{
	ll n, mx;
	bool is_pair, is_setwise;
	cin >> n;
	vector<ll> a(n);
	mx = 0;
	rep(i, n) 
	{
		cin >> a[i];
		mx = max(mx, a[i]);
	}
	vector<bool> f(mx + 1, false); 
	is_pair = true;
	rep(i, n)
	{
		ll x = a[i];
		for(ll j = 2; j * j <= x; j++)
		{
			ll cnt = 0;
			while (x % j == 0)
			{
				x /= j;
				cnt++;
			}
			if (cnt > 0)
			{
				if (f[j] == true)
					is_pair = false;
				f[j] = true;
			}
		}
		if (x != 1 && f[x] == true)
			is_pair = false;
		f[x] = true;
	}
	if (is_pair)
	{
		cout << "pairwise coprime" << endl;
		return 0;
	}
	is_setwise = true;
	ll g = a[0]; 
	for(int i = 1; i < n; i++)
		g = gcd(a[i], g);
	if (g != 1)
		is_setwise = false;
	if (is_setwise)	
	{
		cout << "setwise coprime" << endl;
		return 0;
	}
	cout << "not coprime" << endl;
	return 0;
}


Measured memory_bytes: 11100
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
      Scanner in = new Scanner(System.in);
      String s = in.next();
      boolean yes = true;
      int n = s.length();
      for(int i = 0, j = n-1; i< j; i++, j--)yes &= s.charAt(i) == s.charAt(j);
      for(int i = 0, j = (n-1)/2-1; i< j; i++, j--)yes &= s.charAt(i) == s.charAt(j);
      for(int i = (n+3)/2-1, j = n-1; i< j; i++, j--)yes &= s.charAt(i) == s.charAt(j);
      System.out.println(yes?"Yes":"No");
    }
}

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

int main(){
  string S , T;
  cin >> S >> T;
  int cnt = 0;
  int n = S.length();
  for(int i = 0; i < n; i++){
    if(S[i] != T[i]){
      cnt += 1;
    }
  }
  cout << cnt;
}
    

Measured memory_bytes: 3856
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

const int mod = 1000000007;
int main() {
    int n;
    cin >> n;
    map<int,int>mp;
    rep(i,n) {
        int a;
        cin >> a;
        mp[a]++;
    }
    if(n%2==1) {
        if(mp[0]>1) {
            cout << 0 << endl;
            return 0;
        }
    }
    if(n%2==0) {
        if(mp[0] > 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    rep(i,100005) {
        if(mp[i] > 2) {
            cout << 0 << endl;
            return 0;
        }
    }
    ll ans = 1;
    for(int i = 1;i<=100000;i++) {
        if(mp[i] > 0) {
            ans *= mp[i];
            ans %= mod;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 8224
import numpy as np
import sys
import itertools
import time

# # A - Sandglass2
# #
# #
def A_Sandglass2():
    try:
        LOCAL_FLAG
        X = 100
        t = 170
    except NameError:
        X, t = list(map(int, input().split()))

    R = X - t
    if R > 0:
        print(R)
    else:
        print("0")

start = time.time()
A_Sandglass2()
elapsed_time = time.time() - start
try:
    LOCAL_FLAG
    print ("elapsed_time: {0}".format(elapsed_time) + "[sec]")
except NameError:
    pass


Measured memory_bytes: 12476
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    while(cin >> n, n)
    {
        vector<int> h(n + 1);
        for(int i = 0; i <= n; i++) cin >> h[i];
        for(int i = 0; i < h.size(); i++)
        {
            vector<int> v = h;
            v.erase(v.begin() + i);
            int d = v[1] - v[0];
            if(d < 0) continue;
            bool ok = true;
            for(int j = 1; j < v.size(); j++)
            {
                if(v[j] - v[j - 1] != d) ok = false;
            }
            if(ok)
            {
                cout << h[i] << endl;
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3212
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    int n = sc.nextInt();
    
    String s = sc.next();
    String t = sc.next();
    
    String res = "";
    
    for (int i = 0; i < n; i++) {
      res += s.charAt(i) + "" + t.charAt(i);
    }
    
    os.println(res);
  }
}

Measured memory_bytes: 20308
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
  int N;
  float T, A;
  cin >> N >> T >> A;
  float H[N];
  rep(i, N) cin >> H[i];
  float result[N];
  rep(i, N) { result[i] = T - H[i] * 0.006; }
  float diff = INF;
  int index = 0;
  rep(i, N) {
    if (std::abs(result[i] - A) < diff) {
      diff = std::abs(result[i] - A);
      index = i;
    }
    // cout << diff << endl;
    // cout << std::abs(result[i] - A) << endl;
    // cout << index << endl;
  }
  cout << index + 1 << endl;
  return 0;
}


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

int main(){
  int n;
  cin>>n;
  int vec[n];
  for(int i=0;i<n;i++){
    cin>>vec[i];
    vec[i]--;
  }
  int ans=0;
  for(int i=0;i<n;i++){
    if(vec[vec[i]]==i){
      ans++;
    }
  }
  cout<<ans/2<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)n; i++)
#define PI 3.14159265358979323846
#define vll vector<long long>
#define vvll vector<vector<long long>>
#define pll pair<long long, long long>
using namespace std;
using ll = long long;
using ld = long double;

// グローバル変数（入力）
ll d, c[26], s[365][26],t[365],last[26];

void input() {
  cin >> d;
  rep(i, 26) { cin >> c[i]; }
  rep(i, d) {
    rep(j, 26) { cin >> s[i][j]; }
  }
  rep(i,d){
    cin >> t[i];
  }
}

// satisfactory decrease
ll satDec(ll date){
  ll ans=0;
  rep(i,26){
    ans+=c[i]*(date-last[i]);
  }
  return ans;
}

void solve() {
  ll sat = 0;
  rep(i, 26) { last[i] = -1; }
  rep(i,d){
    last[t[i]-1]=i;
    sat = sat + s[i][t[i]-1] - satDec(i);
    cout << sat << endl;
  }
}

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


Measured memory_bytes: 3664
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>

using namespace std;

#define REP(i, n) for(int i=0; i<n; i++)

int n;
int s[200000];
vector<int> o1;
vector<int> o2;

int main(){
    cin >> n;
    REP(i, n){
        cin >> s[i];
    }

    for(int i=0; i<n; i++){
        if(i%2==0){
            o1.push_back(s[i]);
        } else {
            o2.push_back(s[i]);
        }
    }
    if(n==1){
        printf("%d\n", o1[0]);
    } else if((n-1)%2==0){
        for(int i=o1.size()-1; i>=0; i--){
            printf("%d ", o1[i]);
        }
        REP(i, o2.size()-1){
            printf("%d ", o2[i]);
        }
        printf("%d\n", o2[o2.size()-1]);
    } else {
        for(int i=o2.size()-1; i>=0; i--){
            printf("%d ", o2[i]);
        }
        REP(i, o1.size()-1){
            printf("%d ", o1[i]);
        }
        printf("%d\n", o1[o1.size()-1]);
    }
}


Measured memory_bytes: 3956
fun readIntArray(n: Int): IntArray {
    val arr = IntArray(n)
    var i = 0
    var tmp = 0

    for (c in readLine()!!) {
        if (c == ' ') {
            arr[i] = tmp
            i++
            tmp = 0
        } else {
            tmp *= 10
            tmp += c - '0'
        }
    }
    arr[i] = tmp
    return arr
}

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val aaa = readIntArray(n)
    val bbb = readIntArray(n)
    var ans = 0
    for (k in 29 downTo 0) {
        val t1 = 1 shl k
        val t2 = t1 shl 1
        val t3 = t1 + t2
        val mask = t2 - 1
        val bbbMod = bbb.map { it and mask }.toIntArray()
        bbbMod.sort()
        var tmp = 0
        aaa.forEach { a ->
            val am = a and mask
            if (am <= t1) {
                val s1 = bbbMod.bisectLeft(t1 - am)
                val s2 = bbbMod.bisectLeft(t2 - am, fromIndex = s1)
                tmp += s2 - s1
            } else {
                val s2 = bbbMod.bisectLeft(t2 - am)
                val s3 = bbbMod.bisectLeft(t3 - am, fromIndex = s2)
                tmp += s2 + n - s3
            }
        }
        ans = ans shl 1
        ans += tmp and 1
    }
    println(ans)
}

fun IntArray.bisectLeft(x: Int, fromIndex: Int = 0, toIndex: Int = size - 1): Int {
    var l = fromIndex
    var r = toIndex
    while (l <= r) {
        val m = (l + r + 1) / 2
        if (this[m] < x) {
            l = m + 1
        } else {
            r = m - 1
        }
    }
    return l
}


Measured memory_bytes: 99864
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl;
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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; }

bool dp[110][10110];

int main () {
  int n;
  cin >> n;
  vi s(n);
  rep(i,n) cin >> s[i];
  
  dp[0][0] = true;
  rep(i,n) {
    rep(j,10001) {
      if (!dp[i][j]) continue;
      dp[i+1][j] = dp[i][j];
      dp[i+1][j+s[i]] = dp[i][j];
    }
  }

  int ans = 0;
  rep(i,10001) {
    if (dp[n][i] && i%10 != 0) {
      chmax(ans,i);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
import copy
import sys

n, q = map(int, sys.stdin.readline().split())

s = input()

leftLimit = -1
rightLimit = n

spells =   spell = sys.stdin.readlines()
  
for spell in reversed(spells):
  target, direction = spell.split()
  if direction == "R" and target == s[rightLimit - 1]:
    rightLimit -= 1
    if rightLimit <= 0:
      break
  try:
    if direction == "R" and target == s[leftLimit]:
      if leftLimit != -1:
         leftLimit -= 1
  except Exception as e:
    pass
  if direction == "L" and target == s[leftLimit + 1]:
    leftLimit += 1
    if leftLimit >= n-1:
      break
  try:  
    if direction =="L" and target == s[rightLimit]:
      if rightLimit != n:
        rightLimit += 1
  except Exception as e:
    pass
  #print(target, direction, leftLimit, rightLimit)

print(max(rightLimit - leftLimit - 1 , 0))


Measured memory_bytes: 102324
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<long double, long double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int MOD = 1000000007;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main(){
    string s, t; cin >> s >> t;
    int a, b; cin >> a >> b;
    string u; cin >> u;
    if (t == u) b--;
    else a--;
    cout << a << " " << b << endl;
}

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

int main()
{
  int n;
  cin >> n;
  string s;
  string strColor = "PWGY";
  int intColor = 4;
  cin.ignore();
  getline(cin, s);

  for (int i = 0; i < 4; i++)
  {
    if (s.find(strColor[i]) == string::npos) intColor--;
  }
  if (intColor == 3) cout << "Three" << endl;
  if (intColor == 4) cout << "Four" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
	int x, l, N;
	l=0;
	cin >> N;
	int a[100];
	for(int i=0; i<N; i++)
	{
		cin >> a[i];
	}
	for(int j=0; j<N; j++)
	{
		for(int k=0; k<N-1; k++)
		{
			if(a[k]>a[k+1])
			{
				x=a[k];
				a[k]=a[k+1];
				a[k+1]=x;
				l+=1;
			}
			else{}
		}
	}
	for(int m=0; m<N-1; m++)
	{
		cout << a[m] << " ";
	}
	cout << a[N-1] << endl;
	cout << l << endl;
	return 0;
}

Measured memory_bytes: 1160
n = int(input())
S = input()
ans = 0
for i in range(n):
    s = set()
    t = set()
    for a in S[0:i]:
        s.add(a)
    for b in S[i:n]:
        t.add(b)
    ans = max(ans,len(s&t))
print(ans)

Measured memory_bytes: 39408
#include <iostream>

using namespace std;


int main() {


	long long a, b, k, ra, rb;
	a = b = k = ra = rb = 0;

	cin >> a >> b >> k;


	if (a < k) {
		rb = b - (k - a);
		ra = 0;
	}
	else {
		ra = a - k;
		rb = b;
	}

	if (ra < 0) ra = 0;
	if (rb < 0) rb = 0;

	cout << ra << " " << rb << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <math.h>
#include <algorithm>
using namespace std;

int main() {
	
	int a;
	cin >> a;
	if (a == 0) {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 3620