akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<stdlib.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
//#include <boost/multiprecision/cpp_int.hpp>

//namespace mp = boost::multiprecision;
using namespace std;

int main() {
	string s;
	cin >> s;
	while (1) {
		int a = s.rfind("keyence", 7);
		if (a != -1) {
			cout << "YES" << endl;
			break;
		}
		int b = s.rfind("keyenc", 6);
		int b1 = s.find("e", s.size() - 1);
		if (b != -1 && b1 != -1) {
			cout << "YES" << endl;
			break;
		}
		int d = s.rfind("keyen",  5);
		int d1 = s.find("ce", s.size() - 2);
		if (d != -1 && d1 != -1) {
			cout << "YES" << endl;
			break;
		}
		int e = s.rfind("keye",  4);
		int e1 = s.find("nce", s.size() - 3);
		if (e != -1 && e1 != -1) {
			cout << "YES" << endl;
			break;
		}
		int c = s.rfind("key", 3);
		int c1 = s.find("ence", s.size() - 4);
		if (c != -1 && c1 != -1) {
			cout << "YES" << endl;
			break;
		}
		int f = s.rfind("ke",  2);
		int f1 = s.find("yence", s.size() - 5);
		if (f != -1 && f1 != -1) {
			cout << "YES" << endl;
			break;
		}
		int g = s.rfind("k",  1);
		int g1 = s.find("eyence", s.size() - 6);
		if (g != -1 && g1 != -1) {
			cout << "YES" << endl;
			break;
		}

		int h = s.find("keyence", s.size() - 7);

		if (h != -1) {
			cout << "YES" << endl;
			break;
		}
		else {
			cout << "NO" << endl;
			break;
		}
	}


}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void){
    char str[1000];
    char temp[1000];
    
    int q;
    int a, b;
    char command[100];
    char * point = &command[0];
    char command1[] = "replace";
    char command2[] = "reverse";
    char command3[] = "print";
    int i, j, k, length;

    scanf("%s", str);
    scanf("%d", &q);

    length = strlen(str);

    for (i = 0; i < q; i++){
        scanf(" %s", command);
        if (strcmp(point, command1) == 0){
            scanf(" %d %d %s", &a, &b, temp);
            k = 0;

            for (j = a; j <= b; j++){
                str[j] = temp[k];
                k++;
            }
        }
        else if (strcmp(point, command2) == 0){
            scanf (" %d %d", &a, &b);
            k = 0;

            for (j = a; j <= b; j++){
                temp[k] = str[j];
                k++;
            }
            k--;
    
            for (j = a; j <= b; j++){
                str[j] = temp[k];
                k--;
            }
        }
        else if (strcmp(point, command3) == 0){
            scanf(" %d %d", &a, &b);

            for (j = a; j <= b; j++){
                printf("%c", str[j]);
            }
            putchar('\n');
        }
    }

    return 0;
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int gcd(int x,int y){
  return y?gcd(y,x%y):x;
}

int main(){
  int k = in();
  int ans = 0;
  rep(i,1,k+1){
    rep(j,1,k+1){
      rep(l,1,k+1){
        ans += gcd(gcd(i,j),l);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3740
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter("[^-0-9.]+");
		
		double x=0, y=0;
		int a=0;
		while(true){
			int n = scan.nextInt();
			
			if(n == 0){
				break;
			}
			
			int ai = scan.nextInt();
			int si = ai;
			int max = ai;
			int min = ai<0 ? ai : 0;
			for(int i=0;i<n-1;i++){
				ai = scan.nextInt();
				
				si += ai;
					
				if(si-min > max){
					max = si-min;
				}
				
				if(si < min){
					min = si;
				}
			}
			System.out.println(max);
		}
	}
}

Measured memory_bytes: 37320
#include<bits/stdc++.h>
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if((c<b&&c>a)||(c<a&&c>b)){
		printf("Yes");
	}
	else{
		printf("No");
	}
	return 0;
}

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


int main() {
    string s;
    cin >> s;
    vector<int> c;
    rep(i,s.length())c.push_back(s[i]-'0');
    ll sum = 0;
    int n = s.length()-1;
    for(int bit = 0;bit < (1<<n);bit++){//+を入れるところを全探索
        ll temp = 0;
        for(int i = 0;i<n;i++){
            temp *= 10;
            temp += s[i] - '0';
            if(bit & (1<<i))sum += temp,temp = 0;
        }
        //最後の一文字がループに入っていないから
        temp *= 10;
        temp += s.back()-'0';
        sum += temp;
    }
    cout << sum << endl;
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
a, b, c = map(int, input().split())
k = int(input())
m = max(a, b, c)
if a == max(a, b, c):
    tmp = b + c
elif b == max(a, b, c):
    tmp = a + c
else:
    tmp = a + b

for i in range(k):
    m *= 2
print(m + tmp)


Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())



void init() {

}

void input() {

}

void solve() {
  int a, b;
  cin >> a >> b;
  if (b%a == 0) cout << a+b << endl;
  else cout << b-a << endl;
}

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


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<vector>
using namespace std;
#define ll long long int


int main()
{
	int n,m,ans = 0;
	cin>>n>>m;
	vector<int> height(n+1);
	vector<bool> goodBad(n+1,true);
	for(int i=1;i<=n;i++)
		cin>>height[i];
	int h1,h2,lower;
	while(m--)
	{
		cin>>h1>>h2;
		if(height[h1]==height[h2])
			goodBad[h1]=goodBad[h2]=false;
		lower = (height[h1]<height[h2]) ? h1 : h2 ;
		goodBad[lower] = false;
	}
	for(int i=1;i<=n;i++)
		if(goodBad[i] == true)
			ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3416
//https://atcoder.jp/contests/apc001/tasks/apc001_a
//A - Two Integers
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
    ll X,Y; cin>>X>>Y;
    if (X%Y==0) {
        cout<<-1<<endl;
    } else {
        cout<<(X*(Y+1))<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int n,h[100],ans;
int main(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>h[i];
    bool end=false;
    while(!end){
        end=true;
        int x=1000,y=0;
        for(int i=0;i<n;i++){
            if(!h[i]){
                ans+=y;
                y=0; x=1000;
                continue;
            }
            x=min(x,h[i]);
            y=max(y,x);
            h[i]-=x;
            if(h[i])end=false;
        }
        ans+=y;
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;
//using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007

class Mo{
  public:
  vector<int> l,r,ord;
  vector<bool> is;
  int wid,nl,nr,ptr;
  Mo(int n) : wid((int)sqrt(n)),nl(0),nr(0),ptr(0),is(n){}
  // add queries [l, r)
  void insert(int a,int b){
    l.push_back(a);
    r.push_back(b);
  }
  // after all insert()
  void build(){
    ord.resize(l.size());
    iota(ALL(ord),0);
    sort(ALL(ord),[&](int a,int b){
      if(l[a]/wid != l[b]/wid)return l[a] < l[b];
      if(r[a] == r[b])return l[a] < l[b];
      return bool((r[a] < r[b])^((l[a]/wid) & 1));
    });
  }
  inline int process(){
    if(ptr == ord.size())return -1;
    const int idx = ord[ptr++];
    while(nl < l[idx])distribute(nl++);
    while(nl > l[idx])distribute(--nl);
    while(nr > r[idx])distribute(--nr);
    while(nr < r[idx])distribute(nr++);
    return idx;
  }
  inline void distribute(int idx){
    is[idx].flip();
    if(is[idx])add(idx);
    else del(idx);
  }
  void add(int idx);
  void del(int idx);
};
vector<int> v(500010);
vector<int> cnt(500010);
vector<int> res(500010);
int sum = 0;

inline void Mo::add(int idx){
  cnt[v[idx]]++;
  if(cnt[v[idx]] == 1)sum++;
}
inline void Mo::del(int idx){
  cnt[v[idx]]--;
  if(cnt[v[idx]] == 0)sum--;
}


int main(){
  
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n,Q;
  cin >> n >> Q;
  rep(i,n)cin >> v[i];
  Mo mo(n);
  rep(_,Q){
    int l,r;cin >> l >> r;
    mo.insert(--l,r);
  }
  mo.build();
  rep(_,Q){
    int idx = mo.process();
    res[idx] = sum;
  }
  rep(i,Q)cout << res[i] << "\n";



  return 0;
}

Measured memory_bytes: 15704
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;

int N, A, B, C;
int H[10];

int dfs(int W, int a, int b, int c){
  if(W == N){
    if(min({a,b,c}) == 0) return INF;
    return abs(A-a) + abs(B-b) + abs(C-c);
  }
  int X = dfs(W+1, a+H[W], b, c) + 10;
  int Y = dfs(W+1, a, b+H[W], c) + 10;
  int Z = dfs(W+1, a, b, c+H[W]) + 10;
  int G = dfs(W+1, a, b, c);
  return min({X, Y, Z, G});
}

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

  cin >> N >> A >> B >> C;
  rep(i,N) cin >> H[i];
  cout << dfs(0, 0, 0, 0) - 30 << endl;
}

Measured memory_bytes: 256
import java.util.*;
class Pare {
    int a;
    int b;
    public Pare(int a, int b) {
	this.a = a;
	this.b = b;
    }
    public int getA(){
	return a;
    }
}

class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = Integer.parseInt(sc.next());
	long K = Long.parseLong(sc.next());
	Pare[] p = new Pare[N];

	for(int i = 0; i<N; i++) {
	    p[i] = new Pare(Integer.parseInt(sc.next()),Integer.parseInt(sc.next()));
	}
	Arrays.sort(p,Comparator.comparing(Pare::getA));

	long cnt = 0;
	for(int i = 0; i<N; i++) {
	    cnt += p[i].b;
	    if(cnt >= K) {
		System.out.println(p[i].a);
		return;
	    }
	}


    }
}

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

int main(){
  int a,b,k;
  cin>>a>>b>>k;
  vector<int> ans;
  for(int i=1;i<=min(a,b);i++){
    if(a%i==0 && b%i==0){
      ans.push_back(i);
    }
  }reverse(ans.begin(),ans.end());
  cout<<ans[k-1]<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h, n;
	cin >> h >> n;
	int a[n], sum =0 ;
	for(int i =0 ; i< n;i++)
	{
		cin >> a[i];
		sum +=a[i];
	}
	if(sum >= h)
	{
		cout << "Yes";
	}
	else
	{
		cout <<"No";
	}
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int k=scn.nextInt();
		String str=scn.next();
		System.out.println(str.substring(0, k-1)+""+(char)(str.charAt(k-1)+32)+""+str.substring(k));
	}

}


Measured memory_bytes: 23124
#include <stdio.h>
    char input[3];
    char check1 = 'o';
    char check2 = 'x';

    int i, j = 0;
    int count = 0;

int search(char input[]){
    int a;
    int num= 0;

    for(a = 0; a < 3; a++){
        if(input[a] == 'o'){
            num++;
        }
    }
    return num;
}

int main(int argc, char* argv[]){
    

    scanf("%s", input);

    printf("%d\n", (search(input) * 100) + 700);

    return 0;
}

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

const long long MOD = 1000000007;

void solve(long long H, long long W, std::vector<string> a){
  vector<vector<long long>> dp(H+1, vector<long long>(W+1, 0));
  dp[1][1] = 1;
  for (long long i = 1; i <= H; i++) {
    for (long long j = 1; j <= W; j++) {
      if (i == 1 and j == 1) {
        continue;
      }
      if (a[i-1][j-1] == '.') {
        dp[i][j] = (dp[i-1][j] + dp[i][j-1])%MOD;
      }
    }
  }
  cout << dp.back().back() << endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
  long long H;
  scanf("%lld",&H);
  long long W;
  scanf("%lld",&W);
  std::vector<string> a(H);
  for(int i = 0 ; i < H ; i++){
    for(int j = 0 ; j < 1 ; j++){
      std::cin >> a[i];
    }
  }
  solve(H, W, std::move(a));
  return 0;
}

Measured memory_bytes: 9216
import java.util.*;

import java.lang.*;

import java.math.*;



public class Main {

	Scanner sc = new Scanner(System.in);

	void run(){

		for(;sc.hasNextLong();){

			long n = sc.nextLong();

			if(n==0) break;

			int sum = 0;

			for(n/=5;n>0;n/=5){

				sum+=n;

			}

			System.out.println(sum);

		}

		

	}

	public static void main(String[] args){

		Main m = new Main();

		m.run();

}

}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int a[n+1];
  int aa[n+1];
  aa[n]=a[n]=0;
  int ans=0;
  rep(i,n){
    cin>>a[i];
    aa[i]=a[i];
  }
  sort(a,a+n);
  sort(aa,aa+n);
  rep(i,n-1){
    aa[i+1]+=aa[i];
  }
  rep(i,n){
    //cout<<a[i]<<" "<<aa[i]<<endl;
  }
  repn(i,n-1){
    if(aa[i]*2 >= a[i+1]) ans++;
    else break;
  }
  cout<<ans<<endl;

  return 0;
}


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

int cases, n;
string s;
long long p[4000][255];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    cin >> s;
    memset(p, 0, sizeof(p));
    for (int i = 0; i < n; i++)
        p[i][s[i]]++;
    for (int i = n - 2; i >= 0; i--){
        p[i]['R'] += p[i + 1]['R'];
        p[i]['G'] += p[i + 1]['G'];
        p[i]['B'] += p[i + 1]['B'];
    }
    
    long long res = 0;
    for (int i = 0; i < n - 1; i++)
        for (int j = i + 1; j < n; j++)
            if (s[i] != s[j]){
                res += p[j]['R' + 'G' + 'B' - s[i] - s[j]];
                if (j + j - i < n && s[j + (j - i)] == (char)('R' + 'G' + 'B' - s[i] - s[j]))
                    res--;
            }
    cout << res <<"\n";


    return 0;
}

Measured memory_bytes: 11576
x = int(input())

if 400 <= x < 600:
    print(8)
if 600 <= x < 800:
    print(7)
if 800 <= x < 1000:
    print(6)
if 1000 <= x < 1200:
    print(5)
if 1200 <= x < 1400:
    print(4)
if 1400 <= x < 1600:
    print(3)
if 1600 <= x < 1800:
    print(2)
if 1800 <= x < 2000:
    print(1)

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

using namespace std;

int main(){
    int A, B, count;
    string s;
    bool palind;

    cin >> A >> B;

    for (int i = A; i < B+1; i++){
        palind = true;
        s = to_string(i);
        for (int j = 0; j < s.length() / 2; j++){
            if (s[j] != s[s.length()-j-1]){
                palind = false;
                break;
            }
        }

        if (palind){
            count += 1;
        }
    }

    cout << count << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    int a,b;cin>>a>>b;
    int buf=b-a;
    int x=buf*(buf+1)/2;
    cout<<x-b<<endl;
}


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

#define ll long long
#define rep(i, n) for(ll i = 0; i < n; i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main() {
    vector<vector<int>> data(3,vector<int>(3));
    rep(i,3){
        rep(j,3){
            cin >> data.at(i).at(j);
        }
    }
    bool  judge = false; 
    
     rep(i,101) {
         rep(j,101){
            rep(k,101){
                int l = data.at(0).at(0)-i;
                int m = data.at(1).at(1)-j;
                int n = data.at(2).at(2)-k;
                     //if(data.at(0).at(0) == i+l) {}
                     //if(data.at(1).at(0) == j+l) {}
                     //else if(data.at(2).at(0) == k+l) {}
                     //else if(data.at(0).at(1) == i+m) {}
                    // else if(data.at(1).at(1) == j+m) {}
                    // else if(data.at(2).at(1) == k+m) {}
                     //else if(data.at(0).at(2) == i+n) {}
                     //else if(data.at(1).at(2) == j+n) {}
                     //else if(data.at(2).at(2) == k+n) {}
                     
                     if(data.at(1).at(0) == j+l && data.at(2).at(0) == k+l && data.at(0).at(1) == i+m && data.at(2).at(1) == k+m && data.at(0).at(2) == i+n && data.at(1).at(2) == j+n){
                         judge = true;
                     }
                     //else judge = false;
             }
         }
     }
      
     if(judge) cout << "Yes" << endl; 
     else cout << "No" <<endl;
     
     
     
     
}


Measured memory_bytes: 256
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]
print(a[int(input())-1])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <sstream>
//#include <unordered_map>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for(int i = (a-1); i >= (b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
typedef long long int ll;
using namespace std;
ll mod=1000000007;
//ll mod=67280421310721;
//ll mod=998244353;
ll INF=1e18;
ll po(ll a,ll b)
{
	ll re=1;
	while(b)
	{
		if(b%2==1)
		{
			re=(re*a);
			re%=mod;
		}
		a=(a*a);
		a%=mod;
		b>>=1;
	}
	return re;
}
vector<int> ans;
vector<int> a1,a2;
int co;
int dep[100005];
bool st[100005];
int wuf;
int k;
void dfs(int i,int j,vector<int> gra[],int d)
{
	if(dep[i]==0)
	{
		st[i]=1;
		dep[i]=d;
		FOR(k,0,gra[i].size())
		{
			if(gra[i][k]!=j)
			dfs(gra[i][k],i,gra,d+1);
			if(wuf!=0)
			{
				if(wuf<d)
				ans.pb(i);
				break;
			}
		}
		st[i]=0;
	}
	else
	{
//		cout<<i<<' '<<d<<' '<<dep[i]<<' '<<k<<'\n';
		if((d-dep[i])<=k && st[i]==1)
		{
			wuf=dep[i];
			ans.pb(i);
		}
	}
	return;
}
int u[1000001]={0};
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
//	cin>>test;
	while(test--)
	{
		int n;
		cin>>n;
		int a[n];
		FOR(i,0,n)
		{
			cin>>a[i];
			u[a[i]]++;
		}
		if(u[1]==1)
		{
			cout<<1;
			return 0;
		}
		else if(u[1]>1)
		{
			cout<<0;
			return 0;
		}
		bool f=1;
		int ans=0;
		FOR(i,0,n)
		{
			f=1;
			for(int j=2;(j*j)<=a[i];j++)
			{
				if((a[i]%j)==0)
				{
					if(u[j]>0)
					{
						f=0;
					}
					if(u[a[i]/j]>0)
					f=0;
				}
			}
			if(u[a[i]]>1)
			f=0;
			if(f)
			ans++;
		}
		cout<<ans;
	}
	return 0;
}


Measured memory_bytes: 8300
#include<iostream>

using namespace std;

int k, s;

int main() {
  int cnt = 0;
  cin >> k >> s;
  for(int x=0;x <= k;x++){
    for(int y=0;y <= k;y++){
      int z = s - x - y;
      if(z >= 0 && z <= k) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
vector<ll>vec,vec2;
int main()
{
    ll a,b,c,d,e,i,j,k,l,n,m,x,y,t,p;
    cin>>n;
    x=0;
    y=0;
    for(i=1;i<=n;i++)
    {
        cin>>a>>b;
        if(a==b)
        {
            x++;
        }
        else
        {
            x=0;
        }
        y=max(x,y);
    }
    if(y>=3)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,i;
    cin >> N;
    vector<int> c(N);
    for (i = 0; i < N; i++){
        cin >> c[i];
    }
    sort(c.begin(),c.end());
    int count=1;
    for(i=1;i<c.size();i++){
        if(c[i-1]!=c[i])count++;
    }
    cout<<count<<endl;
}


Measured memory_bytes: 256
function Scanner(input) {
	var self = this;
	self.itemNo = 0;
	self.orgStr = input;
	self.splitedStrs = (function(target) {
		var result = [];
		var target = target.replace(/[\n \t]+/g, " ");
		var strs = target.split(" ");
		for (var i = 0, len = strs.length; i < len; i++) {
			result.push(strs[i]);
		}
		return result;
	}(input));

	self.next = function() {
		var result = self.splitedStrs[self.itemNo];
		self.itemNo++;
		return (result != null) ? result : null;
	}

	self.nextInt = function() {
		var result = self.splitedStrs[self.itemNo];
		self.itemNo++;
		return (result != null) ? parseInt(result) : null;
	}

	self.nextBigDecimal = function() {
		var result = self.splitedStrs[self.itemNo];
		self.itemNo++;
		return (result != null) ? parseFloat(result) : null;
	}
	
	self.nextByte = function() {
		var result = self.splitedStrs[self.itemNo];
		self.itemNo++;
		return (result != null) ? new Int8Array(result) : null;
	}

}

function Main(sc) {

	var N = sc.nextInt();
	var M = sc.nextInt();
	var X = sc.nextInt();
	
	var MAXPRICE = 120000000;
	var ans = MAXPRICE;
	
	var refs = [];
	
	for (var i = 0; i < N; i++) {
		refs.push([]);
		for (var j = 0; j < M + 1; j++) {
			refs[i].push(sc.nextInt());
		}
	}
	
	for (var i = 0, maxcnt = Math.pow(2, N); i < maxcnt; i++) {
		var binari = ("00000000000" + i.toString(2)).slice(-1 * N);
		var price = 0;
		var reqs = Array(M).fill(0);
		for (var j = 0; j < N; j++) {
			if (binari.charAt(j) == "1") {
				price += refs[j][0];
				for (var k = 0; k < M; k++) {
					reqs[k] += refs[j][k + 1];
				}
			}
		}
		var isOK = true;
		for (var j = 0; j < reqs.length; j++) {
			if (reqs[j] < X) {
				isOK = false;
				break;
			}
		}
		if (isOK) {
			ans = Math.min(ans, price);
		}
	}
	
	console.log((ans == MAXPRICE) ? -1 : ans);
}
Main(new Scanner(require("fs").readFileSync("/dev/stdin", "utf8")));
// Main(new Scanner("10 1 2 5 3 4 6 7 3 2 4 1 2 2 3 3 4 4 5 3 6 6 7 1 8 8 9 9 10"));

// var str1 = sc.next(); // Stringで取得
// var int1 = sc.nextInt(); // intで取得
// var bd1 = sc.nextBigDecimal(); // BigDecimalで取得
// var byte1 = sc.nextByte(); // byteで取得
// for (var i = 0; i < 1000000000; i++) var toDelay = "aaa"; // 1000msくらいの遅延
// console.log(wrtnNos); return;


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

int main() {
    int x, y;
    cin >> x >> y;
    for(int t = 0; t < 101; ++t) {
        int k = x - t;
        if(k < 0) continue;
        if(t * 2 + k * 4 == y) {
            cout << "Yes" << '\n';
            return 0;
        }
    }
    cout << "No" << '\n';
    return 0;
}


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

int main() {
  long long N, ans = 0;
  cin >> N;
  for (long long p = 1; p * (p + 1) < N; p++) {
    if (N % p == 0) ans += N / p - 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>
 
#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cerr << v[a][b] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
 
using namespace std;
 
typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;
 
int main()
{
		double r,g;
	cin >> r >> g;
	
	cout << g*2 - r << endl;
 
	
	return 0;
}

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

int A, B;

int main() {
    cin >> A >> B;

    if ((A + B) % 3 == 0 || A % 3 == 0 || B % 3 == 0) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
#define ll long long
inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}
//################################################################
ll n;
ll a[1000005];
ll mem[1000005];
int k;
int main() {
    n = LLD(),k=D();
    for (int i = 0; i < n; i++)a[i] = LLD();
    mem[0]=0;
    mem[1]=abs(a[1]-a[0]);
    for(int i=2;i<n;i++){
        ll mn=LONG_LONG_MAX;

        for(  int j=max(0,i-k);j<i;j++){
            mn=min(abs(a[i]-a[j])+mem[j],mn);
        }
        mem[i]=mn;
    }
    printf("%lld",mem[n-1]);

}

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

bool check(int n) {
    int div = 0;
    for (int i = 1; i <= n; i++) {
        if (n%i == 0) div++;
    }
    return n%2 == 1 && div == 8;
}

int main() {
    int n; cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (check(i)) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 764
#include <stdio.h>

int main(void)
{
    int Sn,i,count = 0;

    scanf("%d", &Sn);

    for (i = 0; i < 3; i++)
    {
        if(Sn % 10 == 1)
        {
            count++;
        }

        Sn = Sn / 10;
    }
    printf("%d", count);

    return (0);
}


Measured memory_bytes: 128
def findcount(x,y):
    if 0<=x <= y:
        return y -x

    if 0 <=y <= x:
        if y == 0:
            return x - y + 1
        else:
            return x - y + 2

    if y <= 0 <= x:
        return 1 + abs(x+y)

    if x <=  0 <= y:
        if y == 0:
            return abs(x)
        else:
            return 1 + abs(x+y)

    if y <= x <=0:
        if x == 0:
            return 1 + x -y
        else:
            return 2+ x - y

    if x <= y <=0:
        return y - x



    


    


if __name__ == "__main__":
    x,y = list(map(int, input().split()))
    print(findcount(x,y))



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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    cout << (A + B >= C ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextInt()
    for (i in 1..9) {
        if (a % i == 0 && a / i <= 9 && a / i >= 1) {
            println("Yes")
            System.exit(0)
        }
    }
    println("No")
}

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

int answer(int n){
	int i=0;
	while(n%2==0){
		i++;
		n = n/2;
	}
	return i;
}
int main()
{
	int n, i, a[1000], ans = 1e9;
	cin >> n;

	while(n--){
		cin >> i;
		ans = min(answer(i), ans);
		//cout << answer(i) << endl;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))
 
using namespace std;
 
typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;
 
template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
 
const int N = 100000 + 10;
int a[N];
 
vector<int> g[N];
 
bool is_leaf(int n)
{
  return g[n].size() == 1;
}
 
lli f(int curr, int prev)
{
  if (is_leaf(curr)) return a[curr];
 
  vector<lli> b;
  each (next, g[curr]) {
    if (next == prev) continue;
    b.emplace_back(f(next, curr));
  }
 
  lli sum = accumulate(b.begin(), b.end(), 0LL);
  lli mx = *max_element(b.begin(), b.end());
  lli paired = sum - a[curr];
  if (paired > sum - mx) throw "";
  if (sum < a[curr]) throw "";
 
  lli passed = a[curr] * 2 - sum;
  if (passed < 0 || (curr == prev && passed)) throw "";
  return passed;
}
 
int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
 
  int n;
  while (cin >> n) {
    fill(g, g + N, vector<int>());
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    for (int i = 0; i < n - 1; ++i) {
      int a, b;
      cin >> a >> b;
      --a;
      --b;
      g[a].push_back(b);
      g[b].push_back(a);
    }
    int r = 0;
    for (int i = 0; i < n; ++i) {
      if (!is_leaf(i)) { r = i; break; }
    }
    if (n == 1) {
      puts(a[0] ? "NO" : "YES");
    } else if (n == 2) {
      puts(a[0] == a[1] ? "YES" : "NO");
    } else try {
      f(r, r);
      cout << "YES" << endl;
    } catch (const char* e) {
      cout << "NO" << endl;
    }
  }
 
  return 0;
}


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

using namespace std;

long long power(int x, int y){
  long long n = 1;
  for(int i = 0; i < y; i++)
    n *= x;
  return n;
}

int log(int x, int y){
  int cnt = 0;
  while(y > 1){
    y /= x;
    cnt++;
  }
  return cnt;
}

int main() {
  int a, b;
  cin >> a >> b;
  int ans = (b-1)/(a-1);
  if(ans * (a-1) != b-1)
    ans++;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


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

	int a, b, c;
	cin >> a >> b >> c;
	if (a == b && b == c) {
		cout << "No\n";
		return 0;
	}
	if (a == b || b == c || c == a) {
		cout << "Yes\n";
		return 0;
	}
	cout << "No\n";

	return 0;
}


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

G = {i: [] for i in range(1, N + 1)}

for i in range(M):
    a, b = map(int, input().split())
    if a == 1 or a == N or b == 1 or b == N:
        G[a].append(b)
        G[b].append(a)

res = False

for i in range(2, N):
    if 1 in G[i] and N in G[i]:
        res = True
        break


if res:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

int main(){
	int n,m;
	cin >> n >> m;
	vector<int> v(n);
	rep(i,m){
		int a,b;
		cin >> a >> b;
		a--,b--;
		v[a]++;
		v[b]++;
	}
	bool ok = true;
	rep(i,n){
		if(v[i] % 2 == 1) ok = false;
	}
	if(ok){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
    return 0;
}



Measured memory_bytes: 768
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<stack>
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

struct edge{
    ll k;
    ll w;
};
static const int N = 100;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
static const int NIL = -1;
static const int Max = 100001;

int n, M[N][N];//nは頂点数、Mは隣接行列
int color[Max], d[N], f[N], tt; //color:状態,d:iの発見時刻,f:iの隣接リスト調査完了時刻,tt:時間
int nt[Max];//uの隣の頂点をどこまで見たか記録
vector<edge> G[Max];
bool anscolor[Max];

//u に隣接するvを番号順に取得
int next(int u){
        /*for(int v = nt[u]; v < G[u].size(); v++){
            nt[u] = v + 1;//uの隣の頂点をどこまで見たか記録
            if( M[u][v] ) return v; 
        }*/
    if(nt[u] < G[u].size()){
        nt[u]++;
        return G[u][nt[u]-1].k;//隣接するのはnt[u]-1だよね！
    }
    return NIL;
}

//スタックを用いた深さ優先探索
void dfs_visit(int r){
    for(int i = 0; i < n; i++) nt[i] = 0;

    stack<int> S;//訪問途中の頂点を退避するスタック
    S.push(r);//現在の頂点をスタックに退避
    color[r] = GRAY;//訪問ずみに
    d[r] = ++tt;

    while( !S.empty()){
        int u = S.top();//uが現在訪問中の頂点
        int v = next(u);
        if(v != NIL){
            if(color[v] == WHITE){
                color[v] = GRAY;
                S.push(v);
                if(G[u][nt[u]-1].w % 2 == 0){
                    anscolor[v] = anscolor[u];
                }else{
                    anscolor[v] = !anscolor[u];
                }
            }
        }else{
            S.pop();
            color[u] = BLACK;
        }
    }
}

void dfs_init(){
    //初期化
    for(int i = 0; i < n; i++){
        color[i] = WHITE;
        anscolor[i] = 0;
        nt[i] = 0;
    }
    tt = 0;

    //未訪問のuを始点として深さ優先探索
    for(int u = 0; u < n; u++){
        if(color[u] == WHITE) dfs_visit(u);
    }
    /*for(int i = 0;i < n; i++){
        cout << i + 1 << " " << d[i]  << " " << f[i] << endl;
    }*/
}

int main(){
    cin >> n;
    ll u, v, w;
    for(int i = 0; i < n-1; i++){
        cin >> u >> v >> w;
        u--;v--;
        edge e1 = {v, w};
        edge e2 = {u, w};
        G[u].push_back(e1);
        G[v].push_back(e2);
    }
    dfs_init();

    REP(i,n){
        cout << anscolor[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 8704
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    const s = readln.chomp;
    const K = readln.chomp.to!(long);
    string[] list;
    foreach (l; 0..s.length) {
        foreach (r; l+1..min(l+6, s.length+1)) {
            list ~= s[l..r];
        }
    }
    list.sort!((a,b) => a < b).uniq.take(K).array.back.writeln;
}



Measured memory_bytes: 2684
#include<iostream>
using namespace std;
int main()
{
	int x,k;
	cin>>x>>k;
	int xx=k-x+1;
	for(int i=0;i<2*x-1;i++)
	{
		if(i==0) cout<<xx;
		else cout<<" "<<xx;
		xx++;
	}
	return 0;
}

Measured memory_bytes: 256
N=int(input())
data=[]
for i in range(1,10**6+1):
    if (N-1)%i==0:
        j=(N-1)//i
        k=i
        if j!=1:
            data.append(j)
        if k!=1:
            data.append(k)

if not data:
    data.append(N-1)
    
data=set(data)
data=list(data)
data=sorted(data)
ans=len(data)
if N==2:
   ans=0


Data=[]

for i in range(1,10**6+1):
    if N%i==0:
        j=N//i
        k=i
        if j!=k:
            Data.append(j)
            Data.append(k)
            
        elif j==k:
            Data.append(j)
if not Data:
    Data.append(N)


Data=sorted(Data)
Data=list(set(Data))

from fractions import gcd
for num in Data:
    ori=N
    if num>1:
        while ori>=num :
            if ori%num==0:
                ori=ori//num
            else:
                ori=ori%num
        if ori==1:
            ans+=1
      

print(ans)
            


    
        
        



Measured memory_bytes: 66008
#include<iostream>
using namespace std;
#define ll long long
int zero=512,one=513,tmp=514,tmp2=515,tmp3=516;
const int lim=62;
void add(int a,int b,int c){
    cout<<"+ "<<b<<" "<<c<<" "<<a<<endl;
}
void lt(int a,int b,int c){
    cout<<"< "<<b<<" "<<c<<" "<<a<<endl;
}
void pow(int a,int b){
    for(int i=1;i<=b;i++){
        add(a,a,a);
    }
}
void mul(int a,int b,int c){
    lt(a,zero,b);
    lt(tmp,zero,c);
    add(a,a,tmp);
    lt(a,one,a);
}

void fenjie(int base,int aim){
    add(tmp,zero,zero);
    for(int i=lim;i>=0;i--){
        add(tmp2,zero,one);
        pow(tmp2,i);
        add(tmp2,tmp2,tmp);
        add(tmp3,one,aim);
        lt(tmp2,tmp2,tmp3);
        add(base+i,zero,tmp2);
        pow(tmp2,i);
        add(tmp,tmp,tmp2);
    }
}

int main() {
	// ios::sync_with_stdio(0); cin.tie(0);
    cout<<30496<<endl;
    // init
    add(tmp,0,1);
    lt(one,zero,tmp);

    int b1=64,b2=128,b3=192,b4=256;
    fenjie(b1,0);
    fenjie(b2,1);

    for(int i=0;i<=lim;i++){
        for(int j=0;j<=lim;j++){
            int now=i+j+b3;
            mul(tmp2,i+b1,j+b2);
            add(now,now,tmp2);
        }
    }
    for(int i=0;i<=lim;i++){
        add(i+b4,zero,i+b3);
        pow(i+b4,i);
        add(2,2,i+b4);
    }

    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s;
    cin >> s;
    int n = s.size();
    string zero_start, one_start;
    for (int i=0;i<n;i++){
        if (i % 2){
            zero_start += "1";
            one_start += "0";
        } else {
            zero_start += "0";
            one_start += "1";
        }
    }

    int tmp1=0, tmp2=0;
    for (int i=0;i<n;i++){
        if (s[i] != zero_start[i])
            tmp1 += 1;
        if (s[i] != one_start[i])
            tmp2 += 1;
    }

    cout << min(tmp1, tmp2) << endl;
}


Measured memory_bytes: 768
from collections import deque

def main():
    n, x, y = map(int, input().split())
    dist = [[None]*n for _ in range(n)]
    cnt = [0]*n
    q = deque()
    
    for i in range(n):
        q.appendleft([i, 0])
        dist[i][i] = 0
        while q:
            j, d = q.pop()
            cnt[d] += 1
            if j > 0 and dist[i][j-1] is None:
                dist[i][j-1] = d+1
                q.appendleft([j-1, d+1])
            if j < n-1 and dist[i][j+1] is None:
                dist[i][j+1] = d+1
                q.appendleft([j+1, d+1])
            if j == x-1 and dist[i][y-1] is None:
                dist[i][y-1] = d+1
                q.appendleft([y-1, d+1])
            elif j == y-1 and dist[i][x-1] is None:
                dist[i][x-1] = d+1
                q.appendleft([x-1, d+1])
    for i in range(1, n):
        print(cnt[i]//2)
                

if __name__ == "__main__":
    main()

Measured memory_bytes: 138376
#include <bits/stdc++.h>
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e18
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

int main() {
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  ll ans = INF;
  for (int i = 0; i <= max(x, y); i++) {
    int X = max(0, x - i);
    int Y = max(0, y - i);
    ll val = X * a + Y * b + 2 * i * c;
    ans = min(ans, val);
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
  int A, B, C, K, F, TOTAL;
  scanf("%d %d  %d", &A, &B, &C);
  scanf("%d", &K);

  for (int i = 1; i <= K ; i++) {
    if (A > B && A > C) {
      A *= 2;
    } else if (B > C) {
      B *= 2;
    } else {
      C *= 2;
    }
  }

  TOTAL = A + B + C;
  printf("%d", TOTAL);
}


Measured memory_bytes: 128
x = int(input())
lst = [i**2 for i in range(1,32)]+[8,27,125,216,343,512,1000]+[32,243]+[128]+[1001]
lst.sort()
for i in range(len(lst)):
    if lst[i]<=x<lst[i+1]:
        print(lst[i])

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
  int a,b,c;
  while(cin>>a>>b>>c,a!=-1||b!=-1||c!=-1){
    if(a==-1||b==-1)cout<<"F"<<endl;
    else if(a+b>=80)cout<<"A"<<endl;
    else if(a+b>=65)cout<<"B"<<endl;
    else if(a+b>=50)cout<<"C"<<endl;
    else if(a+b>=30){
      if(c>=50)cout<<"C"<<endl;
      else cout<<"D"<<endl;
    }else cout<<"F"<<endl;
  }
}


Measured memory_bytes: 3108
#include<iostream>
#include<map>
#include<sstream>

std::string to_bs(int i){
	std::string s = "";
	while(i > 0){
		s = static_cast<char>(i%2+'0') + s;
		i /= 2;
	}
	while(s.length() < 5){
		s = '0' + s;
	}
	return s;
}

int main(){
	std::map<char, std::string> input;
	std::map<std::string, char> output;
	input[' '] = "101";
	input['\''] = "000000";
	input[','] = "000011";
	input['-'] = "10010001";
	input['.'] = "010001";
	input['?'] = "000001";
	input['A'] = "100101";
	input['B'] = "10011010";
	input['C'] = "0101";
	input['D'] = "0001";
	input['E'] = "110";
	input['F'] = "01001";
	input['G'] = "10011011";
	input['H'] = "010000";
	input['I'] = "0111";
	input['J'] = "10011000";
	input['K'] = "0110";
	input['L'] = "00100";
	input['M'] = "10011001";
	input['N'] = "10011110";
	input['O'] = "00101";
	input['P'] = "111";
	input['Q'] = "10011111";
	input['R'] = "1000";
	input['S'] = "00110";
	input['T'] = "00111";
	input['U'] = "10011100";
	input['V'] = "10011101";
	input['W'] = "000010";
	input['X'] = "10010010";
	input['Y'] = "10010011";
	input['Z'] = "10010000";
	
	for(int i=0;i<26;i++){
		output[to_bs(i)] = 'A' + i;
	}
	output["11010"] = ' ';
	output["11011"] = '.';
	output["11100"] = ',';
	output["11101"] = '-';
	output["11110"] = '\'';
	output["11111"] = '?';

	std::string s;
	while(std::getline(std::cin, s), !std::cin.eof()){
		std::string bs = "";
		for(int i=0;i<s.length();i++){
			bs += input[s[i]];
		}

		while(bs.length()%5){
			bs += '0';
		}

		std::string res = "";
		while(bs.length()){
			std::string _s = bs.substr(0, 5);
			res += output[_s];
			bs = bs.substr(5);
		}

		std::cout << res << std::endl;

		std::cin.clear();
	}
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
char a,b;
cin >> a >> b;
string ans="H";
if(a=='D'||b=='D') {
  if(a!=b) ans="D";
}
cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){

  int x,a,b;
  cin>>x>>a>>b;
  a-=x;
  b-=x;
  if(a<0) a*=-1;
  if(b<0) b*=-1;
  if(a<b) cout<<"A"<<endl;
  else cout<<"B"<<endl;

  return 0;

}







Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int cmp(int x, int y){return x>y;}
main()
{
    int n;
    while(cin>>n)
    {
        int a[105];
        memset(a,0,sizeof(a));
        for(int i=0;i<n;i++)cin>>a[i];
        sort(a,a+n,cmp);
        int ans=0;
        for(int i=0;i<n;i++)
        {
            if(i%2==0)ans+=a[i];
            else ans-=a[i];
        }
        cout<<ans<<endl;
    }
}


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

int main(){
	int n;
	cin>>n;
	int a[n+5];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}

	ll sum=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			sum=sum+a[i]*a[j];
		}
	}
	cout<<sum<<endl;
	return 0;
}


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

typedef long long ll;
typedef pair<int,int> p_int;
typedef pair<ll,ll> p_ll;
typedef tuple<ll,ll,ll> t3_ll;
int dx[] = {-1,0,1,0},dy[] = {0,1,0,-1};
int prime[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
const ll inf = 1e9+7;

int main() {
	int a[3],b[3];
	int c[4];
	bool ok = true;
	for (int i = 0;i < 4;i++) {c[i] = 0;}
	for (int i = 0;i < 3;i++) {
		cin >> a[i] >> b[i];
		c[a[i]-1]++;
		c[b[i]-1]++;
	}
	for (int i = 0;i < 4;i++) {
		if (c[i] >=3) ok = false;
	}
	if (ok) cout << "YES" << endl;
	else cout << "NO" << endl;
} 

Measured memory_bytes: 256
str = gets
sum = 0
("a".."z").each do |x|
    if str.count(x).to_i % 2 == 1
    	print "No"
    	break
    end
    if str.count(x).to_i % 2 == 0
    	sum += 1
    end
end
print "Yes" if sum ==26

Measured memory_bytes: 1788
N,M = gets.split.map(&:to_i)
H = [0] + gets.split.map(&:to_i)
path = Hash.new{|h,k| h[k] = Array.new}
M.times{a,b = gets.split.map(&:to_i); path[a] << b; path[b] << a}

puts (1..N).count{|i| path[i] == [] || path[i].all?{|j| H[i] > H[j]}}

Measured memory_bytes: 26840
# -*- coding: utf-8 -*-
 
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
M = 0
 
for i in range(N):
	if A[i] > B[i]:
	
		M = B[i] + M
	
	elif B[i] > A[i] + A[i+1]:
 
		M = A[i] + A[i+1] + M
		A[i+1] = 0
 
	else:
 
		M = A[i] + min(B[i]-A[i],A[i+1]) + M
		A[i+1] = A[i+1] - (B[i] - A[i])
 
print(M)

Measured memory_bytes: 18624