akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
# define ll int64_t
# define str string
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define PI 3.141592653589793
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;



#define INF 2000000000
#define MAX_V 10



bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<ll,ll> a,pair<ll,ll> b){
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) x*=i;
    return x;
}

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

ll func(ll a,ll b,ll& ans_x,ll& ans_y){
    if(b == 0){
        ans_x = 1;
        ans_y = 0;
        return a;
    }else{
        ll ret = func(b,(a%b),ans_y,ans_x);
        ans_y -= (a/b)*ans_x;
        return ret;
    }
}

ll lcm(ll a,ll b){
   return a/gcd(a,b)*b;
}
const ll MAX = 5100000;
const ll MOD = 1000000007;
 
ll fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

using graph = vector<vector<ll>>;
pair<pair<ll,ll>,ll> p[100010];


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    
    sort(ALL(a));
    ll sum=0;
    rep(i,k) sum+=a[i];
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pii pair <int,int>
#define pll pair <ll,ll>
#define testcase() int t; cin>>t; while(t--)
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,n) for(int i=1;i<=n;i++)
#define vll vector <ll>
#define all(v) v.begin(),v.end()

ll M = 1e9 + 7;
double pi = acos(-1.0);
ll powerm(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} return res%M; }
ll power(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x); y=y>>1; x=(x*x);} return res; }
ll gcd(ll a,ll b){if(b>a)return gcd(b,a); if(b==0)return a; return gcd(b,a%b);}

int main() {
	
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	int n,m; ll k; cin>>n>>m>>k;
	ll a[n+1],b[m+1]; a[0] = b[0] = 0;
	forn1(i,n){ cin>>a[i]; a[i] += a[i-1]; }
	forn1(i,m){ cin>>b[i]; b[i] += b[i-1]; }
	int cc = 0;
	int id1 = n, id2 = 0;
	while(id1>=0 && id2<=m)
	{
		while(id1>=0 && a[id1]+b[id2]>k) id1--;
		while(id2<=m && a[id1]+b[id2]<=k) id2++;
		id2--;
		cc = max( cc , id1 + id2 );
		id2++;
	}
	id1 = 0, id2 = m;
	while(id1<=n && id2>=0)
	{
		while(id2>=0 && a[id1]+b[id2]>k) id2--;
		while(id1<=n && a[id1]+b[id2]<=k) id1++;
		id1--;
		cc = max( cc , id1 + id2 );
		id1++;
	}
	cout<<cc;
	return 0;
}


Measured memory_bytes: 6776
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define MOD 1000000007



int main() {
    int A, B, T; cin >> A >> B >> T;
    cout << (T/A) * B << endl;
}


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

int main(){
	int a;
	cin>>a;
	int m=0;
	int x=0;
	for(int i=0;i<a;i++){
		int b[10000];
		cin>>b[i];
		 m=max(m,b[i]);
		x+=b[i];
	}
	cout<<x-m/2<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>

using namespace std;
int main()
{
  int D, G;
  cin >> D >> G;
  vector<int> p(D, 0);
  vector<int> c(D, 0);
  for (auto i = 0; i  <D; i++){
    cin >> p[i] >> c[i];
  }

  vector<int> dp_prev((G/100) + 1, G);
  vector<int> dp_next((G/100) + 1, G);

  for(auto i = 0; i < D; i++) {
    dp_prev[0] = 0;
    dp_next[0] = 0;
    for (auto j = 1; j <= p[i]; j++) {
      for (auto k = 0; k < G/100; k++) {
        int next_point = min(G/100, k + (i+1) * j + (j==p[i]?c[i]/100:0));
        dp_next[next_point] = min(dp_next[next_point], dp_prev[k] + j);
      }
    }
    dp_prev = dp_next;
  }
  std::cout << dp_next[G/100] << std::endl;
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12

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

  if(x < 1200) cout << "ABC" << endl;
  else cout << "ARC" << endl;

  return 0;
}


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

inline void read(int &x) {
	char ch; bool f = 0; while((ch = getchar()), (ch < '0' || ch > '9')) f |= (ch == '-');
	x = ch - '0'; while((ch = getchar()), (ch >= '0' && ch <= '9')) x = x * 10 + (ch  - '0');
	if(f) x = -x;
}

const int MAXN = 100010;
bool F[MAXN];
int N;

int main() {
	int i, t, Ans = 0; read(N);
	for(i = 1; i <= N; i++) read(t), F[i] = t == i;
	for(i = 1; i <= N; i++) if(F[i]) {
		if(F[i+1]) F[i+1] = 0;
		Ans++;
	}
	printf("%d", Ans);
}

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

int main()
{
    int N,L;
    string st[110];
    string ans;
    cin>>N>>L;
    for(int i=0;i<N;i++)cin>>st[i];
    sort(st,st+N);
    for(int i=0;i<N;i++){
        ans += st[i];
    }
    cout<<ans<<endl;
}

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

  int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n;i++){
      cin >> a[i];
    }
    sort(a, a+n);
    int ma = a[n-1]/2;
    int ans = 0;
    for(int i = 0; i < n-1; i++){
      ans += a[i];
    }
    cout << ans + a[n-1]/2 << endl;
    
  }


  
  
  

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include <cstdint>
#include <boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define vi vector
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;


int main() {
	int N;
	cin >> N;
	vector<int>a(N);

	ll b = 0;
	ll c = 0;
	rep(i, N) {
		cin >> a[i];
		b-=a[i] * 2;
		c += pow(a[i], 2);
	}
	ll tmp=0;
	for (int i = -100; i <= 100; i++) {
		ll d = pow(i, 2)*N + i * b;
		if (d < tmp) {
			tmp = d;
		}
	}
	ll ans = tmp + c;
	cout << ans << endl;

}


Measured memory_bytes: 764
#include <stdio.h>

int parent(int i){ return i / 2;}
int left(int i){ return 2 * i;}
int right(int i){ return 2 * i + 1;}

int main(){
  int h[512], size, n, i;

  scanf("%d", &size);
  for(i = 1; i <= size; ++i){
    scanf("%d", h + i);
  }

  for(i = 1; i <= size; ++i){
    printf("node %d: key = %d, ", i, h[i]);
    if(parent(i)) printf("parent key = %d, ", h[parent(i)]);
    if(left(i) <= size) printf("left key = %d, ", h[left(i)]);
    if(right(i) <= size) printf("right key = %d, ", h[right(i)]);
    puts("");
  }
  return 0;
}



Measured memory_bytes: 2044
import java.util.*;

public class Main{
	public static void main(String[] args){

		Scanner scan = new Scanner(System.in);
		for(;;){
			String input = scan.next();
			if(input.equals("-")){
				break;
			}
			int m = scan.nextInt();
			int len = input.length();
			StringBuilder sb = new StringBuilder();
			String output = input;
			for(int i = 0; i < m; i++){
				int h = scan.nextInt();
				String s1 = output.substring(0, h);
				String s2 = output.substring(h, len);
				output = s2 + s1;
			}
			System.out.println(output);
		}
	}
}

Measured memory_bytes: 26436
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;

int main(){
    string s;
    cin >> s;
    int k;
    cin >> k;
    map<string, int> memo;
    for(char ch = 'a'; ch <= 'z'; ch++){
        if(memo.size() > 5) break;
        for(int start = 0, end = 0; start < s.length(); start++){
            if(s[start] == ch){
                string sub = "";
                for(int i = 0; i < 5 && start+i < s.length(); i++){
                    sub += s[start+i];
                    memo[sub] = 1;
                }
            }
        }
    }

    int i = 1;
    for(auto p: memo){
        if(i == k){
            cout << p.first << endl;
            break;
        }
        i++;
    }
    return 0;
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define zero(v) memset(v,0,sizeof(v))
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
typedef long long ll;
typedef unsigned uint;
const int INF=1e8;
const int oo=0x3f3f3f3f;
const double eps=1e-10;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}
int n;
const int Maxn=2e5+5;
pair<ll,ll>buf[Maxn];
bool solve(){
	sort(buf,buf+n);
//	rep(i,n){
//		cout<<buf[i].second<<' '<<buf[i].first<<endl;
//	}
	ll now=0,endTime;
	rep(i,n){
		int A=buf[i].second,B=buf[i].first;
		endTime=now+A;
//		cout<<i<<':'<<now<<' '<<endTime<<endl;
		if(endTime>B){
			return false;
		}
		now=endTime;
	}
	return true;
}
int main(){
	cin>>n;
	rep(i,n){
		cin>>buf[i].second>>buf[i].first;
	}
//	cout<<endl;
	cout<<(solve()?"Yes":"No")<<endl;
	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
const int MOD = (int) 1e9 + 7;
const i64 INF = (i64) 1e18 + 42;

int N, A[3][3], b[10];
bool appear[3][3];

int main() {
  cin.tie(nullptr) -> sync_with_stdio(false);
      for(int i = 0; i < 3; i++) {
        for(int j = 0; j < 3; j++) cin >> A[i][j];
      }
      cin >> N;
      for(int i = 0; i < N; i++) cin >> b[i];
      for(int i = 0; i < N; i++) {
          for(int j = 0; j < N; j++) {
              appear[i][j] = false;
              for(int k = 0; k < N; k++) {
                    if(A[i][j] == b[k]) appear[i][j] = true;
              }
           }
        }
    string ANS = "No";
    for(int i = 0; i < 3; i++) {
        if(appear[i][0] and appear[i][1] and appear[i][2]) ANS = "Yes";
    }
    for(int i = 0; i < 3; i++) {
        if(appear[0][i] and appear[1][i] and appear[2][i]) ANS = "Yes";
    }
    if(appear[0][0] and appear[1][1] and appear[2][2]) ANS = "Yes";
    if(appear[0][2] and appear[1][1] and appear[2][0]) ANS = "Yes";
    cout << ANS << endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int i[12];
	for (int a = 0; a < 12; a++)
	{
		cin >> i[a];
	}
	sort(i, i + 12);
	if (i[0] == i[2] && i[0] == i[1] && i[0] == i[3] &&
		i[4] == i[6] && i[4] == i[5] && i[7] == i[4] &&
		i[8] == i[9] && i[8] == i[10] && i[8] == i[11])
		cout << "yes" << endl;
	else
		cout << "no" << endl;
	return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    int N;
    cin >> N;
    int a[3000];
    for(int i=0;i<N;i++)
        cin >> a[i];
    
    ll ans = 0;
    for(int i=0;i<N;i++){
        ans += a[i] - 1;
    }

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

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

int main(void)
{
	int a[1000];
	int n;
	int i;
	double heikin=0,heikina=0;

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

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

		heikina = heikin / n;

		double bunsan=0, hensa=0,bunsana=0,hensaa=0;

		for (i = 0; i < n; i++)
		{
			bunsan = bunsan+((a[i] - heikina)*(a[i]-heikina));
		}

		bunsana = bunsan / n;
		hensaa = sqrt(bunsana);

		printf("%lf\n", hensaa);

		bunsan = 0, bunsana = 0, hensa = 0, hensaa = 0, heikin = 0, heikina = 0;
	}

	return 0;
}


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

int main(){
    int i, j, k;
    int N, x[100], y[100], h[100];
    cin >> N;
    for(i=0; i<N; i++) cin >> x[i] >> y[i] >> h[i];

    for(int Cx=0; Cx<=100; Cx++){
        for(int Cy=0; Cy<=100; Cy++){
            int H = -1; // -1:未確定
            int Hmax = 2e9; // h[i]=0である点から要求されるHの上限
            bool success = true;
            for(i=0; i<N; i++){
                int d = abs(Cx-x[i]) + abs(Cy-y[i]);
                if(h[i] > 0){
                    int H2 = h[i] + d;
                    if(H > 0 && H != H2){
                        success = false;
                        break;
                    }else{
                        H = H2;
                    }
                }else{
                    Hmax = min(Hmax, d);
                }
            }
            if(success && H <= Hmax){
                cout << Cx << " " << Cy << " " << H << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
C = [2]
D,E = list(map(int,input().split()))
if D in A and E in A:
    print("Yes")
    exit()
elif D in B and E in B:
    print("Yes")
    exit()
elif D in C and E in C:
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9) + 7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";
const double PI = acos(-1);

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector< pair<ll, ll> > prime_factorize(ll n)
{
	vector<pair<ll, ll>> p;
	for (ll i = 2; i * i <= n; i++)
	{
		if ((n % i) != 0)
			continue;
		pair<ll, ll> a = make_pair(i, 0);
		while ((n % i) == 0)
		{
			n /= i;
			a.second += 1;
		}
		p.push_back(a);
	}

	if (n != 1)
		p.push_back(make_pair(n, 1));
	return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a)
{
	ll b = MOD, u = 1, v = 0;
	while (b)
	{
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0)
	{
		u += MOD;
	}
	return u;
}
// 順列
ll permutation(const ll n, const ll m)
{
	ll result = 1;
	for (ll i = n; i > n - m; i--)
	{
		result = (result * i) % MOD;
	}
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x)
{
	if (x == 0)
		return 1;
	ll res = repeat_square(n, x / 2);
	res = res * res % MOD;
	if ((x % 2) == 1)
		res = res * n % MOD;
	return res;
}
// 組み合わせ nCm
ll combination(ll n, ll m)
{
	ll p = permutation(n, m);
	ll div = 1;
	for (ll i = 2; i <= m; i++)
	{
		div = (div * i) % MOD;
	}
	return (p * modinv(div)) % MOD;
}

int main() {
	int N, M;
	cin >> N >> M;
	vector< vector<int> > K(M);

	rep(i, M) {
		int k;
		cin >> k;
		vector<int> s(k);
		rep(j, k) {
			int x;
			cin >> x; x--;
			s[j] = x;
		};
		K[i] = s;
	}
	vector<int> p(M);
	rep(i, M) cin >> p[i];

	ll ans = 0;
	rep (bit, 1 << N) {
		bool ok = true;
		rep (i, M) {
			int count = 0;
			for (auto v : K[i]) {
				if (bit >> v & 1) count++;
			}

			if ((count % 2) != p[i]) ok = false;
		}

		if (ok) ans++;
	}

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


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    string s;cin>>s;
    int N=0,W=0,S=0,E=0;
    for(char c:s){
        if(c=='N')N++;
        else if(c=='W')W++;
        else if(c=='S')S++;
        else E++;
    }
    string ans="Yes";
    if((N==0&&S>0)||(N>0&&S==0))ans="No";
    if((E==0&&W>0)||(E>0&&W==0))ans="No";
    cout<<ans<<endl;
}


Measured memory_bytes: 3620
if __name__ == '__main__':
    N, M = map(int, input().split())
    like = [0]*(M+1)
    
    for i in range(N):
        row = list(map(int, input().split()))
        for j in range(1,len(row)):
            like[row[j]] += 1
    count = 0
    for l in like:
        if l == N:
            count += 1
    print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long int
 
#define REP(i, n) for(int i = 0; i < (n); i++)
#define SREP(i, s) for(int i = 0; i < (s.size()); i++)
#define SORT(v, n) sort(v, v+n);
#define GSORT(v, n) sort(v, v+n, greater<int>());
#define VSORT(v) sort(v.begin(),v.end());
#define VGSORT(v) sort(v.begin(),v.end(),greater<int>());
#define REV(a) reverse(begin(a),end(a));
 
ll gcd(ll x, ll y){
	if(x<y) swap(x,y);
	if(y==0) return x;
	return gcd(y,x%y);
}
 
ll lcm(ll x, ll y){
	return (x*y/gcd(x,y));
}

int main(){
	ios::sync_with_stdio(false);cin.tie(0);
////////////////////////////////////////////
	int n;
	cin >> n;
	for(int i=0;;i++){
		if(n==4||n==2||n==1){
			cout << i+4 << endl;
			break;
		}
		n%2==0 ? n/=2 : n=n*3+1;
	}
/////////////////////////////////////////////
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)
// reader
var sc = bufio.NewScanner(os.Stdin)

func main(){
	// parameters
	var N, M int
	cntMap := make(map[int]int)
	var tmpInt int

	sc.Split(bufio.ScanWords)

	// Problems
	N = nextInt()
	for i:=0; i<N; i++{
		tmpInt = nextInt()
		cntMap[tmpInt]++
	}

	// Requires
	M = nextInt()
	for i:=0; i<M; i++{
		tmpInt = nextInt()

		if cntMap[tmpInt] > 0 {
			cntMap[tmpInt]--
		}else{
			fmt.Println("NO")
			return
		}
	}

	fmt.Println("YES")
}

// https://qiita.com/tnoda_/items/b503a72eac82862d30c6
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 12672
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

bitset<20000> dp[2];

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

    string s;
    int x, y;
    cin >> s >> x >> y;
    s += 'T';
    int n = s.length();
    x += n, y += n;
    bool flag = false;
    int dir = 0;
    dp[0] = 1, dp[1] = 1;
    dp[0] <<= n, dp[1] <<= n;
    int cnt = 0;
    for(int i = 0; i < n; ++i){
        if(s[i] == 'T'){
            if(flag){
                dp[dir] = (dp[dir] << cnt) | (dp[dir] >> cnt);
            }
            else{
                dp[0] = dp[0] << cnt;
                flag = true;
            }
            dir ^= 1;
            cnt = 0;
        }
        else    ++cnt;
    }
    if(dp[0][x] & dp[1][y]) cout << "Yes\n";
    else    cout << "No\n";
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int x, y;
	int temp;
	while(1) {
		scanf("%d %d", &x, &y);
		if(x == 0 && y == 0) break;
		if(x > y) {
			temp = y;
			y = x;
			x = temp;
		}
	printf("%d %d\n", x, y);
	}
	return 0;
}

Measured memory_bytes: 600
import sys


def compress(aaa):
    s = sorted(set(aaa))
    d = {a: i for i, a in enumerate(s)}
    return d, list(map(d.get, aaa))


n, *aaa = map(int, sys.stdin.buffer.read().split())

d, aaa = compress(aaa)
ans = 0
for i, a in enumerate(aaa):
    ans += (i ^ a) & 1
print(ans // 2)


Measured memory_bytes: 25388
x, n =map(int,input().split())
ps = list(map(int, input().split()))
a=100

if not(x in ps):
    print(x)
else:
    for i in range(100):
        if x+i in ps:
            b=100
        else:
            a=x+i
            break
    for j in range(100):
        if x-j in ps:
            b=100
        else:
            if a-x>=j:
                a=x-j
                break
    print(a)

Measured memory_bytes: 9200
x, y = map(int, input().split())

ans = float('inf')

if y > x:
    ans = y - x

if y >= -x:
    ans = min(x+y+1, ans)

if -y >= -x:
    ans = min(x-y+2, ans)

if -y >= x:
    ans = min(-x-y+1, ans)

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cfenv>



int main(int argc, char **argv)
{
    double A, B, N;
    std::cin >> A >> B >> N;

    if(N < B){
        std::cout << std::floor(A*N/B) << std::endl;
        return 0;
    }else{ // if(N >= B){
        std::cout << std::floor(A*(B-1)/B) << std::endl;
        return 0;
    }

    
}


Measured memory_bytes: 3908
#include<stdio.h>

int main(){
	int a, b, sum, count;
	while (scanf("%d %d",&a,&b)!=EOF){
		if (0 <= a, b <= 1000000){
			count = 1;
			sum = a + b;
			while (sum/10 >= 1){
				sum /= 10;
				count++;
			}
			printf("%d\n",count);
		}
	}
	return 0;
}

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

const int MOD = 1e9+7;
const int MAX_N = 2e6+10;
int K;
string S;

ll fact[MAX_N];
ll invf[MAX_N];

ll powmod(ll x, int y)
{
	ll res=1;
	while(y){
		if(y&1) (res*=x)%=MOD;
		(x*=x)%=MOD;
		y>>=1;
	}
	return res;
}

ll nCk(int n, int k)
{
    if(k<0||k>n) return 0;
    return (((fact[n]*invf[n-k])%MOD)*invf[k])%MOD;
}

void solve()
{
	fact[0]=1;
	for(int i=1;i<MAX_N;++i) fact[i]=1LL*i*fact[i-1]%MOD;
	invf[MAX_N-1]=powmod(fact[MAX_N-1], MOD-2);
	for(int i=MAX_N-2;i>=0;--i) invf[i]=1LL*invf[i+1]*(i+1)%MOD;
	
	ll res = 0;
	const int n = S.length();
	for(int len=0;len<n;++len){
		(res+=1LL*nCk(n+K, len)*powmod(25,n+K-len)%MOD)%=MOD;
	}
	ll ans = (powmod(26,n+K)-res+MOD)%MOD;
	cout<<ans;
}

int main()
{
	cin >> K >> S;
	solve();
	return 0;
}

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

int main(){
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;
    bool t = (k < e-a);
    if ( t ){
        cout << ":(" << endl;
    }else{
        cout << "Yay!" << endl;
    }
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N,K,X,Y;
    cin >>N>>K>>X>>Y;
    
    cout << min(N,K)*X+max(0LL,N-K)*Y << endl;


    return 0;
    

}

Measured memory_bytes: 3512
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define MAX 5050
#define INF (1LL<<60LL)
typedef pair<int,int> P;
int V;
struct edge2{
  int from,to,cost;
  edge2(){}
  edge2(int from,int to,int cost):from(from),to(to),cost(cost){}
};
edge2 es[MAX];
int d[MAX];
int ok[MAX];
int used[MAX];
int shortest_path(int s,int e){
  for(int i=0;i<V;i++) d[i]=INF;
  d[s]=0;
  for(int j=0;j<V;j++){
    bool update=0;
    for(int i=0;i<e;i++){
      edge2 e=es[i];
      if(!ok[e.from]||!ok[e.to]) continue;
      if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost){
        d[e.to]=d[e.from]+e.cost;
        update=1;
      }
    }
    if(!update) break;
    if(j==V-1){
      cout<<-1<<endl;
      exit(0);
    }
  }
  return d[V-1];
}

vector<int> G[MAX];
void dfs2(int v){
  if(used[v]) return;
  used[v]=1;
  for(int u:G[v]){
    dfs2(u);
  }
}

signed main(){
  int v,e,p;
  cin>>v>>e>>p;
  for(int i=0;i<e;i++){
    int u,v,d;
    cin>>u>>v>>d;u--;v--;
    G[u].push_back(v);
    es[i]=edge2(u,v,p-d);
  }
  for(int i=0;i<v;i++){
    memset(used,0,sizeof(used));
    dfs2(i);
    ok[i]=used[v-1];
  }
  V=v;
  cout<<max<int>(-shortest_path(0,e),0)<<endl;
  return 0;
}


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

using namespace std;
#define ld long double
long long  dp[3000][3000];

int main()
{
    int n,m,ans=0,mod=1e9+7;
    cin >> n >> m;
    char arr[n+1][m+1];
    for (int i=1; i<=n; i++)
    {
        for (int j=1; j<=m; j++)
            cin >> arr[i][j];
    }

    dp[1][1]=1;
    for (int i=2; i<=max(n,m); i++)
    {
        if (i<=n)
        {
            if (arr[i][1]=='#') dp[i][1]=0;
            else dp[i][1]=dp[i-1][1];
        }
        if (i<=m)
        {
            if (arr[1][i]=='#') dp[1][i]=0;
            else dp[1][i]=dp[1][i-1];
        }
    }

    for (int i=2; i<=n; i++)
    {
        for (int j=2; j<=m; j++)
        {
            if (arr[i][j]=='#') dp[i][j]=0;
            else dp[i][j] = (dp[i-1][j]+dp[i][j-1])%mod;
        }
    }
    cout << dp[n][m] << "\n";

    return 0;
}


Measured memory_bytes: 24832
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,K;
  cin >> N >> K;
  vector<int>A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i); 
  }
  sort(A.begin(), A.end());
  int ok = A.at(N-1)+1;
  int ng = 0;
  
  while (ok - ng > 1) {
    int mid = (ng + ok) / 2;
    long long sum = 0;
    for (int i = 0; i < N; i++) {
      if (A.at(i)/mid * mid == A.at(i)){
        sum += A.at(i)/mid - 1;
      }
      else {
        sum += A.at(i)/mid;
      }
    }
    if (sum <= K){
      ok = mid;
    }
    else {
      ng = mid; 
    }
  }
 
  cout << ok << endl;
  return 0; 
}

Measured memory_bytes: 4040
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
    string S;
    cin >> S;

    int ans = 0;

    if(S.size() % 2 == 0) {
        rep(i, S.size() / 2) {
            if(S.at(i) != S.at(S.size() - i - 1)) ans++;
        }
    } else {
        rep(i, (S.size() + 1) / 2) {
            if(S.at(i) != S.at(S.size() - i - 1)) ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
S = input().strip()
K = int(input())

L = len(S)

if L == 1:
    print(K//2)
    exit()

if len(set(S)) == 1:
    print((L*K)//2)
    exit()

L = len(S)
acc = [0] * L
tmp = 0
cnt1 = 0
for i in range(1, L):
    if S[i - 1] == S[i]:
        tmp += 1
        if tmp % 2 != 0:
            cnt1 += 1
    else:
        tmp = 0
    acc[i] = tmp

if K == 1:
    print(cnt1*K)


S += S
L = len(S)
acc = [0] * L
tmp = 0
cnt2 = 0

for i in range(1, L):
    if S[i - 1] == S[i]:
        tmp += 1
        if tmp % 2 != 0:
            cnt2 += 1
    else:
        tmp = 0
    acc[i] = tmp

diff = cnt2 - cnt1

print(cnt1 + diff*(K-1))

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

  typedef long long int ll;
  typedef pair<int,int> pi;
  typedef pair<ll,ll> pll;
  typedef vector<int> vi;
  typedef vector<ll> vll;
  typedef vector<pi> vpi;
  typedef vector<pll> vpll;

  #define  ff           first
  #define  ss           second
  #define  pb           push_back
  #define  IOS          ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  #define  D(x)         cout << #x << " - " << x << endl;
  #define  D2(x)        cout << "[" << #x << ": "; for(auto it:x) cout << it << " "; cout << "]" << endl;
  #define  all(x)       (x).begin(), (x).end()
  #define  D2p(x)       cout << #x << " ~ [ "; for(auto n: x) cout << n.first << "-" << n.second << " / "; cout << "]" << endl;
  #define  ps(x,y)      fixed<<setprecision(y)<<x
  #define  rep(i,a,b)   for(ll i=a ; i<b ; ++i)

  const ll MOD = 1e9 + 7;
  const ll INF = 1e18;
  const ll maxn = 1e6 + 4;


  void solve(){
	map<pair<int,int>,int> mp;
	ll ans=0;
	int n;
	cin >> n;
	for(int i=1;i<=n;i++){
		int f = i%10;
		int l = f;
		int k = i;
		while(k>0){
			l = k%10;
			k/=10;
		}
		mp[{l,f}]++;
		ans += max(2*(mp[{f,l}])-(l==f && f==l),0);
	}
	cout << ans;
  }

  int main(){
    IOS
    solve();
    cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
  }

// integer overflow
// remember to clear visited array
// take input as vector<string> while using grid
// don't assign after modifying


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  ll n, m;
  cin >> n >> m;

  ll a[m], b[m];
  map<ll, ll> mp;
  REP(i, m){
    cin >> a[i] >> b[i];
    if(b[i] == n) mp[a[i]]++;
    if(a[i] == 1) mp[b[i]]++;
  }
  REP(i, mp.size()){
    if(mp[i] >= 2){
      cout << "POSSIBLE";
      return 0;
    }
  }
  cout << "IMPOSSIBLE";
  return 0;
}


Measured memory_bytes: 15872
#ifndef LOCAL
#pragma GCC optimize ("O3")
#endif
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define mor > muu & operator << (
#define R22(r) sim > typename \
  enable_if<1 r sizeof dud<c>(0), muu&>::type operator<<(c g) {
sim > struct rge { c b, e; };
sim > rge<c> range(c h, c n) { return {h, n}; }
sim > auto dud(c* r) -> decltype(cerr << *r);
sim > char dud(...);
struct muu {
#ifdef LOCAL
stringstream a;
~muu() { cerr << a.str() << endl; }
R22(<) a << boolalpha << g; ris; }
R22(==) ris << range(begin(g), end(g)); }
sim, class b mor pair < b, c > r) { ris << "(" << r.first << ", " << r.second << ")"; }
sim mor rge<c> u) {
  a << "[";
  for (c i = u.b; i != u.e; ++i)
    *this << ", " + 2 * (i == u.b) << *i;
  ris << "]";
}
#else
sim mor const c&) { ris; }
#endif
muu & operator()() { ris; }
};
#define imie(r...) "[" #r ": " << (r) << "] "
#define imask(r...) "[" #r ": " << bitset<8 * sizeof(r)>(r) << "] "
#define arr(a, i) "[" #a imie(i) ": " << a[i] << "] "
#define arr2(a, i, j) "[" #a imie(i) imie(j) ": " << a[i][j] << "] "
#define debug (muu() << __FUNCTION__ << "#" << __LINE__ << ": ")

const int N = 1e5 + 7;
vector <int> G[N];
int dp[N];
int n, m;

void dfs(int v) {
    dp[v] = 1;
    for (int u : G[v]) {
        if (!dp[u]) dfs(u);
        dp[v] = max(dp[v], 1 + dp[u]);
    }
}

int main() {
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= m; ++i) {
        int a, b;
        scanf("%d %d", &a, &b);
        G[a].push_back(b);
    }
    for (int i = 1; i <= n; ++i) if (!dp[i]) dfs(i);
    int wynik = 0;
    for (int i = 1; i <= n; ++i) wynik = max(wynik, dp[i]);
    printf("%d\n", wynik - 1);
    return 0;
}


Measured memory_bytes: 7296
package main

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

const mod = 998244353
const facNum = 300001

func main() {
	sc := newScanner(os.Stdin)
	N := sc.i()
	ans := make([]int, 4)
	for i := 0; i < N; i++ {
		s := sc.s()
		if s == "AC" {
			ans[0] += 1
		} else if s == "WA" {
			ans[1] += 1
		} else if s == "TLE" {
			ans[2] += 1
		} else {
			ans[3] += 1
		}
	}
	fmt.Printf("AC x %d\n", ans[0])
	fmt.Printf("WA x %d\n", ans[1])
	fmt.Printf("TLE x %d\n", ans[2])
	fmt.Printf("RE x %d\n", ans[3])
}

// fmt.Println("Yes")
// fmt.Println("No")

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}

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

//const factorial = new
func Pow(a, n int) int {
	ans := 1
	for n > 0 {
		if (n & 1) == 1 {
			ans = ans * a % mod
		}
		a = a * a % mod
		n = n >> 1
	}
	return ans
}

func Gcd(a, b int) int {
	if a < b {
		return Gcd(b, a)
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

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

func combination(n, k int, fac, ifac []int) int {
	if n < k || n < 0 {
		return 0
	}
	if k == 0 {
		return 1
	}
	//while n != 0
	ans := ifac[k] * ifac[n-k] % mod
	return ans * fac[n] % mod
}

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

// 階乗: factorial
// コンビネーションを計算する際に前もって計算しておく
// fac[k] => k! (mod M)
// ifac[k] => k!^(M-2) (mod M)
// n: ex. 2 * 10^5 => 200001
// fac, ifac := factorial()
func factorial() (fac []int, ifac []int) {
	fac = make([]int, facNum)
	fac[0] = 1
	ifac = make([]int, facNum)
	ifac[0] = 1
	for i := 1; i < facNum; i++ {
		fac[i] = fac[i-1] * i % mod
		ifac[i] = ifac[i-1] * Pow(i, mod-2) % mod
	}
	return
}

// vs: sorted slice int value
func lowerBound(vs []int, v int) (index int) {
	n := len(vs) / 2
	m := len(vs)
	for m != n {
		if vs[n] < v {
			n = (m-n+1)/2 + n
			//m = m
		} else {
			m = n
			n = n / 2
		}
	}
	return n
}

func IntSlice(n, init int) []int {
	r := make([]int, n)
	for i := range r {
		r[i] = init
	}
	return r
}


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

/*新たな文字列の偶数文字目をSの各文字に変える
*/


int main() {
  int N;
  cin >> N;
  string S,T;
  cin >> S >> T;
  string X;
  for(int i = 0;i<2*N;i++){
      X.push_back('a');
  }

  for(int i = 0;i<2*N;i++){
      if(i%2 == 0) X[i] = S[i/2];
      else X[i] = T[i/2];
  }
  cout << X << endl;

 }

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

int main() {
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    sort(arr, arr+n);
    for(int i = 0; i < n; i++) {
       if(arr[i] == arr[i+1]) {
           cout<<"NO"<<endl;
           return 0;
       }
    }
    cout<<"YES"<<endl;
    return 0;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const ll mod = 1000000007;
vector<vector<int>> G;
vector<int> K;
int main() {
	ll A, B, G, k, ans = 0;
	cin >> A >> B;
	G = gcd(A, B);
	k = (ll)sqrt(G);
	rep(i, 2, k + 1) {
		if (G % i == 0)ans++;
		while (G % i == 0)G /= i;
	}
	if (G > k)ans++;
	printf("%lld\n", ans + 1);
	return 0;
}


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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX

const double EPS = 1e-14;
const double PI  = acos(-1.0);


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

  int ans = 0;
  REP (i, s.size()) {
    if (s[i] == '+') ans++;
    else ans--;
  }

  cout << ans << endl;
}


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

using namespace std;

const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
typedef long long ll;

const int maxn = 110;

int N;

vector<unordered_map<string, ll>> memo(maxn);

bool check(string last4) {
    if (last4.find("AGC") != string::npos) {
        return false;
    }
    for (int i = 0; i < 4 - 1; ++i) {
        swap(last4[i], last4[i + 1]);
        if (last4.find("AGC") != string::npos) {
            return false;
        }
        swap(last4[i], last4[i + 1]);
    }
    return true;
}

ll dfs(int cur, const string& last3) {
    if (memo[cur].count(last3)) {
        return memo[cur][last3];
    }
    if (cur == N) {
        return 1;
    }
    ll ret = 0;
    for (char c : string("ACGT")) {
        if (check(last3 + c)) {
            ret = (ret % MOD + dfs(cur + 1, last3.substr(1) + c) % MOD) % MOD;
        }
    }
    return memo[cur][last3] = ret;
}

int main() {
    cin >> N;
    cout << dfs(0, "TTT") << endl;
    return 0;
}

Measured memory_bytes: 896
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys

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

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

print(chr(ord(input())+1))


Measured memory_bytes: 5716
import math
from fractions import Fraction
N = int(input())

ta = [0] * N
ao = [0] * N

for i in range(N):
    t, a = map(int, input().split())
    if i == 0:
        ta[i] = t
        ao[i] = a
    else:
        tmp = max(math.ceil(Fraction(ta[i-1],t)), math.ceil(Fraction(ao[i-1],a)))
        ta[i] = t*tmp
        ao[i] = a*tmp

print(ta[-1]+ao[-1])


Measured memory_bytes: 5088
N = input()
import itertools
li = []
for v in itertools.product('0357', repeat=len(N)):
    a = ''
    for w in v:
        a = a + w
    li.append(a)

li2 = []
for v in li:
    if '3' in v and '5' in v and '7' in v and int(v) <= int(N):
        v = v.replace('0', '')
        li2.append(v)
    else: pass
print(len(set(li2)))

Measured memory_bytes: 36756
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e >> f;
    set<int> water;
    for(int i = 0; i <= f; i += 100 * a){
        for(int j = 0; j <= f; j += 100 * b){
            if(i + j <= f){
                water.insert(i + j);
            }
        }
    }
    set<int> sugar;
    for(int i = 0; i <= f; i += c){
        for(int j = 0; j <= f; j += d){
            if(i + j <= f){
                sugar.insert(i + j);
            }
        }
    }
    double mx = 0.0;
    P ans = make_pair(100 * a, 0);
    for(auto i : water){
        for(auto j : sugar){
            if(0 < i + j && i + j <= f && mx < (double)(100 * j) / (double)(i + j) && (double)(100 * j) / (double)(i + j) <= (double)(100 * e) / (double)(100 + e)){
                mx = (double)(100 * j) / (double)(i + j);
                ans.first = i + j;
                ans.second = j;
            }
        }
    }
    cout << ans.first << " " << ans.second << endl;
}

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

int main() {
	int S;
	cin >> S;
	int h = S / 3600;
	int m = (S - h * 3600) / 60;
	int s = (S - h * 3600) % 60;
	cout << h << ":" << m << ":" << s << endl;
	return 0;
}

Measured memory_bytes: 3080
package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var n, l int
	fmt.Scan(&n, &l)

	var w []string
	for i := 0; i < n; i++ {
		var temp string
		fmt.Scan(&temp)
		w = append(w, temp)
	}

	sort.Strings(w)

	fmt.Println(strings.Join(w, ""))
}

Measured memory_bytes: 1900
/*
THE BEST IS YET TO COME
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define r(i,s,l) for(int i=s;i<l;i++)
#define mod 1000000007
#define INT_BITS 32
#define ld long double
#define pp pair<long long,long long>
#define ss second
#define ff first
#define N 2000005
#define all(a) a.begin(),a.end()
#define pb push_back
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
int main()
{
    fast();
    int n;
    cin>>n;
    int ct=0;
    r(i,1,n+1)
    {
        int dig=0;
        int x=i;
        while(x)
        {
            x = x/10;
            dig++;
            //cout<<i<<endl;
        }
        if(dig&1)
            ct++;
    }
    cout<<ct;
    return 0;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int count=0,count1=0,score2=0,ken3=0;
  
  string ss;
  for(int i=0;i<n;i++){
    
    cin >> ss;
    if(ss=="AC")count++;
    else if(ss=="WA")count1++;
    else if(ss=="TLE")score2++;
    else if(ss=="RE")ken3++;
  }
  cout << "AC" << " " << "x" << " " << count << endl;
  cout << "WA" << " " << "x" << " " << count1 << endl;
  cout << "TLE" << " " << "x" << " " << score2 << endl;
  cout << "RE" << " " << "x" << " " << ken3 << endl;
}



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

#input
N = int(input())
A = list(map(int, input().split()))

#output
from collections import Counter
import bisect

l = Counter(A).most_common()
l = [b for a, b in l]
M = len(l)
l.sort()
p = sum(l)

maximum_operation = [0] * N

ll = []
for x in reversed(range(1, N+1)):
    a = bisect.bisect_left(l, x)
    if a == 0:
        b = M*x
        c = 0
    elif a >= M:
        b = 0
        c = p
    else:
        b = (M-a)*x
        c = sum(l[0:a]) 
    ll.append((b + c)/x)

for K in range(M):
    maximum_operation[K] = N - bisect.bisect_left(ll, K+1)

for m in maximum_operation:
    print(m)


Measured memory_bytes: 120624
n, m, c = map(int, input().split())
B = list(map(int, input().split()))
cnt = 0
for i in range(n):
    A_i = list(map(int, input().split()))
    chk = 0
    for j in range(m):
        chk += (A_i[j]*B[j])
    chk += c
    if chk > 0:
        cnt += 1
    else:
        pass
print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const long long MOD=1e9+7;
int main(){
  int mp[1001];
  mp[1]=1;
  mp[2]=2;
  mp[3]=3;
  for(int i=3;i<=1000;++i){
    bool flag=false;
    for(int j=2;j<i;++j){
        if(i%mp[j]==0){
            mp[i]=mp[j];
            flag=true;
            break;
        }
    }
    if(!flag)mp[i]=i;
  }
  long long ans=1;
  int n,a[1001]={};
  cin>>n;
  for(int i=2;i<=n;++i){
    int num=i;
    while(num!=1){
        a[mp[num]]++;
        num/=mp[num];
    }
  }

  for(int i=2;i<=1000;++i){
    if(a[i]!=0){
        ans*=a[i]+1;
        ans%=MOD;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    int a,b; cin >> a >> b;
    cout << a*b << endl;
}


Measured memory_bytes: 3588
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int A,B,C,D,E,all1;
	scanf("%d %d %d %d %d",&A,&B,&C,&D,&E);
	if(A<0)
	{
		all1=A*(-C);
		A=0;
	}
	if(A==0){all1+=D;}
	all1+=(B-A)*E;
	printf("%d\n",all1);
	return 0;
}


Measured memory_bytes: 3208