akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
typedef long long int Int;
typedef long long ll;
int main(){
  int n;cin >> n;
  map<string,int> mp;
  rep(i,n){
    string s;
    cin >> s;
    sort(s.begin(),s.end());
    mp[s]++;
  }
  Int ans=0;
  for(auto& i:mp){
    int s = i.second;
    ans+= (ll)s*(s-1)/2;
  }
  cout << ans << endl;
  return 0;
}


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

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

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


	int A,B;
	scanf("%d %d",&A,&B);
	//scanf("%d",&B);
	
	if (A>=0 && B<24){ 
	  if (A+B>23) { printf("%d",A+B-24);}
	  else printf("%d",A+B);
	  }

}

Measured memory_bytes: 128
S = input()
c = [0, 0, 0]
for ch in S:
    if ch == 'a':
        c[0] += 1
    elif ch == 'b':
        c[1] += 1
    else:
        c[2] += 1

# max and min
maxC = max(c)
minC = min(c)

if maxC - minC <= 1:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 39536
#include<iostream>
#include<vector>
#include<utility>

#define endl '\n'

using namespace std;

const int MAXN=1e5+3,MOD=1e9+7;
vector<int> graph[MAXN];

int mul(int x, int y){
    return (long long)x*y%MOD;
}

pair<int,int> dfs(int currv, int parent){
    int white=1,black=0;
    for(int nextv : graph[currv]){
        if(nextv!=parent){
            pair<int,int> res=dfs(nextv,currv);
            int copy_white=white;
            white=mul(white,res.second);
            black=(mul(copy_white,res.first)+mul(black,res.first+res.second))%MOD;
        }
    }
    return {white,(white+black)%MOD};
}

int main(){
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    cin>>n;
    for(int i=1;i<n;++i){
        int from,to;
        cin>>from>>to;
        --from;
        --to;
        graph[from].push_back(to);
        graph[to].push_back(from);
    }

    pair<int,int> res=dfs(0,-1);
    res.first=(res.first+res.second)%MOD;
    cout<<res.first<<endl;

return 0;
}

Measured memory_bytes: 12672
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl #define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl #define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

vector<int> color;
void dfs_color(int v,int cur,vector<vector<pair<int,int>>>&G){
  color.at(v)=cur;
  for(auto next_v : G.at(v)){
    
    if(color.at(next_v.first)!=-1) continue;
    if(next_v.second) 
      dfs_color(next_v.first,1-cur,G);
    else
      dfs_color(next_v.first,cur,G);
  }
}

int main(){
  int n;
  cin>>n;
  vector<vector<pair<int,int>>> G(n);
  rep(i,n-1){
    int a,b;
    long d;
    cin>>a>>b>>d;
    a--;b--;
    int nan=d%2;
    G.at(a).push_back(pair<int,int>(b,nan));
    G.at(b).push_back(pair<int,int>(a,nan));

  }
  color.assign(n,-1);
  dfs_color(0,0,G);
  rep(i,n)
    cout<<color.at(i)<<endl;
  
}

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> s(M), c(M);
    rep(i, M) {
        cin >> s[i] >> c[i];
        s[i]--;
    }
    auto ok = [&](string S) -> bool {
        rep(i, M) {
            int n = S[s[i]] - '0';
            if(n != c[i]) return false;
        }
        return true;
    };
    for(int i = 0; i < 1010; ++i) {
        string S = to_string(i);
        if(S.size() != N) continue;
        if(ok(S)) {
            cout << i << '\n';
            return 0;
        }
    }
    cout << -1 << '\n';
    return 0;
}


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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

int D[200000][2];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt", "r", stdin));
	TEST(freopen("output.txt", "w", stdout));
	TEST(freopen("debug.txt", "w", stderr));
	string s;
	cin>>s;
	D[0][0]=1;
	D[1][1]=1;
	if(s.size()>1 && s[0]!=s[1]) D[1][0]=2;
	for(int i=2;i<s.size();i++) {
		D[i][0]=D[i-1][1]+1;
		if(s[i-1]!=s[i]) D[i][0]=max(D[i][0],D[i-1][0]+1);
		D[i][1]=D[i-2][0]+1;
		if(i>2 && (s[i-3]!=s[i-1] || s[i-2]!=s[i])) D[i][1]=max(D[i][1],D[i-2][1]+1);
	}
	cout<<max(D[s.size()-1][0],D[s.size()-1][1])<<'\n';
	return 0;
}

Measured memory_bytes: 2196
def combi(n, m)
  return 1 if m == 0
  return n if m == 1
  return combi(n, n - m) if m > n - m
  fact_s(n, n - m + 1) / fact_s(m, 1)
end
def fact_s(n, m)
  (m..n).to_a.inject(&:*)
end

N = gets.chomp

def count_under(a, b, c, n)
  r = a+b+c
  s = b+c
  cnt = 0
  (0...r).to_a.combination(a).each{|x|
    str = Array.new(r)
    x.each{|i| str[i] = '3'}
    rst = (0...r).to_a - x
    rst.combination(b).each{|y|
      y.each{|i| str[i] = '5'}
      (rst - y).each{|i| str[i] = '7'}
      cnt += 1 if str.join <= n
    }
  }
  cnt
end

def calc(k)
  ret = 0
  d = Hash.new
  (1..k-2).each{|i|
    (1..k-i-1).each{|j|
      tmp = [i, j, k-i-j].sort
      d[tmp] = combi(k, i) * combi(k-i, j) if not d.key?(tmp)
      ret += d[tmp]
    }
  }
  ret
end

ans = 0
(3..N.size-1).each{|k|
  ans += calc(k)
}
if ["8", "9"].include?(N[0]) then
  ans += calc(N.size)
elsif ["3", "4", "5", "6", "7"].include?(N[0]) then
  n = N.size
  (1..(n-2)).each{|i|
    (1..(n-i-1)).each{|j|
      ans += count_under(i, j, n-i-j, N)
    }
  }
end

puts ans


Measured memory_bytes: 1916
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using ll = long long int;



int main(){
    ll X; cin >> X;
    bool q = false;
    ll w;
    for(int i=0; i<1000; i++){
        if(pow(i, 5) == X){
            q = true; w = i; break;
        }
    }
    if(q){
        cout << w << " " << 0;
    }
    else{
    for(ll i=1; i<1000; i++){
        ll m = powl(i, 5);
        ll n = abs(m - X);
        ll v = 0;
        bool g = false;
        for(ll j=1; j<1000; j++){
            if(pow(j, 5) == n){
                v = j; g = true; break;
            }
        }
        if(g){
        if(m - X>0){
            cout << i << " " << v; break;
        }else{
            cout << i << " " << v*(-1); break;
        }
        }
    }
    }
}

Measured memory_bytes: 4040
//Leonidas
#pragma GCC optimize("Ofast")
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container'.',hpp>
//#include <ext/pb_ds/tree_policy'.',hpp>
//typedef tree < int , null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> TREE;
#define ll long long
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define pss pair<short,short>
#define pld pair<long double,long double >
#define ld long double
#define piii  pair<pii,int>
#define vii vector<pair<int,int> >
#define st first
#define nd second
#define pll pair<ll,ll>
#define speed ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define M_PI 3.14159265358979323846
//#define int long long
const int mod=1e9+7;
//const int mod=1009;
//const int mod=998244353;
const int inf=1000000009;
const long long INF=1000000000000000009;
const long long big=1000000000000000;
const long double eps=0.000000000000000000001;
using namespace std;
char T[10][10];
int32_t main()
{
    speed
    int n,m,k;
    cin>>n>>m>>k;
    int x=0;
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
        {
            cin>>T[i][j];
            if(T[i][j]=='#')
                x++;
        }
    x=x-k;
    int wynik=0;
    for(int i=0;i<(1<<n);i++)
    {
        for(int j=0;j<(1<<m);j++)
        {
            int ile=0;
            for(int l=0;l<n;l++)
            {
                for(int k=0;k<m;k++)
                {
                    if((((1<<l)&i)||((1<<k)&j))&&T[l][k]=='#')
                        ile++;
                }
            }
            if(ile==x)
                wynik++;
        }
    }
    cout<<wynik;
    return 0;
}


Measured memory_bytes: 3648
let () =
    let m = 1000000000 + 7 in
    let main () =
        let n, k = Scanf.sscanf (read_line ()) "%d %d" (fun n k -> n, k) in
        let sn = float n |> sqrt |> int_of_float in
        let perfect = n / sn = sn in
        let arr = Array.make (2 * sn - if perfect then 1 else 0) 1 in
        for i = 0 to sn - 1 do
            arr.(i) <- n/(i + 1) - n/(i + 2)
        done;
        let l = Array.length arr in
        let rec loop i prev =
            if i = 0 then prev.(0) else (
                let next = Array.make l 0 in
                for j = l - 1 downto 0 do
                    next.(j) <- ((if j = l - 1 then 0 else next.(j + 1)) + prev.(l - 1 - j) * arr.(j)) mod m;
                done;
                loop (i - 1) next
            )
        in
        Printf.printf "%d\n" (loop k (Array.make l 1))
    in
    main ()

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

const int N = 100;
int n;
vector <int> G[N + 7];
int h[N + 7];
int par[N + 7];

void dfs0(int v, int p) {
  par[v] = p;
  if (p == 0) h[v] = 0;
  else h[v] = h[p] + 1;
  
  for (auto u : G[v]) {
    if (u != p) dfs0(u, v);
  }
}

int znajdzNajdalszy() {
  int maxi = -1;
  for (int i = 1; i <= n; ++i) maxi = max(maxi, h[i]);
  for (int i = 1; i <= n; ++i) if (h[i] == maxi) return i;
  return 0;
}

vector <int> dp[N + 7];

void licz(int v, int p) {
  int sz = 1;
  
  for (auto u : G[v]) {
    if (u != p) {
      licz(u, v);
      sz = max(sz, 1 + (int) dp[u].size()); 
    }
  }
  
  dp[v].clear();
  dp[v].resize(sz, 0);
  
  for (auto u : G[v]) {
    if (u != p) {
      for (int i = 0; i < (int) dp[u].size(); ++i) {
        dp[v][i + 1] = max(dp[v][i + 1], dp[u][i]);
      }
    }
  }
  
  dp[v][0] = (int) G[v].size();
  if (p != 0) dp[v][0]--;
  if ((int) G[v].size() == 1) dp[v][0] = 1;
}

void usun(int u, int v) {
  G[u].erase(find(G[u].begin(), G[u].end(), v));
  G[v].erase(find(G[v].begin(), G[v].end(), u));
}

unsigned long long jebaj1(int v) {
  licz(v, 0);
  /*cout << "korzen = " << v << endl;
  for (int i = 1; i <= max(n, v); ++i) {
    cout << "i = " << i << ": ";
    for (auto u : dp[i]) cout << u << ' ';
    cout << endl;
  }*/
  unsigned long long res = 1;
  for (auto u : dp[v]) res *= u;
  return res;
}

unsigned long long jebaj2(int u, int v) {
  //cout << "usuwamy " << u << ' ' << v << endl;
  usun(u, v);
  
  G[n + 1].push_back(u);
  G[u].push_back(n + 1);
  
  G[n + 1].push_back(v);
  G[v].push_back(n + 1);
  
  unsigned long long res = jebaj1(n + 1);
  
  usun(n + 1, v);
  usun(n + 1, u);
  
  G[u].push_back(v);
  G[v].push_back(u);
  
  return res;
}

int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  dfs0(1, 0);
  int v = znajdzNajdalszy();
  dfs0(v, 0);
  int w = znajdzNajdalszy();
  
  cout << (h[w] + 2) / 2 << ' ';
  
  unsigned long long wynik = 8e18;

  if (h[w] % 2 == 0) {
    int ile = (h[w] / 2);
    while (ile--) w = par[w];
    //cout << "w = " << w << endl;
    vector <int> sas;
    for (auto u : G[w]) sas.push_back(u);
    
    for (auto u : sas) {
      wynik = min(wynik, jebaj2(w, u));
    }
    wynik = min(wynik, jebaj1(w));
  }
  else {
    int ile = h[w] / 2;
    while (ile--) w = par[w];
    wynik = min(wynik, jebaj2(w, par[w]));
  }
  
  cout << wynik << endl;
  return 0;
}

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

int main(){
  
  	char S[11];
  	char T[11];
  	int lengthS;
  	int lengthT;
  
  	scanf("%s", S);
  	scanf("%s", T);
  	
  	lengthS = strlen(S);
  	lengthT = strlen(T);
  
  	if(lengthT == (lengthS+1)){
    	if(strncmp(S, T, lengthS) == 0){
          	printf("Yes\n");
        }else{
         	printf("No\n");
        }
    }else{
    	//NG
      	printf("No\n");
    }

	return 0;
}

Measured memory_bytes: 1684
#include <iostream>
#include <string>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;

int pow(int a, int b) {
  int ret = 1;
  REP(i,b) {ret *= a; }
  return ret;
}

int num2753(int keta, int n) {
  int ret = 0;
  int ck = 1;
  REP(i, keta) {
    ret += ck * (3 + (n % 3) * 2);
    n /= 3;
    ck *= 10;
  }
  return ret;
}

int is753(int v){
  int f = 0;
  while(v > 0) {
    int t = v % 10;
    if(t == 7) f |= 4;
    if(t == 5) f |= 2;
    if(t == 3) f |= 1;
    v /= 10;
  }
  return f == 7;
}

int main(){
  int N;
  cin >> N;
  int result = 0;
  for(int keta=3; keta <= 9; ++keta) {
    int lmax = pow(3, keta);
    REP(l, lmax) {
      int v = num2753(keta, l);
      if(v > N) break;
      if(!is753(v)) continue;
      result++;
    }
  }
  cout << result << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define R cin>>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
    int N, M, X;
    cin>>N>>M>>X;
    vector<int>A(M);
    int a, p=0, m=0;
    rep(i, M) {
        R a;
        if (a <= X) ++p;
        else ++m;
    }
    int ans;
    ans = min(p,m);
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author bcools
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            for (int i = 0; i < s.length(); ++i) {
                if (s.indexOf(s.charAt(i), i + 1) != -1) {
                    out.println("no");
                    return;
                }
            }
            out.println("yes");
        }

    }
}



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

vector<vector<int>>tisei;
int tate, yoko;
void shima(int a, int b) {
	tisei[a][b] = 0;
	for (int c = a-1; c < a+2; c++) {
		for (int d = b - 1; d < b + 2; d++) {
			if (c > -1 && d > -1 && c< tate&d < yoko&&tisei[c][d])shima(c, d);
		}
	}
}
int main() {
	int a, b;
	while (cin >> a >> b, a | b) {
		tate = b;
		yoko = a;
		tisei.clear();
		for (int c = 0; c < b; c++) {
			vector<int>o(a);
			for (int e = 0; e < a; e++) {
				cin >> o[e];
			}
			tisei.push_back(o);
		}
		int s = 0;
		for (int g = 0; g < b; g++) {
			for (int h = 0; h < a; h++) {
				if (tisei[g][h]) { s++;  shima(g, h); }
			}
		}
		cout << s << endl;
	}
}

Measured memory_bytes: 3296
#define N 100
#include<stdio.h>

int main()
{
  int i,j,key;
  /*数値を格納する配列*/
  int A[N];
  /*入力数字数*/
  int sum;
  /*入力数字数input*/
  scanf("%d",&sum);
  /*数字input*/
  for(i=0;i<sum;i++)
    scanf("%d",&A[i]);

  /*昇順にソートする*/
  for(i=0;i<sum;++i){
    key=A[i];
    j=i-1;
while(j>=0&&A[j]>key){
A[j+1]=A[j];
j--;
A[j+1]=key;
   
}
    /*各ステップ表示*/
for(j=0;j<sum-1;j++)
printf("%d ",A[j]);
printf("%d",A[sum-1]);
printf("\n");}

return 0;
}

  



Measured memory_bytes: 2620
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_mut)]
#![allow(unused_assignments)]
use proconio::input;
use proconio::marker::Usize1;
use std::collections::*;
use std::cmp::*;
use std::f64::consts::*;

const MOD: u64 = 1000000007;
const INF: usize = std::usize::MAX / 4;

fn main() {
    input! {
        N: usize,
        A: [Usize1; N - 1],
    }

    let mut ans = vec![0; N];
    for a in A {
        ans[a] += 1;
    }

    for a in ans {
        println!("{}", a);
    }
}


Measured memory_bytes: 5528
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trv(a) cerr<<#a<<":\n";for(ll zz=0;zz<a.size();zz++) cerr<<a[zz]<<" ";cerr<<endl
#define mod 1000000007ll
#define inf 9999999999999999ll



void solve()
{
    lf r;
    cin>>r;
    lf ans = M_PI*2.0*r;
    cout<<setprecision(12)<<ans<<endl;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    // cin>>t;
    t = 1;
    while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
int powint(int a, int x){
	int res = 1;
	REP(i,x){
		res = res *a; 
	}
	return res;
}

using namespace std;

int main(){
	string s;
	cin>>s;
	int nox=0;//x以外の文字の数
	int N=s.size();
	int ans=0;
	bool dame=false;
	REP(i,N){
		if(s[i]!='x') nox++;
	}
	//debug(nox);
	if(nox==0){

	} else if(nox%2==0){
		int idx=0;
		int tmpnox=0;
		int i1=-1;
		int i2=-1;
		for( ; ; idx++){
			if(s[idx]!='x') tmpnox++;
			if(tmpnox==nox/2&&i1<0) i1=idx;
			if(tmpnox==nox/2+1){
				i2=idx;
				break;
			} 
		}
		//debug(i1);
		//debug(i2);
		string s1=s.substr(0,i1+1);
		reverse(s1.begin(),s1.end());
		string s2=s.substr(i2,N-i2);
		//debug(s1);
		//debug(s2);
		vector<int> x1(N+1);
		vector<int> x2(N+1);
		string s1nox="";
		string s2nox="";
		REP(i,s1.size()){
			if(s1[i]=='x'){
				x1[s1nox.size()]++;
			} else {
				s1nox+=s1[i];
			}
		}
		REP(i,s2.size()){
			if(s2[i]=='x'){
				x2[s2nox.size()]++;
			} else {
				s2nox+=s2[i];
			}
		}
		if(s1nox==s2nox){
			REP(i,s1nox.size()+1){
				ans+=max(x1[i]-x2[i],x2[i]-x1[i]);
			}
		}
		else {
			dame=true;
		}
	} else {
		int idx=0;
		int tmpnox=0;
		int i1,i2;
		for( ; ; idx++){
			if(s[idx]!='x') tmpnox++;
			if(tmpnox==(nox+1)/2) break; 
		}
		i1=idx;
		i2=idx;
		//debug(idx);
		string s1=s.substr(0,i1+1);
		reverse(s1.begin(),s1.end());
		string s2=s.substr(i2,N-i2);
		vector<int> x1(N+1);
		vector<int> x2(N+1);
		string s1nox="";
		string s2nox="";
		//debug(s1);
		//debug(s2);
		REP(i,s1.size()){
			if(s1[i]=='x'){
				x1[s1nox.size()]++;
			} else {
				s1nox+=s1[i];
			}
		}
		REP(i,s2.size()){
			if(s2[i]=='x'){
				x2[s2nox.size()]++;
			} else {
				s2nox+=s2[i];
			}
		}
		if(s1nox==s2nox){
			REP(i,s1nox.size()+1){
				ans+=max(x1[i]-x2[i],x2[i]-x1[i]);
			}
		}
		else {
			dame=true;
		}
	}
	if(dame){
		cout<<-1<<endl;
	} else {
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  // 一年の秒数
  int r, g;
  int p = 24;
 
  // 以下のコメント/* */を消して追記する
  cin >> r;
  cin >> g;
  cout << r + (g - r)*2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
ll gcd(ll a,ll b){
  if(b==0) return a;
  return gcd(b,a%b);
}
ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}

int main() {
    int n;
    cin >> n;
    string s[n+1];
    int t[n+1];
    rep(i,n){
        cin>>s[i]>>t[i];
    }
    string x;
    cin >> x;
    int res=0;
    rep(i,n){
        if(x==s[i]){
            res=i;
        }
    }
    int ans=0;
    rep(i,n){
        if(i>res){
            ans+=t[i];
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
	int n,s=0,maxs=0,a[3][105];
    cin>>n;
    for(int i=0;i<n;i++)
    	cin>>a[1][i];
   	for(int i=0;i<n;i++)
    	cin>>a[2][i];
   	for(int i=0;i<n;i++)
   	{
	   	s+=a[1][i];
	   	int t=s;
	    for(int j=i;j<n;j++)
	   	{
	   		t+=a[2][j];
	   	}
	   	maxs=max(maxs,t);
	}
    cout<<maxs<<endl;
	return 0;
}


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

readInt = fst . fromJust . BS.readInt

getInt = readInt <$> BS.getLine

calc :: Int -> Int -> Int -> Int
calc a n x
  | a > n `div` 2 = x
  | n `mod` a == 0 = calc (a + 1) n (x + 1)
  | otherwise = calc (a + 1) n x

calcAll :: Int -> Int -> Int -> Int
calcAll a n x
  | a > n = x
  | a `mod` 2 == 0 = calcAll (a + 1) n x
  | (calc 1 a 0) == 7 = calcAll (a + 1) n (x + 1)
  | otherwise = calcAll (a + 1) n x

main = do
  n <- getInt
  print $ calcAll 1 n 0


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

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i=0; i<N; i++){
        cin >> a.at(i);
    }

    int count = 0;
    int current = 0;
    vector<int> past(N);

    for (int i=0; i<N; i++){
        past.at(i) = current;
        current = a.at(current)-1;
        count++;

        if ((current+1) == 2){
            cout << count << endl;
            return 0;
        }
        /*
        else{
            for (int j=0; j<count; j++){
                if(past.at(j) == current){
                    cout << -1 << endl;
                    return 0;
                }
            }
        }
        */
    } 
    cout << -1 << endl;
}

Measured memory_bytes: 1024
array = Array.new

3.times do
    val = gets.split
    array.push(val)
end

A,B = array[1].map!{|i| i.to_i}

if array[2][0] == array[0][0]
    puts((A - 1).to_s + ' ' + B.to_s)
else
    puts(A.to_s + ' ' + (B - 1).to_s)
end


Measured memory_bytes: 1788
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;

int N;
int Ai[200010];
int Left[600000], Right[600000];
long long Tree[600000];
int n2;
long long res;

long long srch(int nd, int ll, int rr)
{
	if(Left[nd]>=ll && Right[nd]<=rr)
		return Tree[nd];
	if(Left[nd]>rr || Right[nd]<ll)
		return 0;
	return srch(2*nd, ll, rr) + srch(2*nd+1, ll, rr);
}

long long calc(int ll, int rr)
{
	if(ll>rr)
		return 0;
	return srch(1, ll, rr);
}

int bsrch(int ll, int rr, long long vv)
{
	int l=ll, r=rr+1;
	int m;
	while(l<r){
		m = (l+r)/2;
		if(calc(ll, m) >= vv)
			r = m;
		else
			l = m+1;
	}
	return l;
}

void solve()
{
	int i, j;
	n2 = 1;
	while(n2 < N)
		n2 *= 2;
	for(i=0; i<n2; i++)
		Left[n2+i] = Right[n2+i] = i;
	for(i=n2-1; i>=1; i--){
		Left[i] = Left[2*i];
		Right[i] = Right[2*i+1];
	}
	for(i=0; i<N; i++)
		Tree[n2+i] = Ai[i];
	for(i=n2-1; i>=1; i--){
		Tree[i] = Tree[2*i] + Tree[2*i+1];
	}
	res = 1000000000;
	res *= 1000000000;
	long long t1, t2;
	long long t3, t4;
	long long t[4];
	for(i=2; i<=N-2; i++){
		long long sum = calc(0, i-1);
		j = bsrch(0, i-1, (sum+1)/2);
		t1 = calc(0, j);
		t2 = calc(j+1, i-1);
		t3 = calc(0, j-1);
		t4 = calc(j, i-1);
		if(abs(t1-t2) < abs(t3-t4) ){
			t[0] = t1;
			t[1] = t2;
		}
		else{
			t[0] = t3;
			t[1] = t4;
		}
		
		sum = calc(i, N-1);
		j = bsrch(i, N-1, (sum+1)/2);
		t1 = calc(i, j);
		t2 = calc(j+1, N-1);
		t3 = calc(i, j-1);
		t4 = calc(j, N-1);
		if(abs(t1-t2) < abs(t3-t4) ){
			t[2] = t1;
			t[3] = t2;
		}
		else{
			t[2] = t3;
			t[3] = t4;
		}
		sort(t, t+4);
		if(t[3] - t[0] < res)
			res = t[3]-t[0];
	}
	printf("%lld\n", res);
}

int main()
{
	int i;
	scanf("%d", &N);
	for(i=0; i<N; i++)
		scanf("%d", &Ai[i]);
	solve();
	return 0;
}

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

int main(){
    long long n;
    cin >> n;
    vector<long long> a(n+1, 0);

    for(long long i = 1; i <= n; i++){
        cin >> a[i];
    }

    long long count = 0;
    for(long long i = 1; i <= n; i++){
        if(i % 2 != 0 and a[i] % 2 != 0){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

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

int main(void){
    
    string S;
    cin >> S;
    if(S.size()%2==1){
        cout << "No" <<endl;
        return 0;
    }
    
    string hi;
    for(int i = 0; i < S.size()/2;i++)hi += "hi";
    
    if(hi == S)cout << "Yes"<<endl;
    else cout << "No" <<endl;
}

Measured memory_bytes: 256
import fractions

A, B, K = list(map(int, input().split()))

a_re = []
b_re = []

for i in range(max(A,B) + 1):
    if i == 0:
        continue
    #print(i)
    if A % i ==0:
        a_re.append(i)
    if B % i ==0:
        b_re.append(i)
#print(a_re)

result = list (set(a_re) & set( b_re))

result.sort(reverse=True)
print(result[K-1])


Measured memory_bytes: 5048
#include <bits/stdc++.h>
int is1to12(int num){
    if(0<num&&num<13){
        return 1;
    }
    else{
        return 0;
    }
}
int main() {
    int s;
    int p,q;
    std::cin>>s;
    q=s%100;
    p=s/100;
    if(is1to12(p)==1 &&is1to12(q)==1){
        std::cout<<"AMBIGUOUS"<<std::endl;
    }else if(is1to12(p)==0&&is1to12(q)==1){
        std::cout<<"YYMM"<<std::endl;
    }else if(is1to12(p)==1&&is1to12(q)==0){
        std::cout<<"MMYY"<<std::endl;
    }else{
        std::cout<<"NA"<<std::endl;
    }
    return 0;
}


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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var N = input[0];
            var M = input[1];
            var Q = input[2];
            var cityL = new int[M];
            var cityR = new int[M];
            for(var i = 0; i < M; i++)
            {
                input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
                cityL[i] = input[0];
                cityR[i] = input[1];
            }

            var rails = new int[N + 1, N + 1];

            for(var i = 0; i < M; i++)
            {
                rails[cityL[i], cityR[i]]++;
            }

            for(var i = 1; i <= N; i++)
            {
                for(var j = 1; j <= N; j++)
                {
                    rails[i, j] += rails[i, j - 1];
                }
            }

            for(var i = 0; i < Q; i++)
            {
                input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
                var p = input[0];
                var q = input[1];
                var ans = 0;
                for (var j = p; j <= q; j++)
                {
                    ans += rails[j, q] - rails[j, p - 1];
                }
                Console.WriteLine(ans);
            }
        }
    }
}

Measured memory_bytes: 20332
#include<bits/stdc++.h>
using namespace std;
int T;
long long a,b;
int main(){
    ios::sync_with_stdio(false);
    cin>>T;
    while (T--){
        cin>>a>>b;
        if (b<a)swap(b,a);
        long long l=sqrt(a*b-1);
        long long r=l;
        while (r&&r*(l+1)>=a*b)r--;
        bool sig1=0,sig2=0,sig3=0;
        if (l>=a)sig1=1;
        if (r>=b)sig2=1;
        if (l*r<a*b-1&&(l*(r+1)>=a*b||(l+1)*r>=a*b)&&l!=a)sig3=1;
        cout<<l+r-sig1-sig2-sig3<<endl;;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long LL;
#define MD (1000000007)
#define FI first
#define SE second
#define PB push_back
#define N (1010)
#define M (2010)
int fa[N], f[N][12], be[N], ed[N], u[M], v[M], cnt[2], ontr[M];
LL w[M], g[N][12];
int n, m, p[M], p2[M];
LL x;
int tot;
typedef pair<int, LL> PIL;
vector<PIL> tr[N];
bool cmp(int a, int b){
    return w[a] < w[b];
}
int getf(int x){
    return x == fa[x] ? x : (fa[x] = getf(fa[x]));
}
int y;
void dfs(int x){
    be[x] = ++tot;
    for (auto it = tr[x].begin(); it != tr[x].end(); ++it){
        if ((y=it->FI)!=f[x][0]){
            f[y][0] = x;
            g[y][0] = it->SE;
            dfs(y);
        }
    }
    ed[x] = tot;
    // printf("%d %d %d\n", x, be[x], ed[x]);
}
void build(){
    p2[0] = 1;
    for (int i = 1; i <= n; ++i){
        fa[i] = i;
    }
    sort(p+1,p+m+1,cmp);
    for (int i = 1; i <= m; ++i){
        int a = u[p[i]], b = v[p[i]];
        if (getf(a) != getf(b)){
            ontr[p[i]] = 1;
            fa[getf(a)] = getf(b);
            x -= w[p[i]];
            tr[a].PB({b,w[p[i]]});
            tr[b].PB({a,w[p[i]]});
        }
        if ((p2[i] = p2[i-1]+p2[i-1]) >= MD){
            p2[i] -= MD;
        }
    }
    dfs(1);
    f[1][0] = 1;
    for (int j = 1; j <= 10; ++j){
        for (int i = 1; i <= n; ++i){
            f[i][j] = f[f[i][j-1]][j-1];
            g[i][j] = max(g[f[i][j-1]][j-1], g[i][j-1]);
        }
    }
}
int main(){
    scanf("%d%d%lld",&n, &m, &x);
    for (int i = 1; i <= m; ++i){
        scanf("%d%d%lld", u+i,v+i,w+i);
        p[i] = i;
    }
    build();
    for (int i  = 1; i <= m; ++i) if (!ontr[i]){
        int a = u[i], b = v[i];
        // printf("%d %d\n", a, b);
        LL mx = 0;
        if (!(be[a] <= be[b] && ed[a] >= ed[b])){
            for (int j = 10; ~j; --j){
                if (!(be[f[a][j]] <= be[b] && ed[f[a][j]] >= ed[b])){
                    mx = max(mx, g[a][j]);
                    a = f[a][j];
                }
            }
            mx = max(mx, g[a][0]);
            a = f[a][0];
        }
        for (int j = 10; ~j; j--){
            if (!(be[f[b][j]] <= be[a] && ed[f[b][j]] >= ed[a])){
                mx = max(mx, g[b][j]);
                b = f[b][j];
            }
        }
        if (b != a){
            mx = max(mx, g[b][0]);
        }
        // printf("%lld \n", mx);
        if (w[i] - mx >= x){
            cnt[w[i]-mx > x]++;
        }
    }
    // printf("%d %d\n", cnt[0], cnt[1]);
    if (x) printf("%lld\n", 2ll*(p2[cnt[0]]-1+MD)*p2[cnt[1]] %MD);
    else printf("%lld\n", 1ll*(p2[n-1+cnt[0]]-2+MD)*p2[cnt[1]]%MD);
}

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


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

    long long A, B, C;
    cin>>A>>B>>C;

    if (A%2==0 || B%2==0 || C%2==0) cout<<0<<endl;
    else                            cout<<min(min(A*B, B*C), C*A)<<endl;
}


Measured memory_bytes: 3520
while True:
    a, b, c = input().split()
    a = int(a)
    c = int(c)
    if b == "+":
        print(a + c)
    elif b == "-":
        print(a - c)
    elif b == '*':
        print(a * c)
    elif b == '/':
        print(a // c)
    else:
        break


Measured memory_bytes: 5592
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		sc.close();

		Map<Character, Integer> mapS = new HashMap<Character, Integer>();
		Map<Character, Integer> mapT = new HashMap<Character, Integer>();
		int cnt = 0;
		for (int i = 0; i < s.length(); i++) {
			char charS = s.charAt(i);
			char charT = t.charAt(i);
			if (mapS.containsKey(charS)) {
				if (mapT.containsKey(charT)) {
					if (!mapS.get(charS).equals(mapT.get(charT))) {
						System.out.println("No");
						return;
					}
				} else {
					System.out.println("No");
					return;
				}
			} else {
				if (mapT.containsKey(charT)) {
					System.out.println("No");
					return;
				}
				cnt++;
				mapS.put(charS, cnt);
				mapT.put(charT, cnt);
			}
		}
		System.out.println("Yes");
	}
}


Measured memory_bytes: 28548
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
ll INF = 214748364700000000;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<pair<ll,ll>>>;

bool frag[110];

int main(){
   ll N;cin >> N;
   vector<pair<ll,ll>> R(N),B(N);
   rep(i,N) cin >> R[i].second >> R[i].first;
   rep(i,N) cin >> B[i].first >> B[i].second;
   sort(ALL(R));reverse(ALL(R));
   sort(ALL(B));
   ll ans = 0;
   rep(i,N){
       rep(j,N){
           if(frag[j]) continue;
           if(B[i].first <= R[j].second || B[i].second <= R[j].first) continue;
           frag[j] = 1;
           ans++;
           break;
       }
   }
   cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define ull unsigned long long
#define ll long long
#define ld long double
 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
 
#define MX LLONG_MAX
#define MN LLONG_MIN
 
const int N=1e2 + 5;
const ll mod=1e9+7;
 
ll powermodm(ll x,ll n,ll M){ll result=1;while(n>0){if(n % 2 ==1)result=(result * x)%M;x=(x*x)%M;n=n/2;}return result;}
ll power(ll _a,ll _b){ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a);_b/=2;_a=(_a*_a);}return _r;}
ll gcd(ll a,ll b){if(a==0)return b;return gcd(b%a,a);}          
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

int main()                  
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
        cin>>a[i];
    ll g =  a[0];
    for(ll i=1;i<n;i++)
        g = gcd(g,a[i]);
    cout<<g;
    return 0;
}  

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main()
{
    int k, a, b;
    cin >> k >> a >> b;
    bool bigyoshi = false;

    for(int i = a; i <= b; i++) {
        if (i % k == 0)
            bigyoshi = true;
    }

    if (bigyoshi == true)
        cout << "OK";
        else
        cout << "NG";


    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define ALL(x) x.begin(), x.end()
#define DEBUG(args...) { string _s = #args; replace(ALL(_s), ' ', '\0');\
replace(ALL(_s), ',', ' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); _debug(_it, args);}
#define endl "\n"
#define F first
#define S second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void _debug(istream_iterator<string>) {}
template<typename T, typename... Args>
void _debug(istream_iterator<string> it, T first, Args... args) {
    cerr << ">> " << *it << " : " << first << endl; _debug(++it, args...);
}
template <typename T1, typename T2>
inline ostream& operator << (ostream& out, const pair<T1, T2>& p) {
    return out << "(" << p.F << ", " << p.S << ")";
}
template<typename T>
inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty()) return out << "[]";
    else { out << '['; for (auto& e : v) { out << e << ", "; } return out << "\b\b]"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const set<T>& s) {
    if (s.empty()) return out << "{}";
    else { out << '{'; for (auto& e : s) { out << e << ", "; } return out << "\b\b}"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const unordered_set<T>& s) {
    return out << set<T>(ALL(s));
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const map<T1, T2>& m) {
    if (m.empty()) return out << "{}";
    out << '{'; for (auto& p : m) { out << p << ", "; } return out << "\b\b}";
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const unordered_map<T1, T2>& m) {
    return out << map<T1, T2>(ALL(m));
}
template<typename T>
inline ostream& operator << (ostream& out, const ordered_set<T>& s) {
    return out << set<T>(ALL(s));
}

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef pair<ll, ll> pll;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;
/************************************** MAIN PROGRAM ********************************************/

int main()
{
    //freopen("input.txt", "r", stdin);
    SPEED
    vector<int> adj[4];
    FOR(i, 0, 3)
    {
        ll a, b;
        cin >> a >> b;
        a--, b--;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    sort(adj, adj + 4, [] (auto x, auto y) {
         return x.size() < y.size();
     });
     if (adj[0].size() == 1 && adj[1].size() == 1 && adj[2].size() == 2 && adj[3].size() == 2) {
        cout << "YES";
     } else {
        cout << "NO";
     }
}
/************************************** END OF PROGRAM ******************************************/


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int N, kazu, K;
int A[18], B[18], onaji[18], MAB[18];
unsigned char dp[36][1 << 18];
int keisan(int b, bool n, int k) {
	if (dp[k][b] != 255) return dp[k][b];
	if (b == (1 << N) - 1) return 0;

	int saishou = 254;
	int num2 = 0;
	int used = 0;
	auto a = n ? B : A;

	rep(i, N) {
		if (!(b >> i & 1)) {
			if (MAB[i] < k) return dp[k][b] = 254;
			if (a[i] >= k && !(used >> onaji[i] & 1)) {
				chmin(saishou, keisan(b ^ (1 << i), !n, a[i]) + num2);
				used ^= 1 << onaji[i];
			}
			num2++;
		}
	}
	return dp[k][b] = saishou;
}

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


	scanf("%d", &N);
	rep(i, N) {
		if (i & 1) scanf("%d", B + i);
		else scanf("%d", A + i);
	}
	rep(i, N) {
		if (i & 1) scanf("%d", A + i);
		else scanf("%d", B + i);
	}
	rep(i, N) MAB[i] = max(A[i], B[i]);

	rep(i, N) {
		int atta = -1;
		rep(j, i) {
			if (A[i] == A[j] && B[i] == B[j]) {
				atta = j;
				break;
			}
		}
		if (atta != -1) onaji[i] = onaji[atta];
		else onaji[i] = kazu++;
	}

	pair<int, int> kari[36];
	rep(i, N) kari[i] = mp(A[i], i);
	rep(i, N) kari[i + N] = mp(B[i], i + N);
	sort(kari, kari + N * 2);
	int mae = kari[0].first;
	rep(i, N * 2) {
		if (mae != kari[i].first) K++;
		mae = kari[i].first;
		if (kari[i].second < N) A[kari[i].second] = K;
		else B[kari[i].second - N] = K;
	}
	memset(dp[0], 255, (K + 1) * (1 << 18));

	int kotae = keisan(0, 0, 0);
	if (kotae == 254) printf("-1\n");
	else printf("%d\n", kotae);

	Would you please return 0;
}

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

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string str;
	cin >> str;
	int len = str.length();
	if (str[len - 1] == 's')
		cout << str + "es" << endl;
	else cout << str + 's' << endl;
	return 0;
}


Measured memory_bytes: 3656
/*
ID: Nipun Paul
LANG: C++
PROB: God knows
*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> v;

int main()
{
    ll a,b,c=0,d=0,e=0;
    cin>>a>>b;
    c=(b*2)+1;
    d=a/c;
    e=a%c;
    if(e>0)
    {
        d=d+1;
    }
    if(a<b)
    {
        d=1;
    }
    cout<<d<<endl;
    return 0;
}


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

int main(){

    char str[117];

    scanf("%[^\n]",str);
    int i;
    for(i=0;i<117;i++){
        if(str[i] == ' '){
            printf("A%cC\n",str[i+1]);
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 128
x1,y1,x2,y2=map(float,input().split())
if x1<=x2:
    x=x2-x1
else:
    x=x1-x2

if y1<=y2:
    y=y2-y1
else:
    y=y1-y2
    
t=x**2+y**2
t1=t**(1/2)
print(f'{t1:10.8f}')


Measured memory_bytes: 5644
#include <stdio.h>
#include <math.h>

int main(void){
  int n;
  scanf("%d",&n);
  
  long int a[n];
  int i, j=0;
  long double m=0;
  long int z=0;
  long int ans=1;
  
  int count=0;//0が何個あるか
  
  for(i=0; i<n; i++){
    scanf("%ld", &a[i]);
    if(a[i]==z){
      count++;
    }
    m+=log10(a[i]);
    ans*=a[i];
  }
  
  if(count!=0){
    printf("0\n");
    return 0;
  }
  
  if(m>18 || ans>1000000000000000000){
    printf("-1\n");
    return 0;
  }
  ans=1;
  for(i=0;i<n;i++){
    ans*=a[i];
  }
  
  printf("%ld\n",ans);
  
  return 0;
}

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(obj) obj.begin(), obj.end()
#define fcout cout << setprecision(10)

const int iINF = 1e9;
const long long llINF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

template <typename T>
void debug(vector<T> &vec) {
    for (auto x : vec) {
        cout << x << " ";
    }
    cout << endl;
    return;
}

template <typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}

template <typename T>
int getFormer(const vector<T> &vec, T x) {
    return upper_bound(vec.begin(), vec.end(), x) - vec.begin() - 1;
}

template <typename T>
int getLatter(const vector<T> &vec, T x) {
    return lower_bound(vec.begin(), vec.end(), x) - vec.begin();
}

long long dp[110][10010];

int main() {
    int N, W;
    cin >> N >> W;
    vector<int> v(N), w(N);
    REP(i, N) { cin >> v[i] >> w[i]; }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < W + 1; j++) {
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
            if (j - w[i] < 0) continue;
            dp[i + 1][j] = max(dp[i + 1][j - w[i]] + v[i], dp[i][j]);
        }
    }

    cout << dp[N][W] << endl;
    return 0;
}


Measured memory_bytes: 10924
#include<iostream>
using namespace std;
const int maxn=1e5+10;
int n,a[maxn],b[maxn];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		b[a[i]]=i;
	}
	for(int i=1;i<=n;i++){
		if(i==1)
		    cout<<b[i];
		else
			cout<<" "<<b[i];
	}
	return 0;
}

Measured memory_bytes: 1536
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007


signed main(){
    int m1,d1,m2,d2;
    cin>>m1>>d1>>m2>>d2;
    if(m1!=m2) cout<<"1"<<endl;
    else cout<<"0"<<endl;
}


Measured memory_bytes: 3128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DBouquet solver = new DBouquet();
        solver.solve(1, in, out);
        out.close();
    }

    static class DBouquet {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            Arith arith = new Arith();
            final int MOD = (int) 1e9 + 7;
            int n = in.nextInt();
            int a = in.nextInt();
            int b = in.nextInt();
            // すべての花束の作り方は2^n
            // ここからなくすのは0本を使う場合の1通り
            // a本を選ぶ場合のnCa
            // b本を選ぶ場合のnCb
            // これらはすべて排反であるからどれも独立に求めていい
            ModInt ans = new ModInt(arith.modPow(2, n, MOD) - 1);
            ModInt facA = new ModInt(arith.modPerm(a, a, MOD));
            facA.inv();
            ModInt nCa = new ModInt(arith.modPerm(n, a, MOD));
            nCa.mul(facA.getVal());
            ModInt facB = new ModInt(arith.modPerm(b, b, MOD));
            facB.inv();
            ModInt nCb = new ModInt(arith.modPerm(n, b, MOD));
            nCb.mul(facB.getVal());
            ans.sub(nCa.getVal() + nCb.getVal());
            out.println(ans.getVal());
        }

    }

    static class Arith {
        public int modPerm(int n, int k, int MOD) {
            long res = 1;
            for (int i = 0; i < k; i++) {
                res *= (n - i);
                res %= MOD;
            }
            return (int) res;
        }

        public int modPow(int a, int x, int MOD) {
            long res = 1;
            long mul = a;
            while (x != 0) {
                if (x % 2 != 0) {
                    res *= mul;
                    res %= MOD;
                }
                mul *= mul;
                mul %= MOD;
                x /= 2;
            }
            return (int) res;
        }

    }

    static class ModInt {
        int val;
        int MOD = (int) 1e9 + 7;

        public ModInt(long i) {
            this.val = (int) (i % MOD);
        }

        public void sub(long i) {
            this.val = (int) ((this.val - (i % MOD) + MOD) % MOD);
        }

        public void mul(long i) {
            long res = this.val;
            this.val = (int) ((res * i) % MOD);
        }

        public void inv() {
            pow(MOD - 2);
        }

        public void pow(int p) {
            long res = 1;
            long mul = this.val;
            while (p != 0) {
                if (p % 2 != 0) {
                    res *= mul;
                    res %= MOD;
                }
                p /= 2;
                mul *= mul;
                mul %= MOD;
            }
            this.val = (int) res;
        }

        public int getVal() {
            return val;
        }

    }
}



Measured memory_bytes: 23764
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define pi 3.1415926535
#define endl '\n'
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
const ll inf=1e18;
/*ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   ll n,k;
   cin>>n>>k;
   if(n>=10)
    cout<<k<<endl;
   else
    cout<<k+1000-(100*n)<<endl;
}


Measured memory_bytes: 384