akhauriyash/Code-Regression huggingface dataset:
//
//  main.cpp
//  ABC124
//
//  Created by hiroaki on 2019/05/07.
//  Copyright © 2019年 hiroaki. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>


//pair sort firstに揃う

#define int long long
#define pb(n) push_back(n)
#define Rap(n,i) for(int (i)=0;(i)<(n);(i)++)
#define Pr(n) cout<<n<<endl;
#define F first
#define S second
#define vector2 vector<vector<int> >
#define index(v,x) find((v).begin(), (v).end(), (x))-(v).begin()
#define ctoi(c) (int)(c-'0')
#define incin(n) int (n); cin>>(n);
#define stcin(s) string (s); cin>>(s);
#define all(v) (v).begin() , (v).end()

using namespace std;

signed  main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int flag=0;
    incin(s);
    int y,m;
    //yymm
    m=s%100;
    y=(s-m)/100;
    if(0<m && m<13){
        flag++;
    }

    //mmyy
    y=s%100;
    m=(s-y)/100;
    if(0<m && m<13){
        flag+=2;
    }
    switch (flag)
    {
    case 0:
        Pr("NA");
        break;
    case 1:
        Pr("YYMM");
        break;
    case 2:
        Pr("MMYY");
        break;
    case 3:
        Pr("AMBIGUOUS") 
        break;
    default:
        break;
    }
    return 0;
}


Measured memory_bytes: 256
program main
 implicit none
 integer N,i,j,p,k,flag
 integer,allocatable::L(:)
 
 read(*,*) N
 allocate(L(N))
 read(*,*) L
 
 call quicksort(L,1,N)
 
 k=0
 flag=0
 do i=N,2,-1
  do j=i-1,1,-1
   p = j/2
   do
    if(p==0) then
     flag = 1
     exit
    end if
    if(L(p) <= L(i) - L(j)) then
     flag = 0
     exit
    end if   
    p = p/2
   end do
   
   if(flag==0) then
    do
     p = p+1
     if(L(p) > L(i) - L(j)) exit
    end do
    if(j>p) k=k+(j-p)
   else
    k=k+j-1
   end if
  end do
 end do
 write(*,*) k
 
contains
recursive subroutine quicksort(a, first, last)
  implicit none
  integer a(*)
  integer first, last
  integer i, j
  integer x, t
 
  x = a( (first+last) / 2 )
  i = first
  j = last
  do
     do while (a(i) < x)
        i=i+1
     end do
     do while (x < a(j))
        j=j-1
     end do
     if (i >= j) exit
     t = a(i);  a(i) = a(j);  a(j) = t
     i=i+1
     j=j-1
  end do
  if (first < i - 1) call quicksort(a, first, i - 1)
  if (j + 1 < last)  call quicksort(a, j + 1, last)
end subroutine quicksort
end program main

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string c;
  cin >> c;
  if (c == "a" || c == "e" || c == "i" || c == "o" || c == "u") {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" <<  endl;
  }
}

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

int main() {
  int H1,M1,H2,M2,K;cin>>H1>>M1>>H2>>M2>>K;
  cout << (H2-H1)*60+M2-M1-K << endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template <typename T> void read(T &x){
	x=0;char c=getchar();int fh=1;
	while (!isdigit(c)){if (c=='-')fh=-1;c=getchar();}
	while (isdigit(c))x=x*10+c-'0',c=getchar();
	x*=fh;
}
int t,s1,s2,s3,ansn;
string s;
int main(){
	read(t);
	while (t--){
		cin>>s;
		int l=s.length();
		for (int i=0;i<l-1;i++)if (s[i]=='A'&&s[i+1]=='B') ansn++;
		if (s[0]=='B'&&s[l-1]=='A') s1++;
		if (s[0]=='B') s2++;
		if (s[l-1]=='A') s3++;
	}
	s2-=s1;s3-=s1;
	if (s3==0){
		ansn+=max(0,s1-1);
		if (s1&&s2) ansn++;
	}else{
		ansn+=s1+min(s2,s3);
	}
	cout<<ansn<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll H, W, D;
  cin >> H >> W >> D;
  ll A;
  vpll pos(H*W + 1);
  rep(i, H){
    rep(j, W){
      cin >> A;
      pos[A] = {i + 1, j + 1};
    }
  }
  ll Q;
  cin >> Q;
  vl L(Q), R(Q);
  rep(i, Q) cin >> L[i] >> R[i];

  vl cost(H*W + 1);

  rep2(i, 1, D + 1){
    cost[i] = 0;
    ll move = i + D;
    
    while(move <= H*W){
      cost[move] = cost[move - D] + abs(pos[move].first - pos[move - D].first) + abs(pos[move].second - pos[move - D].second);
      move += D;
    }
  }

  rep(i, Q) cout << cost[R[i]] - cost[L[i]] << endl;
  
  return 0;
}


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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define B1 1000000007
#define B2 1000000009

ull mod_pow(ull a,ull n){
  ull res=1;
  while(n){
    if(n&1)res=res*a;
    a=a*a;
    n>>=1;
  }
  return res;
}

string S,T;
vector<ull> hs1,hs2;

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

  cin>>S>>T;
  int N=S.size();
  int M=T.size();
  ull h1=0,h2=0;
  rep(i,M){
    h1*=B1;
    h1+=T[i];
    h2*=B2;
    h2+=T[i];
  }
  rep(i,M){
    ull p1=mod_pow(B1,M-1-i);
    ull p2=mod_pow(B2,M-1-i);
    repl(j,'a','z'+1){
      if(T[i]==j)continue;
      hs1.push_back(h1-p1*T[i]+p1*(ull)j);
      hs2.push_back(h2-p2*T[i]+p2*(ull)j);
    }
    repl(j,'A','Z'+1){
      if(T[i]==j)continue;
      hs1.push_back(h1-p1*T[i]+p1*(ull)j);
      hs2.push_back(h2-p2*T[i]+p2*(ull)j);
    }
  }
  sort(all(hs1)); uni(hs1);
  sort(all(hs2)); uni(hs2);

  h1=0; h2=0;
  ll res=0;
  ull elim1=mod_pow(B1,M),elim2=mod_pow(B2,M);
  rep(i,N){
    h1*=B1;
    h1+=S[i];
    h2*=B2;
    h2+=S[i];
    if(i>=M){
      h1-=elim1*S[i-M];
      h2-=elim2*S[i-M];
    }
    if(i>=M-1&&(*lower_bound(all(hs1),h1))==h1&&(*lower_bound(all(hs2),h2))==h2)res++;
  }
  cout<<res<<endl;

  return 0;
}



Measured memory_bytes: 123276
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

void main()
{
    int[] b;
    foreach(s;stdin.byLine())
    {
        immutable n = s.chomp().to!int;
        if(n) b~=n;
        else writeln(b.back),b.popBack();
    }
}

Measured memory_bytes: 1056
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
 
class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
 
 
    void solve()
    {
        var S = ReadLine();
        var T = ReadLine();
        if (S[0] == T[2] && S[1] == T[1] && S[2] == T[0])
        {
            WriteLine("YES");
        }
        else
        {
            WriteLine("NO");
        }
    }
 
}
 
class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
#define MODSIZE 1000000007
// priority_queue<int, vector<int>, greater<int> > PQ; // 昇順PQ
priority_queue<ll> pq[200006];

int main(){
  int n,k;
  int p[1005];

  scanf("%d %d", &n, &k);

  int i;
  for(i = 0;i < n;i++) scanf("%d", &p[i]);
  sort(p,p + n);

  int sum = 0;
  for(i = 0;i < k;i++) sum += p[i];

  printf("%d\n", sum);
  return 0;
}


Measured memory_bytes: 10068
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;

map<int, vector<int>> to;
map<int, int> in;
map<P,int> colors;

void dfs(int v) {
  int used_color = -1;
  if (in[v] > 0) used_color = colors[P(in[v], v)];
  int color = 1;
  for (int t : to[v]) {
    if (color == used_color) color++;
    colors[P(v,t)] = color;
    dfs(t);
    color++;
  }
}

int main() {
  int N;
  cin >> N;
  int al[N-1], bl[N-1];
  map<int, int> d;
  rep(i,N-1) {
    int a, b;
    cin >> a >> b;
    al[i] = a;
    bl[i] = b;
    to[a].push_back(b);
    in[b] = a;
    d[a] = d[a] + 1;
    d[b] = d[b] + 1;
  }

  dfs(1);
  int k = 0;
  for(auto dg : d) k = max(k, dg.second);
  cout << k << endl;
  rep(i,N-1) cout << colors[P(al[i], bl[i])] << endl;
  return 0;
}


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

using namespace std;

 
 
int main() {
   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
     

      
   
    int i,j,h,w,x,y;
    cin>>h>>w;
    string s;
    
    for(i=0;i<h;++i)
     {
         for(j=0;j<w;++j)
           {
               cin>>s;
               if(s=="snuke")
                  {
                      x=i;
                      y=j;
                  }
           }
     }
     
     cout<<(char)(y+65)<<x+1;
    
      
         
	return 0;
	
} 

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#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 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;
  
int main()
{
  ll N;
  cin >> N;

  map<string,ll> mp;
  vector<string> s(N);
  REP(i, N){
    cin >> s[i];
    sort(ALL(s[i]));
    mp[s[i]]++;
  }
  
  ll ans = 0;
  for(auto x:mp){
      ans+=x.second*(x.second-1)/2;
  }

  cout << ans << endl;
}

Measured memory_bytes: 18176
using System;
class p
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    long sum = 0;
    for (int i = 1; i <= N; i++) {
      if (i % 3 == 0 || i % 5 == 0) {
        continue;
      }
      sum += i;
    }
    Console.WriteLine(sum);
  }
}


Measured memory_bytes: 27480
/*input
2020 2040
*/
#include <bits/stdc++.h>
using namespace std;
#define mod 2019

int ans = mod;

int main() {
	int l, r; cin >> l >> r;
	
	for (int i = l; i < r && i < l + mod; i++) {
		for (int j = r; i < j && r - mod < j; j--) {
			ans = min(ans, (i % mod) * (j % mod) % mod);
		}
	}

	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 256
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

#入力受け取り
def getlist():
	return list(map(int, input().split()))

con = 10 ** 9 + 7

class Combination(object):
	def __init__(self, N, con):
		self.fac = [0] * (N + 1)
		self.inv = [0] * (N + 1)
		self.finv = [0] * (N + 1)
		self.fac[0], self.fac[1] = 1, 1
		self.inv[1] = 1
		self.finv[0], self.finv[1] = 1, 1

		# 前計算
		for i in range(2, N + 1):
			self.fac[i] = self.fac[i - 1] * i % con
			self.inv[i] = self.inv[con % i] * (con - (con // i)) % con
			self.finv[i] = self.finv[i - 1] * self.inv[i] % con

	def com(self, N, k):
		return (self.fac[N] * self.finv[k] * self.finv[N - k]) % con

#処理内容
def main():
	N, K = getlist()
	A = getlist()
	A = sorted(A)
	if K == 1:
		print(0)
		return
	if K == N:
		print(A[N - 1] - A[0])
		return

	invlist = [1] * N
	for i in range(K + 1, N):
		invlist[i] = (invlist[i - 1] * i * pow(i - K , con - 2, con)) % con

	
	C = Combination(N, con)
	mul = C.com(N, K)
	ans = 0
	for i in range(N - 1):
		dist = A[i + 1] - A[i]
		val = mul
		if i + 1 >= K:
			val -= invlist[i + 1]
		if N - 1 - i >= K:
			val -= invlist[N - 1 - i]
		ans += dist * val
		ans %= con
	print(ans)


if __name__ == '__main__':
	main()

Measured memory_bytes: 58352
#include<iostream>

using namespace std;

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

Measured memory_bytes: 1156
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String  a = sc.next();
        String  b = sc.next();
        
        if(a.equals("H")){
            if(b.equals("H")){
                System.out.println("H");
            }else{
                System.out.println("D");
            }
        }else{
            if(b.equals("H")){
                System.out.println("D");
            }else{
                System.out.println("H");
            }
        }
        
    }
    
}

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


int main()
{
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> keys(m);
  rep(i, m)
  {
    int b;
    cin >> keys[i].first >> b;
    keys[i].second = 0;
    rep(j, b)
    {
      int c;
      cin >> c;
      keys[i].second |= 1 << (c - 1);
    }
  }
  vector<vector<int>> dp(m + 1, vector<int>(1<<n, INT_MAX));
  dp[0][0] = 0;
  rep(i, m)
    rep(j, 1<<n)
    {
      if (dp[i][j] == INT_MAX)
        continue;
      dp[i+1][j] = min(dp[i][j], dp[i+1][j]);
      dp[i+1][j|keys[i].second] = min(dp[i+1][j|keys[i].second], dp[i][j] + keys[i].first);
    }
  if (dp[m-1][(1<<n)-1] == INT_MAX)
    puts("-1");
  else
    cout << dp[m][(1<<n)-1] << endl;
  return 0;
}

Measured memory_bytes: 16384
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;

// Extended Print Func
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& input){
    os << "[ ";
    REP(i, input.size()){
        os << input[i];
        if (i < input.size()-1) { os << " "; }
    }
    os << " ]";
    return os;
}
void print() { std::cout << "\n"; }
template<class T, class... A> void print(const T& first, const A&... rest) { std::cout << first << " "; print(rest...); }
template<class... A> void print(const A&... rest) { print(rest...); }



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N, A, B;
  cin >> N >> A >> B;
  ll ans = 0;
  ans += N / (A+B) * A;
  ans += min(A, N % (A+B));
  cout << ans << "\n";
  return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

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

map<char, int64> sz;
map<pair<char, int64>, int64> arr;
map<pair<char, int64>, bool> valid;

void prog(vector<string>& s, int32 &l, int32& p);
void dec(vector<string>& s, int32 &l, int32& p);
void ass(vector<string>& s, int32 &l, int32& p);
int64 exp(vector<string>& s, int32 &l, int32& p);
int64 num(vector<string>& s, int32 &l, int32& p);


int64 res;

void prog(vector<string>& s, int32& l, int32 &p){
	while(l < s.size()){
		if(s[l].find('=') == string::npos){
			dec(s, l, p);
		}else{
			ass(s, l, p);
		}
	}
}

void dec(vector<string>& s, int32& l, int32& p){
	char c = s[l][p++];
	p++;
	int64 size = num(s, l, p);
	p++;
	sz[c] = size;
	l++;
	p = 0;
}

void ass(vector<string>& s, int32& l, int32& p){
	char c = s[l][p++];
	p++;
	int64 idx = exp(s, l, p);
	p+=2;
	int64 r = exp(s, l, p);
	if(idx >= sz[c] && res == 0)
		res = l+1;
	valid[make_pair(c, idx)] = 1;
	arr[make_pair(c, idx)] = r;
	l++;
	p = 0;
}

int64 exp(vector<string>&s, int32 &l, int32& p){
	int64 ret = 0;
	if(isalpha(s[l][p])){
		char c = s[l][p++];
		p++;
		int64 idx = exp(s, l, p);
		p++;
		if((idx >= sz[c] || !valid[make_pair(c, idx)]) && res == 0)
			res = l+1;
		else
			ret = arr[make_pair(c, idx)];
	}else{
		ret = num(s, l, p);
	}
	return ret;
}

int64 num(vector<string>& s, int32& l, int32& p){
	int64 ret = 0;
	while(p < s[l].size() && isdigit(s[l][p])){
		ret = ret*10+s[l][p]-'0';
		p++;
	}
	return ret;
}

int main(void){
	while(1){
		vector<string> s;
		string t;
		while(cin >> t && t != "."){
			s.push_back(t);
		}
		if(s.size() == 0) break;
		sz = map<char, int64>();
		arr = map<pair<char, int64>, int64>();
		valid = map<pair<char, int64>, bool>();
		int32 l = 0, p = 0;
		res = 0;
		prog(s, l, p);
		cout << res << endl;
	}
}


Measured memory_bytes: 3344
#include "bits/stdc++.h"
using namespace std;

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

    int N, H, E, W;
    N = 0;
    H = 0;
    E = 0;
    W = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == 'N') {
            N++;
        }
        else if (S[i] == 'S') {
            H++;
        }
        else if (S[i] == 'E') {
            E++;
        }
        else {
            W++;
        }
    }

    if ((max(N, H) > 0 && min(N, H) == 0) || (max(E, W) > 0 && min(E, W) == 0)) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }
}

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

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

using ll = long long int;
const ll MOD = 1e9 + 7;

int main() {
  std::string S;
  std::cin >> S;

  int Q;
  std::cin >> Q;

  int cnt = 0;
  std::list<char> head, tail;
  rep(i, Q) {
    int T;
    std::cin >> T;
    if(T == 1) {
      ++cnt;
    } else {
      int F;
      char C;
      std::cin >> F >> C;

      if(F == 1) {
        if(cnt % 2 == 0) {
          head.push_front(C);
        } else {
          tail.push_back(C);
        }
      } else {
        if(cnt % 2 == 0) {
          tail.push_back(C);
        } else {
          head.push_front(C);
        }
      }
    }
  }

  if(cnt % 2 != 0) {
    std::swap(head, tail);
    std::reverse(head.begin(), head.end());
    std::reverse(S.begin(), S.end());
    std::reverse(tail.begin(), tail.end());
  }

  for(char c: head) {
    std::cout << c;
  }
  std::cout << S;
  for(char c : tail) {
    std::cout << c;
  }
  std::cout << "" << '\n';

}


Measured memory_bytes: 6912
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=220,p=1000000007;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int qpow(int x,int k){
	int t=1;
	for (;k;k>>=1){
		if (k&1) t=(ll)t*x%p;
		x=(ll)x*x%p;
	}
	return t;
}
int n,ans;
int calc(int x,int k){
	while (x%k){
		int t=x/k;
		x-=(x-t*k+t)/(t+1)*(t+1);
	}
	return x/k;
}
int main(){
	n=read();
	for (int i=1;i<=n;i++){
		int x=read(),k=read();
		ans^=calc(x,k);
	}
	puts(ans ? "Takahashi" : "Aoki");
	return 0;
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)

function main()
    n, k, q = map(parseInt, split(chomp(readline())))
    a = [readline() |> chomp |> parseInt for i = 1:q]
    k -= q
    points = [k for i = 1:n]
    for i = 1:q
        points[a[i]] += 1
    end
    for i = 1:n
        println(points[i] > 0 ? "Yes" : "No")
    end
end

main()

Measured memory_bytes: 152372
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int[] a = in.nextIntArray(3);

            Arrays.sort(a);

            int ans = 0;

            int t1 = (a[2] - a[0]) / 2;
            a[0] += t1 * 2;
            ans += t1;

            int t2 = (a[2] - a[1]) / 2;
            a[1] += t2 * 2;
            ans += t2;

            if (a[0] < a[2] && a[1] < a[2]) {
                ans += 1;
            }

            if (a[0] < a[2] ^ a[1] < a[2]) {
                ans += 2;
            }

            out.println(ans);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

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

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

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



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

struct _Node{
  int key;
  struct _Node *next;
  struct _Node *prev;
};
typedef struct _Node Node;

Node *nil;

void insert(int key) {
  Node *n;
  n = (Node *)malloc(sizeof(Node));
  n->key = key;
  n->next = nil->next;
  nil->next = nil->next->prev = n;
  n->prev = nil;
}
void deleteNode(Node *n) {
  n->prev->next = n->next;
  n->next->prev = n->prev;
}

void delete(int key) {
  Node *n;
  for (n = nil->next; n != nil; n = n->next) {
    if (n->key == key) {
      deleteNode(n);
      return;
    }
  }
}

void deleteFirst() {
  deleteNode(nil->next);
}

void deleteLast() {
  deleteNode(nil->prev);
}



int main() {
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
  int i, key, N;
  char command[30] = {' '};

  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    command[6] = ' ';
    scanf(" %s", command);
    switch(command[0]) {
    case 'i':
      scanf(" %d", &key);
      insert(key);
      break;
    default :
      switch(command[6]) {
      case 'F':
        deleteFirst();
        break;
      case 'L':
        deleteLast();
        break;
      default:
        scanf(" %d", &key);
        delete(key);
        break;
      }
    }
  }

  Node *node;
  for (node = nil->next;; node = node->next) {
    if (node->next == nil) {
      printf("%d\n", node->key);
      break;
    }
    printf("%d ", node->key);
  }
  return 0;
}



Measured memory_bytes: 36116
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,vector<T>(w)))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,vector<T>(w,i)))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	ll s = in();
	set<ll>st;
	ll i = 1;
	for (; st.count(s) == 0; ++i) {
		st.insert(s);
		s = s % 2 == 0 ? s / 2 : 3 * s + 1;
	}
	cout << i << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iostream>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

string S;

int main(int argc, char const *argv[]) {
	cin >> S;
	int size = S.size();
	
	vector<ll> si(size);
	for (int i = 0; i < size; i++) si[i] = S[i] - '0';

	ll res = 0;
	for (int i = 0; i < size; i++) {
		res += si[size-i-1] * (ll)pow(2, size-i-1) * (ll)pow(10, i);
		for (int j = 0; j < size - i - 1; j++) res += si[j] * (ll)pow(2, size-i-2) * (ll)pow(10, i);
	}

	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

signed main()
{
    int k, a, b;

    cin >> k >> a >> b;

    for (int i = a; i <= b; ++i) //value is a is not being read correctly
    {
        if (i % k == 0)
        {
            cout << "OK"
                 << "\n";
            return 0;
        }
    }
    cout << "NG"
         << "\n";

    return 0;
}


Measured memory_bytes: 3036
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
 
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
 
signed main(){
    int N,K;
    cin>>N>>K;
    vpint vec;
    rep(i,N){
        int a,b;
        cin>>a>>b;
        vec.pb({a,b});
    }
    sort(all(vec));
 
    rep(i,vec.size()){
        if(vec[i].se<K){
            K-=vec[i].se;
            continue;
        }
        cout<<vec[i].fi<<endl;
        return 0;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;

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()
{
  int N, D;
  cin >> N >> D;
  int X[N][D];

  int tmp;
  for(int i=0; i<N; i++)
    for(int j=0; j<D; j++)
      {
	cin >> X[i][j];
      }


  
  double dst = 0;
  int count=0;
  for(int i=0; i<N-1; i++)
    for(int j=i+1; j<N; j++)
      {
	dst = 0;
	for(int k=0; k<D; k++)
	  {
	    dst += (X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
	  }
	
	dst = sqrt(dst);
	
	if((int)dst-dst==0)
	  count++;
      }

  cout << count << endl;
      



  return 0;
}


//cout << setprecision(13);
//next_permutation(v.begin(), v.end());



Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    Scanner(System.`in`).use { sc ->
        val h = sc.nextInt()
        val w = sc.nextInt()

        val src = sc.asSequence().take(h).map { it.toCharArray().map { c -> if (c == '#') 1 else 0 }.toIntArray() }.toList()
        val dest = Array(h) { IntArray(w) }
        for (xd in -1..1) {
            for (yd in -1..1) {
                if (xd == 0 && yd == 0) {
                    continue
                }
                for (x in 0 until w) {
                    for (y in 0 until h) {
                        if (y + yd in 0 until h && x + xd in 0 until w) {
                            dest[y][x] += src[y + yd][x + xd]
                        }
                    }
                }
            }
        }
        for (y in 0 until h) {
            for (x in 0 until w) {
                if (src[y][x] == 1) {
                    dest[y][x] = 9
                }
            }
            println(dest[y].joinToString("").replace('9', '#'))
        }
    }
}

Measured memory_bytes: 39364
n, m=  map(int, input().split())
grid = []
for i in range(n):
    grid.append(list(input()))
i = 0
while i < n:
    replace = True
    for j in range(m):
        if grid[i][j] != '.':
            replace = False
            break
    if replace:
        grid.pop(i)
        n -= 1
    else:
        i+=1
i = 0
while i < m:
    replace = True
    for j in range(n):
        if grid[j][i] != '.':
            replace = False
            break
    if replace:
        for x in range(n):
            grid[x].pop(i)
        m-=1
    else:
        i+=1
for i in range(n):
    for j in range(m):
        print(grid[i][j], end='')
    print()

Measured memory_bytes: 4596
#include<iostream>
using namespace std;
int main(){
  while(1){
    int x,y;
    cin>>x>>y;
    if(x==0&&y==0)break;
    else if(x>y){
      cout<<y<<" "<<x<<endl;
    }
    else{
      cout<<x<<" "<<y<<endl;
    }
    }
    return 0;
  }

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

string conv(int a){
  string s;
  for(int i = (int)log10(a); i >= 0; i--){
    s.push_back(a / pow(10,i) + '0');
    a = a % (int)pow(10,i);
  }
  return s;
}

int main(){
  int A, B;
  cin >> A >> B;
  int cnt = 0;
  for(int a = A; a <= B; a++){
    string p = conv(a);
    int f = 0;
    for(int i = 0; i < p.size()/2 ; i++){
      if(p[i] != p[p.size() - i - 1]) f = 1;
    }
    if(!f) cnt++;
  }
  cout << cnt;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define pll pair<ll, ll>
#pragma GCC optimize ("O3")
using namespace std;
int main () {
    #ifdef LOCAL
        freopen ("input.txt", "r", stdin);
        freopen ("output.txt", "w", stdout);
        freopen ("error.txt", "w", stderr);
    #else
        ios::sync_with_stdio(false);
        cin.tie (NULL);
    #endif
    ll a, b, c; cin>>a>>b>>c;
    cout<<max(0ll, c-a+b);
    return 0;
}


Measured memory_bytes: 256
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10
    d,t,s = LMIIS()
    if t-d/s >= 0:
        print('Yes')
    else:
        print('No')

    
main()

Measured memory_bytes: 65008
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
int main(){
  int N;
  cin>>N;
  double p=1,q=0;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    p=p*A.at(i);} //p==pi(A_i)
  for(int i=0;i<N;i++){
    q+=p/(A.at(i));}
  std::cout << std::setprecision(10)<<p/q<<endl;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()
print("Yes"  if A*B % 2 == 1 else "No")

Measured memory_bytes: 5332
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

bool isPrime(int N){
  if(N<=1) return false;
  if(N==2) return true;
  if(N%2==0) return false;

  for(int i=3 ; i*i<=N ; i+=2){
    if(N % i == 0) return false;
  }

  return true;
}



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

    for(int i = x; ; i++){
        if(isPrime(i)){
            cout << i << endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main { 
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	String line = sc.nextLine();
    	long input = Long.parseLong(line);
    	long result = 0;
    	for(long i = 1;i*i <= input;i++) {
    		if(input%i != 0) {
    			continue;
    		}
    		long j = input/i;
    		result = i + j - 2;
    	}
    	
    	System.out.println(result);
    	
    }
}

Measured memory_bytes: 23636
#include <stdio.h>
#include <ctype.h>
#include <string.h>

int main(void)
{
  char str[256];
  int length;
  int i;

  fgets(str, 256, stdin);
  length = (int)strlen(str);
  for (i = 0; i < length; i++) {
    if ( isalpha(str[i]) && islower(str[i]) ) {
      str[i] = toupper(str[i]);
    }
  }
  printf("%s", str);

  return 0;
}

Measured memory_bytes: 524
#include<stdio.h> 

main(){  

int a=0;  

int W,H,x,y,r=0;  

scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);  

if(x-r>=0&&x+r<=W){     

if(y-r>=0&&y+r<=H){       

a=1;     

} 

 }   

else{     

a=0;   

}  

if(a==1){    

printf("Yes\n");  

}   

else if(a==0){    

printf("No\n"); 

 } 

 return 0;

}

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

int main() {
    int n, k;
    cin >> n >> k;
    double ans = 0;
    rep(i, n+1) {
        if (i == 0) continue;
        int score = i;
        int cnt = 0;
        while (score < k) {
            score *= 2;
            cnt++;
        }
        ans += 1 / pow(2, cnt);
    }
    ans /= n;
    printf("%.9lf\n", ans);
}

Measured memory_bytes: 4120
#include "bits/stdc++.h"
using namespace std;
#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 ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;

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

Measured memory_bytes: 256
readints()=parse.(Int,split(readline()))
readint()=parse.(Int,readline())


function AT_D()
    N=readint()
    A=readints()

    sort!(A)
    
    N==1 &&  (return 1)

    Amax=A[end]
    
    F=ones(Bool,Amax)
    
    s=0
    tmp=0
    contf=false
    for i in A
        if i==tmp && !contf
            contf=true
            s-=1
        end
        !F[i] && continue
        s+=1
        F[i:i:Amax].=false
        tmp=i
        contf=false
    end
    s
end
    

print(AT_D())

Measured memory_bytes: 219944
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
using namespace std;

#define ran 505505

char s[ran*4], t[ran];
int len_s, len_t;
int m[ran*4], lm;

set<int> st;
set<int> ::iterator it, p;

vector<int> e[ran*4];
int deg[ran*4], d[ran*4];
int q[ran*4];

namespace KMP {
    typedef char TYPE;

    int prev[ran];

    int prepare(TYPE B[], int LB) {
        prev[0] = -1;
        for(int i=1;i<LB;i++) {
            int d=prev[i-1];
            while(d>=0 && B[i]!=B[d+1]) d=prev[d];
            prev[i]=(B[d+1]==B[i]) ? d+1 : -1;
        }
        return true;
    }

    int match(TYPE A[], int LA, TYPE B[], int LB, int M[], int &LM) {
        prepare(B, LB);
        int d=-1,ret=0;
        LM=0;
        for(int i=0;i<LA;i++) {
            while(d>=0&&B[d+1]!=A[i]) d=prev[d];
            if (B[d+1]==A[i]) d++;
            if (d==LB-1) {
                M[LM++] = i-LB+1;
                d=prev[d];
            }
        }
        return true;
    }
}

int main() {
	scanf("%s%s", s, t);
	len_s = strlen(s);
	len_t = strlen(t);
	
	for(int i=0;i<len_s; i++)
		s[i+len_s] = s[i];
	len_s *= 2;
	while(len_s < len_t*2) {
		for(int i=0;i<len_s; i++)
			s[i+len_s] = s[i];
		len_s *= 2;
	}
	KMP::match(s, len_s, t, len_t, m, lm);
	
	for(int i=0;i<lm;i++)
		st.insert(m[i]);
	
	memset(d, 0, sizeof d);
	int todo = 0;
	for(it = st.begin(); it != st.end(); it++) {
		int fr = (*it), to = (fr+len_t)%(len_s/2);
		if (fr >= len_s/2) break;
		
		d[fr] = 1;
		e[fr].push_back(to);
		deg[to] ++;
		todo ++;
	}
	
	int l = 0, r = 0;
	for(int i=0;i<len_s;i++)
		if (d[i] > 0 && deg[i]==0) {
			q[r++] = i;
		}
	int ans = 1;
	while(l<r) {
		todo --;
		int cur = q[l++];
		ans = max(ans, d[cur]);
		for(int i=0;i<(int)e[cur].size();i++) {
			int nxt = e[cur][i];
			d[nxt] = max(d[nxt], d[cur]+1);
			deg[nxt]--;
			if (deg[nxt] == 0) q[r++] = nxt;
		}
	}
	if (todo>0) puts("-1");
	else printf("%d\n", ans-1);
	
	return 0;
}

Measured memory_bytes: 176896
A = list(input())
sign = ['+','-']
for i in range(2):
    for j in range(2):
        for k in range(2):
            if eval(A[0]+sign[i]+A[1]+sign[j]+A[2]+sign[k]+A[3]) == 7:
                print('{}{}{}{}{}{}{}=7'.format(A[0],sign[i],A[1],sign[j],A[2],sign[k],A[3]))
                exit()

Measured memory_bytes: 9068
/*
 © 2020-01-31 19:54:48 crystaalroo all Rights Reserved
*/
#include <bits/stdc++.h>
#define fore(i, a, b) for(int i = (a); i <(b); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(15);
#define sz(x) (int) (x).size()
#define f first
#define s second
#define pb push_back
using namespace std;

typedef long long lli;
typedef pair<lli,lli > ii;
#define ENDL '\n'
#define deb(x) cout << #x": " << (x) << endl;
const int INF=1e9+5;
const lli mod = 1e9+7;
const int N = 1e5+5;
vector<int>dp(N,0);
vector<int>g[N];
int dfs(int u){
  if(dp[u]!=0)return dp[u];
  for(auto i:g[u])dp[u]=max(dfs(i),dp[u]);
  dp[u]++;
  return dp[u];
}
int main(){_
  int n,m,a,b;
  cin>>n>>m;
  fore(i,0,m){
    cin>>a>>b;
    g[a].pb(b);
  }
  fore(i,1,n+1)if(!dp[i])dfs(i);
  int mx =0;
  fore(i,1,n+1)mx=max(dp[i],mx);
  cout<<mx-1<<ENDL;



}


Measured memory_bytes: 8192
#include <iostream>
#include <vector>
using namespace std;
int main(){
  vector <int> n(3);
  for(int i=0;i<3;++i) cin >> n[i];
  cout << ((n[2]>=n[0] &&n[2]<=n[1])? "Yes":"No")<<endl;;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,f,n) for(ll i=(f); (i) < (n); i++)
#define repe(i,f,n) for(ll i=(f); (i) <= (n); i++)
using namespace std;
using ll = long long;
#define MOD (ll)1000000007
#define PI 3.14159265359
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
//#define P pair<ll, ll>
#define dvec vector<vector<ll>>
//printf("%.10f\n")
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b){if (a < b) { a = b; return true; } return false;}
template<class T> inline bool chmin(T& a, T b){if (a > b) { a = b; return true; } return false;}
ll INF = 1e+18;
int iINF = 1e9;


int main()
{
  string S, T; cin >> S >> T;
  vector<int> si;
  for(auto x: S){
    si.push_back(x - '0');
  }
  int ssize = si.size();
 
  vector<int> ti;
  for(auto x: T){
    ti.push_back(x - '0');
  }
  int tsize = ti.size();

  rep(i, 0, ssize){
    rep(k, 0, tsize){
      if(si[i] < ti[k]){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
 
  int same = 0;
  vector<int> ps;
  rep(i, 0, ssize){
    rep(k, 0,tsize){ 
      if(find(ps.begin(), ps.end(), k) != ps.end()) continue;
      if(si[i] ==  ti[k]){
        ps.push_back(k);
        ++same;
        break;
      }
    }
  }
 
  if(same == ssize && ssize < tsize)cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define debug(x)        cout<<#x<<" :"<<x<<endl;
#define ff              first
#define ss              second
#define ar              array
#define int             long long
#define ld              long double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define f(i,n)          for(int i=0;i<n;i++)
#define MOD             1000000007
#define pi              3.14159265
#define umii            unordered_map<int,int>
#define umci            unordered_map<char,int>
#define umsi            unordered_map<string,int>

void k_007()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE
  freopen("ip1.txt", "r", stdin);
  freopen("op1.txt", "w", stdout);
#endif
}

bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b);
int gcd(int a, int b) ;
int prime(int n);
int power(int x, int y);
int lcm(int a, int b);
int32_t main()
{
  k_007();
  int a, b;
  cin >> a >> b;
  int ans = 0;
  int val = 1;
  while (val < b)
  {
    val--;
    val += a;
    ans++;
  }

  cout << ans << endl;
}
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
{
  return (a.second < b.second);
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int prime(int n) {
  int flag = 1;
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {flag = 0; break;}
  }
  return flag;
}
int power(int x, int y)
{
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return ((power(x, y / 2) % MOD) * ( power(x, y / 2) % MOD)) % MOD;
  else
    return ((x % MOD) * (power(x, y / 2) % MOD) * (power(x, y / 2) % MOD)) % MOD;
}
int lcm(int a, int b)
{
  return (a * b) / gcd(a, b);
}

Measured memory_bytes: 3672
<?php
  $s = trim(fgets(STDIN));
  $week = ["SAT","FRI","THU","WED","TUE","MON","SUN"];
  $ans = [];
  for($i=1; $i<=7; $i++){
    $ans[$week[$i-1]] = $i;
  }
  echo $ans[$s];

Measured memory_bytes: 4728
#include <iostream>

using namespace std;

#define ll long long
#define RS 1000000007

ll pow_ll(ll, ll);

int main() {
	int n, k;
	ll x;
	ll i, j;
	ll ans = 0;
	ll st[100010];
	cin >> n >> k;
	for (i = k; i > 0; i--) {
		x = pow_ll (k / i, n);
		for (j = 2; j <= k; j++) {
			if (i*j > k)break;
			x -= st[i*j];
			while (x < 0)x += RS;
		}
		ans += x * i;
		st[i] = x;
		//cout << ans << endl;
		if (ans > RS)ans %= RS;
	}
	cout << ans;
	return 0;

}

ll pow_ll(ll a,ll b){
    if(b == 0)return 1;
	if (b % 2 == 0)return pow_ll(a * a % RS, b / 2) % RS;
	else return a * pow_ll(a, b - 1) % RS;
}

Measured memory_bytes: 4404
#include <stdio.h>

int main(void)
{
    int n;
    char s[200001];

    int b, w;
    int i, j, k, p, min, num, stock_a, stock_b;

    scanf("%d", &n);
    scanf("%s", s);

    b = 0;
    w = 0;

    for(i=0;i<n;i++){
        if(s[i] == '#'){
            break;
        }
    }
    k = i;

    for(i=n-1;i>=0;i--){
        if(s[i] == '.'){
            break;
        }
    }
    j = i;

    //printf("%d %d\n", k, j);

    min = j - k + 1;
    stock_a = 0;
    stock_b = 0;
    for(p=k;p<=j;p++){
        if(s[p] == '.'){
            stock_b++;
        }
    }

    for(p=k;p<=j;p++){
        if(s[p] == '#'){
            stock_a++;
        }
        if(s[p] == '.'){
            stock_b--;
        }
        if(p == k){
            num = stock_b;
        }else{
            num = stock_a + stock_b;
        }
        if(num < min){
            min = num;
        }
        //printf("%d\n", num);
    }

    printf("%d", min);

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i, MAT.size()){
    REP(j, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

template <typename CLASS1, typename CLASS2>
class HOGE{
  public:
    CLASS1 key;
    CLASS2 value;
    HOGE(void){
      return;
    };
    HOGE(CLASS1 key, CLASS2 value){
      this->key = key;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "key : " << key << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

ll N, K;
vll A, B;

ll search(void){
  ll K_copy = K;
  ll A_max = 1;
  while(K_copy>0){
    K_copy>>=1;
    A_max<<=1;
  }
  A_max>>=1;
  vb usable(N, true);
  REP(i, N){
    if(A[i]>K){
      usable[i] = false;
    }
  }
  ll ans = 0;
  while(A_max>0){
    if((A_max&K)==0){
      REP(i, N){
        if((A_max&A[i])!=0){
          usable[i] = false;
        }
      }
    }else{
      ll ans_tmp = 0;
      REP(i, N){
        if(!usable[i]) continue;
        if((A_max&A[i])==0){
          ans_tmp += B[i];
        }
      }
      ans = max(ans, ans_tmp);
    }
    A_max>>=1;
  }
  ll ans_tmp = 0;
  REP(i, N){
    if(!usable[i]) continue;
    ans_tmp += B[i];
  }
  ans = max(ans, ans_tmp);
  return ans;
}

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  cin >> N >> K;
  A.resize(N);
  B.resize(N);
  REP(i, N) cin >> A[i] >> B[i];

  cout << search() << "\n";

  return 0;
}


Measured memory_bytes: 1792