akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> s(m), c(m);
    for (int i = 0; i < m; i++) {
        cin >> s[i] >> c[i];
    }

    // sが同じでcが違うようなものが存在すれば-1
    for (int i = 0; i < m; i++) {
        for (int j = i + 1; j < m; j++) {
            // iとjを比べる
            if (s[i] == s[j] && c[i] != c[j]) {
                cout << -1 << endl;
                return 0;
            }
        }
    }

    if (n == 1) {
        cout << (m ? c[0] : 0) << endl;
        return 0;
    }

    // 1桁目が0なら-1
    for (int i = 0; i < m; i++) {
        if (s[i] == 1 && c[i] == 0) {
            cout << -1 << endl;
            return 0;
        }
    }

    vector<int> ans(n, 0);
    ans[0] = 1;
    for (int i = 0; i < m; i++) {
        ans[s[i] - 1] = c[i];
    }

    for (int x : ans) cout << x;

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>

using namespace std;

typedef pair<long long int, long long int> P;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

long long int memo[110000][3] = {};
vector<int> E[110000];

int main(){
    int N, M;
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        int u, v;
        cin >> u >> v;
        E[u].push_back(v);
    }
    int S, T;
    cin >> S >> T;
    queue<int> que;
    que.push(S);
    for(int step = 1; step < 1000000; step++){
        int sz = que.size();
        if(sz == 0){
            break;
        }
        for(int loop = 0; loop < sz; loop++){
            int pos = que.front();
            que.pop();
            if(memo[pos][step % 3] != 0){
                continue;
            }
            memo[pos][step % 3] = step;
            for(int to : E[pos]){
                que.push(to);
            }
        }
    }
    if(memo[T][1] == 0){
        cout << -1 << endl;
    }else{
        cout << (memo[T][1] - 1) / 3 << endl;
    }
    return 0;
}

Measured memory_bytes: 8448
Imports System

Module Program
    Sub Main(args As String())
        Dim S As String = Console.ReadLine()

        If S = "AAA" Then
            Console.WriteLine("No")
            Exit Sub
        End If
        If S = "BBB" Then
            Console.WriteLine("No")
            Exit Sub
        End If

        Console.WriteLine("Yes")
    End Sub
End Module


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

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> x(m);
	rep(i, m) cin >> x[i];
	sort(x.begin(), x.end());
	vector<int> res;
	res.emplace_back(x.back() - x.front());
	rep(i, m - 1) {
		res.emplace_back(x[i + 1] - x[i]);
	}
	sort(res.rbegin(), res.rend());
	rep(i, n) res[min(i, m - 1)] = 0;
	int ans = 0;
	for (auto& c : res) ans += c;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1276
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict, Counter
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

class union_find:
  def __init__(self, n):
    self.par = [-1] * n
    self.rank = [0] * n
    self.size = [1] * n
  def unite(self, x, y):
    x = self.root(x)
    y = self.root(y)
    if x == y:
      return
    if self.rank[x] < self.rank[y]:
      self.par[x] = y
      self.size[y] += self.size[x]
    else:
      self.par[y] = x
      self.size[x] += self.size[y]
      if self.rank[x] == self.rank[y]:
        self.rank[x] += 1
  def root(self, x):
    if self.par[x] == -1:
      return x
    else:
      self.par[x] = self.root(self.par[x])
      return self.par[x]
  def comp_size(self, x):
    x = self.root(x)
    return self.size[x]
  def same(self, x, y):
    return self.root(x) == self.root(y)
  def comp_sizes(self):
    return [self.size[i] for i in range(len(self.par)) if self.root(i) == i]

N, M = reads()
edges = []
for _ in range(M):
  A, B = reads()
  edges.append((A-1, B-1))
edges.reverse()

def tri(k):
  return k * (k - 1) // 2

uf = union_find(N)
conv = 0
total = tri(N)
ans = []
for A, B in edges:
  ans.append(total - conv)
  if not uf.same(A, B):
    a = uf.comp_size(A)
    b = uf.comp_size(B)
    uf.unite(A, B)
    conv += tri(uf.comp_size(A)) - tri(a) - tri(b)
ans.reverse()
print("\n".join(map(str, ans)))


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

using namespace std;
const int mod=1e9+7;
int N, K;

bool cmp(long long x, long long y){
    return abs(x)<abs(y);
}

int main(){
    scanf("%d%d", &N, &K);
    vector<long long> A(N);
    int pn=0, nn=0;
    for (int i=0; i<N; i++){
        scanf("%lld", &A[i]);
        if (A[i]<0) nn++;
        else pn++;
    }
    long long ans=1;
    if (pn==0&&K%2){
        sort(A.begin(), A.end(), cmp);
        for (int i=0; i<K; i++) ans=ans*A[i]%mod;
    }
    else {
        sort(A.begin(), A.end(), greater<long long>());
        // for (int i=0; i<N; i++) printf("%lld ", A[i]);
        int l=0, r=N-1;
        while (K){
            if (K%2){
                ans=ans*A[l]%mod;
                l++;
                K--;
            }
            else {
                if (A[l]*A[l+1]>=A[r]*A[r-1]){
                    ans=(ans*A[l]%mod*A[l+1]%mod);
                    l+=2, K-=2;
                }
                else{
                    ans=(ans*A[r]%mod*A[r-1]%mod);
                    r-=2, K-=2;
                }
            }
        }
    }
    ans=(ans%mod+mod)%mod;
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 4816
/*
                       _oo0oo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      0\  =  /0
                    ___/`---'\___
                  .' \\|     |// '.
                 / \\|||  :  |||// \
                / _||||| -:- |||||- \
               |   | \\\  -  /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
             ___'. .'  /--.--\  `. .'___
          ."" '<  `.___\_<|>_/___.' >' "".
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` /  /
     =====`-.____`.___ \_____/___.-`___.-'=====
                       `=---='
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  Vikash Kumar @ Codechef/codeforces 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/   
#include<bits/stdc++.h>
 
#define ll                    long long int
#define ll_MAX                LLONG_MAX
#define ll_MIN                LLONG_MIN
#define pi                    3.14159265358979323846
#define count_1(n)            __builtin_popcountll(n)
#define MOD                   1000000007
#define MAX                   1e9
#define MIN                   -1e9
#define itoc(c)               ((char)(((int)'0')+c))
#define mid(s,e)              (s+(e-s)/2)
const int MX=10010896;
const int lmt=3164;
const int N=10000001;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll extgcd(ll a,ll b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extgcd(b,a%b,y,x);y-=a/b*x;return g;}}
ll modpow(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}

inline void solve(){
    /*_Start_*/
    int arr[6];
    int ans=-1;
    for(int i=1;i<=5;i++){
      cin>>arr[i];
      if(!arr[i])
        ans=i;
    }
    cout<<ans<<"\n";
    /*_End_*/
   
}

int main()
{
	cout<<fixed<<setprecision(12);
	//freopen("input.txt", "r", stdin);
	fastio;ll  t=1,tc=1;
	//cin>>t;
	while(t--){solve();}return 0;
}

Measured memory_bytes: 3576
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<string,int> P;
int main(){
  	int N;
    cin >> N;
    int a[N];
    for(int i=0;i<N;i++) cin >> a[i];

    sort(a, a+N);

    int A = 0, B = 0;
    for(int i=0;i<N;i++){
      if(i%2==0) A += a[N-1-i];
      else B += a[N-1-i];
    }
    cout << A - B <<endl;


  return 0;
}






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

using namespace std;
int main(){
    int c,t,c1,t1;
    int C,T;
    pair<int,int> mejor;
    vector<pair<int,int>> x;
    cin >> c >> t;
    c1= c;
    t1 = t;
    for(int i = 0; i < c; i++){
        cin >> C >> T;
        x.push_back(make_pair(C,T));
    }
    mejor = x[0];
    for(int i = 0; i < x.size(); i++){
        if(x[i].first <= mejor.first&& x[i].second <= t) mejor = x[i];    
    }

    if(mejor.second > t) cout << "TLE";
    else cout << mejor.first;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int n,k;
  cin >> n >> k;
  pair<ll,ll> p[n];
  rep(i,n){
    int x,y;
    cin >> x >> y;
    x--;
    p[i].first=y;
    p[i].second=x;
  }
  sort(p,p+n,greater<pair<int,int>>());
  ll sum=0,var=0;
  ll use[n]={};
  priority_queue<pair<int,int>> multi,unuse;
  rep(i,k){
    sum+=p[i].first;
    if(use[p[i].second]>0)multi.push({-p[i].first,p[i].second});
    else var++;
    use[p[i].second]++;
  }
  rep(i,n){
    if(use[p[i].second]==0){
      unuse.push({p[i].first,p[i].second});
      use[p[i].second]=-1;
    }
  }
  ll ans=sum+var*var;
  for(int i=0;i<k;i++){
    if(multi.empty() || unuse.empty())break;
    sum+=multi.top().first;
    use[multi.top().second]--;
    multi.pop();
    if(unuse.empty())break;
    sum+=unuse.top().first;
    use[unuse.top().second]++;
    if(use[unuse.top().second]==0)use[unuse.top().second]++;
    unuse.pop();
    var++;
    ans=max(ans,sum+var*var);
  }
  cout << ans << endl;
return 0;}

Measured memory_bytes: 3264
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int MAX_N = 200000;
int Par[MAX_N],Rank[MAX_N] = {};
int N;
void init(){
  int i;
  for(i=0;i<N;i++){
    Par[i] = i;
  }
}
int find(int x){//根元探し
  if(Par[x] == x) return x;
  else{
    Par[x] = find(Par[x]);
    return Par[x];
  }
}
bool unite(int x,int y){//結合
  x = find(x);y = find(y);
  if(x == y) return false;//すでに同じ木ならばfalse
  if(Rank[x] < Rank[y]) swap(x,y);
  Par[y] = x;
  if(Rank[x] == Rank[y]) Rank[x]++;
  return true;
}
bool same(int x,int y){//同じ木に含まれているか
  return find(x) == find(y);
}
int main(){
  int Q,i,t,u,v;scanf("%d%d",&N,&Q);
  init();
  for(i=0;i<Q;i++){
    scanf("%d%d%d",&t,&u,&v);
    if(t == 0) unite(u,v);
    else printf(same(u,v) ? "1\n":"0\n");
  }
}

Measured memory_bytes: 5220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;
typedef pair<l_l, ll> lll;
ll N;
vector<lll> v;
ll dp[366][366];

void solve() {
    for(int i = 0; i <= 365; i++) {
        for(int j = 0; j <= 365; j++) {
            dp[i][j] = -1e18;
        }
    }
    dp[0][0] = 0;
    v.resize(N);
    for(int i = 0; i < N; i++) {
        cin >> v[i].first.first >> v[i].first.second >> v[i].second;
    }
    sort(v.begin(), v.end());
    for(auto now : v) {
        for(int i = 365; i >= 0; i--) {
            for(int j = i; j >= 0; j--) {
                if(i < now.first.first) {
                    int newi = now.first.second;
                    int newj = j;
                    if(newi < newj) swap(newi, newj);
                    chmax(dp[newi][newj], dp[i][j] + now.second);
                }
                if(j < now.first.first) {
                    int newj = now.first.second;
                    int newi = i;
                    if(newi < newj) swap(newi, newj);
                    chmax(dp[newi][newj], dp[i][j] + now.second);
                }
            }
        }
    }
    ll ans = 0;
    for(int i = 0; i <= 365; i++) {
        for(int j = 0; j <= 365; j++) {
            chmax(ans, dp[i][j]);
        }
    }
    cout << ans << endl;
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> N) {
        if(N == 0) break;
        solve();
    }
    return 0;
}


Measured memory_bytes: 4208
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
typedef long double ld;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
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 dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; };
int main(){
  string s; cin>>s;
  int n = s.size();
  vector<ll> v(n+1,0);
  rep(i,0,n){
    if(s[i]=='B') v[i+1] = v[i] + 1;
    else v[i+1] = v[i];
  }
  ll sum = 0;
  rep(i,0,n){
    int j=i+1;
    if(s[i]=='W'){
      sum += v[j];
    }
  }
  cout << sum << endl;
  return 0;
}


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

signed main(){
  int n,x;
  cin >> n >> x;
  vector<int> st;
  int cur = 0;
  st.push_back(0);

  for(int i = 0;i<n;i++){
    int l;
    cin >> l;
    st.push_back(l+cur);
    cur+=l;
  } 
  
 // for(int i = 0;i<n;i++)cout << v[i] << endl;

    auto R = upper_bound(st.begin(), st.end(), x) - st.begin();
    cout << R << endl;
  return 0;
}
    
  


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
int main(){
	cin>>n;
	cin>>s;
	for(int i=0;i<s.size();i++){
		char m=n;
		if(s[i]+m>'Z'){
			if(s[i]=='Z') m='A'+n-1;
			else{
				m='A'+n-('Z'-s[i])-1;
			} 
			s[i]=m;
		}
		else{
			m=s[i]+n;
			s[i]=m;
		} 
		cout<<s[i];
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define MOD 1000000007
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using Complex = complex<double>;


int N, K;


signed main(){
    cin >> N >> K;
    
    cout << CEIL((N-1)/(K-1)) << endl;

    return 0;
}

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

int h,r,s[3];
double hx[101],hy[101];
double d[3];
double x[3][101],y[3][101];
double w[101],a[101];
int cnt[101];

bool check(int v,int day){
	double di=atan2(hy[v],hx[v])/M_PI*180.0;
	if(hx[v]*hx[v]+hy[v]*hy[v]>a[day]*a[day])return false;
	if(!((w[day]-d[0]/2.0<di && di<w[day]+d[0]/2.0) || (w[day]-d[0]/2.0<di+360.0 && di+360.0<w[day]+d[0]/2.0)))return false;
	for(int k=0;k<=2;k++){
		for(int i=0;i<s[k];i++){
			double nx=hx[v]-x[k][i],ny=hy[v]-y[k][i];
			if(sqrt(nx*nx+ny*ny)<a[day]){
				double dir=atan2(ny,nx)/M_PI*180.0;
				//printf("%d %d %d %f %f %f %f %f\n",v,k,i,nx,ny,dir,w[day]-d[k]/2.0,w[day]+d[k]/2.0);
				if(w[day]-d[k]/2.0<dir && dir<w[day]+d[k]/2.0)return false;
				if(w[day]-d[k]/2.0<dir+360.0 && dir+360.0<w[day]+d[k]/2.0)return false;
			}
		}
	}
	return true;
}

int main(void){
	while(1){
		scanf("%d %d",&h,&r);
		if(h+r==0)break;
		memset(cnt,0,sizeof(cnt));
		for(int i=0;i<h;i++){
			scanf("%lf %lf",&hx[i],&hy[i]);
		}
		scanf("%d %d %d %lf %lf %lf",&s[0],&s[1],&s[2],&d[0],&d[1],&d[2]);
		for(int i=0;i<3;i++){
			for(int j=0;j<s[i];j++){
				scanf("%lf %lf",&x[i][j],&y[i][j]);
			}
		}
		for(int i=0;i<r;i++){
			scanf("%lf %lf",&w[i],&a[i]);
			for(int j=0;j<h;j++){
				if(check(j,i))cnt[j]++;
			}
		}
		int res=0,rcnt=0;
		for(int i=0;i<h;i++){
			if(res==cnt[i])rcnt++;
			if(res<cnt[i]){
				res=cnt[i];
				rcnt=1;
			}
		}
		if(res==0)printf("NA\n");
		else{
			int cn=0;
			for(int i=0;i<h;i++){
				if(res==cnt[i]){
					printf("%d%c",i+1,cn+1==rcnt?'\n':' ');
					cn++;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1164
A,B = map(int, input().split())
S = str(input())
bool = True

if S[A] == '-':
    for i in range(A):
        if S[i] == '-':
            bool = False
    
    for j in range(B):
        if S[-i] == '-':
            bool = False
else:
    bool = False
            
print('Yes' if bool else 'No')


Measured memory_bytes: 2940
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>

#include <algorithm>
#include <functional>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

const int N = 2010, P = 998244353;

char s[N];
int dp[N * 2][N * 2];
int ss0[N], ss1[N];

void add(int& x, int y) {
  if ((x += y) >= P) x -= P;
}

int main() {
  //freopen("ball.in", "r", stdin);
  //freopen("ball.out", "w", stdout);
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  dp[0][0] = 1;
  int s0 = 0, s1 = 0;
  for (int i = 1; i <= n; ++i) {
    s1 += s[i] - '0';
    ss0[i] = ss0[i - 1] + ('2' - s[i]);
    ss1[i] = ss1[i - 1] + (s[i] - '0');
  }
  s0 = 2 * n - s1;
  for (int i = 0; i <= s0; ++i)
    for (int j = 0; j <= s1; ++j) {
      int lst0 = ss0[min(i + j + 1, n)] - i, lst1 = ss1[min(i + j + 1, n)] - j;
      if (lst0) add(dp[i + 1][j], dp[i][j]);
      if (lst1) add(dp[i][j + 1], dp[i][j]);
    }
  printf("%d\n", dp[s0][s1]);
  return 0;
}


Measured memory_bytes: 60416
#include<bits/stdc++.h>
using namespace std;
int main(){
     int t,n;
     cin>>n>>t;
     vector<string>v(n);
     for(int i=0;i<n;i++){
        cin>>v[i];
     }
     sort(v.begin(),v.end());
     for(int i=0;i<n;i++){
        cout<<v[i];
     }
     }


Measured memory_bytes: 3604
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222







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


  
  ll le, ri;
  cin >> le >> ri;
  FOR(i, le, min(le + 2020, ri + 1)) {
    FOR(j, i + 1, min(i + 2020, ri + 1)) {
      mi = min(mi, (i*j) % 2019);
    }
  }
  cout << mi << endl;




  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B,C,D;
  string s;
  cin >> N >> A >> B >> C >> D >> s;
  int c=0,d=1;
  
  if (C<D){
    d=0;
    for (int i=B-1;i<D-1;i++){
      if (s.at(i)=='#' && s.at(i+1)=='#'){
        c=1;
        break;
      }
    }
    for (int i=A-1;i<C-1;i++){
      if (s.at(i)=='#' && s.at(i+1)=='#'){
        c=1;
        break;
      }
    }
  }
  
  else{
    for (int i=B-1;i<D-1;i++){
      if (s.at(i)=='#' && s.at(i+1)=='#'){
        c=1;
        break;
      }
    }
    for (int i=B-2;i<D-1;i++){
      if (s.at(i)=='.' && s.at(i+1)=='.' && s.at(i+2)=='.')d=0;
    }
    
    for (int i=A-1;i<C-1;i++){
      if (s.at(i)=='#' && s.at(i+1)=='#'){
        c=1;
        break;
      }
    }
  }
  
  if (c==0 && d==0)cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 640
i,j,k;
long a[444],p[444][444],S,T,P;
main()
{
	scanf("%*d");
	for(;~scanf("%d",a+j);)
	{
		for(T=a[i=j++];i--;p[i][j]=P)
		{
			P=9e18;
			for(T+=a[k=i];++k<j;)
			{
				P=fmin(P,p[i][k]+p[k][j]+T);
			}
		}
	}
	printf("%ld",P);
}

Measured memory_bytes: 1536
n = int(input())
a = list(map(int,input().split()))
aset = set()
a2set = set()
a3set = set()
a4set = set()
for i in a:
    if i in a3set:
        a4set.add(i)
    if i in a2set:
        a3set.add(i)
    if i in aset:
        a2set.add(i)
    aset.add(i)
if len(a2set) < 2 and len(a4set) == 0:
    ans = 0
else:
    x = max(a2set)
    if x in a4set:
        ans = x ** 2
    else:
        a2set.remove(x)
        y = max(a2set)
        ans = x * y
print(ans)

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << fixed << setprecision(8);
    cout << a*b*sin(2*acos(0)*c/180)/2  << endl;
    cout << a+b+sqrt(a*a+b*b-2*a*b*cos(2*acos(0)*c/180) ) <<endl;
    cout <<  b*sin(2*acos(0)*c/180) << endl;
    
}


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

using vi = vector<int>;
using vvi = vector<vi>;
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for(int i=0; i<(int)n; i++)
using vb = vector<bool>;


int main(){
  int N,M,K;
  cin>>N>>M>>K;
  vvi fri(N);
  vvi blk(N);
  vi A(M), B(M), C(K), D(K);
  rep(i,M){
    cin>>A[i]>>B[i];
    A[i]--;B[i]--;
    fri[A[i]].pb(B[i]);
    fri[B[i]].pb(A[i]);
  }

  //連結成分調査
  vi where(N);
  vi renketusize(N, 0);
  int renketu = 0;
  vb checked(N, false);
  for(int i=0; i<N; i++){
    //iがどの連結成分にあるか
    if(checked[i])continue;
    queue<int> unchecked;
    unchecked.push(i);

    while(!unchecked.empty()){
      int current = unchecked.front();
      unchecked.pop();

      if(!checked[current]){
        //チェックしてない
        where[current] = renketu;
        checked[current] = true;
        renketusize[renketu]++;
        for(int next: fri[current]){
          unchecked.push(next);
        }
      }
    }
    //一旦dfs終わったらrenketu++
    renketu++;
  }

  rep(i,K){
    cin>>C[i]>>D[i];
    C[i]--;D[i]--;
    if(where[C[i]]==where[D[i]]){
      //同じ連結成分ならブロック情報を入れる価値がある
      blk[C[i]].pb(D[i]);
      blk[D[i]].pb(C[i]);
    }
  }

  /*
  //どこの連結成分に入っているか
  rep(i,N){
    cout<<i<<" is in "<<where[i]<<endl;
  }

  //各連結成分の数は
  for(int x: renketusize){
    if(x==0)break;
    cout<<"size = "<<x<<endl;
  }
  */

  rep(i,N){
    ll ans = renketusize[where[i]] - fri[i].size()
      - blk[i].size() - 1;
    if(i!=0)cout<<" ";
    cout<<ans;
  }
  cout<<endl;
  return 0;

  /*
  vi ans(N);
  rep(i,N){
    //連結成分の大きさ = 可能性あり
    //1引いとく
    ans[i] = renketusize[where[i]] -1;
  }
  rep(i,M){
    //同じ連結成分内の友達リンクの両方で可能性が減る
    if(where[A[i]]==where[B[i]]){
      ans[A[i]]--;
      ans[B[i]]--;
    }
  }
  rep(i,K){
    //同じ連結成分内でのブロックリンクの両方で可能性が減る
    if(where[C[i]]==where[D[i]]){
      ans[C[i]]--;
      ans[D[i]]--;
    }
  }
  rep(i,N){
    if(i!=0)cout<<" ";
    cout<<ans[i];
  }
  cout<<endl;
  */
}

Measured memory_bytes: 14156
#include <iostream>
#include <vector>
using namespace std;
 
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
 
// mod add
const int MOD = 1000000007;
void add(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}
 
// 0: dammy, 1: 'A', 2: 'G', 3: 'C', 4: 'T'
// "AGC, GAC, ACG", "A*GC", "AG*C" を含まない (012, 102, 021 を禁止)
long long solve(int N) {
    auto dp = make_vec<long long>(N+1, 5, 5, 5); // dp[i文字][3文字前][2文字前][1文字前]
    dp[0][0][0][0] = 1;
    for (int n = 0; n < N; ++n) {
        for (int i = 0; i < 5; ++i) {
            for (int j = 0; j < 5; ++j) {
                 for (int k = 0; k < 5; ++k) {
                     for (int l = 1; l < 5; ++l) {
                         if (i == 1 && j == 2 && l == 3) continue;
                         if (i == 1 && k == 2 && l == 3) continue;
                         if (j == 1 && k == 2 && l == 3) continue;
                         if (j == 2 && k == 1 && l == 3) continue;
                         if (j == 1 && k == 3 && l == 2) continue;
                         add(dp[n+1][j][k][l], dp[n][i][j][k]);
                     }
                }
            }
        }
    }
    long long res = 0;
    for (int i = 1; i < 5; ++i)
        for (int j = 1; j < 5; ++j)
            for (int k = 1; k < 5; ++k)
                add(res, dp[N][i][j][k]);
    return res;
}
 
int main() {
    int N;
    while (cin >> N) cout << solve(N) << endl;
}

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

typedef long long ll;

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

// chmax, chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll MOD = 1e+9 + 7;

int main() {
    int N;
    cin >> N;
    string S1,S2;
    cin >> S1 >> S2;
    
    vector<int> S;
    bool flg = false;
    REP(i,N){
        if ( !flg ){
            if ( S1[i] == S2[i] ) {
                S.push_back(0);
            } else {
                S.push_back(1);
                flg = true;
            }
        } else {
            flg = false;
        }
    }
    
    int s = S.size();
    ll ans = -1;
    
    //for ( auto a: S ) cout << a << endl;
    
    int b = -1;
    for ( int i = 0; i < s; ++i){
        if ( b == -1 ){
            if ( S[i] == 0 ) {
                ans = 3;
                b = 0;
            } else {
                ans = 6;
                b = 1;
            }
        } else if ( b == 0 ){
            if ( S[i] == 0 ){
                ans = ( ans * 2 ) % MOD;
                b = 0;
            } else {
                ans = ( ans * 2 ) % MOD;
                b = 1;
            }
        } else {
            if ( S[i] == 0 ){
                ans = ans;
                b = 0;
            } else {
                ans = ( ans * 3 ) % MOD;
                b = 1;
            }
        }
    }
    
    ans %= MOD;
    if ( ans < 0 ) ans += MOD;
    cout << ans << endl;
    
    
    return 0;
}


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

int main()
{
  vector<vector<int>> c(3, vector<int>(3));
  string ans = "Yes";

  for (int i = 0; i < 3; i++)
  {
    for (int j = 0; j < 3; j++)
      cin >> c[i][j] ;
  }
  for (int i = 1; i < 3; i++)
  {
    if (c[0][0] - c[i][0] != c[0][1] - c[i][1] ||
        c[0][0] - c[i][0] != c[0][2] - c[i][2] ||
        c[0][0] - c[0][i] != c[1][0] - c[1][i] ||
        c[0][0] - c[0][i] != c[2][0] - c[2][i])
      ans = "No";
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N, K = [int(n) for n in input().split()]
R, S, P = [int(n) for n in input().split()]
T = input()

scoredict = {'r':R, 's':S, 'p':P}
winning = {'r':'p', 's':'r', 'p':'s'}
loss = {'r':'s', 's':'p', 'p':'r'}

picks = []
score = 0
for i in range(N):
    current = T[i]
    pick = winning[current]
    if i - K >= 0 and pick == picks[i-K]:
        if i + K < N and current == winning[T[i + K]]:
            pick == loss[current]
        else:
            pick = current
    else:
        score += scoredict[pick]
    picks.append(pick)

print(score)

Measured memory_bytes: 4212
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

typedef unsigned long long UL;
typedef long long LL;
typedef long double LD;
#define LP(i, a, b) for (LL i = int(a); i < int(b); i++)
#define LPE(i, a, b) for (LL i = int(a); i <= int(b); i++)
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<vector<PII> > WAL;
typedef vector<vector<int> > SAL;
#define Ep 1e-8
#define INF 1e9
#define LINF 1e18

LL const MOD = 1e9 + 7;
LL const MaxSize = 1e5 + 5;
//LL const MOD = 998244353;

LL f[MaxSize], invF[MaxSize], r[MaxSize];

void preCalc() {
	r[1] = 1;
	f[1] = 1;
	invF[1] = 1;
	LL m = MOD;

	for (LL i = 2; i < MaxSize; ++i) {
		r[i] = (m - (m / i) * r[m % i] % m) % m;

		f[i] = (i * f[i - 1]) % MOD;
		invF[i] = (r[i] * invF[i - 1]) % MOD;
	}
}

LL choose(LL top, LL bottom) {
	if (top < bottom || top < 0 || bottom < 0)
		return 0;
	if (top == bottom || bottom == 0)
		return 1;

	LL bfs = (invF[bottom] * invF[top - bottom]) % MOD;

	//      cout << "ftop:" << top << " " << f[top] << endl;

	return (f[top] * bfs) % MOD;
}
LL N, K;
SAL t;

LL ways(int v, int p) {
	LL cc = t.at(v).size() - 1;
	LL ans = choose(K - 2, cc);
	LPE(i, 1, cc)
	{
		ans *= i;
		ans %= MOD;
	}

	LP(i, 0, t.at(v).size())
	{
		int u = t.at(v)[i];
		if (u == p)
			continue;
		ans *= ways(u, v);
		ans %= MOD;
	}

	return ans;

}

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("/Users/georgeli/A_1.in", "r", stdin);
	cin >> N >> K;

	t = SAL(N + 1);

	LP(i, 0, N - 1)
	{
		int a, b;
		cin >> a >> b;
		t.at(a).push_back(b);
		t.at(b).push_back(a);
	}

	preCalc();
	LL rc = t.at(1).size() + 1;
	LL ans = choose(K, rc);

	LPE(i, 1, rc)
	{
		ans *= i;
		ans %= MOD;
	}

	LP(i, 0, t.at(1).size())
	{
		int u = t.at(1)[i];
		ans *= ways(u, 1);
		ans %= MOD;
	}

	cout << ans;

	return 0;

}


Measured memory_bytes: 13912
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

N=int(input())
A=list(map(int,input().split()))
x=A[0]
y=A[1]
D=sorted(list(set(make_divisors(x))|set(make_divisors(y))))[::-1]
for d in D:
    if sum([a%d==0 for a in A])>=N-1:
        break
print(d)

Measured memory_bytes: 14584
#include <iostream>
#include <string>
#include <vector>
#include <atcoder/all>
typedef long long ll;
using namespace std;
using namespace atcoder;
int main(){
	string s; cin >> s;
	auto sa = suffix_array(s);
    auto lcp = lcp_array(s, sa);
	ll n = s.size();
	ll ans = n * (n+1) / 2;
	for(int i=0; i<n-1; i++) ans -= lcp[i];
	cout << ans << "\n";
}


Measured memory_bytes: 15608
n=int(input())
a=list(map(int,input().split()))
mem={}
for i in range(n):
    if i+1-a[i] not in mem:
        mem[i+1-a[i]]=[0,1]
    else:
        mem[i + 1 - a[i]][1]+=1
    if i+1+a[i] not in mem:
        mem[i+1+a[i]]=[1,0]
    else:
        mem[i+1+a[i]][0]+=1
s=0
mem2=list(mem.values())
for i in range(len(mem2)):
    s+=mem2[i][0]*mem2[i][1]
print(s)

Measured memory_bytes: 89000
while True:
    m =input().split()
    a=int(m[0])
    b=int(m[1]) 
    if a == b == 0:
        break
     
    for i in range(a):
        for j in range(b):
            if (i + j) % 2 == 0:
                print("#",end="")
            else:
                print(".",end="")
        print()
         
    print()


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

int main() {

  int K, N;
  cin >> K >> N;

  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  int mx = 0;

  for (int i = 0; i < N; i++) {
    mx = max(mx, A[i + 1] - A[i]);
    if (i == N - 1) {
      mx = max(mx, K - A[i] + A[0]);
    }
  }

  cout << K - mx << endl;

  return 0;

}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <cmath>
#include <algorithm>
#include <map>
#include <list>

using namespace std;

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

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

ll simple( int, int, double, int );
ll compound( int, int, double, int );

int m, n;
int a, year, p;
bool type;
double r;

int main()
{
	cin >> m;
	while ( m-- ) {
		ll ans = -1;
		cin >> a >> year >> n;
		while ( n-- ) {
			cin >> type >> r >> p;
			ll res = ( type ? compound( a, year, r, p ) : simple( a, year, r, p ) );
			ans = max( ans, res );
		}
		cout << ans << endl;
	}
	return 0;
}

// a_n = a_(n-1)-p, b_n = b_(n-1)+r*a_(n-1)
ll simple( int A, int N, double R, int P ) {
	ll tmp1 = ( ll ) A;
	ll tmp2 = 0;
	REP( i, N ) {
		tmp2 = tmp2 + R * tmp1;
		tmp1 = tmp1 - P;
	}
	return tmp1 + tmp2;
}

// a_n = (1+r)*a_(n-1)-p
ll compound( int A, int N, double R, int P ) {
	ll tmp = ( ll )A;
	REP( i, N ) tmp = ( 1 + R ) * tmp - P;
	return tmp;
}

Measured memory_bytes: 1224
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int X;
  cin >> X;
    
  int num = X / 100;
  
  int num2 = X - num * 100;
  
  int num3 = 5 * num;
  
  if(num2 > num3){
    cout << '0' << endl;
  }
  else{
    cout << '1' << endl;
  }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<int> count(N);
  for (int i = 0; i < M; i++){
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    count[a]++;
    count[b]++;
  }
  bool flg = true;
  for (int i = 0; i < N; i++){
    if (count[i] % 2 == 1){
      flg = false;
    }
  }
  cout << (flg ? "YES" : "NO");
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

int main(){
        cout << setprecision(10);
        while(true){
                int n, w;
                cin >> n >> w;
                if(n == 0 && w == 0){ break; }
                vector<int> counts;
                for(int i = 0; i < n; ++i){
                        int r;
                        cin >> r;
                        r /= w;
                        if(r >= counts.size()){ counts.resize(r + 1); }
                        counts[r]++;
                }
                int maxlen = 0;
                for(int i = 0; i < counts.size(); ++i){
                        maxlen = max(maxlen, counts[i]);
                }
                double answer = 0.01;
                for(int i = 0; i < counts.size(); ++i){
                        answer += (1.0 - (double)i / (counts.size() - 1)) *
                                  ((double)counts[i] / maxlen);
                }
                cout << answer << endl;
        }
        return 0;
}

Measured memory_bytes: 0
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a := iScan()
	b := iScan()
	k := iScan()
	if k <= a {
		fmt.Println(a-k, b)
	} else {
		fmt.Println(0, larger(b-(k-a), 0))
	}
}


Measured memory_bytes: 1772
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define n_p(v) next_permutation(v.begin(),v.end())
#define to_ll(b) stoll(b)
#define MOD 1000000007
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	char a,b; cin>>a>>b;
	if(a==b) cout<<'H';
	else cout<<'D';
	
	return 0;
}

Measured memory_bytes: 256
MOD = 10**9+7

H,W,K = map(int,input().split())

F = [1,1,2,3,5,8,13,21,34]

dp = [[0 for j in range(W)] for i in range(H+1)]
dp[0][0] = 1

for i in range(1,H+1):
    for j in range(W):
        dp[i][j] += dp[i-1][j]*F[j]*F[W-j-1]
        if j != W-1:
            dp[i][j] += dp[i-1][j+1]*F[j]*F[W-j-2]
        if j != 0:
            dp[i][j] += dp[i-1][j-1]*F[j-1]*F[W-j-1]
        dp[i][j] %= MOD
        
print(dp[H][K-1])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b&&b==c){
    cout<<1<<endl;
  }
  else if(a==b||b==c||a==c){
    cout<<2<<endl;
  }
  else{
cout<<3<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;

int main(){
lint N,a=0,b=0,c=0,d=0,e=0,x;
cin >>N;
char v[10];
rep(i,N){
  cin>>v;
  if(v[0]=='M')a++;
  if(v[0]=='A')b++;
  if(v[0]=='R')c++;
  if(v[0]=='C')d++;
  if(v[0]=='H')e++;
}
x=a*b*c+a*b*d+a*b*e+a*c*d+a*c*e+a*d*e+b*c*d+b*c*e+b*d*e+c*d*e;
cout<<x;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int h,w;
	int c=0;
	int d=0;
	int a[8][8];
	char b;
	cin >> h >> w;
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			cin >> b;
			if(b == '#')
			{
				a[i][j] = 1;
			}
			else
			{
				a[i][j] = 0;
			}
		}
	}
	if(a[c][d] == 0)
	{
		cout << "Impossible" << endl;
		return 0;
	}
	while(1)
	{
		if(c < (h-1) && d < (w-1))
		{
			if(a[c+1][d] == 1 && a[c][d+1] == 0)
			{
				c++;
				if(d > 0)
				{
					if(a[c][d-1] == 1)
					{
						cout << "Impossible" << endl;
						return 0;
					}
				}
			}
			else
			{
				if(a[c+1][d] == 0 && a[c][d+1] == 1)
				{
					d++;
					if(c > 0)
					{
						if(a[c-1][d] == 1)
						{
							cout << "Impossible" << endl;
							return 0;
						}
					}
				}
				else
				{
					cout << "Impossible" << endl;
					return 0;
				}
			}
		}
		else
		{
			if(c == (h-1) && d < (w-1))
			{
				if(a[c][d+1] == 1)
				{
					d++;
					if(c > 0)
					{
						if(a[c-1][d] == 1)
						{
							cout << "Impossible" << endl;
							return 0;
						}
					}
				}
				else
				{
					cout << "Impossible" << endl;
					return 0;
				}
			}
			else
			{
				if(c < (h-1) && d == (w-1))
				{
					if(a[c+1][d] == 1)
					{
						c++;
						if(d > 0)
						{
							if(a[c][d-1] == 1)
							{
								cout << "Impossible" << endl;
								return 0;
							}
						}
					}
					else
					{
						cout << "Impossible" << endl;
						return 0;
					}
				}
				else
				{
					cout << "Possible" << endl;
					return 0;
				}
			}
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 hh, nn;
	cin >> hh >> nn;
	vector<int64> aa(nn), bb(nn), memo(hh + 1, 1e18);
	for(int64 ii = 0;ii < nn;ii++)
	{
		cin >> aa[ii] >> bb[ii];
	}
	memo[0] = 0;
	for(int64 ii = 0;ii < nn;ii++)
	{
		for(int64 jj = 0;jj <= hh;jj++)
		{
			if(memo[min(jj + aa[ii], hh)] > memo[jj] + bb[ii])
			{
				memo[min(jj + aa[ii], hh)] = memo[jj] + bb[ii];
			}
		}
	}
	cout << memo[hh] << endl;
	return 0;
}


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

#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)

int main() {
	int n;
	while(cin >> n && n) {
		int a[15];
		rep(i,n) {
			cin >> a[i];
		}
		int p[15], cnt = 0;
		while(1) {
			rep(i,n) {
				p[i] = 1;
			}
			rep(i,n) {
				rep2(j,i+1,n) {
					if(a[i] == a[j]) {
						p[i]++, p[j]++;
					}
				}
			}
			bool f = 1;
			rep(i,n) {
				if(a[i] != p[i]) {
					f = 0;
					break;
				}
			}
			if(f) break;
			cnt++;
			rep(i,n) {
				a[i] = p[i];
			}		
		}
		cout << cnt << endl;
		rep(i,n-1) {
			cout << p[i] << " ";
		}
		cout << p[n-1] << endl;
	}
	return 0;
}

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

int main(){
    ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    ll cnt = x / d;
    if(cnt >= k){
        cout << abs(x - d*k) << endl;
    } else if(cnt % 2 != k % 2){
        cout << abs(x - cnt * d - d) << endl;
    } else {
        cout << abs(x - cnt * d) << endl;
    }
    return 0;
}

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

int main(){
  long long n, a, b;
  cin >> n >> a >> b;
  
  long long set = n/(a+b);
  long long rest = n%(a+b);
  
  if (rest >= a)
    rest = a;
  
  cout << a*set + rest << endl;
}

Measured memory_bytes: 3572
import math

def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

a, b, x = cin()
if a * a * b == x:  print(0)
else:
    if 2 * x <= a ** 2 * b:
        p = 2 * x / (a * b)
        print(math.degrees(math.atan(b / p)))
    else:
        S = x / a
        p = 2 * (a * b - S) / a
        print(90 - math.degrees(math.atan(a / p)))

Measured memory_bytes: 62432
import java.util.*;
 class Main {
    public static void main(String[] args) throws Exception{
        Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String T = scan.next();
        boolean flag = stringMatching(S, T);
        if(flag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
    public static boolean stringMatching(String S, String T){
        if(S.length() == T.length() || T.length() - S.length() > 1 || T.length() < S.length()){
            return false;
        }
        int i = 0;
        int j = 0;
        while(i < S.length()){
            if(S.charAt(i) != T.charAt(i)){
                return false;
            }
            i++;
            j++;
        }

        if(i == S.length() && j != T.length()){
            return true;
        }else{
            return false;
        }
    }
}


Measured memory_bytes: 35628
from collections import Counter

n = int(input())
array = [int(x) for x in input().split()]
counter = Counter(array)
array = sorted(set(array))
judge = [False for x in range(1000001)]
num = set()
set_f = set()
for a in array:
    if judge[a]:continue
    tmp = a
    while tmp + a <= 1000000:
        tmp += a
        judge[tmp] = True
    # print(len(num))
    # set_f |= set(factorization(a))
    # print(factorization(a))
print(len([1 for x in array if not judge[x] and counter[x] == 1]))


Measured memory_bytes: 45116
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
//#define int ll
#define INF INT_MAX/10

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

bool issquare(int n) {
  int sq = floor(sqrt(n));
  return sq * sq == n;
}

int main() {
  int N, D; cin >> N >> D;
  Graph G(N, vector<int>(D, 0) );
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < D; j++) {
      cin >> G[i][j];
    }
  }

  int ans = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      int x = 0;
      for (int k = 0; k < D; k++) {
        x += pow(G[i][k] - G[j][k], 2);
      }
      if (issquare(x)) {
        // cout << i << j << endl;
        ans++;
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define radrad(a)  180.0 * a / M_PI
#define pow(x) x*x
#define ll long long
static const int MAX = 100010;
static const ll INFTY = 1e12;
static const int NUMMAX = 300;


int main(){

  int a, b, x;
  double aa, bb;
  double menseki;
  double hight;
  double kakudo;

  cin >> a >> b >> x;
  aa = (double)a;
  bb = (double)b;

  menseki = (double)x / aa;

  if( menseki >= ((aa * bb) / (double)2) ){
    menseki = a * b - menseki;
    kakudo = atan( 2.0 * menseki / (aa*aa) );
    kakudo = radrad(kakudo);
  }else {
    kakudo = atan( 2.0 * menseki / (bb*bb) );
    kakudo = 90.0 - radrad(kakudo);
  }

  printf("%0.10f\n", kakudo);

  //cout << kakudo << endl;




  return 0;
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 256