akhauriyash/Code-Regression huggingface dataset:
#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;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef pair<ll,unsigned int> ve;

const ll INF=(1LL<<50);

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}



int main(){
  ll N,M;
  cin>>N>>M;
  vector<pair<ll,unsigned int>> key;
  set<ll> s;
  REP(M){
    ll yen,cnt;
    cin>>yen>>cnt;
    unsigned int x=0;
    For(j,cnt){
      ll tmp;
      cin>>tmp;
      --tmp;
      x|=(1<<tmp);
      s.insert(tmp);
    }
    key.push_back(make_pair(yen,(x)));
  }
  if(s.size()!=N){
    cout<<-1<<endl;
    return 0;
  }
  map<unsigned int,ll> ans;
  ans[0]=0;
  REP(M){
    map<unsigned int,ll> tmp;
    for (auto &&j : ans)
    {
      if(tmp.count(j.first)){
        tmp[j.first]=min(tmp[j.first],j.second);
      }else{
        tmp[j.first]=j.second;
      }
      unsigned int y=j.first|key[i].second;
      if(tmp.count(y)){
        tmp[y]=min(tmp[y],j.second+key[i].first);
      }else{
        tmp[y]=j.second+key[i].first;
      }
    }
    
    ans=move(tmp);
  }
  dump(vector<pll>(ans.begin(),ans.end()));
  cout<<ans[(1<<N)-1]<<endl;
  return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cstring>
#include <set>
#include <map>
#define rep(i, m, n) for (int i = m; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

ll n, m, a, b, c, d, sum = 0;
ll graph[1005][1005] = {}, s, g, v, p;
char x,y;

int main()
{
    cin >> x >> y;
    if((x-'a')>(y-'a')){
        cout<<">"<<endl;
    }else if(x<y){
        cout<<"<"<<endl;
    }else{
        cout<<"="<<endl;
    }
}

Measured memory_bytes: 384
/*================================================
# ~  file:C.cpp
# ~~ date:2020-03-22
# ~~~author: Accelerator
#        |everybody finds love,in the end|
#   人の運命か,人の希望は悲しみにつづられているね
=================================================*/

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#define ll long long
const int N=1e6+10;
using namespace std;
typedef pair<int,int>PII;

double n;

int main(){
 ios::sync_with_stdio(false);
  cin>>n;
   double a=n/3;
    printf("%.12f",a*a*a);
  return 0;
}


Measured memory_bytes: 256
import math
a, b, h, m = map(int, input().split())

hrad, mrad = math.pi * (60 * h + m) / 360, math.pi * m / 30
rad = min(abs(hrad - mrad), 2*math.pi - abs(hrad - mrad))

print((a ** 2 + b ** 2 - 2 * a * b * math.cos(rad))** 0.5)



Measured memory_bytes: 9508
S = input()

a = len(S[::2]) - S[::2].count('1') + len(S[1::2]) - S[1::2].count('0')
b = len(S[::2]) - S[::2].count('0') + len(S[1::2]) - S[1::2].count('1')
print(min(a, b))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll howmany(ll a,ll b,ll c){
	ll d=a/c;
	if(a%c==0) d--;
	ll e=b/c;
	return e-d;
}
int main(){
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll C,D,CD;
	C=howmany(a,b,c);
	D=howmany(a,b,d);
	if(c>d) swap(c,d);
	ll p=d*c,q=d%c;
	while(q){
		d=c;
		c=q;
		q=d%c;
	}
	q=p/c;
	
	CD=howmany(a,b,q);
	cout<<b-a+1-C-D+CD;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>  // cin,cout
#include <stdio.h>   // printf,scanf (standard input/output)
#include <cmath>     // abs(x),pow(x,2)
#include <string>
#include <string.h>  // strlen, strcmp
#include <algorithm> // min,max, sort(v.begin(),v.end())
#include <vector>
#include <time.h>
using namespace std;


int Func(int A_min, int A[], int N){
    int result = A_min;
    for (int i=0;i<N;i++) {
        int temp = A[i]%A_min;
        if (temp>=1) result = min(result,temp);
    }
    
    if (result!=A_min) result = min(result, A_min-result);
    
    return result;
}

int main(){
    int N;
    int A[100000];
    
    cin >> N;
    for (int i=0;i<N;i++) {
        cin >> A[i];
    }
    
    int A_min = A[0];
    while (true) {
        int temp = Func(A_min, A, N);
        if (temp==A_min) break;
        else A_min = temp;
    }
    cout << A_min << endl;
    
    
    return 0;
}


Measured memory_bytes: 640
#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<ll,ll>;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
void YesNo(bool j){cout << (j ? "Yes" : "No") << endl; return;}
void yesno(bool j){cout << (j ? "yes" : "no") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}



int main() {
  ll n, a,b;
  cin >> n >> a >> b;
  ll ans=n/(a+b)*a;
  n%=(a+b);
  ans+=min(n,a);
  pt(ans);
}

Measured memory_bytes: 256
h, n = map(int,input().split())
maho = []
for i in range(n):
    aa,ba = map(int,input().split())
    maho.append([aa,ba])

dp = [0 for i in range(h+1)]


for i in range(1,h+1):
    cost = 10000000000
    for j in range(n):
        if i - maho[j][0] < 0:
            cost = min(cost, maho[j][1])
        else:
            cost = min(cost, dp[i-maho[j][0]] + maho[j][1])

    dp[i] = cost

#print(dp[175:183])
print(dp[h])

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

using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(a.rbegin(), a.rend());
    ll com = 0;
    int t = n-1;
    rep(i, n){
        int lim = 2;
        if(i == 0) lim = 1;
        rep(j, lim){
            if(t > 0){
                com += a[i];
                t--;
            }
        }
    }
    cout << com << endl;
    return 0;
}


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

int main () {
  
  int N, Q;
  cin >> N >> Q;
  
  char S[N];
  for (int i = 0; i < N; i++) {
    cin >> S[i];
  }
  
  int count[N];
  count[N] = 0;
  
  for (int i = 1; i < N; i++) {
    if (S[i - 1] == 'A' && S[i] == 'C') {
      count[i] = count[i - 1] + 1;
    } else {
      count[i] = count[i - 1];
    }
  }
  
  int l, r;
  for (int i = 0; i < Q; i++) {
    cin >> l >> r;
    cout << count[r - 1] - count[l - 1] << endl;
  }
  
}

Measured memory_bytes: 1280
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	
	
	public static void main(String[] args) {
	int n =sc.nextInt();
	boolean a=true;
	for(int i=0;i<n;i++) {
		int tmp=sc.nextInt();
		if(tmp%2==0) {
			if(tmp%3==0||tmp%5==0) {
				
			}else {
				a=false;
			}
		}
	}
	if(a) {
		p("APPROVED");
	}else {
		p("DENIED");
	}
	
	
	}
}

Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;
void a()
{
    string s;
    cin >> s;
    map<char, int> count;
    for (int i = 0; i < 4; i++)
    {
        if (count.count(s[i]) == 0)
        {
            count.insert(make_pair(s[i], 1));
        }
        else
        {
            count.at(s[i]) += 1;
        }
    }
    if (count.size() == 2 && count.at(s[0]) == 2)
        cout << "Yes";
    else
    {
        cout << "No";
    }
    return;
}
void b()
{
    int n;
    cin >> n;
    int a, b, c;
    cin >> a >> b >> c;
    int ans = 0;
    if ((b - a) * (b - c) < 0)
        ans += 1;
    for (int i = 0; i < n - 3; i++)
    {
        int t;
        cin >> t;
        a = b;
        b = c;
        c = t;
        if ((b - a) * (b - c) < 0)
            ans += 1;
    }
    cout << ans;
}
int main(void)
{
    b();
}

Measured memory_bytes: 256
import re
s = input()
t = ['KIHBR','AKIHBR','KIHABR','KIHBAR','KIHBRA','AKIHABR','AKIHBAR','AKIHBRA','KIHABAR','KIHABRA','KIHBARA','AKIHABAR','AKIHABRA','AKIHBARA','AKIHABARA']

if s in t:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>

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

using namespace std;

int main(){
	int n;
	while(cin >> n && n) {
		vector<string> str(n);
		rep(i, n) {
			cin >> str[i];
		}
		for(int i = 1; i < str.size(); i++) {
			int j;
			for(j = 0; j < str[i].size() && str[i][j] == '.'; j++) {
				str[i][j] = ' ';
			}
			if(!j) continue;
			j--;
			str[i][j] = '+';
			for(int k = i - 1; k >= 0 && j < str[k].size()
									  && str[k][j] == ' '; k--) {
				str[k][j] = '|';
			}
		}
		rep(i, n) {
			cout << str[i] << endl;
		}
	}
 	return 0;
}

Measured memory_bytes: 1856
# https://atcoder.jp/contests/tenka1-2017/tasks/tenka1_2017_c
def main():
    N = int(input())

    for h in range(1, 3500 + 1):
        for n in range(1, 3500 + 1):
            if (4 * h * n - N * n - N * h != 0) and (N * h * n) % (4 * h * n - N * n - N * h) == 0:
                w = (N * h * n) // (4 * h * n - N * n - N * h)
                if w > 0:
                    print(h, n, w)
                    return

if __name__ == "__main__":
    main()

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

using namespace std;

int main(){
    char a;
    cin >> a;
    cin.ignore();

    if((a >= 'A') && (a <= 'Z')){
        cout << "A" << endl;
        return 0;
    } else {
        cout << 'a' << endl;
        return 0;

    }
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int n;
	cin >> n;
	int V[200001];
	rep(i, n){
		cin >> V[i];
	}
	int mini = V[0];
	int cost = -INF;
	for(int i = 1; i < n; i++){
		cost = max(cost, V[i] - mini);
		mini = min(mini, V[i]);
	}
	FIN(cost);

	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

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

#define ld long double
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define nl '\n'
#define pii pair <ll, ll>
#define pb push_back
#define mp make_pair
#define pi 3.14159265358979323846264
#define y1 abacaba
#define fn "abc"
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define pcnt(i) __builtin_popcount(i)
#define lcm(a,b) (a * b) / __gcd(a, b)
#define chill_wave ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pressF freopen("lepus.in", "r", stdin); freopen("lepus.out", "w", stdout);

using namespace std;

const long long MXN = 1e6 + 4;
const long long MAXN = 2e3 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long long MAXLOG = 20;

inline void f_math(bool ok = 0) { chill_wave if(ok) { pressF; } }

//int dx[]= {1,0,-1,0}; int dy[]= {0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1}; int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2}; int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[]={-1,-1,+0,+1,+1,+0}; int dy[]={-1,+1,+2,+1,-1,-2}; //Hexagonal Direction


ll a, b, c;

int main() {

    f_math();

    cin >> a >> b >> c;
    if(a + b >= c) {
        cout << b + c;
    } else {
        cout << (a + b + 1) + b;
    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = []
for i in range(1,N+1):
    S,P = input().split()
    P = int(P)
    A.append((S,P,i))
A = sorted(A,key=lambda x:x[1],reverse=True)
A = sorted(A,key=lambda x:x[0])
for x in A:
    print(x[2])


Measured memory_bytes: 3060
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
Arr.forEach(function(v){
   var arr=v.split(" ").map(Number);
   var m=[1,2,3,4,5,6,7,8,9,10];
   m=m.filter(function(v){return (v!=arr[0] && v!= arr[1] && v!=arr[2]);});
   var y=0;
   var n=0;
   m.forEach(function(v){((arr[0]+arr[1]+v)<=20)?y++:n++;});
   console.log(y>=n?"YES":"NO");
});

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

vector<int> s = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main(){
  int n;
  cin >> n;
  cout << s[n - 1] << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif 
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    //cin>>t;
  	t=1;
    while(t--)
    {
    	int n;
    	cin>>n;
    	int b;
    	int count=0;
    	for(int a=1;a<n;a++)
    	{
    		b=floor((n-1)/a);
    		count+=b;
    	}
    	cout<<count<<endl;
    }
}

Measured memory_bytes: 3668
#include <stdio.h>
#include <inttypes.h>

#define INF UINT64_C(12345678901234567)

#define KI_MAX 4096

uint64_t ki[KI_MAX * 2 - 1];
uint64_t* ki_buffer = ki + (KI_MAX - 1);

void ki_koutiku(void) {
	int i;
	for (i = KI_MAX - 1 - 1; i >= 0; i--) {
		uint64_t hoge = ki[i * 2 + 1], fuga = ki[i * 2 + 2];
		ki[i] = hoge <= fuga ? hoge : fuga;
	}
}

uint64_t ki_get_i(int i, int qs, int qe, int ss, int se) {
	if (qe <= ss || se <= qs) { /* 完全に重ならない */
		return INF;
	} else if (qs <= ss && se <= qe) { /* セグメントがクエリに完全に含まれる */
		return ki[i];
	} else {
		int sm = ss + (se - ss) / 2;
		uint64_t l = ki_get_i(i * 2 + 1, qs, qe, ss, sm);
		uint64_t r = ki_get_i(i * 2 + 2, qs, qe, sm, se);
		return l <= r ? l : r;
	}
}

uint64_t ki_get(int qs, int qe) {
	return qs < qe ? ki_get_i(0, qs, qe, 0, KI_MAX) : INF;
}

int N;
uint64_t x;
uint64_t a[2048];

int main(void) {
	int i;
	uint64_t kotae = INF;
	if (scanf("%d%" SCNu64, &N, &x) != 2) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%" SCNu64, &a[i]) != 1) return 1;
		ki_buffer[i] = ki_buffer[N + i] = a[i];
	}
	ki_koutiku();
	for (i = 0; i <= N; i++) {
		uint64_t candidate = x * i;
		int j;
		for (j = 0; j < N; j++) {
			candidate += ki_get(N + j - i, N + j + 1);
		}
		if (candidate < kotae) kotae = candidate;
	}
	printf("%" PRIu64 "\n", kotae);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
#define INF 0x3f3f3f3f
#define ll long long
using namespace std;



int main()
{
	int a1,a2,a3;
	int k;
	cin >>a1 >> a2>> a3>>k;
	int cnt=0;
	while(a2<=a1){
		a2=a2*2;
		cnt++;
		if(cnt>k){
			cout << "No" << endl;
			return 0;
		}
	}
	while(a3<=a2){
		a3=a3*2;
		cnt++;
		if(cnt>k){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define int long long 
using namespace std;
signed main(){
  int a,b;
  cin>>a;
  b=a;
  for(int i=1;i<b;i++){
    a*=i;
    a%=1000000007;
  }
  cout<<a<<"\n";
}


Measured memory_bytes: 256
// 以下のソースを勉強する.
// zscoder氏.
// https://atcoder.jp/contests/dp/submissions/3939565
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

LL a[3333];
LL dp[3333][3333];

// 太郎君から見て, X - Y が 最大となるように要素を選択.
// ※ 次郎君の得点 Y は, recursive(l + 1, r) or recursive(l, r - 1) で 計算されたものと見ている.
// @param l: 先頭要素の場所.
// @param r: 末尾要素の場所.
// @return :
// 先頭要素a[l] or 末尾要素a[r] を 選択した上で, 再帰処理を行う.
LL recursive(int l, int r){
    if(l > r)                 return 0;
    if(l == r)                return a[l];
    if(dp[l][r] != -LL(1e18)) return dp[l][r];
    return (dp[l][r] = max(a[l] - recursive(l + 1, r), a[r] - recursive(l, r - 1)));
}

int main(){
    
    // 1. 入力情報取得.
    int N;
    scanf("%d", &N);
    for(int i = 0; i < N; i++) for(int j = 0; j < N; j++) dp[i][j] = -LL(1e18);
    for(int i = 0; i < N; i++) scanf("%d", &a[i]);
    
    // 2. dp更新.
    LL ans = recursive(0, N - 1);
    // for(int i = 0; i < N; ++i){
    //     for(int j = 0; j < N; ++j) printf("%lld ", dp[i][j]);
    //     printf("\n");
    // }
    
    // 3. 出力.
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 80256
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <unordered_map>

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

    if (n == 1) {
        std::printf("Hello World\n");
    } else if (n == 2) {
        int a, b;
        std::cin >> a >> b;
        std::printf("%d\n", a + b);
    }

    return 0;
}

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

#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define MOD 1000000007

using namespace std;

int pow_mod(int a, int b, int p) {
	if (b == 0)return 1;
	else if (b % 2 == 0)return (pow_mod(a*a, b / 2, p) % p);
	else return (pow_mod(a, b - 1, p)*a%p);
}

int factorial_mod(int a, int p) {
	if (!a)return 1;
	else return a * factorial_mod(a - 1, p) % p;
}

int sum_digit(int N) {
	int ans = 0;
	for (; N != 0;) {
		ans += N % 10;
		N /= 10;
	}
	return ans;
}

int D,N;
long long int ans = 0;

int main(){
	cin >> D >> N;
	if (N == 100)ans = 101 * pow(100, D);
	else ans = N * pow(100, D);
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>

int main(){
    int a,b,c;
    char op;
    for(int i = 0;; i++){
        scanf("%d %c %d",&a,&op,&b);
        if(op == '+'){
            c = a + b;
        }
        else if(op == '-'){
            c = a - b;
        }
        else if(op == '*'){
            c = a * b;
        }
        else if(op == '/'){
            c = a / b;
        }
        else if(op == '?'){
            break;
        }
        printf("%d\n",c);
    }
    return 0;
}


Measured memory_bytes: 2684
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class BTAKOYAKIFESTIVAL2019 {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int n;
        cin >> n;
        vector<int> d(n);
        REP(i, n) cin >> d[i];

        int res = 0;
        REP(i, n - 1) {
            FOR(j, i + 1, n - 1) {
                res += d[i] * d[j];
            }
        }
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    BTAKOYAKIFESTIVAL2019 solver;
    solver.solve(in, out);
    return 0;
}


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


int main()
{
    int N;
    std::cin >> N;
    std::vector<int> omask(N);
    std::vector<int> umask(N);
    for (int i=0; i<N; ++i) {
        int A;
        std::cin >> A;
        int o = 0;
        int u = 0;
        for (int j=0; j<A; ++j) {
            int x, y;
            std::cin >> x >> y;
            if (y == 1) {
                o |= 1 << (x-1);
            } else {
                u |= 1 << (x-1);
            }
        }
        omask[i] = o;
        umask[i] = u;
    }

    int maxo = 0;
    int max = (1 << N);// - 1;
    for (int i=0; i<max; ++i) {
        int osum = 0;
        int usum = 0;
        int count = 0;
        for (int n=0; n<N; ++n) {
            int bit = 1 << n;
            if (bit & i) {
                count += 1;
                // n人目が正直
                osum |= omask[n];
                usum |= umask[n];
            }
        }
        if ((osum & (~i & (max-1))) || usum & i) {
            // 矛盾
        } else {
            maxo = std::max(maxo, count);
        }
    }
    std::cout << maxo << std::endl;
    return 0;
}

Measured memory_bytes: 256
dishes_time = []
dishes_time.append(int(input()))
dishes_time.append(int(input()))
dishes_time.append(int(input()))
dishes_time.append(int(input()))
dishes_time.append(int(input()))

temp = 10
index = 0
for i,dish in zip(range(len(dishes_time)),dishes_time):
    if temp > int(str(dish)[-1]) and int(str(dish)[-1])!=0:
        temp = int(str(dish)[-1])
        index = i

for i in range(len(dishes_time)):
    if index != i:
        if dishes_time[i]%10!=0:
            dishes_time[i] = (dishes_time[i]//10)*10 + 10
print(sum(dishes_time))

Measured memory_bytes: 9032
function Main(input) {
  var tmp = input.trim().split("\n");
  var array = tmp.slice(0, tmp.length - 1);
  var limit = parseInt(tmp[tmp.length - 1], 10);
  array = array.map(val => parseInt(val, 10));

  console.log(array[array.length - 1] - array[0] <= limit ? "Yay!" : ":(");
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); ++i)
typedef long long ll;
int main(){
  int a,b; cin >> a >> b;
  if(a*b%2==0) cout << "No";
  else cout << "Yes";
  return 0;

}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var s []byte
	fmt.Scan(&s)
	ns := make([]int, n)
	for i := range s {
		switch s[i] {
		case 'R':
			ns[i] = 0
		case 'G':
			ns[i] = 1
		case 'B':
			ns[i] = 2
		}
	}

	rgb := make([][]int, n+1)
	rgb[0] = make([]int, 3)
	for i := 1; i <= n; i++ {
		rgb[i] = make([]int, 3)
		for j := 0; j < 3; j++ {
			rgb[i][j] = rgb[i-1][j]
		}
		rgb[i][ns[i-1]]++
	}
	var sum int
	for i := 0; i < n-2; i++ {
		for j := i + 1; j < n-1; j++ {
			if ns[i] != ns[j] {
				tn := 3 - ns[i] - ns[j]
				sum += rgb[n][tn] - rgb[j+1][tn]
				k := 2*j - i
				if k < n && ns[k] == tn {
					sum--
				}
			}
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 2076
#include <iostream>
#include <queue>
#include <map>
#include <bitset>
#include <string>
#include <set>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <stack>
#include <cstdlib>
#include <numeric>
#include <cassert>
#include <complex>
#include <iterator>
//#include <unordered_map>
using namespace std;
#define maxn 100007
#define maxm 400007
#define maxq 1000007
#define maxl 1234
#define modn 1000000007
#define scan(a) scanf("%d",&a)
#define scanl(a) scanf("%lld",&a)
#define scanl2(a,b) scanf("%lld%lld",&a,&b)
#define scans(a) scanf("%s",a)
#define scans2(a,b) scanf("%s%s",a,b)
#define scand(a) scanf("%lf",&a)
#define scan2(a,b) scanf("%d%d",&a,&b)
#define scand2(a,b) scanf("%lf%lf",&a,&b)
#define scan3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scan4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)
#define scan5(a,b,c,d,e) scanf("%d%d%d%d%d",&a,&b,&c,&d,&e)
#define print(a) printf("%d\n",a);
#define printl(a) printf("%lld\n",a);
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define rrep(i,a,b) for(int i=a;i>= b;i--)
#define fscan(a) fscanf(stream,"%d", &a);
#define mp      make_pair	
#define pb      push_back
#define eb      emplace_back
#define mm(a,b) memset(a,b,sizeof a)
#define log2(n) (double)(log(n) / log(2.0))
#define _crt_disable_perfcrit_locks
#define bll __int128
#pragma warning(disable:4996)
typedef long long ll;
typedef unsigned long long ull;
const int inf = 0x3f3f3f3f;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef map <int, int> mii;
typedef pair <int, int> pii;
typedef map <char, int> mci;
typedef map <char, char> mcc;
typedef pair <char, int> pci;
typedef complex<double> cd;
typedef vector<complex<double> > vcd;
const double eps = 1e-8;
const double PI = 2 * acos(0.0);

int cc, bb; char ch; inline int F() {
	while (ch = getchar(), (ch < 48 || ch> 57) && ch != '-'); ch == '-' ? cc = bb = 0 : (cc = ch - '0', bb = 1);
	while (ch = getchar(), ch > 47 && ch < 58)cc = (cc << 1) + (cc << 3) + (ch ^ 48); return bb ? cc : -cc;
}
void write(int x) {
	int y = 10, len = 1;
	while (y <= x) { y *= 10; len++; }
	while (len--) { y /= 10; putchar(x / y + 48); x %= y; }
}
ll res;

int main() {
	//ios::sync_with_stdio(0);
	//cin.tie(0);
	//FILE* stream = fopen("L:/20.in", "rb+")
	/*int x, y, z;
	cin >> x >> y >> z;
	swap(x, y);
	swap(x, z);
	cout << x << " " << y << " " << z << endl;*/
	/*int n, m;
	int a[107];
	cin >> n >> m;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	int need = ceil(sum * 1.0 / (4 * m));
	int total = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] >= need)total++;
	}
	if (total >= m)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;*/
	ll n, k;
	cin >> n >> k;
	n %= k;
	res = min(n, k - n);
	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

double dp[110][110];
bool lose[110];
bool back[110];

int main() {
  int n, t, l, b;
  while (scanf("%d %d %d %d", &n, &t, &l, &b), n|t|l|b) {
    MEMSET(lose, false);
    MEMSET(back, false);
    REP(i, l) {
      int x;
      scanf("%d", &x);
      lose[x] = true;
    }
    REP(j, b) {
      int x;
      scanf("%d", &x);
      back[x] = true;
    }
    MEMSET(dp, 0);
    dp[0][0] = 1.0;
    double ans = 0;
    REP(iter, t) {
      REP(s, n) {
        REP(i, 6) {
          double probability = dp[iter][s] / 6.0;
          int nx = s + i + 1;
          if (nx > n) { nx = n - (nx - n); }
          if (back[nx]) { nx = 0; }
          if (nx == n) { ans += probability;
          } else if (lose[nx]) {
            dp[iter + 2][nx] += probability;
          } else {
            dp[iter + 1][nx] += probability;
          }
        }
      }
    }
    printf("%.7f\n", ans);
  }
}

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

int main() {
    int N, M, ans = 0;
    cin >> N;
    vector<int> A(N), B(N);
    int min;
    for (int i = 0; i < N - 1; i++) {
        cin >> A.at(i);
    }
    M = A.at(0);
    int k = 0;
    for (int i = 0; i < N - 1; i++) {
        B.at(A.at(i) - 1)++;
    }
    for (int i = 0; i < N; i++) {
        cout << B.at(i) << endl;
    }
}


Measured memory_bytes: 4840
var lines: string[] = [];
var reader: any = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on("line", function(line: string) {
  lines.push(line);
});

reader.on("close", function() {
  // D X
  var numbers: number[] = lines[1].split(" ").map(x => {
    return Number(x);
  });
  var numD: number = Number(numbers[0]);
  var numX: number = Number(numbers[1]);

  var result: number = numX;

  for (var i: number = 2; i < lines.length; i++) {
    result = result + Math.ceil(numD / Number(lines[i]));
  }

  console.log(result);
});


Measured memory_bytes: 7628
def main():
  import sys
  from scipy.sparse.csgraph import floyd_warshall as f
  n,m,l,*t=map(int,sys.stdin.buffer.read().split())
  d=[[0]*(n+1)for _ in range(n+1)]
  for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c
  d=f(f(d,0)<=l)-1
  d[d>n]=-1
  print('\n'.join(map(str,map(int,[d[i]for i in zip(*[iter(t[m*3+1:])]*2)]))))
main()

Measured memory_bytes: 36232
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i) = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}

// TODO: write
int main() {
  int x,y,z;cin>>x>>y>>z;
  swap(x,y);
  swap(x,z);
  cout<<x<<" "<<y<<" "<<z<<endl;
  return 0;
}


Measured memory_bytes: 256
x = int(input())


def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1

ans = x
while True:
    if is_prime(ans):
        break
    else:
        ans += 1
print(ans)

Measured memory_bytes: 38512
N = int(input())
Hs = input().split()
A = []
b = 0
b_h = 0
for i in range(N-1):
  if int(Hs[i]) < int(Hs[i+1]):
    b = i
    A.append(b-b_h)
    b_h = b+1

if len(A) != N-1:
  b = i + 1
  A.append(b-b_h)
  print(max(A))
else:
  print(0)

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

struct Vertex {
    vector<ll> node;
};

Vertex V[105];
ll C[105];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    REP(i, N) {
        C[i] = INF;
    }
    REP(i, N) {
        ll n, k;
        cin >> n >> k;
        n--;
        REP(_, k) {
            ll v;
            cin >> v;
            v--;
            V[n].node.push_back(v);
        }
    }

    queue<pll> q;
    q.push(pll(0, 0));
    C[0] = 0;
    while (!q.empty()) {
        pll t = q.front();
        q.pop();
        ll cost = t.second + 1;
        for (auto &n:V[t.first].node) {
            if (C[n] <= cost)
                continue;
            C[n] = cost;
            q.push(pll(n, cost));
        }
    }

    REP(i, N) {
        cout << i + 1 << " ";
        if (C[i] == INF)
            cout << -1;
        else
            cout << C[i];
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3224
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
  int W,H,x,y,r;
  cin >> W >> H >> x >> y >> r;
  if(W<=x||x<=0||H<=y||y<=0){
    cout << "No" << endl;
  }else if(W-r<x||x<r||H-r<y||y<r){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
  return(0);
}



Measured memory_bytes: 3100
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            int temp = sc.nextInt();
            if (set.contains(temp)) {
                set.remove(temp);
            } else {
                set.add(temp);
            }
        }
        System.out.println(set.size());
    }
}


Measured memory_bytes: 61000
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>  
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
double eps = 1e-12;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
 
ll mpow(ll a, ll b){
	if(a==0) return 0;
	if(b==0) return 1;
	ll t1 = mpow(a,b/2);
	t1 *= t1;
	t1 %= MOD;
	if(b%2) t1 *= a;
	t1 %= MOD;
	return t1;
}
 
ll mpow(ll a, ll b, ll p){
	if(a==0) return 0;
	if(b==0) return 1;
	ll t1 = mpow(a,b/2,p);
	t1 *= t1;
	t1 %= p;
	if(b%2) t1 *= a;
	t1 %= p;
	return t1;
}
 
ll modinverse(ll a, ll m){
	ll m0 = m; 
    ll y = 0, x = 1; 
    if (m == 1) return 0; 
    while (a > 1){
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    }
    if (x < 0) x += m0; 
    return x; 
}

mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
 
ll range(ll l, ll r){
	return l + mt()%(r-l+1);
}
 
ll rev(ll v){
	return mpow(v,MOD-2);
}

void solve(){
	ll a,b,c,d;
	cin >> a >> b >> c >> d;
	ll dp[c+1][d+1];
	forn(i,c+1) forn(j,d+1) dp[i][j]=0;
	dp[a][b]=1;
	forsn(i,a,c+1){
		forsn(j,b,d+1){
			dp[i][j] += dp[i-1][j]*j+dp[i][j-1]*i;
			dp[i][j] -= dp[i-1][j-1]*(i-1)*(j-1);
			dp[i][j]%=MOD;
		}
	}
	cout << ((dp[c][d]<0) ? dp[c][d]+MOD : dp[c][d]) << ln;
}
 
int main()
{
	fast_cin();
    ll t=1;
    // cin >> t;
    forn(i,t) {
    	// cout << "Case #" << i+1 << ": ";
    	solve();
    }
    return 0;
}

Measured memory_bytes: 73848
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
ll a[3][100010], b[3][100010], sm[100010];
int main(){
  int n;
  while(cin>>n){
    for(int i=0; i<3; ++i){
      for(int j=0; j<n; ++j){
        scanf("%lld",&a[i][j]);
      }
    }
    a[0][n]=a[1][n]=a[2][n]=10+(1e9);
    sort(a[0], a[0]+n);
    sort(a[1], a[1]+n);
    sort(a[2], a[2]+n);
    ll ptr=0, tmp;
    for(int i=0; i<n; ++i){
      tmp=a[1][i];
      while(a[2][ptr]<=tmp)
        ++ptr;
      b[1][i]=n-ptr;
//      cout<<"&&"<<tmp<<" "<<b[1][i]<<endl;
    }
    ptr=0;
    for(int i=0; i<n; ++i){
      tmp=a[0][i];
      while(a[1][ptr]<=tmp)
        ++ptr;
      b[0][i]=ptr;
//      cout<<tmp<<" "<<ptr<<endl;
    }
    sm[0]=b[1][0];
    for(int i=1; i<n; ++i){
      sm[i]=sm[i-1]+b[1][i];
    }
    sm[n]=sm[n-1];
    ll ans=0;
    for(int i=0; i<n; ++i){
      if(b[0][i]==0){
        ans+=sm[n];
      }
      else{
        ans+=sm[n]-sm[b[0][i]-1];
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}




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

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

    if(s == "Sunny") {
        std::cout << "Cloudy" << std::endl;
    } else if(s == "Cloudy") {
        std::cout << "Rainy" << std::endl;
    } else {
        std::cout << "Sunny" << std::endl;
    }
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	mp := make(map[int]int)
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scan(&tmp)
		mp[tmp - 1] = mp[tmp - 1] + 1
		mp[tmp] = mp[tmp] + 1
		mp[tmp + 1] = mp[tmp + 1] + 1
	}
	max := 0
	for _, v := range mp {
		if v > max {
			max = v
		}
	}
	fmt.Println(max)
}

Measured memory_bytes: 7936
/*input
4
aaaa
a
aaa
aa
*/

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

int main() {
    set<string> st;
    int n;
    cin >> n;
    rep(i, n) {
        string s;
        cin >> s;
        st.insert(s);
    }
    cout << st.size() << endl;
}

Measured memory_bytes: 19148
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>

using namespace std;

#define N 3
#define M 9
#define O 4

struct Puzzle{
  int f[M];
  int space;
  string path;

  bool operator < ( const Puzzle &p ) const {
    for(int i = 0;i < M;i++){
      if(f[i] == p.f[i]) continue;
      return f[i] > p.f[i];
    }
    return false;
  }
};

static const int dx[O] = {-1, 0, 1, 0};
static const int dy[O] = {0, -1, 0, 1};
static const int dir[O] = {'u', 'l', 'd', 'r'};

bool isTarget (Puzzle p){
  int i;
  for(i = 0;i < M;i++)
    if(p.f[i] != (i + 1)) return false;
  return true;
}

string bfs(Puzzle s){
  queue<Puzzle> Q;
  map<Puzzle, bool> V;
  Puzzle u,v;
  s.path = "";
  Q.push(s);
  V[s] = true;

  while(!Q.empty()){
    u = Q.front();
    Q.pop();
    if(isTarget(u))return u.path;
    int sx = u.space / N;
    int sy = u.space % N;
    for(int r = 0;r < O;r++){
      int tx = sx + dx[r];
      int ty = sy + dy[r];
      if(tx < 0 ||ty < 0 ||tx >= N ||ty >= N)continue;
      v = u;
      swap(v.f[u.space], v.f[tx * N + ty]);
      v.space = tx * N + ty;
      if( !V[v]){
        V[v] = true;
        v.path += dir[r];
        Q.push(v);
      }
    }
  }
  return "unsolvable";
}

int main(){
  Puzzle in;
  int i;

  for(i = 0;i < M;i++){
    cin >> in.f[i];
    if(in.f[i] == 0){
      in.f[i] = M;
      in.space = i;
    }
  }

  string ans = bfs(in);
  cout << ans.size() << endl;

  return 0;
}



Measured memory_bytes: 30580
a, b = input().split()

int_a = int(a)
int_b = int(b)

a_List = ''
b_List = ''

for i in range(int_a):
    b_List = b_List + b

for i in range(int_b):
    a_List = a_List + a


# print('a_List : ' + a_List)
# print('b_List : ' + b_List)

a_List = int(a_List)
b_List = int(b_List)

if a_List >= b_List:
    print(a_List)

else:
    print(b_List)

Measured memory_bytes: 3064
#include <cctype>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <sstream>
#include <stack>
#include <string>
using namespace std;

int s2i(string s){
	stringstream ss(s);
	int d;
	ss >> d;
	return d;
}

int main(){
	string s;
	double a, b, x;
	while (getline(cin, s)){
		stack<double>X;
		stringstream ss(s);
		while(ss>>s){
			if (s=="+"||s=="-"||s=="*"||s=="/"){
				b = X.top(); X.pop();
				a = X.top(); X.pop();
				if (s == "+") x = a + b;
				else if (s == "-") x = a - b;
				else if (s == "*") x = a * b;
				else if (s == "/") x = a / b;
				X.push(x);
			}
			else{
				X.push(s2i(s));
			}
		}
		printf("%.6f\n", X.top());
	}
}

Measured memory_bytes: 1288
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int N[3 * 4][15] = { 0 };

int main()
{
	int n;
	cin >> n;
	REP(i, n)
	{
		int b, f, r, v;
		cin >> b >> f >> r >> v;
		r--; b--; f--;
		N[3 * b + f][r] += v;
	}

	REP(b, 4)
	{
		REP(f, 3)
		{
			REP(r, 10)
			{
				cout << " " << N[3 * b + f][r];
			}
			cout << endl;
		}
		if (b < 3)
		{
			REP(i, 20)
			{
				cout << '#';
			}
			cout << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3136
#include<iostream>
#include<algorithm>
#define LL long long
LL N;
LL A[100010];
LL sum;

int main() {
	std::cin >> N;
	for (int i = 1; i <= N; i++) {
		std::cin >> A[i];
		sum += A[i];
		if (i == 0)A[0] = A[N];
	}
	LL D = ((N + 1)*N) / 2;
	if (sum%D) {
		std::cout << "NO" << std::endl;
		return 0;
	}
	LL ave = sum / D;
	LL k = 0;
	for (int i = 1; i < N; i++) {
		LL tmp = A[i] - A[i + 1] + ave;
		if (tmp < 0 || tmp % N) {
			std::cout << "NO" << std::endl;
			return 0;
		}
	}
	std::cout << "YES" << std::endl;
	return 0;
}

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

int main()
{
    int N;
    cin >> N;
    bool ans = false;
    while (N > 0){
        if (N % 10 == 7){
            ans = true;
        }
        N = N / 10;
    }
    if (ans) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 3636
n,m,X,Y=map(int,input().split())

p_x=[int(j) for j in input().split()]
p_y=[int(i) for i in input().split()]

max_x=max(p_x)
Z=min(p_y)

if max_x<Z and (X<Z and Z<=Y):
    print('No War')
else:
    print('War')

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

unsigned long long int takasa(unsigned long long int a ,unsigned long long int b)
{
  unsigned long long int h=0;
  if(a>b)
  {
    h=a-b;
  }
  return h;
}
unsigned long long int humidai(vector<  unsigned long long int> &humidai,int N)
{  
  unsigned long long int H=0;
  for(int i=1;i<N;i++)
  {
    unsigned long long int high=takasa(humidai.at(i-1),humidai.at(i));
    humidai.at(i)=humidai.at(i)+high;
    H+=high;
  }
  return H;
}

int main()
{
  int N;
  cin >> N;
  vector<unsigned long long int> tall(N);
  for(int i=0;i<N;i++)
  {
    cin >> tall.at(i);
  }
  cout << humidai(tall,N) << endl;
}
    

Measured memory_bytes: 4816
//Never stop trying
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef string str;
typedef long long ll;
#define int ll
typedef double db;
typedef long double ld;

typedef pair<int,int> pi;
#define fi first
#define se second

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;

#define pb push_back
#define eb emplace_back
#define pf push_front

#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"

const int MOD = 1e9+7; //998244353
const ll INF = 1e18;
const int nx[4]={0,0,1,-1}, ny[4]={1,-1,0,0}; //right left down up

void IO(){
#ifndef ONLINE_JUDGE 
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout); 
#endif 
}

const int MX=1e5+10;
int N; 
int t[MX];
int memo[MX];

int solve(int i){
	if(i==N-1) return 0;
	if(memo[i]!=-1)return memo[i];
	int ans=solve(i+1)+abs(t[i]-t[i+1]);
	if(i<N-2) ans=min(ans,solve(i+2)+abs(t[i+2]-t[i]));
	return memo[i]=ans;
}

int32_t main(){
   boost;
   IO();

   memset(memo,-1,sizeof(memo));
   cin>>N;
   for(int i=0; i<N;i++) cin>>t[i];

   cout << solve(0) << endl;
	


   return 0;
}



Measured memory_bytes: 9820
n = int(input())
num = [int(i) for i in input().split()]
plus = []
minus = []
sumlist = []
for i in range(n):
    if(num[i] >= 0):
        plus.append(num[i])
    else:
        minus.append(num[i])

ans = []
if(len(plus) >= len(minus)): #正の個数の方が多い
    last = min(num)
    if(last >= 0):
        plus.remove(min(plus))
    else:
        minus.remove(min(minus))
    while(len(minus) > 0):
        sumlist.append(plus[0] - minus[0])
        ans.append([plus.pop(0), minus.pop(0)])
    for i in range(len(plus)):
        sumlist.append(plus[i])
    for i in range(len(sumlist)-1):
        tmp = last
        last -= sumlist[0]
        ans.append([tmp, sumlist.pop(0)])
    ans.append([sumlist[0], last])
    score = sumlist[0] - last
    print(score)
    for i in range(len(ans)):
        print(str(ans[i][0]) + " " + str(ans[i][1]))
else: #負の個数の方が多い
    last = max(num)
    if(last >= 0):
        plus.remove(max(plus))
    else:
        minus.remove(max(minus))
    while(len(plus) > 0):
        sumlist.append(minus[0] - plus[0])
        ans.append([minus.pop(0), plus.pop(0)])
    for i in range(len(minus)):
        sumlist.append(minus[i])
    for i in range(len(sumlist)-1):
        tmp = last
        last -= sumlist[0]
        ans.append([tmp, sumlist.pop(0)])
    ans.append([last, sumlist[0]])
    score = last - sumlist[0]
    print(score)
    for i in range(len(ans)):
        print(str(ans[i][0]) + " " + str(ans[i][1]))



Measured memory_bytes: 23240
#include<iostream>
using namespace std;
int main() {
	int A, B, C, X;
	int count = 0;
	cin >> A >> B >> C>>X;
	for (int a = 0; a <= A; a++) {
		for (int b = 0; b <= B; b++) {
			for (int c = 0; c <= C; c++) {
				int total = 500*a +100* b +50* c;
				if (total == X)count++;


			}
		}
	}
	cout << count;
	return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n = int(input())
    s = input()

    res = s.count('R') * s.count('G') * s.count('B')
    if res == 0:
        print(0)
        sys.exit()
    for i1 in range(n):
        for i2 in range(i1+1, n):
            i3 = i2 * 2 - i1
            if i3 <= n - 1:
                res -= s[i1] != s[i2] and s[i1] != s[i3] and s[i2] != s[i3]
    print(res)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9192