akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <cassert>
using namespace std;
typedef long long ll;

const int MAXN = 100001;
int N;
ll ans = 0;
vector<int> edges[2][MAXN];
bool vis[2][MAXN] = {0};
ll r = 0, c = 0, edgeCnt = 0;

void dfs(bool group, int u)
{
    vis[group][u] = true;
    if (group)
        r++;
    else
        c++;
    if (group == false)
        edgeCnt += edges[group][u].size();

    for (int i = 0; i < edges[group][u].size(); i++)
    {
        int v = edges[group][u][i];
        if (!vis[!group][v])
        {
            dfs(!group, v);
        }
    }
}

int main()
{
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int x, y;
        cin >> x >> y;
        edges[0][x].push_back(y);
        edges[1][y].push_back(x);
    }

    for (int i = 1; i <= 100000; i++)
    {
        if (!vis[0][i])
        {
            r = 0, c = 0, edgeCnt = 0;
            dfs(false, i);
            // cout << i << " " << edgeCnt << endl;
            ans += 1ll * r * c - edgeCnt;
        }
    }
    cout << ans << endl;
    // system("pause");
}

Measured memory_bytes: 11136
import java.io.*;
import java.util.*;


class Main {
    public static void main(String[] args) {
        Scanner scr = new Scanner(System.in);
//        int t = scr.nextInt();
//        while (t-- > 0)
        solve(scr);
    }


    static void solve(Scanner scr) {
        String str = scr.next();
        System.out.println(isP(str) && isP(str.substring(0, (str.length() - 1) / 2)) && isP(str.substring((str.length()) / 2 + 1))?"Yes":"No");

    }

    static boolean isP(String str) {
        for (int i = 0; i < str.length() / 2; i++) {
            if (str.charAt(i) != str.charAt(str.length() - 1 - i)) return false;

        }
        return true;
    }


}





Measured memory_bytes: 23636
open Printf open Scanf
open Array

let () =
  scanf " %d" @@ fun n ->
    let vs = init n (fun _ -> scanf " %d" @@ fun v -> v) in
    let cs = init n (fun _ -> scanf " %d" @@ fun v -> v)
    in
    let rec lp a i =
      if i=n then (
        a
      ) else (
        max
          (lp a (i+1))
          (lp (a + vs.(i) - cs.(i)) (i+1)))
    in
    print_int @@ lp 0 0



Measured memory_bytes: 384
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N;
LL A[200000];

LL ans = 0;

void solve(){
	for(int i=0;i<N;i++) A[i] -= (i+1);
	sort(A,A+N);
	for(int i=0;i<N;i++) ans += abs(A[i] - A[N/2]);
}
 
int main(){
    cin >> N;
    for(int i=0;i<N;i++) cin >> A[i];
 
    solve();

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

Measured memory_bytes: 1792
#include<iostream>
#include<string.h>
using namespace std;

const int INF = 100000000;
int adj[110][110];

int main() {
  int n,p,r,k,t,s,d,v;

  for(int i=0; i<110; ++i) {
    for(int j=0; j<110; ++j) {
      adj[i][j] = INF;
    }
  }

  cin>>n;
  for(int i=0; i<n; ++i) {
    cin>>r>>k;
    r--;
    for(int j=0; j<k; ++j) {
      cin>>t;
      t--;
      adj[r][t] = 1;
    }
  }

  for(int k=0; k<n; ++k) {
    for(int i=0; i<n; ++i) {
      for(int j=0; j<n; ++j) {
	adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j]);
      }
    }
  }
  
  cin>>p;
  for(int i=0; i<p; ++i) {
    cin>>s>>d>>v;
    s--,d--;
    if(adj[s][d]+1 <= v) cout<<adj[s][d]+1<<endl;
    else cout<<"NA"<<endl;
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#pragma optimize("Ofast")
using namespace std;

using ll = long long;
const int N = 1e5+5;

int main()
{
    ios_base::sync_with_stdio(0);

    ll n;
    cin >> n;
    ll sz,len;
    for(int i = 1; i <= 12; ++i) {
        ll temp = 0;
        for(int j = 0; j < i; ++j) {
            temp += pow(26,j);
        }
        if(temp <= n) {
            sz = i;
            len = temp;
        }
    }
    string ans(sz,'a');
    n -= len;
    for(int i = sz-1; i >= 0; --i) {
        ll inc = n/pow(26,i);
        n -= (inc*(pow(26,i)));
        ans[i] += inc;
    }
    reverse(ans.begin(),ans.end());
    cout << ans;
    return 0;
}

Measured memory_bytes: 4068
#include<iostream>
#include<cstring>
#define	REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
bool goddess_in;
int goddess_t;
int n,hr,mi,p,ans;
string date;
char move;
int total[1111];
int man_t[1111];
bool man_in[1111];
void solve();
int main(){
	while(cin>>n&&n){
		ans=0;
		memset(man_t,0,sizeof(man_t));
		memset(man_in,0,sizeof(man_in));
		memset(total,0,sizeof(total));
		goddess_in=false;
		while(n--){
			cin>>date>>hr>>move>>mi>>move>>p;
			solve();
		}
		rep(i,1111){if(total[i])ans=max(ans,total[i]);}
		cout<<ans<<endl;
	}
}
void solve(){
	int t=hr*60+mi;
	if(move=='I'){
		if(p==0){
			goddess_in=true;
			goddess_t=t;
		}else{
			man_in[p]=true;
			man_t[p]=t;
		}
	}else{
		if(p==0){
			goddess_in=false;
			rep(i,1111){if(man_in[i])total[i]+=(t-max(goddess_t,man_t[i]));}
		}else{
			man_in[p]=false;
			if(goddess_in)total[p]+=(t-max(goddess_t,man_t[p])); 
		}
	}
}

Measured memory_bytes: 1208
#include<stdio.h>

int main(void){

    long sum;

    int min,max,a[10000],n,i;

    scanf("%d",&n); 

    for(i=0;i<n;i++){

        scanf("%d",&a[i]);  

        if(i==0){

            min=a[i];

            max=a[i];

        }

        else if(a[i]>max){

            max=a[i];

        }

        else if(a[i]<min){

            min=a[i];

        }

        sum+=a[i];

    }

    printf("%d %d %ld\n",min,max,sum);


    return 0;

} 

Measured memory_bytes: 640
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N=gets.to_i
A=get_i
card=A.tally
res=0
card.each do|k,v|
  res+=v-1 
end
puts N-((res+1)/2)*2

Measured memory_bytes: 25744
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin  >> n;
    if(n % 10 == 9){
        cout << "Yes" << endl;
        }else if(n / 10 == 9){
          cout << "Yes" << endl;
          }else{
            cout  << "No" << endl;
          } 
}


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

using namespace std;

int main() {

    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    long long cost=0;
    for(int i=1;i<n;i++){
        if(a[i]!=a[i-1])
            cost+=(a[i]-a[i-1]);
    }
    cout<<cost;
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ll  long long
#define PR  pair<int, int>

const int N = 3e5 + 10;
const int MOD = 1e9 + 7;
const long long INF = 5e18;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> c(n), s(n), f(n);
    for (int i = 0; i < n- 1; i++) {
        cin >> c[i] >> s[i] >> f[i];
    }
    for (int i = 0; i < n - 1; i++) {
        int ans = s[i] + c[i];
        for (int j = i + 1; j < n - 1; j++) {
            int tmp = ans;
            if (tmp >= s[j]) {
                tmp %= f[j];
                if (tmp == 0) {
                    ans += c[j];
                } else {
                    int need = f[j] - tmp;
                    ans += need;
                    ans += c[j];
                }
            } else {
                ans += (s[j] - ans);
                ans += c[j];
            }
        }
        cout << ans << '\n';
    }
    cout << "0\n";
    return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>
int gcd(int , int);

int main(){
  int a, b, c, K;
  long sum = 0;
  int ans_1;
  scanf("%d", &K);

  for(a=1; a<=K; a++){
    for(b=1; b<=K; b++){
      for(c=1; c<=K; c++){
        sum += gcd(gcd(a, b), c);
      }
    }
  }
  printf("%ld", sum);
  return 0;
}

int gcd(int m, int n){
  if (m%n==0){
    return n;
  }
  else
    return gcd(n, m%n);
}


Measured memory_bytes: 1728
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n, m = map(int, input().split())

uf = UnionFind(n)

for i in range(m):
    x, y, z = map(int, input().split())
    x -= 1
    y -= 1
    uf.union(x, y)

st = set()
for i in range(n):
    st.add(uf.find(i))

print(len(st))


Measured memory_bytes: 12780
import itertools
import math
import fractions
import functools
import copy

n,m = map(int, input().split())
k = []
s = []
for i in range(m):
    l = list(map(int, input().split()))
    k.append(l[0])
    s.append(l[1:])
p = list(map(int, input().split()))

result = 0
for i in range(2**n):
    count = 0
    for d in range(m):
        on = 0
        for sw in range(n):
            if i >> sw & 1:
                for o in range(k[d]):
                    if s[d][o] == sw+1:
                        on += 1
        if on % 2 == p[d]:
            count += 1
    if count == m:
        result += 1

print(result)

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

int main(){
  long long int a,b,c,d=0,e;
  cin>>a;
  vector<pair<int,int>> ps(a);
  for(int i=0;i<a;i++){
    cin >> b>>c;
    ps[i]=make_pair(c,b);
  }
  sort(ps.begin(),ps.end());
  e=ps[a-1].first;
  for(int i=0;i<a;i++){
    d+= ps[i].second;
    if(d>ps[i].first){
      e=0;
      break;
    }
  }
  if(d>e)cout << "No" << endl;
  else cout<< "Yes"<<endl;
}
  
    


Measured memory_bytes: 1792
s = input()
wordList = 'ACGT'
t = []
tmp = []
lead = 0
ans = 0
slist = list(s)
for i in range(len(slist)):
    if not slist[i] in wordList:
        ans = max(ans, (i - lead))
        lead = i + 1
ans = max(ans, (len(slist) - lead))
print(ans)

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

int main() {
  char n[4];
  cin >> n[0] >> n[1] >> n[2] >> n[3];
  if (n[0] == n[1] && n[1] == n[2] || n[1] == n[2] && n[2] == n[3]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

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

int main() {
  int N, M=0;
  cin>>N;
  int A	= N;
  while	(A != 0) {
    M += A%10;
    A /= 10;
  }
  cout << ((N % M == 0) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
def main(arg):
    arg = str(arg)
    w, h, x, y, r = [int(x)for x in arg.split(" ")]
    if (y+r) <= h and (x+r) <= w and r <= x and r <= y:
        return "Yes"
    return "No"

if __name__ == '__main__':
    print(main(input()))

Measured memory_bytes: 7692
a, b = map(int, input().split())
s = input()

def is_int(s):
    try:
        int(s)
        return True
    except ValueError:
        return False

if is_int(s[0:a]) and is_int(s[a+1:a+b+2]) and s[a] == "-":
    print("Yes")
else:
    print("No")


Measured memory_bytes: 61936
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def main():
    n,m = LI()
    e = collections.defaultdict(set)
    for _ in range(m):
        a,b = LI()
        e[a-1].add(b-1)
        e[b-1].add(a-1)
    r = [0] * n

    q = I()
    qq = sorted([[_] + LI() for _ in range(q)], reverse=True)
    f = [-1] * n
    for _,v,d,c in qq:
        v -= 1
        if f[v] >= d:
            continue
        if r[v] == 0:
            r[v] = c
        q = [v]
        for nd in range(d-1,-1,-1):
            t = []
            for p in q:
                for vv in e[p]:
                    if f[vv] >= nd:
                        continue
                    f[vv] = nd
                    t.append(vv)
                    if r[vv] == 0:
                        r[vv] = c
            q = t

    return '\n'.join(map(str, r))



print(main())


Measured memory_bytes: 75968
import sys
sys.setrecursionlimit(101)

n, k = list(map(int, input().split()))
vs = list(map(int, input().split()))
memo = {}


def doit(l, r, kk):
    if kk == 0 or l > r:
        return 0
    if (l, r, kk) not in memo:
        memo[(l, r, kk)] = max(vs[l] + doit(l + 1, r    , kk - 1),
                           vs[r] + doit(l    , r - 1, kk - 1),
                                   doit(l + 1, r    , kk - 2) if kk > 1 else 0,
                                   doit(l    , r - 1, kk - 2) if kk > 1 else 0)
    return memo[(l, r, kk)]


print(doit(0, n - 1, k))


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

bool isprime[1000005];

void init(){
  
  for(int i=0;i<1000005;i++) isprime[i] = true;
  
  isprime[0] = isprime[1] = false;
  
  for(int i=2;i<1000005;i++){
    if( !isprime[i] ) continue;
    for(int j=i*2;j<1000005;j+=i){
      isprime[j] = false;
    }
  }
  
}

bool isPrime(int num){
  
  if( num == 1 ) return false;
  
  for(int i=2;i*i<=num;i++){
    if( num % i == 0 ) return false;
  }
  
  return true;
}

signed main(){
  
  init();
  
  int n;
  cin >> n;
  
  if( isPrime(n) == true ){
    cout << 1 << endl;
    return 0;
  }
  
  int ans = 0;
  
  for(int i=0;i<1000005;i++){
    
    if( !isprime[i] ) continue;
    
    int cnt = 0;
    
    while( n % i == 0 ){
      n /= i;
      cnt++;
    }
    
    int sum = cnt;
    
    for(int j=1;j<=sum;j++){
      
      if( j <= cnt ){
	cnt -= j;
	ans++;
      }
      
    }
    
  }
  
  if( isPrime( n ) == true ) ans++;
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 4560
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
 
#define ff                  first
#define ss                  second
#define endl                "\n"
#define loop(i,s,e)         for(int i=s;i<e;i++)
#define int                 long long
#define vi                  vector<int> 
#define S(v)                sort(v.begin(),v.end())
#define RS(v)               sort(v.rbegin(),v.rend())
#define R(v)                reverse(v.begin(),v.end())
#define mxpq(T)             priority_queue <T>
#define mnpq(T)             priority_queue<T,vector<T>,greater<T>>
#define prv(v)              for(auto &x : v)cout << x << " ";
#define piirv(v)            for(auto &x : v)cout << x.ff << " " << x.ss << endl;
#define prvv(v)             for(auto &x : v)for(auto &y : x.ss)cout << y << " ";
#define mp                  make_pair
#define pii                 pair<int,int>
#define mset(a,f)           memset(a , f , sizeof(a))
#define pb                  push_back
#define inf                 INT_MAX
#define INF                 LLONG_MAX
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
 
const int N = 2e6 + 6;
const int M = 1e9+7;
int A[N];
int n , m;

void solve()
{
	char ch;
 	cin >> ch;

 	if(ch >= 'a' && ch <= 'z')
 	{
 		cout << 'a';
 	}
 	else cout << 'A';
}			
 
int32_t main()
{
 
cout<<fixed<<setprecision(16);
 
ios_base:: sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
 	
 
 	int t = 1;
 	// cin >> t;
 	while(t--)solve();
  
}

Measured memory_bytes: 3664
#include"stdio.h"
int main(){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    int f[101];
    for(int i=0;i<101;i++)
        f[i]=0;
    for(int i=a;i<b;i++)
        f[i]++;
    int cnt=0;
    for(int i=c;i<d;i++){
        f[i]++;
        if(f[i]==2)
            cnt++;
    }
    printf("%d\n",cnt);
}


Measured memory_bytes: 1728
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)






int main() {

	char a;
	cin >> a;
	

	if (a=='A' ) {
		a='T';
	}
	else if (a == 'T') {
		a = 'A';
	}
	else if (a == 'C') {
		a = 'G';
	}
	else if (a == 'G') {
		a = 'C';
	}
	cout << a << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define getMat(x, n, m, val) vector<vector<ll>> x(n, vector<ll> (m, val))
#define setp fixed<<setprecision // use it as cout<<setp(number of fractional digits in x)<<x;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll M=1000000000+7;
 
ll power(ll x,ll n)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}

ll dp[1005][1005];
ll n;

string fun(string s,ll sub=0){
    if(s.length()==0)return "";
    // if(s.length()==1){
    //     for(ll i=0;i<s[0]-'0'-sub;i++)s="("+s;
    //     for(ll i=0;i<s[0]-'0'-sub;i++)s=s+")";
    //     return s;
    // }
    ll mn=INT_MAX,mnind=-1;
    vector<ll>indv;
    for(ll i=0;i<s.length();i++){
        if(s[i]<mn){
            mn=s[i];
            mnind=i;
        }
    }
    for(ll i=0;i<s.length();i++){
        if(s[i]==mn){
            indv.pb(i);
        }
    }
    string ts="";
    if(indv[0]>0)ts+=fun(s.substr(0,indv[0]),mn-'0');
    for(ll i=0;i<indv.size()-1;i++){
        ts+=(mn);
        ts+=fun(s.substr(indv[i]+1,indv[i+1]-1-indv[i]),mn-'0');
    }
    ts+=(mn);
    if(indv[indv.size()-1]<s.length()-1)ts+=fun(s.substr(indv[indv.size()-1]+1,s.length()-indv[indv.size()-1]-1),mn-'0');
    for(ll i=0;i<mn-'0'-sub;i++)ts="("+ts;
    for(ll i=0;i<mn-'0'-sub;i++)ts=ts+")";
    return ts;
}


int main(){
    fastio;
    ll t=1,cno=0;
    // ll mod=998244353 ;
    // cin>>t;
    while(t--){
        ll n,m;
        cin>>n>>m;
        ll a[n],sum=0;
        for(ll i=0;i<n;i++){
            cin>>a[i];
            sum+=a[i];
        }
        double mn=sum/(4.0*m);
        sort(a,a+n,greater<ll>());
        if(a[m-1]<mn)cout<<"No\n";
        else cout<<"Yes\n";
    }
}

Measured memory_bytes: 256
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	int INF = 1 << 28;
	
	@SuppressWarnings("unchecked")
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			int n = sc.nextInt();
			int h = sc.nextInt();
			
			if( (n|h) == 0 ) break;
			
			int sum = n*n*n;
			HashSet<P>[] holes = new HashSet[3];
			HashSet<P> cross = new HashSet<P>();
			//0:xy 1:xz 2 yz
			for(int i=0;i<3;i++) holes[i] = new HashSet<P>();
			
			for(int i=0;i<h;i++) {
				String str = sc.next();
				int a = sc.nextInt();
				int b = sc.nextInt();
				sum -= n;
				if( str.equals("xy")) {
					for(P p: holes[1]) {
						if( p.f == a ) {
							sum++;
							cross.add(new P(a, b, p.s));
						}
					}
					for(P p: holes[2]) {
						if( p.f == b && !cross.contains(new P(a, b, p.s)) ) {
							sum++;
							cross.add(new P(a, b, p.s));
						}
					}
					holes[0].add(new P(a, b));
				}
				if( str.equals("xz")) {
					for(P p: holes[0]) {
						if( p.f == a ) {
							sum++;
							cross.add(new P(a, p.s, b));
						}
					}
					for(P p: holes[2]) {
						if( p.s == b && !cross.contains(new P(a, p.f, b)) ) {
							sum++;
							cross.add(new P(a, p.f, b));
						}
					}
					holes[1].add(new P(a, b));
				}
				if( str.equals("yz")) {
					for(P p: holes[0]) {
						if( p.s == a ) {
							sum++;
							cross.add(new P(p.f, a, b));
						}
					}
					for(P p: holes[1]) {
						if( p.s == b && !cross.contains(new P(p.f, a, b)) )  {
							sum++;
							cross.add(new P(p.f, a, b));
						}
					}
					holes[2].add(new P(a, b));
				}
			}
//			debug(cross.size());
//			for(P p: cross) debug(p.f, p.s, p.t);
			
			System.out.println(sum);
		}
	}
	
	class P {
		int f, s, t;
		P(int f, int s) {
			this.f = f;
			this.s = s;
			t = 0;
		}
		
		P(int f, int s, int t) {
			this.f = f;
			this.s = s;
			this.t = t;
		}
		
		@Override
		public boolean equals(Object o) {
			if(o instanceof P) {
				P p = (P)o;
				return f == p.f && s == p.s && t == p.t;
			}
			return false;
		}
		
		@Override
		public int hashCode() {
			return f * 250000 + s * 500 + t;
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 12000
A=list(map(int,input().split()))
#print(A)

def odd_check(a):
  for aa in a:
    if aa%2:
      return 1
  return 0

if odd_check(A):
  print(0)
  exit()
  
if A[0]==A[1]==A[2]:
  print(-1)
  exit()
  
ans=0
while 1:
  A[0],A[1],A[2]=A[1]//2+A[2]//2,A[0]//2+A[2]//2,A[1]//2+A[0]//2
  #print(A)
  ans+=1
  if odd_check(A):
    print(ans)
    exit()

Measured memory_bytes: 3064
n = int(input())
A = list(map(int, input().split()))

A.sort()
A.append(-1)

x = A[0]
if x != 1:
    flag = True
    for a in A:
        if a % x != 0:
            flag = False
    if flag:
        print(0)
        exit()

used = [False] * A[-2]
ans = 0
for idx, a in enumerate(A[:-1]):
    if used[a - 1]:
        continue
    if a != A[idx + 1]:
        ans += 1
    for j in range(a, len(used) + 1, a):
        used[j - 1] = True
print(ans)


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

int main()
{
    int K, X;
    cin >> K >> X;
    int s = X - K + 1;
    int e = X + K - 1;

    for (int i = s; i <= e; ++i)
    {
        cout << i << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N,M;
    int t;
    int Z;
    Z = 0;
    cin >> N >> M;
    vector<int> A;
    for(int i = 0; i < N; i++){
        cin >> t;
        Z = Z + t;
        A.push_back(t);
    }
    sort(A.begin(),A.end(),greater<int>());
    double r;
    r = 1.0 / (4.0 * (double)M);
    if((double)A[M-1] / (double)Z < r){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;

int score(int a, int k) {
  if (a < k) return 0;
  if (a%k == 0) return a/k;
  int rem = a%k;
  int c = (rem + a/k) / (a/k + 1);
  return score(a-c*(a/k+1), k);
}

int main()
{
  int n;
  cin>>n;
  int32_t grundy = 0;
  REP(i,n) {
    int a, k;
    cin>>a>>k;
    grundy ^= score(a, k);
  }
  if (grundy == 0) {
    cout << "Aoki" << endl;
  } else {
    cout << "Takahashi" << endl;
  }
  return 0;
}


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

l_A = len(A)
nums = []
for i in range(l_A):
    sum = 0
    for j in range(i, l_A):
        sum += A[j]
        nums.append(sum)
nums.sort(reverse=True)
max_num = 0
for num in nums:
    if num > max_num:
        max_num = num

b = bin(max_num)
b_max_nums = (list(b))[2:]
l_b_max_nums = len(b_max_nums)

b_nums = []
for num in nums:
    b_nums.append(num)

target_group = b_nums
for i in range(l_b_max_nums):
    p = pow(2, l_b_max_nums-i)
    _target_group = []
    l_target_group = len(target_group)
    for t in target_group:
        if (p & t >= p):
            _target_group.append(t)
    if len(_target_group) >= K:
        target_group = _target_group
ans = target_group[0]
l_target_group = len(target_group)
for i in range(1, l_target_group):
    ans = ans & target_group[i]
print(ans)


'''
for num in nums:
    n = []
    for i in range(l_b_max_nums):
        n.append('0')
    _b = bin(num)
    _b_nums = (list(_b))[2:]
    l_b_nums = len(_b_nums)
    for i in range(l_b_nums):
        n[len(n)-1-i] = _b_nums[l_b_nums - 1 - i]
    b_nums.append(n)

target_group = b_nums
for i in range(l_b_max_nums):
    l_target = len(target_group)
    _target_group = []
    for j in range(l_target):
        if b_nums[j][i] == '1':
            _target_group.append(b_nums[j])
    if len(_target_group) >= K:
        target_group = _target_group

ans = int("0b" + ''.join(target_group[0]), 2)
l_target_group = len(target_group)
for i in range(1, l_target_group):
    ans = ans & int("0b" + ''.join(target_group[i]), 2)
print(ans)
'''


Measured memory_bytes: 34604
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, d; cin >> a >> b >> c >> d;
    while(true){
        c -= b;
        if(c <= 0){
            cout << "Yes" << endl;
            return 0;
        }
        a -= d;
        if(a <= 0){
            cout << "No" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3572
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <utility>

using namespace std;

int main()
{
    long long n, k, x[100010],ans=99999999999999;
    cin>>n>>k;
    x[0]=0;
    for (int i=1; i<=n; i++)
    {
        cin>>x[i];
    }
    for (int i=1; i<=n-k+1; i++)
    {
        if (x[i]>0) ans=min(ans, x[i+(k-1)]);
        else if (x[i+(k-1)]<0) ans=min(ans, -x[i]);
        else ans=min(ans, min(x[i+(k-1)]-x[i]-x[i], x[i+(k-1)]-x[i]+x[i+(k-1)]));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
H, W = map(int, input().split())
S = []
def Scal(H, W):
    for i in range(1, (H//2)+1):
        S1 = W * i
        S2 = W * ((H-i)//2)
        S3 = H * W - S1 - S2
        s1 = [S1, S2, S3]
        S.append(s1)
        S2 = W//2 * (H-i)
        S3 = H * W - S1 - S2
        s2 = [S1, S2, S3]
        S.append(s2)
    
Scal(H, W)
Scal(W, H)
Sdif = []
for i in range(len(S)):
    Sdif.append(max(S[i])-min(S[i]))
print(min(Sdif))


Measured memory_bytes: 47312
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n;i>0;i--)
#define rep1(i,s,n) for(int i=s;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<string> svec;

const ull mod=998244353;

ull f(ull n,ull m){
    ull p=1;
    for(int i=0;i<m;i++){
        p*=n;
        p%=mod;
    }
    return p;
}

int main(){
    ull n,ans=1,k=2;
    cin>>n;
    ulvec d(n),dis(n,0);
    bool flag=true;
    rep(i,n) {
        cin>>d[i];
        if(i!=0&&d[i]==0) flag=false;    
    }
    if(d[0]!=0) cout<<0;
    else if(!flag) cout<<0;
    else if(n==1) cout<<1;
    else if(n==2){
        if(d[1]==1) cout<<1;
        else cout<<0;
    }
    else{
        sort(d.begin(),d.end());
        for(int i=0;i<n-1;i++){
            if(d[i+1]-d[i]>1) flag=false;
        }
        for(int i=1;i<n;i++) dis[d[i]]++;
        while(dis[k]!=0){
            ans*=(f(dis[k-1],dis[k]))%mod;
            if(ans>=mod) ans%=mod;
            k++;
            if(k==n) break;
        }
        if(flag) cout<<ans;
        else cout<<0;
    }
}

Measured memory_bytes: 1792
/**
 * File    : C.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-7-1 20:31:24
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <random> // random_device rd; mt19937 mt(rd());
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
// const ll M = 1000000007;

int N;
ll A[200010];

int main()
{
  cin >> N;
  for (auto i = 0; i < N; i++)
  {
    cin >> A[i];
    A[i] -= i + 1;
  }
  sort(A, A + N);
  ll b = A[N / 2];
  ll ans = 0;
  for (auto i = 0; i < N; i++)
  {
    ans += abs(A[i] - b);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
import std.algorithm;
import std.array;
import std.bigint;
import std.bitmanip;
import std.conv;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

// 差の絶対値
@nogc @safe pure T diff(T)(const ref T a, const ref T b) { return a > b ? a - b : b - a; }

// 切り上げ除算
@nogc @safe pure T divCeil(T)(const ref T a, const ref T b) {
    return (a+b-1)/b;
}

T[] readToArray(T)() {
    return readln.split.to!(T[]);
}

void readInto(T...)(ref T ts) {
    auto ss = readln.split;
    foreach(ref t; ts) {
        t = ss.front.to!(typeof(t));
        ss.popFront;
    }
}

// 冪乗をmod取りつつ計算
@nogc @safe pure ulong modPow(ulong a, ulong n, ulong m) {
    ulong r = 1;
    while (n > 0) {
        if(n % 2 != 0) r = r * a % m;
        a = a * a % m;
        n /= 2;
    }
    return r;
}

// フェルマーの小定理から乗法逆元を計算
// 定理の要請により法は素数
@nogc @safe pure ulong modInv(ulong a, ulong m) {
    return modPow(a, m-2, m);
}

// mod取りつつ順列を計算
@nogc @safe pure ulong modPerm(ulong n, ulong k, ulong m) {
    if (n < k) return 0;

    ulong r = 1;
    for (ulong i = n-k+1; i <= n; i++) {
        r *= i;
        r %= m;
    }
    return r;
}

// mod取りつつ順列を計算
@nogc @safe pure ulong modFact(ulong n, ulong m) {
    return modPerm(n, n, m);
}

// mod取りつつ組み合わせを計算
// modInvを使っているので法は素数
@nogc @safe pure ulong modComb(ulong n, ulong r, ulong m) {
    return modPerm(n, r, m)*modInv(modFact(r, m), m) % m;
}

immutable ulong MOD = 1000000007;

void main() {
    ulong n;
    readInto(n);
    double[] vs = readToArray!(double);
    sort!("a < b")(vs);
    for(int i = 1; i < vs.length; i++) {
        vs[i] = (vs[i-1]+vs[i])/2;
    }
    writefln("%.10f", vs[vs.length-1]);
}


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

using namespace std;

int main()
{
    int n,x,t;
    scanf("%d %d %d",&n,&x,&t);
    printf("%d\n",(n+x-1)/x*t);
    return 0;
}

Measured memory_bytes: 3260
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL-1
double EPS=1e-9;
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef complex<double> P;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

/*
cin >> n;
vi a(n);
rep(i,n)cin>>a[i];
*/
int main(){
	int N;
	cin>>N;
	vector<ll> a(N);
	ll sum=(ll)0;
	for(int i=0;i<N;i++){
		cin>>a[i];
		sum+=a[i];
	}
	a.pb(a[0]);
	ll mo = (ll)N;
	ll suma = mo*(mo+(ll)1)/(ll)2;
	if(sum%suma == 0){
		ll hoge=sum/suma;
		ll cnt=0;
		bool flag=true;
		for(int i=0;i<N;i++){
			ll x=hoge-a[i+1]+a[i];
			//cout << x << endl;
			if(x%mo!=0){
				cout<<"NO"<<endl;
				return 0;
			}
			if(x<(ll)0){
				cout<<"NO"<<endl;
				return 0;
			}
			cnt=cnt+x/mo;
		}
		//cout<<cnt<<" "<<hoge<<endl;
		if(cnt==hoge)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
}


Measured memory_bytes: 1920
i = input().split(' ')

W = int(i[0])
H = int(i[1])
x = int(i[2])
y = int(i[3])
r = int(i[4])

if x - r >= 0 and y - r >= 0 and x + r <= W and y + r <= H:
    print('Yes')
else:
   print('No')

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

using namespace std;

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


Measured memory_bytes: 256
/************************************/
//
//????????¢?????????????????????????????????????????????????????°??????
//????????¢?????????????????????????????¨??????????????????????????§?¨? (W,H)????????????????????????????????????????????????????????§?¨?(x,y)??¨??????r??§????????????????????? 
//
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_2_D&lang=jp
/************************************/

#include<stdio.h>

#define Circle_MIN -100
#define Circle_MAX 100
#define Rect_MIN 0
#define Rect_MAX 100

int main()
{
	int W,H,x,y,r;
	
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	
	if(x>=Circle_MIN && x<=Circle_MAX &&
		y>=Circle_MIN && y<=Circle_MAX &&
		W>Rect_MIN && W<=Rect_MAX &&
		H>Rect_MIN && H<=Rect_MAX &&
		r>Rect_MIN && r<=Rect_MAX)
	{
		if(x+r<=W && x-r>=0 && y+r<=H && y-r>=0)
		{
			printf("Yes\n");
		}
		else
		{
			printf("No\n");
		}
	}
	else
	{
		/* ERROR */
		return -1;
	}
	
	return 0;
}

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


int main()
{
    int N;
    cin >> N;
    vector<int> A(N+1), B(N);
    for(int i = 0; i <= N; ++i) cin >> A[i];
    for(int i = 0; i < N; ++i) cin >> B[i];

    long long ans = 0;
    for(int i = 0; i <= N; ++i){
        if(A[i] >= B[i]){
            ans += B[i];
        }else{
            ans += A[i];
            if(i < N and B[i]-A[i] <= A[i+1]){
                ans += B[i]-A[i];
                A[i+1] -= B[i]-A[i];
            }else if(i < N and B[i]-A[i] > A[i+1]){
                ans += A[i+1];
                A[i+1] = 0;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>

int main(){
    ll N, M;
    cin >> N >> M;
    VS s(N);
    rep(i, 0, N){
        cin >> s[i];
    }
    rep(j, 0, N){
        cout << s[j] << endl;
        cout << s[j] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define db(a) cout << fixed << #a << " = " << a << endl;

using namespace std;

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


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string S, T;
	cin >> S >> T;
	int c = 0;
	for (int i = 0; i < (int) S.size(); i++) {
		if (S[i] != T[i]) c++;
	}
	cout << c << endl;
}



Measured memory_bytes: 3816
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vc = vector<char>; using vvc = vector<vc>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;


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


  int A1,A2,A3; cin>>A1>>A2>>A3;

  string ans = A1+A2+A3 >= 22 ? "bust" : "win";
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

		int h = sc.nextInt();
		int w = sc.nextInt();
		char map[][] = new char[h][w];	
		
		for(int i=0;i<h;i++) {
			str = sc.next();
			for(int j=0;j<w;j++)
				map[i][j] = str.charAt(j);
		}
		
		for(int i=0;i<h;i++) {
			for(int j=0;j<w;j++) {
				if(map[i][j] != '#') {
					cnt = 0;
					
					for(int x=-1;x<=1;x++) {
						for(int y=-1;y<=1;y++) {
							if( j+x<0 || w<=j+x || i+y<0 || h<=i+y || (x==0 && y==0) )
								continue;
							if( map[i+y][j+x]=='#' )
								cnt++;
						}
					}
					// int→charの変換(ASCIIコードで「(int)49→(char)'1'」だから)
					// もっと適切な方法がありそう
					map[i][j] = (char)(cnt+48);
				}
			}
		}
		
		for(int i=0;i<h;i++) {
			str = String.valueOf(map[i]);
			System.out.println(str);
		}
		
	}
}
	
	


Measured memory_bytes: 22996
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
const LL N = 1000000007;

LL dp[3005][3005] = {0};
LL pre[3005] = {0};
LL n;
char c[3005] = {0};

int main(){
	cin >> n;
	for(LL i = 2;i <= n;i ++) cin >> c[i];
	dp[1][1] = 1;
	for(LL i = 2;i <= n;i ++){
		for(LL j = 1;j <= i;j ++) pre[j] = (pre[j - 1] + dp[i - 1][j]) % N;
		for(LL j = 1;j <= i;j ++){
			if(c[i] == '>') dp[i][j] = pre[i - 1] - pre[j - 1];
			if(c[i] == '<') dp[i][j] = pre[j - 1];
			dp[i][j] = (dp[i][j] + N) % N;
		}
	}
	LL ans = 0;
	for(LL i = 1;i <= n;i ++) ans = (ans + dp[n][i]) % N;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 69120
#include<stdio.h>
main( )
{
  int num;
  int i = 0 ;

  while(1)
    {
      ++i;
      
      scanf("%d", &num);
      if( num == 0)
	break;

      printf("Case %d: %d\n", i, num);

    }


  return 0;


}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    int n, m;
    cin >> n >> m;
    if (n == m) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define uniq(x) (x).erase(unique(all(x)),(x).end())

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const int MAX = 64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;

vector <ll> v;
map <ll, int> mp;
ll nck[MAX][MAX];


void solve(void){
    int N, A, B;
    cin >> N >> A >> B;
    rep(N, i) {
        ll V; scanf("%lld", &V);
        v.pb(V); mp[V]++;
    }
    sort(all(v));
    reverse(all(v));
    int cnt = 0, i = 0;
    double sum = 0;
    while (1) {
        if (cnt + mp[v[i]] >= A) {
            sum += v[i]*(A-cnt);
            break;
        }
        cnt += mp[v[i]];
        sum += v[i]*mp[v[i]];
        i+=mp[v[i]];
    }

    rep(MAX, n) nck[n][0] = 1;
    rep(MAX-1, n) rep(MAX-1, k) {
        nck[n+1][k+1] = nck[n][k] + nck[n][k+1];
    }

    int l = A - cnt, n = mp[v[0]];
    ll comb = 0LL;
    if (i == 0) {
        int r = min(B, n);
        Rep(l, r, x) comb += nck[n][x];
    }
    else {
        comb += nck[mp[v[i]]][l];
    }
    printf("%.6lf\n%lld\n", sum/A, comb);
}

int main(void){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
 
int main() {
 
  char ch[1200];
  int i,n;
  n=0;
  char a[1200];
 
  while(1) {
    scanf("%c",&a[n]);
    if(a[n] == '\n') {
      break;
    }
    ch[n] = a[n];
    if('A' <= a[n] && a[n] <= 'Z') {
      ch[n] = a[n] + 32;
    } else if(a[n] >= 'a' && a[n] <= 'z') {
      ch[n] = a[n] - 32;
 
    }
     
     
    n = n +1;
     
  }
   
  for(i=0; i<n ; i++) {
    printf("%c" ,ch[i]);
  }
  printf("\n"); 
  return 0;
   
}


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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b,c;
    cin >> a >> b >> c;
    cout << min(c,b/a) << "\n";
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
 
int main(void) {
	int n;
 
	int hoge[9] = {111,222,333,444,555,666,777,888,999};
 
 	if( scanf("%d", &n) == 1);

 
	if(n < 100 || n > 999) {
		exit(0);
	}
 
	for(int i = 0;i <  9;i++) {
		if(n <= hoge[i]) {
			printf("%d\n", hoge[i]);
			break;
		}
	}
	return 0;
}

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

int main(){
  char c;
  cin >> c;
  if('A' <= c && c <= 'Z') cout << 'A' << endl;
  else if('a' <= c && c <= 'z') cout << 'a' << endl;
  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 998244353;
const int maxn = 2e5 + 10;
int n, m, k;
ll fac[maxn], inv[maxn], facinv[maxn], bin[maxn];
void pre()
{
	fac[0] = 1; for(int i = 1; i < maxn; ++i) fac[i] = fac[i - 1] * i % mod;
	inv[1] = 1; for(int i = 2; i < maxn; ++i) inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	facinv[0] = 1; for(int i = 1; i < maxn; ++i) facinv[i] = facinv[i - 1] * inv[i] % mod;
	bin[0] = 1; for(int i = 1; i < maxn; ++i) bin[i] = bin[i - 1] * 2 % mod;
}
ll C(int n, int m) { return n < m ? 0 : fac[n] * facinv[m] % mod * facinv[n - m] % mod;}
int main()
{
	pre();
	scanf("%d%d%d", &n, &m, &k);
	ll cur = m, ans = 0;
	for(int i = 2; i <= n - k; ++i) cur = cur * (m - 1) % mod;
	for(int i = n - k; i <= n; ++i)
	{
		ans = (ans + cur * C(n - 1, i - 1) % mod) % mod;
		cur = cur * (m - 1) % mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 10052
#include <iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
using namespace std;




int main() {
	int N;
	long int F[10000],P[10000];
	cin >> N;
	for (int i = 0; i < 10 * N; i++) {
		cin >> F[i];
	}
	for (int i = 0; i < 11 * N; i++) {
		cin >> P[i];
	}
	
	long long int W = -100000;

	for (int i = 1; i <1024 ; i++) {
		bitset<10> Q(i);
		long long int Y =0;
		
		for (int k = 0; k < N; k++) {
			bitset<10> mise(0);
			
			for (int I = 0; I < 10; I++) {
				int r = 9-I +10*k;
				if (F[r] == 1) {
					mise.set(I);
				}
			}
		
			
			bitset<10>andbit =Q&mise;
			
			Y+=P[andbit.count()+11*k];
			
			
		}
	
		if (i == 1) {
			W = Y;
		}
		if (W < Y) {
			W = Y;
			
		}
	}
	cout << W << endl;
 
	
	return 0;
}

Measured memory_bytes: 256