akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int ll
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

signed main() {
    int n, m;
    cin >> n >> m;
    int k[m], s[m][10];
    rep(i, 0, m) {
        cin >> k[i];
        rep(j, 0, k[i]) {
            cin >> s[i][j];
            s[i][j]--;
        }
    }
    int p[m];
    rep(i, 0, m) cin >> p[i];
    int ans = 0;
    for (int bit = 0; bit < (1 << n); bit++) {
        int sum = 0;
        rep(i, 0, m) {
            int cnt = 0;
            rep(j, 0, k[i]) {
                if (bit & (1 << s[i][j])) cnt++;
            }
            if (cnt % 2 == p[i]) sum++;
        }
        if (sum == m) ans++;
    }
    cout << ans << "\n";
}

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

int main(){
	int n,s,g;
	int seq[]={0,1,2,3,4,5,6,7,8,9,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,5,4,3,2,1,0};
	cin >> n;
	
	while(n--){
		cin >> s >> g;
		for(int i=0;i<32;i++){
			if(s<=5 && s>g){
				if(seq[10+i]==s){
					for(int j=10+i;j<32;j++){
						if(j!=10+i)cout << " ";
						cout << seq[j];
						if(seq[j]==g)break;
					}
					cout << endl;
					break;
				}
			}else{
				if(seq[i]==s){
					for(int j=i;j<32;j++){
						if(j!=i)cout << " ";
						cout << seq[j];
						if(seq[j]==g)break;
					}
					cout << endl;
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 0
n,m = map(int,input().split())
l = []
r = []
for i in range(m):
  A, B = list(map(int,input().split()))
  l.append(A)
  r.append(B)

min = 0
max = n
for i in range(m):
  if min < l[i]:
    min = l[i]
  if max > r[i]:
    max = r[i]

if max - min + 1 > 0:
  print(max - min + 1)
else:
  print(0)

Measured memory_bytes: 11068
#include<stdio.h>

int main(){
    float a,b,c,d,e,f,x,y;
    while(scanf("%f %f %f %f %f %f",&a,&b,&c,&d,&e,&f) != EOF){
        x = (f - (e/b) * c)/(d - (e/b) * a);
        y = (f - (d/a) * c)/(e - (d/a) * b);
        if(x == 0)x = 0;
        if(y == 0)y = 0;
        printf("%.3f %.3f\n",x,y);
    }
    return 0;
}

Measured memory_bytes: 648
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  ll N,A,B;
  cin >> N >> A >> B;
  v(ll) X(N);
  rep(i,N) {
    cin >> X[i];
  }
  ll sum = 0;
  rep(i,N-1) {
    if((X[i+1] - X[i]) * A < B) {
      sum += (X[i+1] - X[i]) * A;
    } else {
      sum += B;
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
	static void Main(){
		int[] s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		int N=s[0],W=s[1];
		long[,] dp=new long[N+1,W+1];
		for(int i=0;i<N;i++){
			int[] q=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
			int w=q[0],v=q[1];

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

Measured memory_bytes: 89056
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const long long mod = 998244353;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division

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;}

void solve(long long A, long long B, long long C, long long D){
    ll H = C-A;
    ll W = D-B;
    mint dp[H+1][W+1];
    dp[0][0] =1;
    for(int i=0;i<H;i++){
        dp[i+1][0] = (dp[i][0]*B);
    }
    for(int i=0;i<W;i++){
        dp[0][i+1] =(dp[0][i]*A);
    }
    for(int i=0;i<H;i++)for(int j=0;j<W;j++){
        dp[i+1][j+1] = dp[i+1][j]*(A+i+1)+dp[i][j+1]*(B+j+1) -(dp[i][j]*(A+i)*(B+j));
    }
    cout << dp[H][W] << endl;

}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long D;
    scanf("%lld",&D);
    solve(A, B, C, D);
    return 0;
}


Measured memory_bytes: 73976
#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>;
const int INF = 1000000000;
const int MOD = 1000000007;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

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

  ll ans = 0;
  ll money = 100;
  while(money < x){
    ans++;
    money += money / 100;
  }

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


Measured memory_bytes: 3620
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define PB(a,num) FOR(i,0,num) {ll x; scanf("%lld",&x); a.pb(x); }
#define LOWER(a,x) lower_bound(ALL(a), x) - a.begin() - 1;
#define COUNT(a,x)  upper_bound(ALL(a), x) - lower_bound(ALL(a), x);
#define MCOUNT(a,x,y) upper_bound(ALL(a), y) - lower_bound(ALL(a), x);
#define INF 111111111111111111
#define MOD 1000000007
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef set<ll> SET;
typedef map<ll, ll> MAP;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool flag, ok;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[8] = { 1,-1,0,0,1,1,-1,-1 }, ddy[8] = { 0,0,1,-1,1,-1,1,-1 };
#pragma endregion
#define MAX 111111



int main(void) {
  cin >> n >> m;
  if (llabs(n - m) > 1) {
	cout << "0" << endl;
	return 0;
  }

  ans = 1;
  FOR(i, 1, n + 1) (ans *= i) %= MOD;
  FOR(i, 1, m + 1) (ans *= i) %= MOD;
  if(n==m) (ans *= 2) %= MOD;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int i,count=0,kari;
  int h[10]={0};

  for(i=0;i<10;i++){
    scanf("%d",&h[i]);
  }
  while(1){
    for(i=0;i<9;i++){
      if(h[i]<h[i+1]){
	kari=h[i];
	h[i]=h[i+1];
	h[i+1]=kari;
	count++;
      }
    }
    if(count==0){
      break;
    }
    count=0;
  }
  for(i=0;i<3;i++){
    printf("%d\n",h[i]);
  }
  return 0;
}

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

using ll = long long;
using pp = pair<ll,ll>;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end()
#define pb(a,b) a.push_back(b)
//fixed << setprecision(20)
int main(){
	int n;
	cin >> n;
	int w[n];
	int g[n + 1] = {};
	for(int i = 0; i < n; i++){
		cin >> w[i];
		g[i + 1] = g[i] + w[i];
	}
	int mini = 99999;
	for(int i = 1; i < n; i++){
		mini = min(mini,abs(g[n] - g[i] - g[i]));
	}
	cout << mini << endl;
	return 0;
}

Measured memory_bytes: 256
local s = io.read()
local anum = 0
local num = 0
for i=1,string.len(s)-1 do
	local a = string.sub(s, i, i)
	local b = string.sub(s, i, i+1)
	if a == "A" then
		anum = anum + 1
	elseif  b == "BC" then
		num = anum + num
	else
		if i > 1 and string.sub(s, i-1, i) ~= "BC" then
			anum = 0
		end
	end
end
print(num)

Measured memory_bytes: 2748
#include <stdio.h>

#define SWAP(A,B) \
  { \
    char * G__1 = (A); \
    (A) = (B); \
    (B) = G__1; \
  }

char buf[ 2 ][ 16777216 ];

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  char  * dest = buf[ 0 ]
     ,  * src  = buf[ 1 ];

  for ( ; ; )
  {
    char  * d
       ,  * s;
    int n;

    fgets ( dest, 128, stdin );
    n = atoi ( dest );
    if ( !( n ) ) break ;
    fgets ( src, 128, stdin );

    while ( n-- )
    {
      int ctr = 0;

      d = dest;
      for ( s = src; isdigit ( *s ); ++s )
      {
        if ( s[ 0 ] == s[ 1 ] ) ++ctr ;
        else
        {
          d += sprintf ( d, "%d", ++ctr );
          *( d++ ) = *s;
          ctr = 0;
        }
      }
      *d = '\0';

      SWAP ( dest, src );
    }
    puts ( src );
  }

  return ( 0 );
}

Measured memory_bytes: 0
package main

import (
    "fmt"
)

func main() {
    var start, end, k int
    fmt.Scanf("%d %d %d", &start, &end, &k)

    numsLen := end - start + 1
    if numsLen <= k*2 {
        for i := start; i <= end; i++ {
            fmt.Println(i)
        }
    } else {
        for i := start; i < start + k; i++ {
            fmt.Println(i)
        }
        for i := end - k + 1; i <= end; i++ {
            fmt.Println(i)
        }
    }
}


Measured memory_bytes: 512
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
ans=[]
for i in range(X):
	j=0
	while((i+1)*(j+1)<K+1 and j<Y):
		k=0
		while((i+1)*(j+1)*(k+1)<K+1 and k<Z):
			ans.append(A[i]+B[j]+C[k])
			k+=1
		j+=1
ans.sort(reverse=True)
for i in range(K):
    print(ans[i])

Measured memory_bytes: 8708
#include <stdio.h>

int binarySearch(int A[], int key, int n){
	int left = 0;
	int right = n;
	while(left < right){
		int mid = (left + right)/2;
		if(A[mid] == key)return 1;
		if(A[mid] < key)left = mid + 1;
		if(A[mid] > key)right = mid;
	}  
	return 0;
}

int main(void) {
	int n;
	int S[100000];
	scanf("%d",&n);
	for(int i = 0; i < n; i++)scanf("%d", &S[i]);
	int q;
	scanf("%d",&q);
	int cnt = 0;
	for(int i = 0; i < q; i++){
		int temp;
		scanf("%d",&temp);
		cnt += binarySearch(S, temp, n);
	}
	printf("%d\n",cnt);
	return 0;
}



Measured memory_bytes: 2124
#include"bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
using namespace std;

#define double long double
#define int long long
#define pb push_back 
#define eb emplace_back
#define Z(c) (int)(c).size()
#define L(c) c[Z(c)-1]
#define F first
#define S second
#define nl "\n"
#define mii map<int,int> 
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define rep(i,iv,n) for(int (i)=(iv);(i)<(n);++(i))
#define FO fflush(stdout) 
#define D1(x) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<nl
#define D2(x,y) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<nl
#define D3(x,y,z) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<nl
#define tr(it,ct) for(auto &(it) : (ct))
#define pi acos(-1)
#define prt(ct) for(auto &(it) : (ct)) cerr<<it<<" "; cerr<<nl
#define prtp(ct) for(auto &(it) : (ct)) cerr<<it.F<<" "<<it.S<<nl; cerr<<nl

typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;
typedef pair<pii,pii> ppp;
typedef vector< pii > vp;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, 
             tree_order_statistics_node_update> baap;

void swap(char &a,char &b)
{ auto tm=a; a=b; b=tm; }

void mina(int &a,int b)
{ a=(a<b?a:b); }

void maxa(int &a,int b)
{ a=(a>b?a:b); }

  const int mod=1000000007;
  const int mod2=998244353;
  const int INF=1e18;
  const int N=1e5+15;
  const int M=2001+21;
  

 void doit()         
 { 
   int n; cin>>n; map<string,int> m;
   rep(i,0,n){
     string s; cin>>s;
     m[s]++;
   }

   cout<<Z(m);

 }


signed main()
{ 
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

 
   int tc=1;                         
//  cin>>tc;

  rep(i,1,tc+1)
  { // cout<<"Case #"<<i<<": ";
    
   doit();
   if(i<tc)
   cout<<nl;
  }
  

 return 0; 
}

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

int main() {
	int a,p,N,c=1,s=0;
	cin >> N >> a;
	p = a;

	rep(i,N-1) {
		cin >> a;
		if(p == a)
			++c;
		else {
			s += c/2;
			c = 1;
			p = a;
		}
	}

	cout << s+c/2 << endl;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
A=[int(input()) for i in range(M)]
for i in range(M-1):
    if A[i+1]-A[i]==1:
        print(0)
        exit()
kaidan=[1]*(N+1)
for i in A:
    kaidan[i]=0
for i in range(2,N+1):
    if kaidan[i]!=0:
        kaidan[i]=(kaidan[i-1]+kaidan[i-2])%(10**9+7)
print(kaidan[-1])

Measured memory_bytes: 7380
# AtCoder Beginner Contest 175
# B - Making Triangle

import bisect

N=int(input())
L=list(map(int,input().split()))

ans=0

for i in range (N):
    for j in range (i+1,N):
        for k in range (j+1,N):
            # print(i,j,k)
            a=min(L[i],L[j],L[k])
            c=max(L[i],L[j],L[k])
            b=(L[i]+L[j]+L[k]-a-c)
            if a+b>c and a<b<c:
                ans+=1

print(ans)

Measured memory_bytes: 9104
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
int ch(int x)
{
	int g[7]={1,3,5,7,8,10,12};
	if(x==2)return 3;
	for(int i=0;i<7;i++)if(g[i]==x)return 1;
	return 2;
}
int main()
{
	int x,y;
	scanf("%d%d",&x,&y);
	puts(ch(x)==ch(y)?"Yes":"No");
}


Measured memory_bytes: 256
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>

int main()
{
    int N;
    int count = 0;
    std::cin >> N;
    
    if (N % 10 == 2) count++;
    N /= 10;
    if (N % 10 == 2) count++;
    N /= 10;
    if (N % 10 == 2) count++;
    N /= 10;
    if (N % 10 == 2) count++;
    
    std::cout << count << std::endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <climits>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define in insert
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define f first
#define s second
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define int ll
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
using namespace std;

 
const ll INF = 1e12;
const ll N =(2000+5); // TODO : change value as per problem
const ll MOD = 1e9+7;

int dp[N][N];
int pre[N];
void solve(){
    int S;
    cin >> S;
    // dp[len][sum]
    for(int i = 3;i<=S;i++) dp[1][i] = 1;
    for(int i = 3;i<=S;i++){
        pre[i] = (pre[i-1] + dp[1][i])%MOD;
    }
    for(int i =2;i<=2000;i++){
        for(int j =3*i;j<=S;j++){
            dp[i][j] = (dp[i][j] + pre[j-3])%MOD;
            if(dp[i][j] < 0) dp[i][j] += MOD;
            dp[i][j]%=MOD;
            dp[i][j] = (dp[i][j] - pre[2])%MOD;
            if(dp[i][j] < 0) dp[i][j] += MOD;
            dp[i][j]%=MOD;
            // for(int k = 3;k<=j-3;k++){
            //     dp[i][j] = (dp[i-1][k] + dp[i][j])%MOD;
            //     if(dp[i][j] < 0)dp[i][j]+=MOD;
            //     dp[i][j]%=MOD;
            // }
        }
        
            for(int j = 1;j<=S;j++){
                pre[j] = 0;
            }
            for(int j = 1;j<=S;j++){
                pre[j] = (pre[j-1] + dp[i][j])%MOD;
                if(pre[j]  < 0)pre[j]+=MOD;
            }
    }
    int sum = 0;
    for(int i =1;i<=2000;i++){
        sum = (sum + dp[i][S])%MOD;
        if(sum < 0)sum+=MOD;
        sum%=MOD;
    }
    cout << sum << endl;
}
signed main(){
 
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
     // freopen(".in","r",stdin);freopen(".out","w",stdout);
    
     ll tt=1;   
     // cin >> tt;
    while(tt--){    
        solve();
    }    
}

Measured memory_bytes: 11156
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)


signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    int(n);
    int a[n]; scn(n, a);
    int res = 1234567890;
    for(i = -100;i <= 100;++i){
      int sum = 0;
      rep(j, n)sum += (a[j] - i) * (a[j] - i);
      res = min(res, sum);
    }
    pri(res);

/*/

//*/ break;
  }
  return 0;
}


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

typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)

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;
}

template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

int main() {
  ll N,ss=0;
  string s;
  cin >> N;
  s = toString(N);
  for (auto k:s) {
    ss += k-'0';
  }
  string ans;
  if (N%ss==0) ans = "Yes";
  else ans = "No";
  cout << ans << endl;
}

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

using namespace std;

const int maxN = 2e5 + 100;
const int module = 1e9 + 9;

void enter()
{
    freopen("solve.inp","r",stdin);
    freopen("solve.out","w",stdout);
}
void solve()
{
    int n;
    cin >> n;
    cout << 1LL * n * (n - 1) / 2;

}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
    //enter();
    solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <memory>
#include <algorithm>
using namespace std;

struct Node;
typedef shared_ptr<Node> NP;
struct Node {
  NP l, r;
};

void test() {
  for (int i = 0; i < 1000000; ++i) new Node();
}

int main() {
  test();
  int a, b, c;
  cin >> a >> b >> c;
  cout << ((a+b+c) == max({a,b,c})*2 ? "Yes" : "No") << endl;
  return 0;
}


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

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

    static class ITeet {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            String s = in.next();
            int n = s.length();
            out.println(s.charAt(0) + "" + (n - 2) + "" + s.charAt(n - 1));
        }

    }

    static class FastReader {
        BufferedReader reader;
        StringTokenizer st;

        public FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

    }
}



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

const int MAX_N = 100000;

int N;
int M;
int x[MAX_N + 1];

int gcd(int x, int y) {
  if (x % y == 0) return y;
  return gcd(y, x % y);
}

int main() {
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    cin >> x[i];
    x[i] = abs(x[i] - M);
  }
  sort(x, x + N, greater<int>());
  int ans = x[0];
  for (int i = 1; i < N; i++) {
    ans = gcd(ans, x[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;

int main(){
    int n;
    while(cin >> n && n != 0){
        int s[1000];
        double m = 0;
        for(int i = 0 ; i < n ; i++){
            cin >> s[i];
            m += s[i];
        }
        m = m / n;
        double a = 0;
        for(int i = 0 ; i < n ; i++){
            a += (s[i] - m) * (s[i] - m);
        }
        a = a / n;
        cout << fixed << setprecision(10) << sqrt(a) << endl;
    }
    return 0;
}


Measured memory_bytes: 3280
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <climits>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <type_traits>
#include <utility>
#include <vector>

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;
using intl32 = std::int_least32_t;
using intl64 = std::int_least64_t;
using uintl32 = std::uint_least32_t;
using uintl64 = std::uint_least64_t;

template<typename T>
T gcd(T m, T n)
{
	T temp = m;
	temp %= n;
	while (temp) {
		m = n;
		n = temp;
		temp = m%n;
	}
	return n;
}

int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	uint32 n, k;
	std::cin >> n >> k;
	std::vector<uint32> a(n);
	uint32 max = 0;
	for (uint32 i = 0;i < n;++i) {
		std::cin >> a[i];
		max = std::max(max, a[i]);
	}
	bool f;
	if (n == 1) {
		f = a[0] == k;
	}
	else {
		uint32 g = gcd(a[0], a[1]);
		for (uint32 i = 2;i < n;++i) {
			g = gcd(g, a[i]);
		}
		f = max >= k&&k%g == 0;
	}
	std::cout << (f ? "POSSIBLE" : "IMPOSSIBLE");
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<char,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


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

    int n, m, k;
    cin >> n >> m >> k;

    bool ok = false;
    rep(i, n+1){
        rep(j, m+1){
            int sum = i * (m-j) + j * (n-i);

            if(sum == k){
                ok = true;
            }
        }
    }


    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i,a,b) for(int i= a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef pair<pair<int, int>, int> P;
typedef vector<vector<int>> V;
int h, w;
vector<string> vec;

map<int, int> cnt;
vector<int> dx = {1, -1, 0, 0};
vector<int> dy = {0, 0, 1, -1};

int calc(V &seen) {
  int ans = 0;
  rep(i, h)rep(j, w) {
    ans = max(ans, seen.at(i).at(j));
  }
  return ans;
}

int main()
{
  cin >> h >> w;
  vec.resize(h);
  rep(i, h) cin >> vec.at(i);
  int ans = 0;
  rep(i, h)rep(j, w) {
    V seen(h, vector<int>(w, -1));
    if (vec.at(i).at(j) == '#') continue;
    queue<P> que;
    seen.at(i).at(j) = 0;
    que.push(P(make_pair(i, j), 0));
    while(!que.empty()) {
      P v = que.front(); que.pop();
      rep(k, 4) {
        int nx = dx.at(k) + v.first.second;
        int ny = dy.at(k) + v.first.first;
        if (nx < 0 || nx >= w || ny < 0 || ny >= h) continue;
        if (vec.at(ny).at(nx) == '#') continue;
        if (seen.at(ny).at(nx) == -1 || seen.at(ny).at(nx) > v.second + 1) {
          seen.at(ny).at(nx) = v.second + 1;
          que.push(P(make_pair(ny, nx), v.second + 1));          
        }
      }
    }
    ans = max(ans, calc(seen));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1 = Console.ReadLine();
            int n = int.Parse(s1);
            char suit;
            int number;
            char[] suit2 = new char[4] { 'S', 'H', 'C', 'D' };
            bool[,] cards = new bool[4, 13];
            for (int i = 0; i < n; i++)
            {
                string[] s2 = Console.ReadLine().Split(' ');
                suit = char.Parse(s2[0]);
                number = int.Parse(s2[1]);
                switch (suit)
                {
                    case 'S':
                        cards[0, number - 1] = true;
                        break;
                    case 'H':
                        cards[1, number - 1] = true;
                        break;
                    case 'C':
                        cards[2, number - 1] = true;
                        break;
                    case 'D':
                        cards[3, number - 1] = true;
                        break;
                }
            }

            for (int j = 0; j < 4; j++)
            {
                for (int k = 0; k < 13; k++)
                {
                    if (cards[j,k] == false)
                    {
                        Console.WriteLine(suit2[j] + " " + (k + 1));
                    }
                }
            }
        }
    }
}

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

#define chmin(x, y) x = min(x,y);

using namespace std;
const auto INF = (int) 1e9;

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

    vector<int> dp(1U << N, INF);
    dp[0] = 0;
    for (int i = 0; i < M; i++) {
        int price, num;
        cin >> price >> num;
        unsigned int bitmask = 0;
        for (int j = 0; j < num; j++) {
            unsigned int x;
            cin >> x;
            x--;
            bitmask |= (1U << x);
        }

        for (unsigned int j = 0; j < (1U << N); j++) {
            chmin(dp[j | bitmask], dp[j] + price);
        }
    }

    if (dp[(1 << N) - 1] == INF) {
        cout << -1 << endl;
    } else {
        cout << dp.back() << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N=int(input())
A=[[0]]
for i in range(N):
    a=list(map(int,input().split()))
    a+=[0]
    A.append(a)
    
#print(A)
B=[0 for i in range(N+1)]
C=[a for a in range(1,N+1)]
cnt=0
for i in range(10**6):
    D=[]
    F=0
    for j in C:
        if A[A[j][B[j]]][B[A[j][B[j]]]]==j and j not in D and A[j][B[j]] not in D:
            D.append(j)
            D.append(A[j][B[j]])
            B[A[j][B[j]]]+=1
            B[j]+=1
            F=1
            cnt+=1
            #print("A",i,B,D)
            #print(A[j][B[j]],B,D)
    if F==0:
        break
    D.sort()
    C=D
    
if cnt==N*(N-1)//2:
    print(i)
else:
    print(-1)

Measured memory_bytes: 53980
// ----------------------------------------------------------
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <numeric>

using namespace std;


int main(int argc, const char * argv[]) {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,L,ans;
    int zeroFlg = 0;
    
    cin >> N >> L;
    
    vector<int> w(N,0);
    
    for(int i=0;i<N;i++){
        w[i]=L+i;
        if(w[i]==0){
            zeroFlg=1;
        }
    }
    
    if(w[w.size()-1] < 0){
        zeroFlg=2;
    }
    
    int sum = std::accumulate(w.begin(), w.end(), 0);
    
    if(zeroFlg==1){
        ans=sum;
    }else if(zeroFlg==2){
        ans=sum-w[w.size()-1];
    }else{
        ans=sum-w[0];
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}

			System.out.println(Collections.max(integers) - Collections.min(integers));
		}
	}
}

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

int main(){
    int K,A,B; cin >> K >> A >> B;
    if(A%K==0 || B%K==0){
        cout << "OK" << endl;
    }else if(A/K < B/K){
        cout << "OK" << endl;
    }else{
        cout << "NG" << endl;
    }
}

Measured memory_bytes: 3612
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define PUT(x) cout << x << endl
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 200LL * 200 * 100000 + 10;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };

int a, b;
string s;

bool solve() {

	if (s[a] == '-') {
		s[a] = '0';
		for (int i = 0; i < s.size(); i++) {
			if (s[i] >= '0' && '9' >= s[i]) {

			}
			else {
				return false;
			}
		}
	}
	else {
		return false;
	}
	return true;

}

int main(void) {

	cin >> a >> b >> s;
	if(solve()){
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

const int mod = 1e9 + 7 ; 

int n , cnt[26] ; 
string s ; 

int32_t main() {
	cin >> n >> s ; 
	for(auto x : s)
		cnt[x - 'a']++ ; 
	long long res = 1 ; 
	for(int i = 0 ; i < 26 ; ++i)
		(res *= (cnt[i] + 1)) %= mod ; 
	cout << (res + mod - 1) % mod << endl ; 
}


Measured memory_bytes: 512
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    def dfs(u=0,pu=-1):
        w,b=1,1
        for v in to[u]:
            if v==pu:continue
            dfs(v,u)
            vw,vb=dp[v]
            w*=(vw+vb)
            b*=vw
        dp[u]=[w%md,b%md]

    md=10**9+7
    to=defaultdict(list)
    n=int(input())
    for _ in range(n-1):
        x,y=map(int1,input().split())
        to[x].append(y)
        to[y].append(x)
    dp=[[0]*2 for _ in range(n)]
    dfs()
    print(sum(dp[0])%md)

main()

Measured memory_bytes: 136600
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

#define AB 0
#define BA 1
#define AC 2
#define CA 3
#define BC 4
#define CB 5

inline int mostleft(int x){
  int ret = 0;
  if(x == 0) return -1;
  if(x & 0xff00){ ret += 8; x >>= 8; }
  if(x & 0x00f0){ ret += 4; x >>= 4; }
  if(x & 0x000C){ ret += 2; x >>= 2; }
  if(x & 0x0002){ ret += 1; x >>= 1; }
  return ret;
}

int n, m;
int solve(int a, int b, int c, int prev){
  int ret = 0;
  const int ok = (1 << n) - 1;

  while( ++ret < m ){
    //printf("ret=%d, prev=%d: %x %x %x\n",ret,prev,a,b,c);
    if(a == ok || c == ok) return ret;

    if(a < b && prev != AB){
      int g = 1<<mostleft(b);
      prev = BA;
      a ^= g;
      b ^= g;
    }else if(b < a && prev != BA){
      int g = 1<<mostleft(a);
      prev = AB;
      a ^= g;
      b ^= g;
    }else if(b < c && prev != BC){
      int g = 1<<mostleft(c);
      prev = CB;
      b ^= g;
      c ^= g;
    }else if(c < b && prev != CB){
      int g = 1<<mostleft(b);
      prev = BC;
      b ^= g;
      c ^= g;
    }
  }

  return m + 1;
}

int main(){
  int num[3];

  while((n = getInt()) + (m = getInt())){
    const int ok = (1 << n) - 1;
    REP(i,3){
      int t = getInt();
      num[i] = 0;
      REP(j,t){
        int h = getInt() - 1;
        num[i] |= (1 << h);
      }
    }

    int a = num[0];
    int b = num[1];
    int c = num[2];

    int ans = INT_MAX;

    if(a == ok || c == ok){
      puts("0");
      continue;
    }

    //printf("%x(%d) %x(%d) %x(%d)\n",a,mostleft(a),b,mostleft(b),c,mostleft(c));

    if(a < b){
      int g = 1<<mostleft(b);
      ans = min(ans, solve(a ^ g, b ^ g, c, BA));
    }
    if(b < a){
      int g = 1<<mostleft(a);
      ans = min(ans, solve(a ^ g, b ^ g, c, AB));
    }
    if(b < c){
      int g = 1<<mostleft(c);
      ans = min(ans, solve(a, b ^ g, c ^ g, CB));
    }
    if(c < b){
      int g = 1<<mostleft(b);
      ans = min(ans, solve(a, b ^ g, c ^ g, BC));
    }

    if(ans > m) puts("-1");
    else printf("%d\n",ans);

  }
  return 0;
}

Measured memory_bytes: 836
#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 DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define debug(...)
#endif
#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 ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define rall(c) c.rbegin(), c.rend()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
#define init(a, x) memset(a,x,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)
const int L=1e6+7;
map<ll,ll> counter;
ll fastexpo(ll x,ll y,ll m=1e9+7)
{
	ll temp=1;
	while(y>0)
	{
		if(y&1)temp = ((temp%m)*(x%m))%m;
		x = ((x%m)*(x%m))%m;
		y>>=1;
	}return temp;
}
void fff()
{
	ll x;
	cin >> x;
	cout << (!x)<<ln;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//int t;cin >> t;while(t--)
	fff();
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int a, b;
  cin >> a >> b;
  if(a == b) cout << "Draw" << endl;
  else if(a == 1) cout << "Alice" << endl;
  else if(b == 1) cout << "Bob" << endl;
  else if(a > b) cout << "Alice" << endl;
  else cout << "Bob" << endl;
}

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

int main(){
  int N;
  cin>>N;
  vector<string>S(N);
  for(int i=0;i<N;i++)cin>>S[i];
  
  sort(S.begin(),S.end());
  
  int ans;
  for(int i=0;i<N-1;i++){
    if(S[i]!=S[i+1]){
      ans++;
    }
  }
  
  cout<<ans+1<<endl;
}

Measured memory_bytes: 9660
#include <stdio.h>

int main(void){
  int a,b;
  scanf("%d %d", &a, &b);
  if(b==1)	printf("0");
  else if( (b-1)%(a-1)==0 )	printf("%d", (b-1)/(a-1));
  else	printf("%d", (b-1)/(a-1) + 1);
  return 0;
}

Measured memory_bytes: 128
import java.io.InputStreamReader
import java.io.BufferedReader

fun main(args: Array<String>) {
  val br = BufferedReader(InputStreamReader(System.`in`))

  br.readLine()

  val res = br.readLine().split(' ').map { it.toInt() }
    .fold(Pair(0, 1)) { acc, ai ->
      val (broken, cnt) = acc
      if(ai == cnt) Pair(broken, cnt + 1) else Pair(broken + 1, cnt)
    }

  val ans = if(res.second == 1) -1 else res.first
  println(ans)
}

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
int main() {
  int x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2;
  int x3,y3,x4,y4;
  int dx,dy;
  dx=x1-x2;
  dy=y1-y2;
  cout<<(x2+dy)<<" "<<(y2-dx)<<" "<<(x1+dy)<<" "<<(y1-dx)<<" "<<endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
N,K=map(int, sys.stdin.readline().split())
A=map(int, sys.stdin.readline().split())

#最大の長さがnの丸太にK回切ってすることができるか？
def func(n):
    cnt=0
    for a in A:
        #print "a :: ",a
        if a%n==0:
            cnt+=a/n-1
        else:
            cnt+=a/n
    if cnt<=K:
        return True
    else:
        return False

l=0
r=10**9
while 1<r-l:
    m=(l+r)/2
    if func(m):
        r=m
    else:
        l=m
print r

Measured memory_bytes: 100124
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(),(v).end())
typedef int64_t lint;
lint mod = 998244353;
template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

// https://drken1215.hatenablog.com/entry/2018/06/08/210000
const lint MAX = 200010;
const lint MOD = mod;
lint fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
lint COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/////////////////////

lint app() {
  lint n,m,k;
  cin>>n>>m>>k;

  lint ans=0;
  lint mseq=m;
  rep(nk,n-k-1){
    mseq=mseq*(m-1)%mod;
  }
  rep_rev(nk,k+1,0){
    ans+=mseq*COM(n-1,nk);
    ans%=mod;
    mseq=mseq*(m-1)%mod;
  }
  return ans;
}

int main(){
  COMinit();
  cout<<app()<<endl;return 0;}


Measured memory_bytes: 8300
#include<bits/stdc++.h>
#define pii pair<int,int>
#define F first
#define S second
#define mp make_pair
#define vi vector<int>
#define pb push_back
using namespace std;
long long n,ans;
int main()
{
	cin>>n;
	for(long long i=1;i*(i+2)<=n;i++)
		if(n%i==0)
			ans+=(n-i)/i;
	cout<<ans<<endl;
	return 0;
}

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


def main(n, k):
    # print(n, k)
    if n % k == 0:
        # print('n%k=0')
        res = 0
    else:
        # print(n % k, abs((n % k)-k), n)
        res = min(n % k, abs((n % k) - k), n)

    print(res)


main(N, K)
# main(7, 4)
# main(2, 6)
# main(1000000000000000000, 1)
# main(9, 6)


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

using namespace std ;

string s ;

bool u [ 100001 ] ;

int main ()
{
    cin >> s ;
    u [ 0 ] = 1 ;
    for ( int i = 0 ; i < s . size () ; ++ i ){
        if ( u [ i ] == 1 ){
        if ( s . substr ( i , 5 ) == "dream" ){
            u [ i + 5 ] = 1 ;
        }
        if ( s . substr ( i , 7 ) == "dreamer" ){
            u [ i + 7 ] = 1 ;
        }
        if ( s . substr ( i , 5 ) == "erase" ){
            u [ i + 5 ] = 1 ;
        }
        if ( s . substr ( i , 6 ) == "eraser" ){
            u [ i + 6 ] = 1 ;
        }
        }
    }
    if ( u [ s . size () ] == 1 ){
        cout << "YES" ;
        return 0 ;
    }
    cout << "NO" ;
    return 0 ;
}

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

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t h, n;
    cin >> h >> n;

    for (auto i : irange(0L, n)) {
        int64_t a;
        cin >> a;
        h -= a;
    }

    if (h <= 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define endl        "\n"
#define fast        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int         long long int
#define mod         1000000007
#define test        int t;cin>>t;while(t--)
#define REP(i,a,b)  for(int i=a,i<=b;i++)
#define MAXN        200001

int32_t main()
{
    char ch;
    cin>>ch;
    ch++;
    cout<<ch<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <iomanip>
#include <vector>
using namespace std;
#define ll long long
int main()
{
	int n;
	cin >> n;
	vector<int> p(n+1);
	int	smallest = 2e7+1;
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		cin >> p[i];
		if (smallest >= p[i])
		{
			smallest = p[i];
			ans++;
		}
	}
	cout << ans;
	system("pause>0");
	return 0;
}


Measured memory_bytes: 1272
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<functional>
//#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
//printf("%.10f\n", n);
signed main() {
	ll n, a, b, c, cnt = 0, ans = 1;
	cin >> n; string s, t; cin >> s >> t;
	for (int h = 0; h < n; h++) {
		if (h == 0) {
			if (s[h] == t[h]) { ans *= 3; }
			else { ans *= 6; h++; }
		}
		else {
			if (s[h - 1] == t[h - 1]) {
				ans *= 2; ans %= mod;
			}
			else {
				if (s[h] != t[h]) {
					ans *= 3; ans %= mod;
				}
			}
			if (s[h] != t[h]) { h++; }
		}
	}
	cout << ans % mod << endl;
	return 0;
}

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

int main(){
  long long int h,w;
  cin>>h>>w;
  long long int res=1e13;
  for(int i=1;i<h;i++){
    long long int s1=i*w;
    long long int s2=(h-i)*(w/2+w%2);
    long long int s22=(h-i)*(w/2);
    long long int s3=((h-i)/2+(h-i)%2)*w;
    long long int s33=((h-i)/2)*w;
    res=min(res,max({abs(s1-s2),abs(s2-s22),abs(s1-s22)}));
    res=min(res,max({abs(s1-s3),abs(s3-s33),abs(s1-s33)}));
    
  }
  for(int i=1;i<w;i++){
    long long int s1=i*h;
    long long int s2=(w-i)*(h/2+h%2);
    long long int s22=(w-i)*(h/2);
    long long int s3=((w-i)/2+(w-i)%2)*h;
    long long int s33=((w-i)/2)*h;
    res=min(res,max({abs(s1-s2),abs(s2-s22),abs(s1-s22)}));
    res=min(res,max({abs(s1-s3),abs(s3-s33),abs(s1-s33)}));
  }
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 256