akhauriyash/Code-Regression huggingface dataset:
N, M = list(map(int, input().split()))

a = 1
b = 1+M

while(a < b) :
  print(a, b)
  a += 1
  b -= 1

a = M+2
b = 2*M+1
while(a < b) :
  print(a, b)
  a += 1
  b -= 1

Measured memory_bytes: 9240
//n個の整数 ai(i=1,2,...n)を入力し、それらの最小値、最大値、合計値を求めるプログラム
// Input
// １行目に整数の数 n が与えられます。２行目に n 個の整数 ai が空白区切りで与えられます。
// Output
// 最小値、最大値、合計値を空白区切りで１行に出力してください。

#include <stdio.h>

#define INPUT_MAX_NUMBER 10000

int main(void)
{
    //変数定義
    int iInputNumber;
    int iMin;
    int iMax;
    long long iSum;
    int iCount;
    int iBubleCount;
    int iTemporary;
    int aiData[INPUT_MAX_NUMBER];

    //変数の初期化
    iInputNumber = 0;
    iMax = 0;
    iMin = 0;
    iSum = 0;
    iTemporary = 0; 

    scanf ("%d",&iInputNumber);

    for (iCount = 0; iCount < iInputNumber; iCount++)
    {
        scanf("%d",&aiData[iCount]);
       // printf("%d ",aiData[iCount]); 
    }

    //バブルソート
    for (iCount = 0; iCount < iInputNumber; iCount++)
    {
        for (iBubleCount = iCount; iBubleCount < iInputNumber; iBubleCount++)
        {
            if (aiData[iCount] > aiData[iBubleCount])
            {
                iTemporary = aiData[iCount];
                aiData[iCount] = aiData[iBubleCount];
                aiData[iBubleCount] = iTemporary;
            }
            else if (aiData[iCount] == aiData[iBubleCount])
            {
                //何もしない
            }
            else
            {
                //何もしない
            }
            
        }
    }

    //合計値を計算
    for (iCount = 0; iCount < iInputNumber; iCount++)
    {
        iSum += aiData[iCount];
    }

    iMin = aiData[0];
    iMax = aiData[iInputNumber - 1];

    printf("%d %d %lld\n",iMin,iMax,iSum);
    


    return 0;
}


Measured memory_bytes: 2104
n=int(input())
sy=[[-1]*n for _ in range(n)]
ans=[0]
for j in range(n):
  for i in range(int(input())):
    x,y=map(int,input().split())
    sy[j][x-1]=y
for i in range(2**n):
  c=[]
  for j in range(n):
    c.append((i>>j)&1)  
  d=0  
  for i in range(n):
    if c[i]==1:
      for j in range(n):
        if sy[i][j]==-1:
          continue
        elif sy[i][j]==c[j]:
          continue
        else:
          d+=1
          break
    else:
      continue
  if d==0:
    ans.append(sum(c))
print(max(ans))    
      

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

int n, m;
int par[100001], cnt[100001];

int find(int u) {
    if (par[u] == u) {
        return u;
    }
    return par[u] = find(par[u]);
}

void merge(int u, int v) {
    u = find(u), v = find(v);
    if (u > v) swap(u, v);
    par[u] = par[v];
}

int main() {
    scanf("%d %d", &n, &m);
    for (int i = 0; i <= 100000; i++) {
        par[i] = i;
    }

    for (int i = 0; i < n; i++) {
        int k, x1;
        scanf("%d %d", &k, &x1);
        cnt[x1]++;
        while (--k) {
            int x2;
            scanf("%d", &x2);
            cnt[x2]++;
            merge(x1, x2);
        }
    }

    int mx = -1, idx;
    for (int i = 1; i <= m; i++) {
        if (cnt[i] > mx) {
            mx = cnt[i];
            idx = i;
        }
    }

    par[idx] = find(par[idx]);
    for (int i = 1; i <= m; i++) {
        par[i] = find(par[i]);
        if (cnt[i]) {
            if (par[idx] != par[i]) {
                puts("NO");
                return 0;
            }
        }
    }

    puts("YES");

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
using namespace std;
int main(){
	string S;
  	int count = 0;
  	cin >> S;
  	if(S[0] == '1'){count = count + 1;}
  	if(S[1] == '1'){count = count + 1;}
  	if(S[2] == '1'){count = count + 1;}
  	cout << count << endl;
  	
  	return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  int a;
  int ans = n;

  for (int i = 0; i < m; i++){
    cin >> a;
    ans -= a;
  }

  if (ans < 0) cout << "-1" << endl; 
  else cout << ans << endl;
}



Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <regex>
using namespace std;

long long N, M;

bool check(long long ans) {
    long long MM = M - ans * N;
    if (MM < 0) return false;
    if (MM % ans == 0) return true;
    else return false;
}

int main() {
    cin >> N >> M;

    if (N == 1) {
        cout << M << endl;
        return 0;
    }

    for (long long ans=101010101; ans >= 1; ans--) {
        if (check(ans)) {
            cout << ans << endl;
            return 0;
        }
    }
    
    return 0;
}

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

int main(){
    int x,i;
    cin>>x;
    vector<bool> v(x+1,0);
    v[1]=1;
    for(int b=2;b<=sqrt(x);b++){
        for(int p=2;pow(b,p)<=x;p++) v[pow(b,p)]=1;
    }
    for(i=x;;i--) if(v[i]==1) break;
    cout<<i<<endl;
    return 0;
}

Measured memory_bytes: 256
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
	Scanner scan = new Scanner(System.in);
	int count = 0;
	
	BufferedReader br =
    new BufferedReader(new InputStreamReader(System.in));

	String w = "";
    String line = "";
    while ((line = br.readLine()) != null) {
		if (w.isEmpty()) {
			w = line.toLowerCase();
			continue;
		}

		if ("END_OF_TEXT".equals(line)) {
			break;
		}

		String[] words = line.split(" ");
		for (int i = 0; i < words.length; i++) {
		if (w.equals(words[i].toLowerCase())) {
				count++;
			}
		}	    	
    }

	System.out.println(count);
}
}

Measured memory_bytes: 17164
import math
from functools import reduce

n, x = map(int, input().split())
a = list(map(int, input().split()))
a.append(x)
a.sort()

l = []
for i in range(n):
    l.append(a[i+1] - a[i])

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

print(gcd_list(l))



Measured memory_bytes: 92552
#include <iostream>
using namespace std;
int main()
{
  int n;
  cin >> n;
  int data[100];
  for (int i = 0; i < n; i++)
  {
    cin >> data[i];
  }
  for (int i = n - 1; i > 0; i--)
  {
    cout << data[i] << " ";
  }
  cout << data[0] << endl;
  return 0;
}


Measured memory_bytes: 3100
#pragma GCC optimize("Ofast")
#pragma GCC optimization ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define p 1000000007
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define LONGLONG_MAX 10000000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,m;
	cin>>n>>m;
	multiset<int>s;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		s.insert(x);
	}
	vector<pii>v(m);
	for(int i=0;i<m;i++){
		cin>>v[i].se>>v[i].fi;
	}
	sort(v.begin(),v.end());
	bool b=true;
	for(int i=m-1;i>=0&&b;i--){
		while(v[i].se--){
			int x=*s.begin();
			s.erase(s.begin());
			if(x<v[i].fi){
				s.insert(v[i].fi);
			}
			else{
				s.insert(x);
				b=false;
				break;
			}
		}
	}
	long long x=0;
	for(auto i:s){
		x=x+i;
	}
	cout<<x;
    return 0;
}

Measured memory_bytes: 5760
import java.util.*;

class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] h = new int[n + 2];
		int answer = 0;
		for (int i = 1; i <= n; i++) {
			h[i] = sc.nextInt();
		}
		int flag = 0;
		int flag2 = 0;

		int hoge = 0;
		int i = 1;
		while (flag == 0) {
			while (h[i] != 0 && i <= n) {
				hoge = h[i];
				h[i]--;
				i++;
				flag2++;
			}
			if (i == n + 1 && flag2 == 0) {
				flag++;
			} else if (i == n + 1) {
				flag2 = 0;
				i = 1;
				if (hoge != 0) {
					answer++;
				}
				hoge = 0;
			} else if (hoge != 0) {
				answer++;
				i++;
				hoge = 0;
			} else {
				i++;
				hoge = 0;
			}
		}
		System.out.print(answer);
		sc.close();
	}
}


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

#define N 500000

void merge();
void mergeSort();
int count=0;

int main(){
  int n, s[N], a;

  scanf("%d",&n);
  for(a = 0; a < n; a++){
    scanf("%d",&s[a]);
  }

  mergeSort(s,0,a);
  for(a = 0; a < n-1; a++) printf("%d ",s[a]);
  printf("%d\n",s[a]);
  printf("%d\n",count);

  return 0;
}

void merge(int *s, int left, int mid, int right){
  int n1 = mid - left;
  int  n2 = right - mid;
  int l[n1], r[n2], a, b, c;
  
  for(a = 0; a < n1; a++) l[a] = s[left+a];
  for(a = 0; a < n2; a++) r[a] = s[mid+a];
  l[n1] = 2147483647;
  r[n2] = 2147483647;

  a = b = 0;
  for(c = left; c < right; c++){
    count++;
    if(l[a] <= r[b]){
      s[c] = l[a];
      a++;
    }
    else{
      s[c] = r[b];
      b++;
    }
  }
}

void mergeSort(int *s, int left, int right){
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(s,left,mid);
    mergeSort(s,mid,right);
    merge(s,left,mid,right);
  }
}



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

int main() {
    int N;
    int A[110];
    int min = 1000000000;
    int max = 1;

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

    for (int i=1; i<N+1; ++i) {
      if (min > A[i]) min = A[i];
      if (max < A[i]) max = A[i];
    }

    cout << max - min << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s,t;
  cin >> s >> t;
  int size = min(s.size(),t.size());
  for (int i=0; i<size; i++) {
    cout << s.at(i) << t.at(i);
  }
  if (s.size() > t.size()) {
    cout << s.at(s.size()-1) << endl;
  } else if (s.size() < t.size()) {
    cout << t.at(t.size()-1) << endl;
  } else {
    cout << endl;
  }
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var S, str string
	fmt.Scan(&S, &str)
	S += S
	ans := strings.Index(S, str)
	if ans != -1 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}



Measured memory_bytes: 1124
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)

int N;
char s[123];

int main() {

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

	int r = 0, b = 0;

	rep(i, N) {
		if (s[i] == 'R') ++r;
		else ++b;
	}

	if (r > b) printf("Yes\n");
	else printf("No\n");
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int N=5e3+2;
int dp[N][N],pw2[N],inv2[N],sum[N][N];
void add(int &x,int y){
	x+=y;
	if(x>=mod){
		x-=mod;
	}
}
void sub(int &x,int y){
	x-=y;
	if(x<0){
		x+=mod;
	}
}
int mul(int x,int y){
	return (1ll*x*y)%mod;
}
int binpow(int x,int y){
	int tich=1;
	while(y){
		if(y&1){
			tich=mul(tich,x);
		}
		x=mul(x,x);
		y>>=1;
	}
	return tich;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m,i,j,k,l;
	cin>>n>>m;
	pw2[0]=1;
	for(i=1;i<=m+1;i++){
		pw2[i]=pw2[i-1];
		add(pw2[i],pw2[i-1]);
	}
	inv2[m+1]=binpow(pw2[m+1],mod-2);
	for(i=m+1;i>0;i--){
		inv2[i-1]=inv2[i];
		add(inv2[i-1],inv2[i-1]);
	}
	for(i=1;i<=m;i++){
		dp[0][i]=1;
		sum[0][i]=sum[0][i-1];
		add(sum[0][i],mul(mul(dp[0][i],i),inv2[i+1]));
	}
	for(i=1;i<=n;i++){
		for(j=1;j<=m;j++){
			dp[i][j]=mul(dp[i-1][j],j+1);
			add(dp[i][j],mul(sum[i-1][j-1],pw2[j]));
			sum[i][j]=sum[i][j-1];
			add(sum[i][j],mul(mul(dp[i][j],j),inv2[j+1]));
		}
	}
	cout<<dp[n][m];
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-12)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
bool LTE(double a,double b) { return equals(a,b) || a < b; }
bool LT(double a,double b) { return !equals(a,b) && a < b; }


class Point{
public:
  double x,y;

  Point(double x = 0,double y = 0): x(x),y(y){}

  Point operator + (Point p){return Point(x+p.x,y+p.y);}
  Point operator - (Point p){return Point(x-p.x,y-p.y);}
  Point operator * (double a){return Point(a*x,a*y);}
  Point operator / (double a){return Point(x/a,y/a);}
  Point operator * (Point a){ return Point(x * a.x - y * a.y, x * a.y + y * a.x); }

  bool operator < (const Point& p) const{ return !equals(x,p.x)?x<p.x:(!equals(y,p.y)&&y<p.y); }

  bool operator == (const Point& p)const{ return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS; }

};

ostream& operator << (ostream& os,const Point& a){ return os << "(" << a.x << "," << a.y << ")"; }

#define MAX 200
int n;
Point ps[MAX];

bool debug = 0;

struct Data {
  Point p;
  double arg;
  bool operator < ( const Data &d ) const {
    return LT(arg, d.arg);
  }
};

void compute() {
  vector<Data> vec;
  rep(i,n) {
    Data d;
    d.p = ps[i];
    d.arg = atan2(ps[i].y,ps[i].x) * 180.0 / M_PI;
    if( LT(d.arg,0) ) d.arg += 360.0;
    vec.push_back(d);
    d.arg += 360.0;
    vec.push_back(d);
  }
  sort(ALL(vec));

  if(debug) {
    cout << "---" << endl;
    rep(i,(int)vec.size()) {
      cout << vec[i].p << " : arg = " << vec[i].arg << endl;
    }
  }
  double maxi = 0;
  rep(L,n) {
    Point p = Point(0,0);
    REP(R,L,L+n) {
      p = p + vec[R].p;
      double delta = vec[R].arg - vec[L].arg;
      if( LT(180.0,delta) ) break;
      double dist = sqrt( p.x * p.x + p.y * p.y );
      if( LT(maxi,dist) ) maxi = dist;
    }
  }
  printf("%.20f\n",maxi);
}

int main() {
  cin >> n;
  rep(i,n) cin >> ps[i].x >> ps[i].y;
  compute();
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll lx[4] = {0, 0, 1, -1};
ll ly[4] = {1, -1, 0, 0};
ll dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};
void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}
ll lcm(ll a, ll b) {return (a*b)/__gcd(a, b); }

void solve()
{
    ll n;
    cin >> n;
    map<char, ll> mp;
    rep(i, n)
    {
        string s; cin >> s;
        mp[s[0]]++;
    }
    ll ans = 0;
    char a[] = {'M', 'A', 'R', 'C', 'H' };
    for(ll i = 0; i < 5; i++){
        for(ll j = i+1; j < 5; j++){
            for(ll k = j+1; k < 5; k++){
                ans += mp[a[i]]*mp[a[j]]*mp[a[k]];
            }
        }
    }
    cout << ans;
}
int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
h, w, k = map(int, input().split())
l=[list(input()) for _ in range(h)]

ans = 0

for h_bin in range(1 << h):
    for w_bin in range(1 << w):
        black_cnt = 0
        for i in range(h):
            for j in range(w):
                if (h_bin >> i & 1) == 1 and (w_bin >> j & 1) == 1 and l[i][j] == '#':
                   black_cnt += 1
        if k == black_cnt:
            ans += 1

print(ans)

Measured memory_bytes: 9040
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n,m=0,a=0,r=0,c=0,h=0;
    string s;
    long long ans;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s;
        if(s[0]=='M'){m++;}
        else if(s[0]=='A'){a++;}
        else if(s[0]=='R'){r++;}
        else if(s[0]=='C'){c++;}
        else if(s[0]=='H'){h++;}
    }
    ans=m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h;
    cout<<ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<stack>
#include<string.h>
#include<map>
#include<set>
#include<deque>
#include<queue>
#include<list>
#include<bitset>
#include<sstream>
#include<iterator>

#define ln     (int)1e6
#define pi     acos(-1.0)
#define pb     push_back
#define pf     push_front 1
#define mp     make_pair
#define F      first
#define S      second
#define INF    1000000000000000000
#define less  -1000000000000000000
#define intlim 2147483648
#define ll     long long
#define ull    unsigned long long
#define str    string
#define in     insert

#define ms(arr)    memset(arr,0,sizeof(arr))
#define msbool(arr)    memset(arr,true,sizeof(arr))
#define msINF(arr) memset(arr,INF,sizeof(arr))
#define case1(cs)  cout<<"Case "<<cs<<": "
#define case2(cs)  cout<<"Case "<<cs<<":\n"
#define lb         cout<<"\n";

#define vec vector
#define qu  queue
#define li  list
#define pq  priority_queue

#define fori(i,a,b) for(int i=0;i<b;i++)
#define ford(i,a,b) for(int i=b-1;i>=0;i--)
#define forc(ch);   for(char ch:str)

#define sc1(a)       scanf("%lld",&a)
#define sc2(a,b)     scanf("%lld %lld",&a,&b)
#define sc3(a,b,c)   scanf("%lld %lld %lld",&a,&b,&c)
#define sc4(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)

using namespace std;

int main()
{
    ll n;
    cin>>n;
    
    vec<ll>akash;
    fori(i,0,n){
        ll data;
        sc1(data);
        
        akash.pb(data);
    }
    
    sort(akash.begin(),akash.end());
        
    if(n<3){
        cout<<"0\n";
    }
    else{
        ll count=0;
        for(ll i=0;i<=n-3;i++){
            for(ll j=i+1;j<=n-2;j++){
                if(akash[i]<akash[j]){
                    for(ll k=j+1;k<=n-1;k++){
                        if(akash[j]<akash[k]){
                            
                            if(akash[i]+akash[j]>akash[k]){
                                count++;
                            }
                        }
                    }
                }
            }
        }
        cout<<count;lb
    }

    return 0;
}







     


 



 

   



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

int main()
{
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    int ans = 0;
    rep(i, N - 1) {
        if (S[i] == S[i + 1]) ans++;
    }
    ans += 2 * K;
    cout << min(N - 1, ans) << endl;

    return 0;
}

Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"math"
	"os"
	"strconv"
)

func main() {
	n := readInt()

	m := make([][]byte, n)
	for i := range m {
		m[i] = make([]byte, n)
	}

	for i := 0; i < n; i++ {
		a := readInt()

		for j := 0; j < a; j++ {
			x, y := readInt()-1, readInt()
			if y == 1 {
				m[i][x] = '1'
			} else {
				m[i][x] = '0'
			}
		}
	}

	all := int(math.Pow(2, float64(n)))
	format := "%0" + strconv.Itoa(n) + "b"
	ans := 0
	for i := 0; i < all; i++ {
		b := []byte(fmt.Sprintf(format, i))
		honest := 0

	LABEL:
		for k := range m {
			if b[k] == '0' {
				continue
			}
			honest++

			for l := range m[k] {
				if m[k][l] == 0 {
					continue
				}
				if m[k][l] != b[l] {
					honest = 0
					break LABEL
				}

			}
		}

		ans = max(ans, honest)
	}

	fmt.Println(ans)
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n;cin >> n;
    vl v(n);
    rep(i,n)cin >> v[i];
    ll ans=0;
    ll sum=0;
    ll r=0;
    rep(l,n){
        while(r<n&&(sum^v[r])==sum+v[r]){
            sum+=v[r];r++;
        }
        ans+=r-l;
        if(l==r)r++;
        else sum-=v[l];
    }
    cout <<ans <<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
const int mod = 1e9+7;
using namespace std;
int gt[1000002];
void prep()
{
	gt[1]=1;
	for(int i=2; i<=1e6; i++)
	{
		gt[i]=(gt[i-1]*i)%mod;
	}
}

int binpow(int n, int k, int mod)
{
	int m = n%mod, i=1, ans=1;
	{
		while(i<=k)
		{
			int temp=i&k;
			if(temp>0)
			{
				ans=(ans*m)%mod;
			}
			i<<=1, m=(m*m)%mod;
		}
	}
	return ans;
}

int rev_mod(int n, int mod)
{
	return binpow(n, mod-2, mod);
}

int C(int k, int n)
{
	if(k==0||k==n)
	{
		return 1;
	}
	else
	{
		
		return ((((gt[n]%mod)*rev_mod(gt[k], mod))%mod)*rev_mod(gt[n-k], mod))%mod;
	}
}
int path(int i,int j, int x, int y){
	if(i>x||j>y) return 0;
	return C((x-i),(x-i)+(y-j));
}
signed main(){
	prep();
	int n,m;
	cin>>n>>m;
	vector<pair<int,int>> blk;
	int c;
	cin>>c;
	blk.resize(c);
	for(int i=0;i<c;i++) 
	{
		cin>>blk[i].first>>blk[i].second;
		blk[i].first--;
		blk[i].second--;
	}
	sort(blk.begin(),blk.end());
	int res = C(n-1,m+n-2);
	int dp[c];
	for(int i=0;i<c;i++){
		dp[i] = path(0,0,blk[i].first,blk[i].second);
		for(int j=0;j<i;j++)
		dp[i] -= (dp[j]*path(blk[j].first,blk[j].second,blk[i].first,blk[i].second))%mod; 
		dp[i]%=mod;
		res-= (dp[i]*path(blk[i].first,blk[i].second,n-1,m-1))%mod;
		res%=mod;
	}
	if(res<0) res+=mod;
	cout<<res<<endl;
}

Measured memory_bytes: 8192
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <iterator>
#include <sstream>
#include <bits/stdc++.h>

using ll = long long;
using namespace std;
#define modmod 1000000007

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

int main(){
    ll x,y;
    cin >> x >> y;

    ll result;

    if(abs(x)<abs(y)){
        result = abs(y)-abs(x);
        if(x<0){
            result++;
        }
        if(y<0){
            result++;
        }
    }else if(abs(x)==abs(y)){
        cout << 1 << endl;
        return 0;
    }else{
        result = abs(x)-abs(y);
        if(x>0){
            result++;
        }
        if(y>0){
            result++;
        }
    }

    cout << result << endl;
    return 0;

}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace ABC119D
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            long[] ABQ = Console.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
            long A = ABQ[0];
            long B = ABQ[1];
            long Q = ABQ[2];

            long[] S = new long[A];
            for (int i = 0; i < A; i++)
            {
                S[i] = long.Parse(Console.ReadLine());
            }

            long[] T = new long[B];
            for (int i = 0; i < B; i++)
            {
                T[i] = long.Parse(Console.ReadLine());
            }

            long[] X = new long[Q];
            for (int i = 0; i < Q; i++)
            {
                X[i] = long.Parse(Console.ReadLine());
            }

            Array.Sort(S);
            Array.Sort(T);
            for (int i = 0; i < Q; i++)
            {
                Console.WriteLine(solve(S, T, X[i]));
            }
        }

        private static long solve(long[] S, long[] T, long X)
        {
            int skey = binary_search(S, X);
            int tkey = binary_search(T, X);
            long sleft = skey == 0 ? long.MinValue/6 : S[skey - 1];
            long sright = skey == S.Length ? long.MaxValue/6 : S[skey];
            long tleft = tkey == 0 ? long.MinValue/6 : T[tkey - 1];
            long tright = tkey == T.Length ? long.MaxValue/6 : T[tkey];
            return calc(sleft, sright, tleft, tright, X);
        }

        private static int binary_search(long[] array, long key)
        {
            int ng = -1;
            int ok = array.Length;

            while (Math.Abs(ok - ng) > 1)
            {
                int mid = (ok + ng) / 2;
                if (isOk(mid, key, array))
                {
                    ok = mid;
                }
                else ng = mid;
            }

            return ok;
        }

        private static Boolean isOk(int index, long key, long[] array)
        {
            return array[index] >= key;
        }

        private static long calc(long sleft, long sright, long tleft, long tright, long current)
        {
            long sl = Math.Abs(current - sleft);
            long sr = Math.Abs(sright - current);
            long tl = Math.Abs(current - tleft);
            long tr = Math.Abs(tright - current);

            long[] dis =
            {
                Math.Max(sr, tr),
                Math.Max(sl, tl),
                Math.Max(sr, tl) + Math.Min(sr, tl) * 2,
                Math.Max(sl, tr) + Math.Min(sl, tr) * 2
            };
            return dis.Min();
        }
    }
}

Measured memory_bytes: 20424
import java.util.Scanner;

public class Main{
	static int N;
	
	public static void main(String[] args){
		int[][] square = getSquare();
		int[][] dp = new int[100][100];
		dp[0][0] = square[0][0];

		for(int i = 1; i< N; i++){
			dp[0][i] = dp[0][i-1] + square[0][i];
			dp[i][0] = dp[i-1][0] + square[i][0];
		}
		for(int i = 1; i < N; i++){
			for(int j = 1; j < N; j++){
				dp[i][j] = Math.max(dp[i-1][j], dp[i][j-1]) + square[i][j];
			}
		}

		System.out.println(dp[N-1][N-1]);
	}

	static int[][] getSquare(){
		int[][] square = new int[100][100];
		Scanner sn = new Scanner(System.in);
		int ni = -1, nj = 0, esLen = 0;
		while(sn.hasNext()){
			String[] es = sn.nextLine().split(",");
			if(es.length > esLen) ni++;
			else nj++;
			esLen = es.length;
			int i = ni, j = nj;
			for(int k = 0; k < es.length; k++){
				square[i][j] = Integer.parseInt(es[k]);
				i--; j++;
			}
	
		}
		N = ni+1;
		return square;
	}

}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
int mod = 1000000000+7;

int main(){

	int d;
	cin>>d;
	int c[26];
	rep(i,26)cin>>c[i];
	//int lastd[26]={};
	int s[d][26];
	rep(i,d){
		rep(j,26){
			cin>>s[i][j];
		}
	}

	rep(i,d){
		cout<<1<<endl;
	}

}


Measured memory_bytes: 3668
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#define ll long long int
#define MOD 1000000007LL
using namespace std;
int main() {
    int n,c,k;
    int t[114514]={};
    cin>>n>>c>>k;
    for(int i=0;i<n;i++){
        cin>>t[i];
    }
    sort(t,t+n);
    int s=0;
    int ans=1;
    for(int i=0;i<n;i++){
        if((t[i]<=t[s]+k)&&(i-s+1<=c)){
            continue;
        }else{
            s=i;
            ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 640
n,l=map(int, input().split())

v=[]
for i in range(n):
    v.append(l+i)
if min(v)>=0:
    del v[0]
elif min(v)<0 and max(v)>=0:
    v.remove(0)
else:
    del v[-1]
print(sum(v))

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public class Dice {

		int[] dice = new int[6];

		/**
		 * サイコロを用意する
		 * @param nums
		 */
		public Dice(int[] nums) {
			dice = nums;
		}

		/**
		 * サイコロの状態を確認
		 */
		public int[] checkSurface() {
			return dice;
		}


		/**
		 * 入力された方向に移動
		 * @param order
		 */
		public void move(String order) {

			for(Character s : order.toCharArray()) {
				int buf;
		        switch(s){
		            case 'N':{
		                buf = dice[0];
		                dice[0] = dice[1];
		                dice[1] = dice[5];
		                dice[5] = dice[4];
		                dice[4] = buf;
		                break;
		            }
		            case 'E':{
		                buf = dice[0];
		                dice[0] = dice[3];
		                dice[3] = dice[5];
		                dice[5] = dice[2];
		                dice[2] = buf;
		                break;
		            }
		            case 'W':{
		                buf = dice[0];
		                dice[0] = dice[2];
		                dice[2] = dice[5];
		                dice[5] = dice[3];
		                dice[3] = buf;
		                break;
		            }
		            case 'S':{
		                buf = dice[0];
		                dice[0] = dice[4];
		                dice[4] = dice[5];
		                dice[5] = dice[1];
		                dice[1] = buf;
		                break;
		            }
		            case 'R': {
		            	buf = dice[1];
		            	dice[1] = dice[2];
		            	dice[2] = dice[4];
		            	dice[4] = dice[3];
		            	dice[3] = buf;
		            }
		        }
			}
		}

		/**
		 * 指定された状態になるまで回転を行う
		 * @param upper
		 * @param flont
		 * @return dice サイコロの状態
		 */
		public int[] checkRight(int upper, int front) {

			// 上面が指定の面になるまで回転
			for(int i=0; i<3; i++) {
				if(dice[0] == upper) break;
				move("W");
			}
			if(dice[0] != upper) {
				for(int i=0; i<3; i++) {
					if(dice[0] == upper) break;
					move("E");
				}
			}

			// 正面が指定の面になるまで回転
			for(int i=0; i<4; i++) {
				if(dice[1] == front) break;
				move("R");
			}

			return dice;
		}

	}


	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[] nums = new int[6];
		for(int i=0; i<6; i++) {
			nums[i] = sc.nextInt();
		}

		String order = sc.next();

		sc.close();

		Dice dice = new Main().new Dice(nums);
		dice.move(order);

		System.out.println(dice.checkSurface()[0]);
	}

}



Measured memory_bytes: 26268
import sys
input = sys.stdin.readline

N = int(input())
nums = list(map(int, input().split()))
colors = [0]*9
mi = 0
ma = 0

for i in range(N):
    a = nums[i]
    if a < 400:
        colors[0] += 1
    elif a < 800:
        colors[1] += 1
    elif a < 1200:
        colors[2] += 1
    elif a < 1600:
        colors[3] += 1
    elif a < 2000:
        colors[4] += 1
    elif a < 2400:
        colors[5] += 1
    elif a < 2800:
        colors[6] += 1
    elif a < 3200:
        colors[7] += 1
    else:
        colors[8] += 1

for j in range(8):
    if colors[j] > 0:
        mi += 1
ma = mi
ma += colors[8]
if mi == 0:
    mi = 1

print(mi, ma)

Measured memory_bytes: 3064
k, a, b = map(int, input().split())

if (b - a) < 2:
    ans = 1 + k

else:
    ans = a
    if (k-a-1) % 2 == 0:
        ans += (b - a) * int((k-a+1) / 2)
    else:
        ans += (b - a) * int((k-a) / 2) + 1

print(ans)


Measured memory_bytes: 3064
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        pw.println(sc.next().toInt() * sc.next().toInt())
    }
}


Measured memory_bytes: 36416
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main() {
	int A,B,C;
  cin >> A >> B>>C;
  int ans=0;

  ans=A*10+B+C;
  if(ans<B*10+C+A){ans=B*10+C+A;
  }
  if(ans<C*10+B+A){ans=C*10+B+A;
  }

 cout << ans << endl;
}


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

#define forn(l, r) for (int i = l; i < (r); ++i)
#define F first
#define S second
#define MAXN 212345
#define INF 0x3f3f3f3f3f3f3f3fLL

typedef long long int ll;


using namespace std;

bitset<10> numbers;

bool valid(int x){
    while(x){
        if(numbers.test(x%10)) return false;
        x /= 10;
    }
    return true;
}

int32_t main() {

    ios::sync_with_stdio(0);

    int n, k;

    cin >> n >> k;

    int d;

    forn(0, k){
        cin >> d;
        numbers.set(d);
    }

    while(!valid(n)) ++n;


    cout << n << endl;

}


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

class CARD
{
public:
    CARD(){}
    CARD(CARD &card)
    : suit(card.suit), value(card.value) {}

    char suit;
    int  value;

    bool operator > (CARD target)
    {
        if (value > target.value) return true;
        else                      return false;
    }

    bool operator < (CARD target)
    {
        if (value < target.value) return true;
        else                      return false;
    }

    bool operator != (CARD target)
    {
        if (value != target.value) return true;
        else                       return false;
    }
};

int bubbleSort(CARD A[], int N)
{
    bool flag = true;
    while (flag)
    {
        flag = false;

        for (int j = N-1; j > 0; j--)
        {
            if (A[j] < A[j-1])
            {
                CARD temp = A[j];
                A[j]   = A[j-1];
                A[j-1] = temp;
                flag = true;
            }
        }
    }
}

void selectionSort(CARD A[], int N)
{
    for (int i = 0; i < N; i++)
    {
        int minj = i;

        for (int j = i; j < N; j++)
        {
            if (A[j] < A[minj])
            {
                minj = j;
            }
        }

        CARD temp = A[i];
        A[i] = A[minj];
        A[minj] = temp;
    }
}

void printDeck(CARD deck[], int num)
{
    for (int i = 0; i < num; i++)
    {
        std::cout << deck[i].suit << deck[i].value;

        if (i < num - 1) std::cout << " ";
        else             std::cout << std::endl;
    }
}

int main()
{
    int num;
    std::cin >> num;

    CARD *bubbleDeck    = new CARD[num];
    CARD *selectionDeck = new CARD[num];
    for (int i = 0; i < num; i++)
    {
        std::string input;
        std::cin >> input;
        bubbleDeck[i].suit  = input[0];
        bubbleDeck[i].value = input[1] - 0x30;
        selectionDeck[i].suit  = input[0];
        selectionDeck[i].value = input[1] - 0x30;
    }

    bubbleSort(bubbleDeck, num);
    printDeck(bubbleDeck, num);
    std::cout << "Stable" << std::endl;

    selectionSort(selectionDeck, num);
    printDeck(selectionDeck, num);

    for (int i = 0; i < num; i++)
    {
        if (bubbleDeck[i].suit != selectionDeck[i].suit)
        {
            std::cout << "Not stable" << std::endl;
            return 0;
        }
    }
    std::cout << "Stable" << std::endl;
}


Measured memory_bytes: 3160
#include<cstdio>
using namespace std;
int n,sum[110];
int main(){
    scanf("%d",&n);
    if(n==1)
	{
        printf("1\n");
        return 0;
    }
    sum[1]=2;
    for(int i=2;i<=100;i++)
        sum[i]=sum[i-1]*2;
    for(int i=1;i<=100;i++)
	{
        if(n<sum[i+1]&&n>=sum[i])
		{
        	printf("%d\n",sum[i]);
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(num) cerr << #num << " " << num << endl;
#define F0(itr, limit) for(int itr=0;itr<limit;itr++) 
#define F(itr, init, limit) for(int itr=init;itr<limit;itr++) 
#define FR(itr, init, limit) for(int itr=init;itr>limit;itr--) 
#define Fll(itr,limit) for(long long itr=0;itr<limit;itr++) 
#define coutarr(list_name) for(auto it: list_name) cout << it << " ";
#define cinarr(list_name) for(auto &it: list_name) cin >> it;
#define sz(list_name) (int)((list_name).size())
#define all(list_name) (list_name).begin(), (list_name).end()
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int>>
#define vvll vector<vector<ll>>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define umap unordered_map
#define endl "\n"
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
using namespace std;
// "If I die here, then I'm a man that could only make it this far."


int main()
{
    IOS;
	int n;
    cin >> n;
    vi a(n);
    cinarr(a);
    int ans = 0;
    F0(i, n)
    {
        if(!(i&1) && a[i] & 1) ans++;
    }
    cout << ans;
	return 0;
}


Measured memory_bytes: 3588
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();

      int[] a = new int[n+1];
      for(int i = 0; i < n+1 ; i++) {
        a[i] = sc.nextInt();
      }

      int[] b = new int[n];
      for(int i = 0; i < n ; i++) {
        b[i] = sc.nextInt();
      }

      
      long cnt = 0;
      for(int i = 0; i < n; i++) {
        if(a[i] > b[i]) {
          
          cnt+=b[i];
          a[i] = a[i] - b[i];
          b[i] = b[i] - b[i];


        } else {
          if(a[i] != 0) {
            cnt+=a[i];
            b[i] -= a[i];
            a[i] -= a[i];
          }
        }
        
    
        if(b[i] != 0) {
          if(a[i+1] > b[i]) {
            cnt+=b[i];
            a[i+1] -= b[i];
            b[i] -= b[i];
          } else {
            if(a[i+1]!=0) {
              cnt+=a[i+1];
              b[i] -= a[i+1];
              a[i+1] -= a[i+1];
            }
          }
        }

       
      }

      System.out.println(cnt);
    }
}

Measured memory_bytes: 64800
#include<stdio.h>
#include <string.h>
int main(void){
    char wat[7];
  	char sun[7] = "Sunny";
    char clo[7] = "Cloudy";
    char rai[7] = "Rainy";
    scanf("%s",wat);
    if(strcmp(wat,sun) == 0){
         printf("Cloudy");
    }else if(strcmp(wat,clo) == 0){
            printf("Rainy");
    }else if(strcmp(wat,rai) == 0){
            printf("Sunny");
    }
    return 0;
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <set>
#include <functional>
#include <cmath>
#include <set>
#include <map>


//マクロ
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
#define All(a) (a).begin(),(a).end()
#define RAll(a) (a).rbegin(),(a).rend()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e9
#define INFL 1e18
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<int, int>;
using Graph = vector<vector<int>>;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数

//使用する関数
template<class T>bool chmax(T &a, const T &b) {
	if (a < b) { a = b; return 1; }
	return 0;
}
template<class T>bool chmin(T &a, const T &b) {
	if (a > b) { a = b; return 1; }
	return 0;
}

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

	char a;
	cin >> a;

	if (a < 'a') {
		cout << "A" << endl;
	}
	else {
		cout << "a" << endl;
	}
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;
// auto mod int
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {if ((x += a.x) >= mod) x -= mod; return *this;}
  mint& operator-=(const mint a) {if ((x += mod-a.x) >= mod) x -= mod; return *this;}
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination mod prime
struct Combination {
  vector<mint> fact, ifact;
  Combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};


int main() {
  int n;
  cin >> n;
  ++n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  int l,r;
  vector<int> v(n+1,-1);
  rep(i,n){
    if(v[a[i]]!=-1){
      l = v[a[i]];
      r = i;
      break;
    }
    v[a[i]] = i;
  }

  Combination c(n);
  rep(i,n){
    int k = i+1;
    mint ans = c(n,k) - c(n-(r-l+1),k-1);
    cout << ans << endl;
  }
}

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

int main(){
  int N;
  cin >> N;
  string S;
  set<string> Slist;
  for (int i=0; i<N; i++) {
    cin >> S;
    Slist.insert(S);
  }
  cout << Slist.size() << endl;
}

Measured memory_bytes: 19200
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#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 <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

int main() {
    int N,M;cin >> N >> M;
    vector<P> retu(M);
    //終了が早い順に並べる区間スケジューリング問題にできる
    for(int i = 0;i<M;i++){
        cin >> retu.at(i).second >> retu.at(i).first;
    }
    sort(retu.begin(),retu.end());
    int avoidmaxi = 0;
    int ans = 0;
    for(int i = 0;i<M;i++){
        int left = retu.at(i).second;
        int right = retu.at(i).first;
        if(left > avoidmaxi){
            avoidmaxi = right-1;
            ans++;
        }
        //cout << left << " " << right << " " << ans << endl;
    }
    cout << ans << endl;
}


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

int main(){
  int v,r,i,j,x;
  scanf("%d",&v);

  int a[v],cnt=0;
  for(i=0; i<v; i++){
    scanf("%d",&a[i]);
  }

  scanf("%d",&r);

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

    scanf("%d",&x);

    for(j=0; j<v; j++){
      if(a[j]==x){
	    cnt++;
	    break;
      }
    }
  }
  
  printf("%d\n",cnt);
  
  return 0;
}




Measured memory_bytes: 2036
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

int N, T;
ll A[100010];

signed main(){
    cin >> N >> T;
    REP(i, N) cin >> A[i];
    priority_queue<ll> que;
    ll m = A[N - 1];
    for(int i = N - 1; i >= 0; i--){
        if(A[i] > m) m = A[i];
        else que.push(m - A[i]); 
    }
    ll M = que.top(), cnt = 0;
    while(que.top() == M){
        que.pop();
        que.push(M - 1);
        cnt++;
    }
    PRINT(cnt);
    return 0;
}

Measured memory_bytes: 2168