akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;
const ll mod = 1e9+7;

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    ll A, B, N;
    cin >> A >> B >> N;
    ll x = min(B-1, N);
    cout << (A * x/B);
    return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int A,b;
	while(1){
		cin>>A;
		if(A==0)break;
		for(int i=0;i<9;i++){
		cin>>b;
		A=A-b;
		}
		cout<<A<<endl;
	}
}

Measured memory_bytes: 1160
#include<stdio.h>
int main(void)
{
	int a,n,x=0,z=0;
	char s[105];
	scanf("%d",&n);
	scanf("%s",s);
	for(a=0;a<=n;a++){
		if(a[s]=='I'){
			x=x+1;
		}
		else if(a[s]=='D'){
			x=x-1;
		}
		if(x>z){
			z=x;
		}
	}
		printf("%d\n",z);
	return 0;
}

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

int main() {
  vector <string> A(10);
  A[0] = "pon";
  A[1] = "pon"; 
  A[2] = "hon"; 
  A[3] = "bon"; 
  A[4] = "hon"; 
  A[5] = "hon"; 
  A[6] = "pon"; 
  A[7] = "hon"; 
  A[8] = "pon"; 
  A[9] = "hon"; 
  
  int N;
  cin >> N;
  
  cout << A[N%10] << endl;

  
 
  
  
 
}


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

vector<vector<int>> refresh(vector<vector<int>> b, int h, int w){
    vector<vector<int>> ret(h, vector<int>(w, 0));
    rep(j, w){
        vector<int> nonzero;
        for(int i = h-1; i >= 0; --i){
            if(b[i][j] != 0) nonzero.push_back(b[i][j]);
        }

        rep(i, nonzero.size()){
            ret[h-i-1][j] = nonzero[i];
        }

    }

    return ret;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int h, w, k;
    cin >> h >> w >> k;

    vector<string> s(h);
    rep(i, h) cin >> s[i];
    vector<vector<int>> board(h, vector<int>(w));
    rep(i, h) rep(j, w) board[i][j] = s[i][j] - '0';

    int res = 0;

    rep(si, h) rep(sj, w){

        vector<vector<int>> b = board;
        b[si][sj] = 0;

        b = refresh(b, h, w);

        int score = 0;
        int turn = 0;
        while(1){

            int sm = 0;
            rep(i, h){

                vector<pair<int, int>> vp;
                vp.push_back(make_pair(b[i][0], 1));

                rep1(j, w){
                    if(b[i][j] == vp.back().first) ++vp.back().second;
                    else{
                        vp.push_back(make_pair(b[i][j], 1));
                    }
                }

                // rep(j, vp.size()) cout << vp[j].first << ":" << vp[j].second << " ";
                // cout << endl;

                int ptr = 0;
                rep(j, vp.size()){
                    if(vp[j].second < k){
                        ptr += vp[j].second;
                    }
                    else{
                        sm += pow(2, turn)*(vp[j].first*vp[j].second);
                        for(int l = ptr; l < ptr+vp[j].second; ++l){
                            b[i][l] = 0;
                        }
                        ptr += vp[j].second;
                    }
                }
                // cout << endl;
                // rep(m, h){
                //     rep(o, w) cout << b[m][o] << " ";
                //     cout << endl;
                // }

            }

            if(sm == 0) break;
            else{
                score += sm;
                b = refresh(b, h, w);
            }

            ++turn;
        }

        res = max(res, score);
    }

    cout << res << endl;


    return 0;
}

Measured memory_bytes: 4084
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
#include <sstream>
#include <bitset>
using namespace std;

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

int main()
{
    int N;
    cin >> N;
    double T,A;
    cin >> T >> A;
    double dist=1e9;
    int ans=0;
    for(int i=0; i<N; i++){
        double h;
        cin >> h;
        double temp=T-h*0.006;
        if(abs(temp-A)<dist){
            dist=abs(temp-A);
            ans=i+1;
        }
    }
    cout << ans << endl;




    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){

  int n;
  cin >> n;
  int x[n];
  int sum = 0;
  for(int i = 0; i < n ; i++){
    cin >> x[i];
    sum += x[i];
  }
  sum /= n;
  int ans= 0,ans1 = 0;
  for(int i = 0; i < n ;i++) {
    ans += (sum-x[i])*(sum-x[i]);
  }
  sum++;
    for(int i = 0; i < n ;i++) {
    ans1 += (sum-x[i])*(sum-x[i]);
  }
  cout << min(ans,ans1) ;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
void push(int);
int pop(void);
int top = 0;
int simbol[100];

void initialize(){
  top = 0;
}

int isEmpty(){
  return top == 0;
}
 
int main(){
  int a,b,x;
  char n[100];
 
  while( scanf("%s", n) != EOF ){
    if ( n[0] == '+' ){
      a=pop();
      b=pop();
      push(a+b);
    } 
    else if ( n[0] == '-' ){
      a=pop();
      b=pop();
      push(b-a);
    } 
    else if ( n[0] == '*' ){
      a=pop();
      b=pop();
      push(b*a);
    } 
    else {
      x= atoi(n);
      push(x);
    }
  }
  printf("%d\n",pop());
  return 0;
}
 
void push(int x){
  top++;
  simbol[top]=x;
}
  
int pop(){
  top--;
  return simbol[top+1];
}



Measured memory_bytes: 2048
#include <cstdio>
#include <vector>
#include <cassert>
#include <cstring>
#include <algorithm>
#define meow(args...) fprintf(stderr, args)
bool vis[100];
int n, m, a[100][100], e[100][100], ans[100][100], back[100];
std::vector<int> num[100][100];
bool match(int u) {
	for(int v=0; v<n; ++v)
		if(e[u][v]&&!vis[v]) {
			vis[v]=true;
			if(back[v]==-1||match(back[v])) {
				back[v]=u;
				return true;
			}
		}
	return false;
}
int main() {
	assert(scanf("%d%d", &n, &m)==2);
	for(int i=0; i<n; ++i)
		for(int j=0; j<m; ++j) {
			assert(scanf("%d", a[i]+j)==1);
			++e[i][(a[i][j]-1)/m];
			num[i][(a[i][j]-1)/m].push_back(a[i][j]);
		}
	for(int i=0; i<m; ++i) {
		memset(back, -1, n*sizeof(int));
		for(int j=0; j<n; ++j) {
			memset(vis, 0, n);
			assert(match(j));
		}
		for(int j=0; j<n; ++j) {
			int k=back[j];
			assert(~k);
			ans[i][k]=num[k][j][--e[k][j]];
		}
	}
	for(int i=0; i<n; ++i) {
		for(int j=0; j<m; ++j) printf("%d ", ans[j][i]);
		puts("");
	}
	for(int i=0; i<m; ++i) std::sort(ans[i], ans[i]+n);
	for(int i=0; i<n; ++i) {
		for(int j=0; j<m; ++j) printf("%d ", ans[j][i]);
		puts("");
	}
	return 0;
}


Measured memory_bytes: 1024
/*for better*/
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define f(i,a,b) for(i=a;i<b;i++)
#define fr(i,a,b) for(i=a;i>=b;i--)
#define endl '\n'
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mod 1000000007
#define M 998244353
#define inf 1e9+10
using namespace std;

ll dp[100005],n,m,visit[100005];
vector<ll> v[100005];

void dfs(int x)
{
	visit[x]=1;
	for(auto y: v[x])
	{
		if(!visit[y])
			dfs(y);
		dp[x]=max(1+dp[y],dp[x]);
	}
}

int main()
{
    fast; 
    ll i,x,y,mx=0;
    cin>>n>>m;
    f(i,0,m)
    {
    	cin>>x>>y;
    	v[x].pb(y);
    }
    f(i,1,n+1)
    	if(!visit[i])
    		dfs(i);
    
    f(i,1,n+1)
    	mx=max(mx,dp[i]);
    cout<<mx;
}


Measured memory_bytes: 9344
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC107C_cs
{
    class Program
    {
        static void Main(string[] args)
        {
            var nk = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var x = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var cdls = new Candles(nk[0], nk[1], x);
            Console.WriteLine(cdls.CalculateMinimumMoves());
        }
    }
    public class Candles
    {
        private int n;
        private int k;
        private int[] x;

        public Candles(int n, int k, int[] x)
        {
            this.n = n;
            this.k = k;
            this.x = x;
        }

        public int CalculateMinimumMoves()
        {
            var result = int.MaxValue;
            for(var cx = 0; cx < n - k + 1; cx++)
            {
                var left = x[cx];
                var right = x[cx + k - 1];
                var movelefttoright = Math.Abs(left) + Math.Abs(left - right);
                var moverighttoleft = Math.Abs(right) + Math.Abs(left - right);
                result = Math.Min(Math.Min(movelefttoright, moverighttoleft), result);
            }
            return result;
        }
    }
}


Measured memory_bytes: 23520
#include <iostream>
#include <string>
using namespace std;
int main(){
	string a;
	cin>>a;
	int N=a.size();
	int fac=1;
	for(int i=0;i<N;i++){
		if(a[i]!=a[N-i-1]) fac=0;
	}
	int m=(N-1)/2;
	for(int i=0;i<m;i++)
		if(a[i]!=a[m-i-1]) fac=0;
	cout<<(fac?"Yes":"No")<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(void){
    int D;

    cin>>D;

    switch(D){
        case 22:
        cout<<"Christmas Eve Eve Eve"<<endl;
        break;

        case 23:
        cout<<"Christmas Eve Eve"<<endl;
        break;

        case 24:
        cout<<"Christmas Eve"<<endl;
        break;

        case 25:
        cout<<"Christmas"<<endl;
        break;

        default:
        cout<<"error"<<endl;
        break;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

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

  int num = min(a, b);
  rep(i, 0, a + b - num) {
    printf("%d", num);
  }
  return 0;
}


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


int main()
{
    int N, A, amount = 0, times = 1;
    cin >> N >> A;

    for( int i = 0; i < N; i++)
    {
        int L = 0;
        cin >> L;

        amount += L;

        if ( amount <= A )
        {
            times += 1;
        }

    }

    cout << times << endl;
}


Measured memory_bytes: 256
# 35

# dp[i][j] : i-1 までの品物を使って重さw以下で押さえたときの価値の最大値
n, w = map(int, input().split())
vw_l = [[int(x) for x in input().split()] for y in range(n)]

dp = [[0] * (w+1) for y in range(n+1)]

for i in range(n):
    for j in range(w+1):
        _v, _w = vw_l[i]
        if j < _w:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j-_w] + _v, dp[i][j])

print(dp[n][w])


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

int main(){
	int n;
	cin>>n;
	int v[n+1];
	for (int i=1;i<=n;i++)
		cin>>v[i];
	double dp[n+1][n+1];
	v[0] = 0;
	sort(v, v+n+1);
	for (int i=1;i<=n;i++)
		dp[i][i] = v[i];
	for (int i=1;i<=n-1;i++){
		for (int j=1;j+i<=n;j++){
			int x = j;
			int y = j + i;
			double temp = 0;
			for (int k=0;k<i;k++){
				temp = max(temp, (dp[x][x+k] + dp[x+k+1][y])/2.0);
			}
			dp[x][y] = temp;
		}
	}
	cout<<setprecision(100);
	cout<<dp[1][n];
	// for (int i=1;i<=n;i++){
	// 	for (int j=1;j<=n;j++)
	// 		cout<<dp[i][j]<<" ";
	// 	cout<<"\n";
	// }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
const ll C = 1e18;
const int c=1e9;
ll s;
int main()
{
	
	scanf("%lld",&s);
	if(s==C){
		printf("0 0 %d 0 %d %d\n",c,c,c);
		return 0;
	}
	ll m = sqrt(s-0.5);
	while(m*m>s)m--;
	int x1=0,y1=0;
	int x2=m+1,y3=m+1;
	ll t = (m+1)*(m+1)-s;
	int x3= t,y2=1;
	printf("%d %d %d %d %d %d",x1,y1,x2,y2,x3,y3);
	return 0;
}


Measured memory_bytes: 256
uses math;
var
  head,next,d,dfn,low,a:array[0..200005]of longint;
  insta:array[0..200005]of boolean;
  n,m,i,x,y,k,num,s,son,ans:longint;
procedure add(x,y:longint);
begin
  inc(num);
  d[num]:=y;
  next[num]:=head[x];
  head[x]:=num;
end;
procedure dfs(u,fa:longint);
var
  v,ll:longint;
  flag:boolean;
begin
  inc(s);
  dfn[u]:=s;
  low[u]:=s;
  ll:=head[u];
  insta[u]:=true;
  flag:=true;
  while ll<>0 do
  begin
    v:=d[ll];
    if v=fa then
    begin
      ll:=next[ll];
      continue;
    end;
    if dfn[v]=0 then
    begin
      dfs(v,u);
      low[u]:=min(low[u],low[v]);
      if low[v]>dfn[u] then
        inc(ans);
    end else
      low[u]:=min(low[u],dfn[v]);
    ll:=next[ll];
  end;
  insta[u]:=false;
end;
procedure qsort(l,r:longint);
var
  i,j,k,t:longint;
begin
  i:=l;
  j:=r;
  k:=(i+j) div 2;
  t:=a[k];
  a[k]:=a[i];
  while i<j do
  begin
    while (i<j) and (a[j]>t) do
      dec(j);
    if i<j then
    begin
      a[i]:=a[j];
      inc(i);
    end;
    while (i<j) and (a[i]<t) do
      inc(i);
    if i<j then
    begin
      a[j]:=a[i];
      dec(j);
    end;
  end;
  a[i]:=t;
  if i-1>l then
    qsort(l,i-1);
  if i+1<r then
    qsort(i+1,r);
end;
begin
  readln(n,m);
  for i:=1 to m do
  begin
    readln(x,y);
    add(x,y);
    add(y,x);
  end;
  for i:=1 to n do
    if dfn[i]=0 then
      dfs(i,0);
  writeln(ans);
end.

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

int main() {
    int n;
    long long ans = 0;
    cin >> n;
    vector<long long> a(n),b(n);
    for (int i = 0;i < n;++i) cin >> a[i];
    for (int i = 0;i < n;++i) cin >> b[i];

    for (int i = 31;i >= 0;--i) {
        long long T = 1 << i;
        for (int j = 0;j < n;++j) b[j] %= 2*T;
        sort(b.begin(),b.end());

        int p = 0;
        for (int j = 0;j < n;++j){
            a[j] %= 2*T;
            p += lower_bound(b.begin(),b.end(),2*T-a[j])-lower_bound(b.begin(),b.end(),T-a[j]);
            p += lower_bound(b.begin(),b.end(),4*T-a[j])-lower_bound(b.begin(),b.end(),3*T-a[j]);
            p %= 2;
        }
        ans += (p%2 << i);
        //cout << ans << endl;
    }
    cout << ans << endl;

    return 0;
}

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

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

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

bool ok(const vector<ll> &v){
    for(int i=0; i<v.size(); ++i){
        if(v[0]!=v[i]){return false;}
    }
    return true;
}

int main(){
    int n; cin >> n;
    vector<ll> a(n);
    ll mi = LONG_LONG_MAX;
    for(int i=0; i<n; ++i){
        cin >> a[i]; mi = min(mi, a[i]);
    }
    bool br = false;
    while(1){
        for(int i=0; i<n; ++i){
            a[i] %= mi;
            if(a[i]==0){a[i] += mi;}
        }
        for(int i=0; i<n; ++i){
            mi = min(mi, a[i]);
        }
        if(ok(a)){break;}
    }
    cout << mi << endl;
    return 0;
}

Measured memory_bytes: 4048
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll ct=0,x,y,z,cp,cq,w;
    char m,n;
    string a,b,p,q;
    set<char>st1,st2;
    b="ABC";
    cin>>z;
    cin>>a;
    ct=0;
    for(ll i=0;i+3-1<z;i++)
    {
        p=a.substr(i,3);//cout<<p<<endl;
        if(p==b) ct++;
    }
    cout<<ct<<endl;
    return 0;
}





Measured memory_bytes: 256
#include <iostream>
#include <string>
#define factors 3
using namespace std;

int main() {
    int a, b, c;
    int five = 0;
    int seven = 0;
    cin >> a >> b >> c;
    int l[factors] = {a, b, c};
    for (int tmp = 0; tmp < factors; tmp++){
        if (l[tmp] == 5){
            five++;
        }
        if (l[tmp] == 7){
            seven++;
        }
    }
    if (five == 2 && seven == 1){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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



Measured memory_bytes: 3336
#include "bits/stdc++.h"

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define P3(a, b, c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main(){
    int N;
    cin >> N;
    vector<string> field(N);
    REP(i,0,N) cin >> field[i];
    int graph[N][N];
    REP(i,0,N){
        REP(j,0,N){
            if(field[i][j]=='1'){
                graph[i][j]=1;
            }else{
                graph[i][j]=0;
            }
        }
    }

    // REP(i,0,N){
    //     REP(j,0,N){
    //         cout << graph[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    int ans=0;
    REP(start,0,N){
        //幅優先探索 (グラフ: 配列)
        queue<int> q; //<コスト, ノード>
        int dist[N];
        bool visited[N];
        for(int i=0; i<N; i++) dist[i]=-1; 
        for(int i=0; i<N; i++) visited[i]=false;    //初期位置を設定
        for(int i=0; i<N; i++) dist[i] = -1;// 最後まで-1なら到達不可能
        q.push(start);  //開始ノードを追加
        dist[start] = 1; // 初期状態のコスト

        while(!q.empty()){
            int curNode = q.front();
            int curStep = dist[curNode];
            q.pop();
            //if(curStep > R) continue;    //制限ステップ数を超えたら打ち切り
            if(visited[curNode]) continue;
            visited[curNode] = true;

            for(int nextNode=0; nextNode<N; nextNode++){
                if(graph[curNode][nextNode]==0) continue;
                if(!visited[nextNode]){     //未到達のノードだけpush.
                    q.push(nextNode);
                    dist[nextNode] = curStep + graph[curNode][nextNode];
                }
            }
        }

        bool flag=true;
        REP(i,0,N){
            REP(j,0,N){
                if(graph[i][j]) if(abs(dist[i]-dist[j])!=1){
                    flag=false;
                }
            }
        }
        int maxi=0;
        if(flag){
            REP(i,0,N){
                maxi = max(maxi, dist[i]);
            }
        }
        ans = max(ans,maxi);
    }
    if(ans==0){
        P(-1);
    }else{
        P(ans);
    }
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define ulli unsigned long long int
#define ld long double  
#define endl "\n"
using namespace std; 


void solve() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int & x: v) {
        cin >> x;
    }

    int cnt = 0;
    int i = 0;
    while (cnt < n) {
        if (i == 1) {
            cout << cnt << endl;
            return;
        }
        i = v[i] - 1;
        cnt++;
    }
    cout << -1 << endl;
}

int main() 
{ 
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
  
    int t = 1; 
    //cin >> t; 
    while (t--) { 
        solve(); 
    } 
  
    cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl; 
    return 0; 
} 


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

int main()
{
    string S;
    cin >> S;
    int ans = 700;
    for (int i = 0; i < 3; i++)
    {
        if (S[i] == 'o')
        {
            ans += 100;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<memory>
#include<map>
#include<set>
#include<unordered_map>
#include<array>
#include<vector>
#include<algorithm>
#include<list>
#include<limits>
#include<stdio.h>
#include<math.h>
#include<string>
#include<fstream>
#include<functional>


using namespace std;
using ll = long long;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<int>;
using pr  = pair<int, int>;


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

	vec mod(K,0);

	int i = 1;
	int m = 7 % K;
	
	while (mod[m] == 0)
	{
		if (m == 0)
		{
			cout << i << endl; return 0;
		}

		mod[m] = 1;
		m = ((m * 10) + 7) % K;
		++i;
	}
	cout << -1 << endl;
	return 0;
	



}


Measured memory_bytes: 7160
import math

def prime_check(x):
  if x == 2:
    return True
  limit = math.floor(math.sqrt(x)+1)
  cnt = 0
  for i in range(2,limit):
    if x%i == 0:
      cnt += 1
  if cnt == 0:
    return True
  else:
    return False
  
X = int(input())

while True:
  if prime_check(X):
    print(X)
    break
  else:
    X += 1

Measured memory_bytes: 9004
from math import ceil, floor

# dp[a_i番まで見た。a_iを含む][a_i（を含む）までにいくつ採用しているか][i - 1を使ったかどうか] bool
memo = {}


def dp(i, j):
    if (i, j) in memo:
        return memo[(i, j)]
    else:
        return float("inf")*-1


def main():
    n = int(input())
    A = [0] + list(map(int, input().split()))
    memo[(0, 0)] = 0
    memo[(1, 1)] = A[1]
    memo[(1, 0)] = 0
    for i in range(2, n + 1):
        for j in range(max(floor(n/2) - ceil((n-i)/2) - 1, 0), floor(i/2) + 5):
            # a_iを採用する場合
            if (i, j) in memo:
                memo[(i, j)] = max(
                    [dp(i, j), A[i] + dp(i - 2, j - 1), A[i] + dp(i - 3, j - 1)])
            else:
                memo[(i, j)] = max(A[i] + dp(i - 2, j - 1),
                                   A[i] + dp(i - 3, j - 1))
            # a_iを採用しない場合
            if (i - 1, j) in memo:
                memo[(i, j)] = max(dp(i - 1, j), dp(i, j))

    print(dp(n, floor(n/2)))
    return
if __name__ == "__main__":
    main()


Measured memory_bytes: 256952
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		sc.close();
		
		int sqrt = (int)Math.sqrt(X);
		int ans = 1;
		for(int i = 2;i <= sqrt;++i) {
			int num = i * i;
			while(num*i <= X)
				num *= i;
			if(num > ans)
				ans = num;
		}
		System.out.println(ans);
	}
}


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

int main()
{
	while (true)
	{
		int n;
		cin >> n;
		if (!n)
		{
			break;
		}
		int h[101];
		for (int i=0; i<=n; i++)
		{
			cin >> h[i];
		}

		int def[4] = { h[1]-h[0],
				 h[2]-h[1],
				 h[3]-h[2],
				 h[4]-h[3] };

		if (def[0]==def[1] && def[1]==def[2] && def[2]==def[3])
		{
			for (int i=5; i<=n; i++)
			{
				if (h[i]-h[i-1] != def[0])
				{
					cout << h[i] << endl;
					break;
				}
			}
		}

		/*
		2  3  5  7  9
		3  4  5  7  9
		3  1  5  7  9
		3  5  6  7  9
		3  5  7  8  9
		3  5  7 11  9
		3  5  7  9 10

		辺りを考慮
		*/

		else if (def[0] == def[3])
		{
			cout << h[2] << endl;
		}
		//h[2]確定
		else if (def[1] == def[2])
		{
			if (def[2] == def[3])
			{
				cout << h[0] << endl;
			}
			else
			{
				cout << h[4] << endl;
			}
		}
		//h[0]、h[4]確定
		else
		{
			//確定済みのh[0]、h[2]、h[4]の差を利用する
			if (def[0]+def[1] < def[2]+def[3])
			{
				cout << h[1] << endl;
			}
			else
			{
				cout << h[3] << endl;
			}
		}
	}

	return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

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

const ll INF = 1e18;
const ll MOD = 998244353;
const ll MX = 1000001;

ll A, B, C, K;

void solve() {
    cin >> A >> B >> C >> K;
    ll ans = 0;
    ans += min(A, K);
    K = max(0ll, K - A);
    K = max(0ll, K - B);
    ans -= min(C, K);
    
    cout << ans;
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 3608
#include <iostream>
#include <math.h>

using namespace std;

void solve(int a, int b, int c) {
	bool f = false;
	int max_num = max(a, max(b, c));
	int sub1, sub2;
	if (max_num != a) {
		sub1 = a;
		if (max_num != b) sub2 = b;
		else sub2 = c;
	} else if (max_num != b) {
		sub1 = b;
		sub2 = c;
	} 		
	if (pow(max_num, 2) == pow(sub1, 2) + pow(sub2, 2)) f = true;
	if (f) cout << "YES" << endl;
	else cout << "NO" << endl;
}

int main() {
	int num, a, b, c;
	cin >> num;
	for (int i=0; i<num; i++) {
		cin >> a >> b >> c;
		solve(a,b,c);
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int M,N;
char map[1000][1024];
char JOI[4][4];
int cnt[1000][1000];
int osii[4][1000][1000];

int id(char c) {
	switch(c) {
		case 'J': return 0;
		case 'O': return 1;
		case 'I': return 2;
	}
	return 3;
}

int main(void) {
	int i,j,k;
	int answer;
	int raw_count=0;
	if(scanf("%d%d",&M,&N)!=2)return 1;
	for(i=0;i<M;i++) {
		if(scanf("%s",map[i])!=1)return 1;
	}
	if(scanf("%s%s",JOI[0],JOI[1])!=2)return 1;
	for(i=1;i<M;i++) {
		for(j=1;j<N;j++) {
			int match=0;
			int di,dj;
			int ii,jj;
			for(di=0;di<=1;di++) {
				for(dj=0;dj<=1;dj++) {
					if(map[i-di][j-dj]==JOI[1-di][1-dj]) {
						match++;
					} else {
						ii=di;
						jj=dj;
					}
				}
			}
			if(match==4) {
				raw_count++;
				cnt[i][j]++;
				cnt[i-1][j]++;
				cnt[i][j-1]++;
				cnt[i-1][j-1]++;
			} else if(match==3) {
				osii[id(JOI[1-ii][1-jj])][i-ii][j-jj]++;
			}
		}
	}
	answer=raw_count;
	for(i=0;i<M;i++) {
		for(j=0;j<N;j++) {
			for(k=0;k<3;k++) {
				int new_answer=raw_count+osii[k][i][j]-cnt[i][j];
				if(new_answer>answer)answer=new_answer;
			}
		}
	}
	printf("%d\n",answer);
	return 0;
}

Measured memory_bytes: 19080
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
//	cut here before submit 
//	freopen ("testcase.IR", "r", stdin );
	double xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2;
	while (scanf ("%lf %lf %lf %lf %lf %lf %lf %lf", &xa1, &ya1, &xa2, &ya2, &xb1, &yb1, &xb2, &yb2 ) != EOF ){
		bool overlop = true;
		if (xb2 < xa1 || xa2 < xb1 || yb2 < ya1 || ya2 < yb1 ) overlop = false;
		if (overlop ){
			printf ("YES\n" );
		}else{
			printf ("NO\n" );
		} // end if
	} // end loop

	return 0;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,x,t;
  cin>>n>>x>>t;
  if(n<=x)
  {
    cout<<t<<endl;
    return 0;
  }
  int cnt=0;
  while(n>0)
  {
    n-=x;
    cnt++;
  }
  cout<<cnt*t<<endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a, b;
  int mp[105] = {};
  
  cin >> n >> a >> b;

  if((abs(a - b) - 1) % 2 == 0){
    cout << "Borys" << endl;
  }else{
    cout << "Alice" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<climits>
 
using namespace std;
 
#define debug(x,y) cout<<(#x)<<" " <<(#y)<<" is " << (x) <<" "<< (y) << endl
#define watch(x) cout<<(#x)<<" is " << (x) << endl
#define fast ios_base::sync_with_stdio(false)
#define fie(i,a,b) for(i=a;i<b;i++)
#define MOD 1000000007
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define ll long long
#define lld long long int
#define ALL(x) (x).begin(),(x).end()
 
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<pair<int,int>> vpi;
 
const long long OO = 2e18;
const double pi=2*acos(0.0);
 
bool isprime(long long int a){
    if(a==1){
        return false;
    }
    for(int i=2;i*i<=a;i++){
        if(a%i==0){
            return false;
        }
    }
    return true;
} 

bool iscoprime(int a,int b){
    int i;
    for(i=2;i<=min(a,b);i++){
        if(a%i==0 && b%i==0){
            return false;
        }
    }
    return true;
}

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

int maxA(vi a){
    int m=0;
    for(int i=0;i<a.size();i++){
        m=max(m,a[i]);
    }
    return m;
}

int minA(vi a){
    int m=100000;
    for(int i=0;i<a.size();i++){
        m=min(m,a[i]);
    }
    return m;
}

vi freqN(vi a, int n){
    vi f(n);
    f={0};
    for(int i=0;i<a.size();i++){
        f[a[i]]++;
    }
    return f;
}

vi freqA(vi a){
    vi f(26);
    f={0};
    for(int i=0;i<a.size();i++){
        f[a[i]-'0']++;
    }
    return f;
}

bool mycomp(const pair<long int,long int>&p1 , const pair<long int,long int>&p2){
    if(p1.second < p2.second) return true;
    else if(p1.second==p2.second) return p1.first<p2.first;
    else return false;
}

unsigned int rightmostsetbit(unsigned int n){
    return n & -n;
}

bool cmp(pair<string,int>&p1 , pair<string,int>&p2){
    if(p1.second==p2.second) return p1.first<p2.first;
    return p1.second>p2.second;
}

int main(){
fast;
cin.tie(0);
lld a,b;
cin>>a>>b;
if((a==1 && b==2) || (a==2 && b==1)){
    cout<<"3"<<endl;
}
else if((a==2 && b==3) || (b==2 && a==3)){
    cout<<"1"<<endl;
}
else if((a==1 && b==3) || (a==3 && b==1)){
    cout<<"2"<<endl;
}


}

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

if N % 2 == 0:#Nが偶数
  inf = float("inf")
  DP = [[-inf for i in range(2)] for i in range(N)]
  #print(DP)
  DP[0][0] = A[0]
  DP[1][1] = A[1]
  for i in range(2, N):
    DP[i][0] = DP[i - 2][0] + A[i]
    DP[i][1] = max(DP[i - 2][1], DP[i - 3][0]) + A[i]
  print(max(DP[N - 2][0], DP[N - 1][1]))
  
else:#Nが奇数         
  #print(N)
  inf = float("inf")
  DP = [[-inf for i in range(3)] for i in range(N)]
  #print(DP)
  DP[0][0] = A[0]
  DP[1][1] = A[1]
  DP[2][2] = A[2]
  DP[2][0] = A[0] + A[2]
  for i in range(3, N):
    DP[i][0] = DP[i - 2][0] + A[i]
    DP[i][1] = max(DP[i - 2][1], DP[i - 3][0]) + A[i]
    DP[i][2] = max(DP[i - 2][2], DP[i - 3][1]) + A[i]
  print(max(DP[N - 2][1], DP[N - 1][2]))
  

  

Measured memory_bytes: 72008
#include<bits/stdc++.h>
using namespace std;
int n,a[11];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>a[i];
	sort(a,a+n);
	int ans=0;
	for(int i=0;i<n-1;i++)
	ans+=a[i];
	if(ans>a[n-1])
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	return 0;
}


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

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

			int x = Integer.parseInt(br.readLine());
			int a = Integer.parseInt(br.readLine());
			int b = Integer.parseInt(br.readLine());
			System.out.println((x-a)%b);

		}
	}
}

Measured memory_bytes: 25168
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;cin>>S;
  int n=S.size(),a=n;
  for(int i=1;i<a/2;i++){
    n-=2;
    S=S.substr(0,n);
    if(S.substr(0,n/2)==S.substr(n/2)){
      cout<<n<<endl;
      break;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <fstream>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cstring>
#include <cctype>
#include <numeric>
#include <cstdio>
#include <math.h>
#include <functional>
using namespace std;
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (i64 i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
#define na(a, n) rep(i, n) cin >> a[i];
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;
}
vb d(10);
int ans(int x)
{
    while (x)
    {
        if (d[x % 10])
            return 0;
        x /= 10;
    }
    return 1;
}
//ここからメイン
int main()
{
    vi x(3);
    rep(i,3){cin >> x[i];}
     SORT(x);
        cout << x[0]+x[1];
    }

Measured memory_bytes: 256
#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>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        while(true){
            int a,b;
            cin >> a >> b;
            if(a == 0 && b == 0) break;
            if(a > b) swap(a,b);
            cout << a << " " << b << endl;
        }

    }
};


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

    Solve().solve();


    return 0;
}



Measured memory_bytes: 3044
#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

#define FOR(i,a,b) for (int i = a; i < b; ++i)
#define FORR(i,a,b) for (int i = b - 1; i >= a; --i)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,0,n)

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

	int ans = 10000;
	REP(i, S.length() - T.length() + 1) {
		int cnt = 0;
		REP(j, T.length()) {
			if (S[i + j] != T[j]) ++cnt;
		}

		ans = min(ans, cnt);
	}

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

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n;
map<string, int> mp;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;

  int sum = 0;
  REP(i, n) {
    string s;
    int a;
    cin >> s >> a;
    sum += a;
    mp[s] = sum;
  }

  string s;
  cin >> s;
  cout << (sum - mp[s]) << endl;
}


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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll A[10005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    ll s = 0;
    REP(i, M) {
        cin >> A[i];
        s += A[i];
    }

    cout << std::max(-1LL, N - s) << endl;
    return 0;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n, r;
  cin >> n >> r;
  cout << r + 100 * max(0, (10 - n)) << endl;
}

Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize,
       mut b:[i64;n],
    }
    let mut a = vec![0];
    a.append(&mut b);
    dbg!(&a);
    /*



    */
    let mut anss = vec![false; n + 1];
    let mut r = vec![false; n + 1];
    let mut z = vec![];
    for i in (1..=n).rev() {
        let j = divisor(i);
        // if ((a[i] == 1) ^ anss[i]) {}
        if ((a[i] == 1) ^ anss[i]) {
            // iを入れないといけない
            for divs in j {
                anss[divs] = !anss[divs];
            }
            z.push(i);
        }
    }
    println!("{}", z.len());
    for &x in z.iter() {
        println!("{}", x);
    }
}
pub fn divisor(n: usize) -> Vec<usize> {
    let mut res = Vec::new();
    for i in (1..).take_while(|x| x * x <= n) {
        if n % i == 0 {
            res.push(i);
            if i != n / i {
                res.push(n / i);
            }
        }
    }
    res.sort();
    res
}


Measured memory_bytes: 7200
#include<iostream>

#define NIL -2000000001

using namespace std;

struct Node {
	int key, p_key, l_key, r_key;
};


int main() {
	int n, num;
	cin >> n;
	Node nodes[270];
	for (int i = 1;i < n+1;++i) {

		cin >> num;
		nodes[i].key = num;
		nodes[i].r_key = NIL;
		nodes[i].l_key = NIL;
		if (i == 1) {
			nodes[i].p_key = NIL;
			nodes[i].r_key = NIL;
			nodes[i].l_key = NIL;
			continue;
		}

		nodes[i].p_key = nodes[i / 2].key;
		if (i % 2 == 0) {
			nodes[i / 2].l_key = nodes[i].key;
		}
		else {
			nodes[i / 2].r_key = nodes[i].key;
		}
		

	}
	for (int i = 1;i < n + 1;++i) {
		cout << "node " << i << ": key = " << nodes[i].key << ", ";
		if (nodes[i].p_key != NIL){
			cout << "parent key = " << nodes[i].p_key << ", ";
		}
		if (nodes[i].l_key != NIL) {
			cout << "left key = " << nodes[i].l_key << ", ";
		}
		if (nodes[i].r_key != NIL) {
			cout << "right key = " << nodes[i].r_key << ", ";
		}
		cout << endl;
	}


	return 0;
}


Measured memory_bytes: 3116
require 'prime'
 
prime = Prime.each(101010)
c = Array.new(101010, 0)
l=[], r=[]
Q = gets.to_i
Q.times do |i|
	l[i], r[i] = gets.split.map(&:to_i)
end
 
isPrime = Array.new(101010, false)
prime.each do |i|
	isPrime[i] = true
end
 
j = 1
while j < 100000
	c[j] += 1 if isPrime[j] && isPrime[(j+1)/2]
	j +=2
end
 
1.upto(100000) do |i|
	c[i] += c[i-1]
end
 
Q.times do |i|
	puts c[r[i]]-c[l[i]-1]
end

Measured memory_bytes: 6356
#include<iostream>
#include<vector>
#include<string>
#include <algorithm>
#include <queue>
#include <climits>
#include<cmath>
#include <sstream>
#include <iomanip>

bool sort_pair( std::pair< int64_t, int64_t > origin, std::pair< int64_t, int64_t > another )
{
    return origin.first < another.first;
}


int main()
{

    int64_t a,b;
    //int64_t c = 1;
    
    std::cin>> a;
    std::cin>> b;

    std::vector< std::string > list( a );

    for( int i = 0; i < a; i++ )
    {
        std::cin>> list[i];
    }

    std::vector< int > h_list( b );
    int current_w = 0;
    int max = 0;

    for( int i = 0; i < a; i++ )
    {
        for( int r = 0; r < b; r++ )
        {
            if( list[i][r] != '#' )
            {
                if( i == 0
                    || list[i-1][r] == '#' )
                {
                    h_list[r] = 0;
                    
                    for( int s = i; s < a; s++ )
                    {
                        if( list[s][r] == '#' )
                        {
                            break;
                        }
                        
                        h_list[r] += 1;
                    }
                }
                
                if( r == 0 ||
                    list[i][r-1] == '#' )
                {
                    current_w = 0;
                    
                    for( int s = r; s < b; s++ )
                    {
                        if( list[i][s] == '#' )
                        {
                            break;
                        }

                        current_w += 1;
                    }
                }

                //std::cout<< i << " " << r << " " << current_w << " " << h_list[r] <<"\n";
                if( max < current_w + h_list[r] )
                {
                    max = current_w + h_list[r];
                }
            }
        }
    }

    if( max != 1 )
    {
        max -= 1;
    }

    std::cout<< max;
}


Measured memory_bytes: 4352
def main02():
    data = input().split()
    num = []

    for i in range(2):
        num.append(int(data[i]))
    if (num[1]-num[0]) > 2020:
        num[1] = num[0] + 2020
    kaisu = num[1] - num[0] + 1
    result = 3000
    for i in range(num[0],num[0]+kaisu-1,1):
        for j in range(i+1,num[0]+kaisu,1):
            kari = (i * j) % 2019
            if kari < result:
                result = kari
    print(result)


if __name__ == "__main__":
    main02()

Measured memory_bytes: 3064
import std.stdio, std.conv, std.string, std.algorithm, std.array, std.format;

void main()
{
    for( int iii=1; ; ++iii ){
        const w = readln.chomp.to!int;
        if ( w == 0 )
           break;
        const n = readln.chomp.to!int;

        int[][1001] item;

        item[0] = [0, 0];
        foreach( i; 0..n ) {
                        // Value: 0, Weight: 1
            item[i+1] = readln.chomp.split(",").map!(to!int).array;
        }

        //     W     N
        int dp[1002][1002];
        foreach( i; 0..w+1 )
            dp[i][0] = 0;
        foreach( i; 0..n+1 )
            dp[0][i] = 0;
        
        int max_v = 0;
        int max_w = 0;
        foreach( ni; 1..n+1 ) {
            foreach( wi; 1..w+1 ) {
                auto bw = wi - item[ni][1/*Weight*/];
                auto bi = ni - 1;

                if ( bw >= 0 ) {
                    auto cand = dp[bw][bi] + item[ni][0/*Value*/];  
                    dp[wi][ni] = max( cand, dp[wi][bi] );
                } else {  
                    dp[wi][ni] = dp[wi][bi];
                }

                if ( dp[wi][ni] > max_v || ( dp[wi][ni] == max_v && wi < max_w ) ) {
                   max_v = dp[wi][ni];
                   max_w = wi;
                }
            }
        }

        printf( "Case %d:\n", iii );
        max_v.writeln;
        max_w.writeln;
    }
}

Measured memory_bytes: 5028
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
template<typename T>
int sz(const T &a){return (int)a.size();}
map<lli,lli> am;
int main(){
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    int n;
    cin>>n;
    lli hi;
    lli ans=0;
    for(lli i=1;i<=n;i++){
        cin>>hi;
        ans+=am[i-hi];
        am[hi+i]+=1;
    }
    printf("%lli\n",ans);
    return 0;
}

Measured memory_bytes: 26360