akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
const lli INF = 1e9 + 100;
const lli INF64 = (1LL << 61) + 100;
const lli MOD = 1e9 + 7;
const lli MH1 = 1599614977, MH2 = 2034417103, MH3 = 1090250123, MH4 = 2024491871; 
const int N = 1e5 + 10;
lli rr[N];
lli gg[N];
lli bpow(lli baseee, lli exponenttt) {
	if(exponenttt < 0) return 0;
	lli res = 1;
	baseee %= MOD;
	while (exponenttt > 0) {
		if ((exponenttt & 1) == 1) res = (res*baseee) % MOD;
		baseee = (baseee*baseee) % MOD;
		exponenttt >>= 1;
	}
	return res;
}
lli multInverse(lli a) {//if_mod_is_prime
	return bpow(a, MOD - 2);
}
lli divm(lli a, lli b) {//if_mod_is_prime
	return (a * multInverse(b)) % MOD;
}
lli multm(lli a, lli b) {
	return (a * b) % MOD;
}
lli subm(lli a, lli b) {
	a += MOD;
	lli r = a - b;
	if(r >= MOD) return r - MOD;
	return r;
}
lli addm(lli a, lli b) {
	lli r = a + b;
	if(r >= MOD) return r - MOD;
	return r;
}
signed main() {
//	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	vector<lli> cc(c);
	for(int i = 1; i <= a; i++) cin >> rr[i];
	for(int i = 1; i <= b; i++) cin >> gg[i];
	for(int i = 0; i < c; i++) cin >> cc[i];
	
	sort(rr + 1, rr + 1 + a);
	sort(gg + 1, gg + 1 + b);
	sort(cc.rbegin(), cc.rend());
	
	multiset<lli> rrr;
	multiset<lli> ggg;
	for(int i = a-x+1; i <= a; i++) rrr.insert(rr[i]);
	for(int i = b-y+1; i <= b; i++) ggg.insert(gg[i]);
	
	while(!cc.empty()) {
		lli r1 = *rrr.begin();
		lli g1 = *ggg.begin();
		if(r1 > g1) {
			ggg.erase(ggg.find(g1));
			ggg.insert(max(g1, cc.back()));
		} else {
			rrr.erase(rrr.find(r1));
			rrr.insert(max(r1, cc.back()));
		}
		cc.pop_back();
	}
	
	lli sum = 0;
	while(!rrr.empty()) {
		lli cur = *rrr.begin();
		sum += cur;
		rrr.erase(rrr.find(cur));
	}
	while(!ggg.empty()) {
		lli cur = *ggg.begin();
		sum += cur;
		ggg.erase(ggg.find(cur));
	}
	cout << sum << "\n";
	return 0;
}

Measured memory_bytes: 11008
#include <iostream>
#include <type_traits>
#include <iomanip>
#include <string>

int main() {
    std::string str;
    std::cin >> str;
    
    int g = 0, p = 0;
    int w = 0, l = 0;
    for(auto c : str) {
        if(c == 'g') {
            if(g > p) {
                ++w;
                ++p;
            }else {
                ++g;
            }
        }else {
            if(g > p) {
                ++p;
            }else {
                ++g;
                ++l;
            }
        }
    }
    std::cout << w - l << std::endl;
}

Measured memory_bytes: 512
def gcd(a, b):
    if b == 0:
        return a
    r = a % b   
    return gcd(b, r)

def lcm(a, b):
    x = gcd(a, b)
    return a * b // x

def gcdN(a):
    x = a[0]
    for i in range(1, len(a)):
        x = gcd(x, a[i])
    return x

def lcmN(a):
    x = a[0]
    for i in range(1, len(a)):
        x = lcm(x, a[i])
    return x


n, m = map(int, input().split())
a = list(map(int, input().split()))  #;print(a)

g = gcdN(a)
for i in a:
    if (i//g) % 2 == 0:
        print(0)
        break
else:
    l = lcmN(a) 
    k = 2*m // l
    print((k+1)//2)


Measured memory_bytes: 19996
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var ans = 0;

            var count = cin.ReadInt;
            int[] line = new int[count];

            for (var i = 0; i < count; i++)
            {
                line[i] = cin.ReadInt;
            }
            Array.Sort(line);
            Array.Reverse(line);

            var a = 0;
            var b = 0;
            for (var x = 0; x < line.Count(); x++)
            {
                if (x % 2 == 0)
                {
                    a = a + line[x];
                }
                else
                {
                    b = b + line[x];
                }
            }

            ans = a - b;

            WriteLine(ans.ToString());
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 28044
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int H,W,N; cin>>H>>W>>N;
  vi ans(10);
  ans[0]=(H-2)*(W-2);
  set<pii> S;
  rep(_,0,N){
    int A,B; cin>>A>>B;
    S.insert(mp(A,B));
  }
  vi P={0,0,1,1,1,-1,-1,-1,0},Q={1,-1,0,-1,1,-1,0,1,0};
  for(auto p:S){
    int X=p.first,Y=p.second;
    rep(i,0,9){
      int A=X+P[i],B=Y+Q[i];
      if(1<A&&A<H&&1<B&&B<W){
        int count=0;
        rep(j,0,9){
          int C=A+P[j],D=B+Q[j];
          if(mp(C,D)<mp(X,Y)&&S.count(mp(C,D))){
            count=-1;
            break;
          }
          if(S.count(mp(C,D)))
            count++;
        }
        if(count!=-1){
          ans[0]--;
          ans[count]++;
        }
      }
    }
  }
  rep(i,0,10) cout<<ans[i]<<endl;
  }



Measured memory_bytes: 6528
#include <iostream>
using namespace std;
bool check(int *b,int a);
int main() {
  int a;
  cin >> a;
  int b[a];
  for (int i = 0;i < a ; i++)
  {
      cin >> b[i];
  }
  int c[a];
  int tmp;
for (int i = 0;i<a;i++)
{
  for(int j = i;j<a;j++)
  {
    for(int k = 0;k < a;k++)
    {
      c[k] = b[k];
    }
    tmp = c[i];
    c[i] = c[j];
    c[j] = tmp;
    if (check(c,a))
    {
      cout << "YES" << endl;
      return 0;
    }
  }
}
  cout << "NO" << endl;
  return 0;
}

bool check(int *b,int a)
{
  for(int i = 0;i<a - 1;i++)
  {
    if(b[i] > b[i + 1])
    {
      return false;
    }
  }
      return true;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int A,B,C,D,E,F; cin>>A>>B>>C>>D>>E>>F;
  int S=0,W=A*100;
  REP(i,0,F/A/100){
    int P=F-100*i*A;
    REP(j,0,P/B/100){
      int Q=100*j*B+100*i*A;
      int R=F-Q;
      int X=Q/100;
      X*=E;
      int Y=min(X,R);
      REP(k,0,Y/C){
        int Z=min(X-k*C,R-k*C);
        int H=Z/D;
        H*=D;
        double I=(H+k*C)*1.0/(H+k*C+Q),J=S*1.0/(S+W);
        if(I>J){
          S=H+k*C;
          W=Q;
        }
      }
    }
  }
  cout<<W+S<<" "<<S<<endl;
  }



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

int main() {
 int a,b,c,x;
 cin >> a >> b >> c >> x;
 int count=0;
for(int i=0; i<=a; i++){
  for(int j=0; j<=b; j++){
     for(int k=0; k<=c; k++){
       if(500*i+100*j+50*k==x){
        count++;    
       }
     }
  }
}
cout << count << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

#define M 1046527
#define Nil (-1)
#define L 14

char H[M][L];

int getChar(char ch) {
  if (ch == 'A') return 1;
  else if (ch == 'C') return 2;
  else if (ch == 'G') return 3;
  else if (ch == 'T') return 4;
  else return 0;
}

long long getKey(char str[]) {
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++) {
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)); }

int find(char str[]) {
  long long key, i, h;
  key = getKey(str);
  for ( i = 0;; i++) {
    h = (h1(key) + i * h2(key)) % M;
    if (strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0) return 0;//文字列が入ってないとき
  }
  return 0;
}

int insert(char str[]){
  long long key, i, h;
  key = getKey(str);
  for ( i = 0;; i++) {
    h = (h1(key) + i * h2(key)) % M;
    if (strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0) {
      strcpy(H[h], str);
      return 0;
    }//文字列が入ってないとき
  }
  return 0;
}

int main() {
  int i ,n ,h ;
  char str[L], com[9];
  for (size_t i = 0; i < M; i++) H[i][0] = '\0';
  scanf("%d", &n);
  for ( i = 0; i < n; i++) {
    scanf("%s%s", com, str);

    if (com[0] == 'i') {
      insert(str);
    } else {
      if (find(str)) {
        printf("yes\n");
      } else {
        printf("no\n");
      }
    }
  }
  return 0;
}



Measured memory_bytes: 17076
#include<iostream>
#include<iomanip> 

using namespace std;

int main()
{
	int N;
	
	cin>>N;
	if(N>=1&&N<=100)
	{
	
    switch(N%2)
	{
		case 0:
		 	cout<<setiosflags(ios::fixed)<<setprecision(10)<<(N/2.0)/N<<endl;
			break;
		case 1:
	cout<<setiosflags(ios::fixed)<<setprecision(10)<<1.0*(N/2+1)/N<<endl;
		break;
	}
	}
	
	
	return 0;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A + B < C + D) {
    cout << "Right" << endl;
  }
  else if (A + B == C + D) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Left"<< endl;
  }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int i,j,n,m,cnt=0,s=0;
    map<long long int,long long int>a;
    cin>>n>>m;
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(i=0;i<n;i++){
        s+=a[i];
    }
    j=(4*m);
    for(i=0;i<n;i++){
        if(j*a[i]>=s){cnt++;}
    }
    if(cnt>=m){cout<<"Yes\n";}
    else{cout<<"No\n";}
    
    
    
    
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef long long LL;

#define d(x)  cout<<#x<<" = "<<(x)<<endl;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define REACH(i,c) for(typeof((c).rbegin()) i=(c).rbegin(); i!=(c).rend(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c,n) sort(c,c+n)
#define VSORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define DFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define DREP(i,n) DFOR(i,n,0)
#define INF 2000000000

const double EPS = 1e-10;
const double PI  = acos(-1.0);
////////////////////////////////////////////////
int n,dp[110][110],p[110];


int main()
{
	cin>>n;
	FOR(i,1,n+1)
	{
		cin>>p[i-1]>>p[i];
	}
	FOR(i,1,n+1)
	{
		dp[i][i]=0;
	}
	FOR(l,2,n+1)
	{
		FOR(i,1,n-l+2)
		{
			int j=i+l-1;
			dp[i][j]=INF;
			FOR(k,i,j)
			{
				dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+p[i-1]*p[k]*p[j]);
			}
		}
	}
	cout<<dp[1][n]<<endl;
	return 0;
}

Measured memory_bytes: 3140
program answer
  implicit none
  integer :: N, i, j, count, a, b
  integer, allocatable :: H(:), s(:), d(:)
  read(*,*) N
  allocate(H(N))
  read(*,*) H
  allocate(s(N))
 
 s(:)=0 
  count=0
  do i = 1, n-1
     if(H(i)<H(i+1)) then
        count=count+1
        s(count)=i
     end if
  end do

  if(count==1) then
     write(*,*) max(s(1)-1, n-s(1)-1)
     stop
  else if(count==n-1) then
     write(*,*) 0
     stop
  else if(count==0) then
     write(*,*) n-1
     stop
  end if
  allocate(d(count-1))
  do i = 1, count-1
     d(i)=s(i+1)-s(i)-1
  end do
  
  
  write(*,*) max(maxval(d), s(1)-1, n-s(count)-1)

  deallocate(d)
  deallocate(s)
  deallocate(H)
  stop
 end program answer
        


Measured memory_bytes: 3720
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

main() {
    string s;
    cin >> s;

    int64_t sz = s.size();
    char prev = s[0];
    int64_t ans = sz;
    for (int64_t i = 1; i < sz; ++i) {
        auto c = s[i];

        if (prev == c) {
            continue;
        }

        int64_t dist_left = i;
        int64_t dist_right = sz - i;

        int64_t dist = max(dist_left, dist_right);
        ans = min(ans, dist);

        prev = c;
    }

    cout << ans << endl;
}


Measured memory_bytes: 512
import java.util.Scanner;

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

 
for(int i=1;;i++){
    int x = sc.nextInt();
    if(x == 0) {
        break;
    }
    System.out.printf("Case %d: %d\n",i,x);

}


    sc.close();

}

}


Measured memory_bytes: 66392
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	a,b,c,d = readline() |> split |> parseMap
	e = lcm(c,d)
	total = div(b,c)-div(a-1,c)+div(b,d)-div(a-1,d)-div(b,e)+div(a-1,e)
	println(b-a+1-total)
end

main()

Measured memory_bytes: 111768
#include <iostream>

using namespace std;

const int MAXN = 100 + 10;
const int MAXW = 1e5 + 10;
long long v[MAXN];
int w[MAXW];
long long dp[MAXN][MAXW];

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

    for (int i = 1; i <= N; i++)
        cin >> w[i] >> v[i];

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

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

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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> cnt(26);
    string s;  cin >> s;
    rep (i, s.size()) {
      cnt[s[i] - 'a']++;
    }
    rep (i, 26) {
      if (cnt[i] % 2 != 0) {
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256
//                             In The Name Of Allah
#include <bits/stdc++.h>
#define ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define int long long
#define ld long double
using namespace std; 
 
const int N = 1e6 + 100, T = 4, OO = 1e9 + 100, M = 1e9 + 7, P = 6151, SQ = 50, lg = 21;
typedef pair <int, int> pii;
int a[N];

int32_t main() {
	use_fast;
	int n, m;
	cin >> n >> m;
	n = (n + m - 1) / m;
	cout << n << endl;
	return 0; 
}
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- ... 
*/	

Measured memory_bytes: 256
module Fenwick = struct
    module type Element =
        sig
            type t
            val proc: t -> t -> t
            val zero: t
        end
    module Make(E: Element) = struct
        let create n = Array.make (n + 1) E.zero

        let update bit index value =
            let n = Array.length bit - 1 in
            let rec loop ii =
                if ii <= n then (
                    bit.(ii) <- E.proc bit.(ii) value;
                    loop (ii + (ii land (-ii)))
                )
            in
            loop index

        let query bit index = 
            let rec loop ii acc =
                if ii > 0 then (
                    loop (ii - (ii land -ii)) (E.proc bit.(ii) acc)
                ) else acc
            in
            loop index E.zero
    end
end;;
type q = { r:int; l:int; idx:int };;
Scanf.scanf "%d %d" (fun n q ->
    let solve arr n query q =
        let ans = Array.make q 0 in
        let module F = Fenwick.Make (struct type t = int let proc = (+) let zero = 0 end) in
        let bit = F.create n in
        let last_visit = Array.make 500001 (-1) in

        let rec loop i qi =
            if i < n then (
                if last_visit.(arr.(i)) <> -1 then
                    F.update bit (last_visit.(arr.(i)) + 1) (-1);
                last_visit.(arr.(i)) <- i;

                F.update bit (i + 1) 1;

                let rec loop2 qi =
                    if qi < q && query.(qi).r = i then  (
                        ans.(query.(qi).idx) <-
                            F.query bit (query.(qi).r + 1) - F.query bit (query.(qi).l);
                        loop2 (qi + 1)
                    ) else qi
                in
                loop (i + 1) (loop2 qi)
            )
        in
        loop 0 0;
        Array.iter (Printf.printf "%d\n") ans
    in
    let c = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    let query = Array.init q (fun i -> Scanf.scanf " %d %d" (fun l r -> { r = r - 1; l = l - 1; idx = i})) in
    Array.sort compare query;
    solve c n query q
)

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

int main() {
    int n, k, s;
    cin >> n >> k >> s;
    for(int i = 0; i < n; ++i) {
        if(i < k) cout << s << " ";
        else {
            if(s == 1e9) cout << s - 1 << " ";
            else cout << s + 1 << " ";
        }
    }
    cout << '\n';
    return 0;
}


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

#define SIS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define lowbit(x) (x & -x)
using namespace std;
const int MAX = 0x7ffffff;
int t , ans;
int n , m , k;
char a[7][7];
void check(int maskR , int maskC)
{
	int black = 0;
	for(int i = 0;i < n;i ++)
	{
		for(int j = 0;j < m;j ++)
		{
			if(((maskR >> i) & 1) == 0 && ((maskC >> j) & 1) == 0)
			{
				if(a[i][j] == '#')black++;
			}
		}
	}
	if(black == k)ans++;
}
void slove()
{	
	cin >> n >> m >> k;
	for(int i = 0;i < n;i ++)
		cin >> a[i];

	for(int i = 0; i <= (1 << n) - 1;i ++)
	{
		for(int j = 0;j <= (1 << m) - 1;j ++)
		{
			check(i , j);
		}
	}
	cout << ans << endl;
}
int main()
{
	SIS;
	slove();
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vector<bool> gused(100007,false),eused(100007,false);
vector<ll> gnum(100007,0);
mat G(100007,vec(0));

void dfs(ll v,ll index, ll from){
    gused.at(v) = true;
    //cout<<v<<' '<<index<<' '<<from<<endl;
    for(P e : G.at(v)){
        if(eused.at(e.fi) || e.se == from) continue;
        if(gused.at(e.se)) {
            eused.at(e.fi) = true;
            ++gnum.at(e.se);
            cout<<e.se+1<<' '<<v+1<<endl;
            continue;
        }
        dfs(e.se, e.fi, v);
    }

    if(index == 100006){
        return;
    }

    eused.at(index) = true;
    if(gnum.at(v)&1){
        ++gnum.at(v);
        cout<<v+1<<' '<<from+1<<endl;
        return;
    }else{
        ++gnum.at(from);
        cout<<from+1<<' '<<v+1<<endl;
        return;
    }
}

int main(){
    cin>>N>>M;
    for(int i = 0; i < M; i++) {
        // sからtへの辺を張る
        int s,t;
        scanf("%d %d", &s, &t);
        --s;
        --t;
        G[s].emplace_back(i,t);
        G[t].emplace_back(i,s);
    }
    //cout<<'a'<<endl;
    if(M%2 != 0){
        cout<<-1<<endl;
        return 0;
    }
    dfs(0,100006,100006);
}


Measured memory_bytes: 20224
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    int x[N], y[N], h[N];
    rep(i, N) {
        cin >> x[i] >> y[i] >> h[i];
    }
    
    int MAX = 100;

    for(int posY = 0; posY <= MAX; posY++) {
        for(int posX = 0; posX <= MAX; posX++) {
            
            int needH = -1;

            rep(i, N) {
                if(h[i] > 0) {
                    int tmp = h[i] + abs(posY-y[i]) + abs(posX - x[i]);
                    if(needH == -1) {
                        needH = tmp;
                    }
                    else {
                        if(needH != tmp) {
                            needH = -2;
                            break;
                        }
                    }
                }
            }

            if(needH == -2) {
                continue;
            }

            rep(i, N) {
                if(h[i] == 0) {
                    int dist = abs(posY - y[i]) + abs(posX - x[i]);
                    if(needH > dist) {
                        needH = -2;
                        break;
                    }
                }
            }

            if(needH == -2) {
                continue;
            }

            cout << posX << " " << posY << " " << needH << endl;
            return 0;
        }
    }
}

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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define lint long long
#define FOR(i,a,b) for(lint i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define yes "Yes"
#define no "No"
#define divs 1000000007
#define dive 1000000009

typedef pair<int, int> P;

lint ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
bool kaibun(string s){
	bool flag = true;
	REP(i,s.length()/2){
		if(s[i]!=s[s.length()-i-1]){
			flag = false; break;
		}  
	}
	if(flag) return true;
	else return false;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
	string s; cin>>s;
	int n = s.length();
	string t = s.substr(0,(n-1)/2);
	string u = s.substr((n+4)/2-1,n-(n+3)/2+1);
	if(kaibun(s)&&kaibun(t)&&kaibun(u)) cout<<yes<<endl;
	else cout<<no<<endl;
	return 0;
}

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

vector < int > a;
int n;

gg solve(){
    int l,r;
    r=0;
    int c=0;
    gg ans=0;
    for(l=0;l<n;++l){
        // last {c} is [l-1,r-1]
        // now {c} is [l,r-1]
        while(r<n && (c^a[r]) == (c+a[r]) ){
            c^=a[r];
            r+=1;
        }
        ans+=r-l;
        c^=a[l];// same as c-=a[l];
    }
    return ans;
}

void _prepare(){
    cin>>n;
    a.resize(n);
    for(int i=0;i<n;++i)cin>>a[i];
}

int main(){
    _prepare();
    cout<<solve()<<endl;
    return 0;
}


Measured memory_bytes: 1024
use proconio::input;

#[allow(clippy::many_single_char_names)]
fn inv(mut x: i64, m: i64) -> i64 {
    let mut y = m;
    let mut u = 1;
    let mut v = 0;
    while x != 0 {
        let q = y / x;
        y -= x * q;
        v -= u * q;
        std::mem::swap(&mut x, &mut y);
        std::mem::swap(&mut u, &mut v);
    }
    v %= m;
    if v < 0 {
        v += m;
    }
    v
}

fn main() {
    input!(n: usize, m: i64);
    let size = n * n;
    let mut two_pow = vec![1; size + 1];
    let mut two_hyp = vec![2; size + 1];
    let mut fact = vec![1; size + 1];
    let mut finv = vec![1; size + 1];
    for i in 0..size {
        two_pow[i + 1] = (two_pow[i] + two_pow[i]) % m;
        two_hyp[i + 1] = (two_hyp[i] * two_hyp[i]) % m;
        fact[i + 1] = (fact[i] * (i as i64 + 1)) % m;
    }
    finv[size] = inv(fact[size], m);
    for i in (0..size).rev() {
        finv[i] = (finv[i + 1] * (i as i64 + 1)) % m
    }
    let binom = |n: usize, k: usize| ((fact[n] * finv[k]) % m * finv[n - k]) % m;
    let mut slg = vec![vec![0; n + 2]; n + 2];
    for i in 1..=n + 1 {
        slg[i][1] = 1;
        slg[i][i] = 1;
    }
    for i in 1..=n + 1 {
        for j in 1..i {
            slg[i][j] = slg[i - 1][j - 1];
            slg[i][j] = (slg[i][j] + slg[i - 1][j] * j as i64) % m;
        }
    }

    let mut ans = 0;
    for i in 0..=n {
        for k in 0..=i {
            let mut now = slg[i + 1][k + 1];
            now = (now * two_pow[k * (n - i)]) % m;
            now = (now * two_hyp[n - i]) % m;
            let b = if i % 2 == 0 {
                binom(n, i)
            } else {
                (binom(n, i) * (m - 1)) % m
            };
            ans = (ans + now * b) % m;
        }
    }
    println!("{}", ans);
}


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

using namespace std;

using ll = long long;

int main(void) {
    ll n, k;
    cin >> n >> k;

    vector<ll> a(n);
    for(auto &e: a) cin >> e;

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

    ll ng = 2e18, ok = -2e18;
    // ok譛ｪ貅縺ｮ蛟区焚 < k
    while(ng - ok > 1) {
        ll m = (ok + ng)/2;
        
        ll s = 0;
        for(ll i=0; i<n; i++) {
            auto chk = [&](){
                ll r = 0;
                for(ll j=0; j<n; j++) {
                    if(i == j) continue;
                    r += a[j] * a[i] < m;
                }
                return r;
            };
            if(a[i] < 0) {
                // a[x] * a[i] < m
                ll j = [&]() {
                    ll ok = n, ng = -1;
                    while(abs(ng - ok) > 1) {
                        ll mm = (ok + ng)/2;
                        (a[mm] * a[i] < m ? ok : ng) = mm;
                    }
                    return ok;
                }();
                // ng ng [ok] ok ok
                if(i >= j) j++;
                s += max(n-j, 0ll);
            }
            if(a[i] > 0) {
                // a[x] * a[i] < m
                ll j = [&]() {
                    ll ok = 0, ng = n;
                    if(!(a[0] * a[i] < m)) return -1ll;
                    while(abs(ng - ok) > 1) {
                        ll mm = (ok + ng)/2;
                        (a[mm] * a[i] < m ? ok : ng) = mm;
                    }
                    return ok;
                }();
                // ok ok [ok] ng ng
                if(i <= j) j--;
                s += max(j+1, 0ll);
            }
            if(a[i] == 0) {
                // a[x] * 0 < m
                s += m > 0 ? n-1 : 0;
            }
        }
        assert(s % 2 == 0);
        s /= 2;

        (s < k ? ok : ng) = m;
    }
    cout << ok << endl;
}


Measured memory_bytes: 1792
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}

const string YES = "Yes";
const string NO = "No";

void solve(long long N){
    if(N%10==9 || N/10==9)cout<<YES<<endl;
    else cout<<NO<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

char a[300][304];
int res[300][300];

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

    int n = gi();
    int m = gi();
    gi();
    memset(res, 0, sizeof(res));
    int c = 1;
    for (int i = 0; i < n; i++) {
        scanf("%s", a[i]);
        int f = 0;
        for (int j = 0; j < m; j++)
            if (a[i][j] == '#') {
                f = 1;
                res[i][j] = c++;
            }
        if (f) {
            for (int j = 1; j < m; j++)
                if (res[i][j] == 0)
                    res[i][j] = res[i][j-1];
            for (int j = m-2; j >= 0; j--)
                if (res[i][j] == 0)
                    res[i][j] = res[i][j+1];
        }
    }

    for (int i = 1; i < n; i++)
        if (res[i][0] == 0) {
            for (int j = 0; j < m; j++)
                res[i][j] = res[i-1][j];
        }

    for (int i = n-2; i >= 0; i--)
        if (res[i][0] == 0) {
            for (int j = 0; j < m; j++)
                res[i][j] = res[i+1][j];
        }

    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
            printf("%d%c", res[i][j], (j == m-1 ? '\n' : ' '));

    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp> 
//using namespace __gnu_pbds; 
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
typedef long long ll;
typedef long double ld;
#define trace(x)  cerr << #x << ": " << x << endl;
#define rep(i,a)  for(ll i=0; i< a; i++)
#define pb push_back
#define vl vector<ll>
const ll N=2*1e5+5;ll mod=1e9+7;
int main()
{
	fast;
	ll n;cin>>n;ll d;cin>>d;ll p=0;
	for(ll i=0;i<n;i++)
	{
		ll x,y;cin>>x>>y;
		ld z=x*x*1.0 + y*y*1.0;
		z=sqrt(z);
		if(z<=d)p++;
	}
	cout<<p;

}

Measured memory_bytes: 3596
MOD = 1000000007
n = gets.to_i
fs = Array.new(n + 1) { Array.new(n + 1, 0) }
for i in 1..n
  j = i
  for k in (2..Math.sqrt(i).to_i + 1)
    while j % k == 0
      j /= k
      fs[i][k] += 1
    end
  end
  fs[i][j] += 1 if j > 1
end
p fs.transpose.map { |f| f.inject(:+) }.map { |x| x + 1 }.inject(:*) % MOD

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

using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    vector<int> s(n),t(m);
    for(int i=0;i<n;i++){
        cin >> s[i];
    }
    for (int i=0;i<m;i++){
        cin >> t[i];
    }
    vector<vector<long long>> dp(n+1,vector<long long> (m+1,0));
    for(int i=0;i<n+1;i++){
        dp[i][0]=1;
    }
    for(int i=0;i<m+1;i++){
        dp[0][i]=1;
    }
    for (int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(s[i]==t[j]){
                dp[i+1][j+1]=(dp[i][j+1]+dp[i+1][j])%1000000007;;
            }
            else{
                dp[i+1][j+1]=(dp[i][j+1]+dp[i+1][j]-dp[i][j]+1000000007)%1000000007;
            }
        }
    }
    cout << dp[n][m] << endl;
}


Measured memory_bytes: 31616
H=int(input())+1
A=[0]+list(map(int,input().split()))
def h(i):
 l=2*i;r,g=l+1,[i,l][l<H and A[i]<A[l]]
 if r<H and A[g]<A[r]:g=r
 if g>i:A[i],A[g]=A[g],A[i];h(g)
for i in range(H//2,0,-1):h(i)
print(' '+' '.join(map(str,A[1:])))


Measured memory_bytes: 65220
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000


r,D,x = map(int,input().split())
ans = [0 for i in range(11)]
ans[0] = x
for i in range(10):
    ans[i+1] = r*ans[i]-D

for i in range(1,11):
    print(ans[i])


Measured memory_bytes: 7872
using System.Collections.Generic;
    using System.Collections;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System;

    namespace cysharp_test
    {
        class Program
        {
            static void Main (string[] args)
            {
                new Program ().solve ();
            }

            void solve ()
            {
            int N = int.Parse(Console.ReadLine());
            switch(N%10){
                case 0:
                    Console.WriteLine("pon");
                    break;
                case 1:
                    Console.WriteLine("pon");
                    break;
                    
                case 2:
                    Console.WriteLine("hon");
                    break;
                    
                case 3:
                    Console.WriteLine("bon");
                    break;
                    
                case 4:
                    Console.WriteLine("hon");
                    break;
                    
                case 5:
                    Console.WriteLine("hon");
                    break;
                    
                case 6:
                    Console.WriteLine("pon");
                    break;
                    
                case 7:
                    Console.WriteLine("hon");
                    break;
                    
                case 8:
                    Console.WriteLine("pon");
                    break;
                    
                case 9:
                    Console.WriteLine("hon");
                    break;
                    

            }
            Console.ReadKey ();
            }

        }
        struct Vector2
        {
            public Vector2 (long x, long y)
            {
                this.x = x;
                this.y = y;
            }

            public long x, y;

            public static Vector2 operator + (Vector2 a, Vector2 b)
            {
                return new Vector2 (a.x + b.x, a.y + b.y);
            }

            public static Vector2 operator - (Vector2 a, Vector2 b)
            {
                return new Vector2 (a.x - b.x, a.y - b.y);
            }

            public static Vector2 operator * (Vector2 a, long scala)
            {
                return new Vector2 (a.x * scala, a.y + scala);
            }

            public static bool operator == (Vector2 a, Vector2 b)
            {
                return (a.x == b.x) && (a.y == b.y);
            }

            public static bool operator != (Vector2 a, Vector2 b)
            {
                return !(a.x == b.x) && (a.y == b.y);
            }

            public override int GetHashCode ()
            {
                return (int) (x + y);
            }

            public override bool Equals (object obj)
            {
                if (!(obj == null) && obj is Vector2)
                {
                    return (this == (Vector2) obj);
                }
                else return false;
            }

            public override string ToString ()
            {
                return ("(" + x + "," + y + ")");
            }
        }
    }

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

int main(){

  int n, tmp;
  ll ans = 0;
  vector<int> a, b, c;
  cin >> n;
  a.resize(n); b.resize(n); c.resize(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  rep(i,n) cin >> c[i];
  sort(a.begin(),a.end());
  sort(c.begin(),c.end());
  
  for(auto itr = b.begin(); itr != b.end(); itr++){
    int d1 = lower_bound(a.begin(),a.end(), *itr) - a.begin();
    int d2 = c.end() - upper_bound(c.begin(),c.end(),*itr);
    ans += 1ll*d1*d2;
  }

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

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
constexpr int INF = (numeric_limits<int>::max() == INT_MAX ? (int)1e9 : (long long)1e18);
constexpr long double eps = 1e-6;
const string el = "\n";
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
using ld  = long double;using pii = pair<int,int>;using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
void fast_io(){ios::sync_with_stdio(false); cin.tie(nullptr);}

signed main(){
    fast_io();
    const string s = "CODEFESTIVAL2016";
    string t; cin >> t;
    int ans = 0;
    rep(i,s.size())ans += (s[i] != t[i]);
    cout << ans << endl;
}


Measured memory_bytes: 256
(defun create-table ()
  (let ((table (make-array '(3 3 2) :initial-element 0)))
    (dotimes (i 3)
      (dotimes (j 3)
        (setf (aref table i j 0) (read))))
    table))


(defun bingo ()
  (let* ((table (create-table))
        (n (read))
        (x (make-array n))
        (ans "No"))
    (dotimes (i n)
      (setf (aref x i) (read)))
    (dotimes (i 3)
      (dotimes (j 3)
        (dotimes (k n)
          (if (= (aref table i j 0) (aref x k))
              (setf (aref table i j 1) 1)))))
    (dotimes (i 3)
      (if (= 1 (aref table i 0 1) (aref table i 1 1) (aref table i 2 1))
          (setf ans "Yes")))
    (dotimes (j 3)
      (if (= 1 (aref table 0 j 1) (aref table 1 j 1) (aref table 2 j 1))
          (setf ans "Yes")))
    (if (or (= 1 (aref table 0 0 1) (aref table 1 1 1) (aref table 2 2 1))
            (= 1 (aref table 0 2 1) (aref table 1 1 1) (aref table 2 0 1)))
        (setf ans "Yes"))
    ans))


(format t "~A~%" (bingo))

Measured memory_bytes: 20836
#include<iostream>

using namespace std;

int main() {
	int M1, D1, M2, D2;
	cin >> M1 >> D1;
	cin >> M2 >> D2;

	if (D1 > D2) {
		cout << 1;
	}
	else {
		cout << 0;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(a) (a).begin(), (a).end()
typedef long long ll;
using namespace std;
const int N = 2e5 + 5;
using namespace std;

int main()
{
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    int a[N];
    a[0] = 1;
    for (int i = 1; i < n; ++i)
    {
        if (s[i] == 'C' && s[i - 1] == 'A')
        {
            a[i] = a[i - 1] + 1;
        }
        else
        {
            a[i] = a[i - 1];
        }
    }
    int l, r;
    rep(i, q)
    {
        cin >> l >> r;
        cout << a[r - 1] - a[l - 1] << endl;
    }
    return 0;
}

Measured memory_bytes: 4144
s=input()

if s=='SUN':
    print('7')
elif s=='MON':
    print('6')
elif s == 'TUE':
    print('5')
elif s == 'WED':
    print('4')
elif s == 'THU':
    print('3')
elif s == 'FRI':
    print('2')
elif s == 'SAT':
    print('1')



Measured memory_bytes: 8928
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;
        cin.ignore();

        map<string, int> m;
        for(int i=0; i<n; ++i){
            string s, t;
            getline(cin, s);
            istringstream iss(s);
            while(iss >> t)
                ++ m[t];
        }

        vector<pair<int, string> > a(m.size());
        map<string, int>::iterator it = m.begin();
        for(unsigned i=0; i<m.size(); ++i){
            a[i] = make_pair(- it->second, it->first);
            ++ it;
        }
        sort(a.begin(), a.end());

        char c;
        cin >> c;
        vector<string> ret;
        for(unsigned i=0; i<a.size(); ++i){
            if(a[i].second[0] == c)
                ret.push_back(a[i].second);
        }

        if(ret.size() == 0)
            cout << "NA" << endl;
        else{
            cout << ret[0];
            for(unsigned i=1; i<min(5u, ret.size()); ++i)
                cout << ' ' << ret[i];
            cout << endl;
        }
    }
}

Measured memory_bytes: 948
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
int a,b,w,e,r,t;
char op;
	for(;;){
	cin>>a>>op>>b;
	if(op=='+'){
	w=a+b;
	cout<<w<<endl;
	}else if(op=='-'){
	e=a-b;
	cout<<e<<endl;
	}else if(op=='*'){
	r=a*b;
	cout<<r<<endl;
	}else if(op=='/'){
	t=a/b;
	cout<<t<<endl;
	}else{
	break;
	}
	}
	return 0;
}

Measured memory_bytes: 3004
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
  int max,n,data[255];
  bool MAS[255][255];
  while(1){
    memset(MAS,false,sizeof(MAS));
    memset(data,false,sizeof(data));
    cin >> max;
    if(max==0)break;
    cin >> n;
    for(int i=1;i<=n;i++) cin >> data[i];
    for(int j=0;j<n+2;j++){
      for(int i=1;i<=max && j+i<n+2;i++){
	if(j+i==n+1)MAS[j][n+1]=true;
	else j+i+data[j+i]>=n+1 ? MAS[j][n+1]=true :
	       (j+i+data[j+i]<0?MAS[j][0]=true:MAS[j][j+i+data[i+j]]=true);
      }
    }


    for(int i=0;i<n+2;i++){
      for(int j=0;j<n+2;j++){
	for(int k=0;k<n+2;k++){
	  if(MAS[j][i]&&MAS[i][k]){
	    MAS[j][k]=true;
	  }
	}
      }
    }
    bool flg=false;
    for(int i=0;i<=n;i++){
      if(MAS[0][i]&&(!MAS[i][n+1])){
	flg=true;
	break;
      }
    }
    cout << (flg?"NG":"OK") << endl;
  }
}

Measured memory_bytes: 1228
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#define pi 3.14159265358979323846264338327950

int main() {
	int a, b; std::cin >> a >> b;
	if (b < 10)
		a = a * 10;
	else if (b < 100)
		a = a * 100;
	else
		a = a * 1000;
	for (int i = 0; i <= 10000; ++i) {
		if (i * i == a + b) {
			std::cout << "Yes" << std::endl;
			return 0;
		}
		if (i * i > a + b)
			break;
	}
	std::cout << "No" << std::endl;

	return 0;
}

Measured memory_bytes: 3572
import java.util.Scanner;

class Main {	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int cards[][] = new int[4][13];
		
		for(int i=0;i<n;i++){
			String suit = sc.next();
			int rank = sc.nextInt() - 1;
			
			switch(suit){
			case "S":
				cards[0][rank] = 1;
				break;
			case "H":
				cards[1][rank] = 1;
				break;
			case "C":
				cards[2][rank] = 1;
				break;
			case "D":
				cards[3][rank] = 1;
				break;
			}
		}
		
		for(int j=0;j<4;j++){
			for(int k=0;k<13;k++){
				if(cards[j][k] != 1){
					switch(j){
					    case 0:
					        System.out.println("S "+(k+1));
					        break;
					    case 1:
					        System.out.println("H "+(k+1));
					        break;
					    case 2:
					        System.out.println("C "+(k+1));
					        break;
					    case 3:
					        System.out.println("D "+(k+1));
					}
				}
			}
		}
	}
}



Measured memory_bytes: 25988
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<i64>();
    let k = read::<i64>();
    println!("{}", n - k + 1);
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		String S = scanner.nextLine();
		char s = S.charAt(0);

		System.out.println(Character.isUpperCase(s)?"A":"a");

	}

}

Measured memory_bytes: 35744
#include <bits/stdc++.h>
using namespace std;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
int main(void){
	int N;
  	cin >> N;
  	vector<pair<float, int>> vec(N);
  	float avg = 0.0f;
  	rep(i,0,N){
      	int input;
      	cin >> input;
      	vec[i] = make_pair(input, i);
      	avg+=(float)vec[i].first;
    }
  	avg/=N;
  	float minimum  = vec[0].first;
  	rep(i,0,N){
      	vec[i].first = abs(vec[i].first- avg);
      	if (minimum > vec[i].first)
          	minimum = vec[i].first;
    }
  	rep(i,0,N){
      	if ( minimum == vec[i].first){
    		cout << i << endl; 
          	return 0;
      	}
    }
}
        	

Measured memory_bytes: 256