akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define reset(x, y) memset(x, y, sizeof(x))
#define BUG(x) cerr << #x << " = " << (x) << endl
#define BUGP(x) cout << #x << " = " << (x)._1 << ", " << (x)._2 << endl
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};
// Head

int n, tot;

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

    cin >> n;

    vector<pii> pos, neg;
    for (int i = 0; i < n; ++i) {
        string s;
        int l = 0, r = 0, maxm = 0;
        cin >> s;

        for (int j = 0; j < s.length(); ++j) {
            if (s[j] == '(') ++l;
            else ++r;
            maxm = max(maxm, r - l);
        }

        if (l - r >= 0) pos.pb({ l - r, maxm });
        else neg.pb({ r - l, maxm });
    }

    sort(all(pos), [](const pii &a, const pii &b) { return a._2 < b._2; });
    for (auto &it : pos) {
        if (it._2 > tot) {
            cout << "No\n";
            return 0;
        }
        tot += it._1;
    }

    sort(all(neg), [](const pii &a, const pii &b) { return a._2 - a._1 > b._2 - b._1; });
    for (auto &it : neg) {
        if (it._2 > tot) {
            cout << "No\n";
            return 0;
        }
        tot -= it._1;
    }

    if (tot) cout << "No\n";
    else cout << "Yes\n";

    return 0;
}


Measured memory_bytes: 11236
#include <stdio.h>
int main() {
    int i;
    long long gcd, lcm,n1,n2;
    scanf("%lld %lld", &n1, &n2);

    for (i = 1; i <= n1 && i <= n2; ++i) {

        if (n1 % i == 0 && n2 % i == 0)
            gcd = i;
    }

    lcm = (n1 * n2) / gcd;

    printf("%lld\n", lcm);
    return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int cnt = 0;
  while (n > 0) {
    n /= k;
    cnt++;
  }
  cout << cnt << '\n';
  return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

// {{{
template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar[0].size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}

template<typename T>
T digitsum(T x){
    T y=0;
    while(x){
        y += x % 10;
        x /= 10;
    }

    return y;
}

template<typename T>
T gcd(T x, T y){
    if (x == 0 || y == 0) {
        return 0;
    }

    while (x != y){
        if (x > y) {
            x -= y;
        }else{
            y -= x;
        }
    }
    return x;
}

// }}}

ll gcd(ll a, ll b){
    if (b == 0) return a;
    return gcd(b, a%b);
}

ll lcm(ll a, ll b){
    ll g = gcd(a,b);
    return a / g * b;
}


/* vim:set foldmethod=marker: */

void solve(){
    int N;
    cin >> N;

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

    if (N == 1) {
        cout << T[0] << endl;
        return;
    }

    ll l=T[0];
    for (int i = 1; i < N; i++) {
        l = lcm(l, T[i]);
    }
    cout << l << endl;
    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector 昇順
// sort(v.begin(), v.end(), greater<int>()); // 降順

// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }

// string を int に変換 stoi("1010")
// int を string に変換 to_string(1010)


// map の key, value を全て抜き出す。
// for (auto itr = mp.begin(); itr != mp.end(); itr++) {
//     cout << "key" << itr->first << " value" << itr->second << endl;
// }

// 文字列の検索
// string s="abc";
// if (s.find('d') == string::npos){
//     cout << "find" << endl;
// }else{
//     cout << "not find" << endl;
// }


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



int main()
{
    int n,k;
    cin>>n>>k;

    vector<int> A(n,0);
    for(int i=0;i<k;i++){
        int d;
        cin>>d;
        for(int j=0;j<d;j++){
            int a;
            cin>>a;
            A.at(a-1)++;
        }
    }

    int cnt=0;
    for(int i=0;i<n;i++){
        if(A.at(i)==0)
            cnt++;
    }


    cout<<cnt<<endl;

    return 0;
}

Measured memory_bytes: 3632
#include<cstdio>
const int MOD = 998244353;
const int MAXN = 4000;
int C[MAXN + 5][MAXN + 5];
int pw2[MAXN + 5];
void init() {
	C[0][0] = 1; pw2[0] = 1;
	for(int i=1;i<=MAXN;i++) {
		C[i][0] = 1;
		for(int j=1;j<=i;j++) {
			C[i][j] = (C[i-1][j] + C[i-1][j-1]) % MOD;
		}
		pw2[i] = pw2[i-1] * 2 % MOD;
	}
}
int solve(int x, int y, int z) {
	int ret = 0;
	for(int i=0;i<=z&&i<=x;i++)
		if( y+i-1 >= 0 ) ret = (ret + 1LL*pw2[i]*C[x][i]%MOD*C[z+y-1][y+i-1]%MOD) % MOD;
	return ret;
}
int main() {
	init();
	int N, K;
	scanf("%d%d", &K, &N);
	for(int i=2;i<=2*K;i++) {
		int cnt = 0;
		for(int j=1;j<=K;j++)
			if( 1 <= i-j && i-j <= K ) cnt++;
		if( i % 2 == 0 ) {
			printf("%d\n", (solve((cnt-1)/2, K-cnt, N) + solve((cnt-1)/2, K-cnt, N-1)) % MOD);
		}
		else {
			printf("%d\n", solve(cnt/2, K-cnt, N));
		}
	}
}

Measured memory_bytes: 61312
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FScanner sc = new FScanner();
		String S = sc.next();
		String T = sc.next();
		int count = 0;
		for (int i = 0; i < 3; i++) {
			char s = S.charAt(i);
			char t = T.charAt(i);
			if (s == t) {
				count++;
			}
		}
		System.out.println(count);
	}

}

class FScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    int2(ah, am);
    int2(bh, bm);
    Int(k);
    
    int mi = (bh - ah) * 60 + (bm - am);

    cout << (int)(mi - k) << endl;

    return 0;
}


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

void solve()
{
	int i,j,n,k;
	cin>>n>>k;
	vector <int> v(n);
	vector <int> dp(n,INT_MAX);
	for(i=0;i<n;i++)
		cin>>v[i];
	dp[0]=0;
	dp[1]=abs(v[1]-v[0]);
	if(n==1)
	{
		cout<<dp[0]<<"\n";
		return;
	}
	if(n==2)
	{
		cout<<dp[1]<<"\n";
		return;
	}
	for(i=2;i<n;i++)
	{
		for(j=max(0,i-k);j<i;j++)
		{
			if(dp[i]>(dp[j]+abs(v[i]-v[j])))
				dp[i]=dp[j]+abs(v[i]-v[j]);
		}
	}
	cout<<dp[n-1]<<"\n";

}


int main()
{
	solve();
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    long long N;
    cin >> N;
    long long A[N],B[N];
    rep(i,N){
        cin >> A[i] >> B[i];
    }
    long long ans=0;
    for(int i=N-1;i>=0;i--){
        A[i]+=ans;
        long long x=A[i]%B[i];
        if(x==0){

        }else{
            x=B[i]-x;
            ans+=x;
        }
    }
    cout << ans << endl;


}


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

int main(){
	int A, B, C;
	cin >> A >> B >> C;
	int ans = 0;
	ans = max(ans, A * 10 + B + C);
	ans = max(ans, B * 10 + A + C);
	ans = max(ans, C * 10 + A + B);
	cout << ans << endl;
}

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

using ll = long long;

int main() {
    int n, w, d;
    cin >> n >> w >> d;
    while (w > 0) {
        vector<int> p(n), s(n), x(n + 1), y(n + 1);
        rep(i, n) cin >> p[i] >> s[i];
        x[0] = w;
        y[0] = d;
        rep(i, n) {
            int i0 = p[i] - 1;
            int x0, y0, x1, y1;
            int r = s[i] % (x[i0] + y[i0]);
            //cout << "r=" << r << " s[i]=" << s[i] << " x[i0]=" << x[i0] << " y[i0]=" << y[i0] << "\n";
            if (r < x[i0]) {
                x0 = r;
                y0 = y[i0];
                x1 = x[i0] - x0;
                y1 = y[i0];
            } else {
                x0 = x[i0];
                y0 = r - x[i0];
                x1 = x[i0];
                y1 = y[i0] - y0;
            }
            for (int j = i0; j < n; j++) {
                x[j] = x[j + 1];
                y[j] = y[j + 1];
            }
            x[i] = min(x0, x1);
            y[i] = min(y0, y1);
            x[i + 1] = max(x0, x1);
            y[i + 1] = max(y0, y1);
            //rep(i, n + 1) cout << x[i] << " " << y[i] << " ";
            //cout << "\n";
        }
        vector<int> ans(n + 1);
        rep(i, n + 1) {
            ans[i] = x[i] * y[i];
        }
        sort(ans.begin(), ans.end());
        rep(i, n + 1) {
            cout << ans[i];
            if (i == n) cout << "\n";
            else cout << " ";
        }
        cin >> n >> w >> d;
    }
}


Measured memory_bytes: 3176
N,M=map(int,input().split())
k=[list(map(int,input().split())) for _ in range(M)] 
*p,=map(int,input().split())
print(sum(1for i in range(2**N) if M==sum(1for j in range(M) if sum(1for h in k[j][1:] if i>>(h-1)&1)%2==p[j])))

Measured memory_bytes: 9228
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}

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

int main() {
   int n, T, A;
   cin >> n >> T >> A;
   double t = INF;
   int ans = -1;
   rep(i, 0, n) {
      int x;
      cin >> x;
      if (abs(A - (T - x * 0.006)) < t) {
         t = abs(A - (T - x * 0.006));
         ans = i + 1;
      }
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010

void swap(LL* a,LL* b){LL tmp=*a;*a=*b;*b=tmp;}
LL dup(LL a,LL d){if(a%d==0)return a/d;else return a/d+1;}
LL rou(LL a,LL d){if((a*10/d)%10<5)return a/d;else return a/d+1;}
LL GCD(LL a,LL b){LL c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(&m,&d);x-=k*y;swap(&x,&y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}

LL fact[NUM],finv[NUM],inv[NUM];
void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[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||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;}

int main(){
  comi();
  LL N,K,i,ans=0;
  scanf("%lld%lld",&N,&K);
  LL A[N],n,k;
  FOR(i,0,N)scanf("%lld",&A[i]);
  qsort(A,N,sizeof(LL),lcmp);
  for(n=N;n>=K;n--){
    k=mod(com(n,K)-com(n-1,K),MOD);
    ans=mod((ans+(A[n-1]-A[N-n])*k),MOD);
  }

  printf("%lld\n",ans);
	return 0;
}


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

int main() {
#ifdef LOCAL
  freopen("c.txt", "r", stdin);
  // freopen("main.txt","w",stdout);
#else
  ios::sync_with_stdio(0);
  cin.tie(0);
#define endl '\n'
#endif
  int n, mn, ans = 1;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  mn = v[0];
  for (int i = 1; i < n; i++) {
    mn = min(mn, v[i]);
    ans += (mn >= v[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
N, A = input(), [int(v) for v in input().split()]

# max(abs(x-y) for x, y in  zip(A, A[1:]))

stool = A[0]
ans = 0
for i, h in enumerate(A):
    if h < stool:
        ans += stool - h
    stool = max(stool, h)

print(ans)


Measured memory_bytes: 32100
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int d = sc.nextInt();
		int n = sc.nextInt();

		int min = (int) Math.pow((double) 100, (double) d);
		if (n == 100) {
			System.out.println(min * 101);
		} else {
			System.out.println(min * n);
		}

		sc.close();
	}
}

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

using namespace std;

typedef long long LL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<LL> vl;
typedef vector<vector<LL>> vvl;
typedef vector<vector<vector<LL>>> vvvl;


const int inf = 1e9+7;
const LL INF = 1e18+5;
const int mod = 1e9+7;
const int mxN = 1e5+5;
const int mxM = 1e5+5;

int main(){
    #ifndef ONLINE_JUDGE
    freopen("E:\\Coding\\Programming\\input.txt", "r", stdin);
    freopen("E:\\Coding\\Programming\\output.txt", "w", stdout);
    #endif
    int n;
    cin>>n;
    string s;
    cin>>s;
    int c=0;
    for(int i=0;i<n;i++) if(s[i]=='R') c++;
    int x = 0;
    for(int i=0;i<c;i++) if(s[i]=='R') x++;
    int ans = c-x;
    c=0;
    for(int i=0;i<n;i++) if(s[i]=='W') c++;
    x=0;
    for(int i=0,j=n-1;i<c;i++,j--) if(s[j]=='W') x++;
    ans = min(ans,c-x);
    cout<<ans<<endl;
}

Measured memory_bytes: 3688
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

// ll cnt_ub(vector<ll> &A, vector<ll> &B) {
//     int N = A.size();
    
//     ll ub = (ll)1e9 + 100, lb = 0;
//     while(ub - lb > 1) {
//         ll mid = (ub + lb) / 2;
//         // mid 以下が (N+1)/2 個以上できるものの中で最大
//         int cnt = 0;
//         for(int i=0; i<N; i++) {
//             if(A[i] <= mid and mid <= B[i]) 
//         }
//     }
// }

int main() {
    int N; scanf("%d", &N);
    vector<ll> A(N), B(N);
    for(int i=0; i<N; i++) {
        scanf("%lld%lld", &A[i], &B[i]);
    }

    vector<ll> low, high;
    for(int i=0; i<N; i++) {
        low.emplace_back(A[i]);
        high.emplace_back(B[i]);
    }
    sort(low.begin(), low.end());
    sort(high.begin(), high.end());
    if(N % 2 == 1) {        
        ll lb = low[N/2], ub = high[N/2];
        cout << ub - lb + 1 << endl;
    }
    else {
        ll lb = low[N/2-1] + low[N/2];
        ll ub = high[N/2-1] + high[N/2];
        cout << (ub - lb + 1) << endl;
    }
    return 0;
}


Measured memory_bytes: 9792
import Control.Applicative
import Text.Printf

solve :: (Eq a, Fractional a) => [a] -> [a]
solve [a, b, c, d, e, f] = [x, y]
    where
        det = a * e - b * d
        x = e * c / det - b * f / det
        y = a * f / det - c * d / det

main :: IO ()
main = do
    rs <- (map solve . map (map (read :: String -> Double)) . map words . lines) <$> getContents
    mapM_ (\[x, y] -> printf "%.3g %.3g\n" x y) rs

Measured memory_bytes: 4532
#include <iostream>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    int cnt1 = 0;
    int cnt2 = 0;
    int cnt4 = 0;
    while(N--) {
        int a;
        cin >> a;
        if(a%4 == 0) {
            cnt4++;
        } else if(a%2 == 0) {
            cnt2++;
        } else {
            cnt1++;
        }
    }

    if(cnt1 <= cnt4) {
        cout << "Yes" << endl;
    } else if(cnt1 == cnt4+1 && cnt2 == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*
import java.math.*
fun main(args: Array<String>) {

    val N = readLine()!!.toInt()
    val S = readLine()!!
    var tmp = S.count { it == '.' }//right
    var ans = tmp
    for (c in S) {
        if (c == '#') {
            tmp++
        }
        if (c == '.') {
            tmp--
            ans = Math.min(ans,tmp)
        }
    }

    println(ans);
}


Measured memory_bytes: 32908
#include <iostream>
#include <vector>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

struct UF {
	int par[100000];
	int sz[100000];
	UF() { int i; rep(i, 100000) { par[i] = i; sz[i] = 1; } }
	int root(int x) { if (par[x] == x) return x; return par[x] = root(par[x]); }
	void unit(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b) return;
		par[a] = b;
		sz[b] += sz[a];
	}
	int getSz(int x) { return sz[root(x)]; }
	bool same(int a, int b) { return root(a) == root(b); }
};

int n, m, k;
vector<int> fri[100000];
vector<int> blo[100000];
UF uf;

int main() {
	int i, j;
	
	cin >> n >> m >> k;
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		fri[a].push_back(b);
		fri[b].push_back(a);
		uf.unit(a, b);
	}
	rep(i, k) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		blo[a].push_back(b);
		blo[b].push_back(a);
	}
	
	vector<int> ans;
	rep(i, n) {
		int res = uf.getSz(i) - (int)fri[i].size() - 1;
		rep(j, blo[i].size()) {
			int x = blo[i][j];
			if (uf.same(i, x)) res--;
		}
		ans.push_back(res);
	}
	
	rep(i, ans.size()) {
		cout << ans[i];
		if (i + 1 < ans.size()) cout << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 13432
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

int main(){
  int n,m;
  while(cin>>n>>m, n|m){
    vector<int> vec(n);
    rep(i,n) cin>>vec[i];
    int ans = -1;
    rep(i,n)rep(j,i) if(vec[i]+vec[j]<=m) ans = max(ans, vec[i]+vec[j]);
    if(ans==-1) cout << "NONE" << endl;
    else cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
using namespace std;

set<pair<long long int, long long int> > S;

map<pair<long long int, long long int>, int > C;

int N;
long long int A[200005], B[200005];

map<pair<long long int, long long int>, int> used;

long long int gcd(long long int a, long long int b) {
	if (b == 0) { return a; }
	return gcd(b, a%b);
}

long long int MOD = 1000000007;

long long int P[200005];

int main(void) {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A[i] >> B[i];
	}

	P[0] = 1;
	P[1] = 2;
	for (long long int i = 2; i <= (long long int) N; i++) {
		P[i] = P[i - 1] * 2;
		P[i] %= MOD;
	}

	long long int L = 0;

	for (int i = 1; i <= N; i++) {
		long long int tmp = gcd(abs(A[i]), abs(B[i]));

		long long int a;
		long long int b;

		if (tmp != 0) {
			a = A[i] / tmp; b = B[i] / tmp;
		}
		else if (A[i] == 0 && B[i]==0) { a = 0; b = 0; }
		else if (A[i] == 0) { a = 0; b = 1; }
		else if (B[i] == 0) { a = 1; b = 0; }

		if (b < 0) { a = -a; b = -b; }
		

		if (a == 0 && b == 0) { L++; }
		else {
			S.insert(make_pair(a, b));
			C[make_pair(a, b)]++;
		}
	}

	//cout << "S" << endl;
	/*for (auto u : S) {
		cout << u.first << " " << u.second << endl;
	}*/

	long long int ans = 1;

	for (auto y : S) {
		if (used[y] == 1) { continue; }

	//	cout << "y: " << y.first << " " << y.second << endl;

		pair<long long int, long long int> z;
		z.first = y.second; z.second = -y.first;

		if (z.second < 0) { z.first = -z.first; z.second = -z.second; }
		else if (z.second == 0) { z.first = 1; }
        else if (z.first == 0) { z.second = 1; }
		
		//cout << "z: " << z.first << " " << z.second << endl;

		long long int m, n=0;
		m = C[y];
		if (C[z] != 0) { n = C[z]; used[z] = 1; }

		//cout << "m= " << m << " n=" << n << endl;
		ans *= (P[m] - 1 + P[n] - 1 + 1);
		ans %= MOD;
		//cout << "ans= " << ans << endl;
	}
	ans += L;
	ans %= MOD;

	ans = ans + MOD - 1;
	ans %= MOD;

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

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

int main() {
    int n = 0;
    cin >> n;
    vector<string> S;
    
    for(int i = 0 ; i < n ; i++){
        string s = "";
        cin >> s;
        S.push_back(s);
    }

    sort(S.begin(),S.end());
    S.erase(unique(S.begin(),S.end()),S.end());
    
    cout << S.size() << endl;
    return 0;
}

Measured memory_bytes: 11604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define ALL(v) (v).begin(),(v).end()
#define REP(i, x, n) for(ll (i)=(x); (i)<(n); (i)++)
#define RREP(i, x, n) for(ll (i)=(n)-1; (i)>=x; (i)--)
#define FOR(i, n) for(ll (i)=0; (i)<(n); (i)++)
#define RFOR(i, n) for(ll (i)=(n)-1; (i)>=0; (i)--)

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

        ll n;
        cin >> n;
        vector<ll> a(n), b(n);
        FOR(i, n) cin >> a[i] >> b[i];
        sort(ALL(a)); sort(ALL(b));
        if (n & 1) cout << b[n / 2] - a[n / 2] + 1 << endl;
        else cout << (b[n / 2] + b[n / 2 - 1]) - (a[n / 2] + a[n / 2 - 1]) + 1 << endl;

        return 0;
}

Measured memory_bytes: 6332
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main() {
	int n;
	cin >> n;
	cout << ceil((double)n / 2) << endl;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
const int mod=1000000007;
char str[100010];
long long f[100010][20];
int t[20];
int main()
{
	scanf("%s",str+1);
	int len=strlen(str+1);
	reverse(str+1,str+len+1);
	long long num=0,x=1;
	f[0][0]=1;
	for(int i=1;i<=len;i++)
	{
		if(str[i]=='?')
		{
			for(int j=0;j<13;j++)
			{
				memset(t,0,sizeof(t));
				for(int k=0;k<10;k++)
					t[(j-k*x%13+13)%13]++;
				for(int k=0;k<13;k++)
					f[i][j]=(f[i][j]+f[i-1][k]*t[k]%mod)%mod;
			}
		}
		else
		{
			for(int j=0;j<13;j++)
				f[i][j]=f[i-1][(j-(str[i]-'0')*x%13+13)%13];
			num=(num+(str[i]-'0')*x)%13;
		}
		x=x*10%13;
	}
	cout<<f[len][5]<<endl;
	return 0;
}

Measured memory_bytes: 16000
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
//#define INF 1e18
#define MOD 1000000007

using namespace std;
typedef long double ll;
typedef pair <int,int> P;

int n;
ll a,t;

int main(){
  cin >> n;
  t = 1;
  rep(i,0,n){
    cin >> a;
    if(a==0)t=0;
    if(t==-1 || t==0)continue;
    t *= a;
    if(t > 1000000000000000000LL){
      t = -1;
    }
    if(t<0)t = -1;
  }
  cout << setprecision(0) << fixed;
  cout << t << endl;

  return 0;
}


Measured memory_bytes: 3788
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


class RollingHash(object):
    def __init__(self, source: str, base=10**9+7, mod=(1<<64)-1):
        self.source = source
        self.base = base
        self.mod = mod
        self.hash_from_zero_to = self._get_hash_from_zero_to()
        self.base_pow = self._get_base_pow()

    # 文字列sourceの区間 [0, right) のハッシュ値を前計算する
    def _get_hash_from_zero_to(self):
        hash_from_zero_to = [0]
        for si in self.source:
            hash_from_zero_to.append((hash_from_zero_to[-1] * self.base + ord(si)) % self.mod)

        return hash_from_zero_to

    # base値をi回掛けてmodをとった値を前計算する
    def _get_base_pow(self):
        base_pow = [1]
        for i in range(len(self.source)):
            base_pow.append(base_pow[-1] * self.base % self.mod)

        return base_pow

    # 文字列sourceの区間 [left, right) のハッシュを取得する
    def get_hash(self, left: int, right: int):
        return (self.hash_from_zero_to[right]
                - self.hash_from_zero_to[left] * self.base_pow[right - left]) % self.mod


def binsearch(func, rh: RollingHash, ok: int, ng: int):
    source_length = len(rh.source)
    while ng - ok > 1:
        mid = (ok + ng) // 2
        if func(rh, mid, source_length):
            ok = mid
        else:
            ng = mid

    return ok


# 題意を満たす長さtarget_lengthの文字列があるか判定
def judge(rh: RollingHash, target_length: int, source_length: int):
    memo = {}
    for start_idx in range(source_length - target_length + 1):
        cur_hash = rh.get_hash(start_idx, start_idx + target_length)
        if cur_hash in memo:
            if start_idx - memo[cur_hash] >= target_length:
                return True
        else:
            memo[cur_hash] = start_idx

    return False


n = ni()
s = ns()

rh = RollingHash(s)
print(binsearch(judge, rh, 0, n//2 + 2))

Measured memory_bytes: 4264
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A = int(readline())
S = set(readline().decode().split())

print('Four' if len(S) == 4 else 'Three')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
#define fast { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define pb push_back
#define ll long long
 
#define vi vector<int>
#define vl vector<long>
#define vll vector<long long>
 
#define infi INT_MAX
#define infl LONG_LONG_MAX
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fi(i,a,b) for(ll i=(b-1);i>=a;i--)
#define F first
#define S second
#define G(a,b) get<a>(b)
#define MP make_pair
#define MT make_tuple
#define pll pair<ll,ll> 
#define endl "\n"
#define ALL(v) v.begin(),v.end()
#define nl cout<<"\n";
#define pr(x) cout<<x;
#define pr1(x) cout<<x<<" ";
#define pr2(x,y) cout<<x<<" "<<y;
#define deb printf("***************************************************************************************\n");

inline ll ceil(ll a,ll b)
{
  return (a+b-1)/b;
}

const ll N=2e3+3;

list<ll>adj[N];
ll dist[N+1];
ll cnt[N];

void bfs(ll s)
{
  dist[s]=0;
  queue<ll>q;
  q.push(s);
  while(!q.empty())
  {
    ll x=q.front();
    q.pop();
    cnt[dist[x]]++;
    for(auto i:adj[x])
    {
      if(dist[i]==infl) 
      {
        dist[i]=dist[x]+1;
        q.push(i);
      }
    }
  }
}

void func()
{ 
  ll n,x,y;
  cin>>n>>x>>y;
  f(i,1,n) 
  {
    adj[i].pb(i+1);
    adj[i+1].pb(i);
  }
  adj[x].pb(y);
  adj[y].pb(x);
 
  f(i,1,n+1)
  {
    f(j,1,n+1) dist[j]=infl;
    bfs(i); 
  }
  f(i,1,n) cout<<cnt[i]/2<<endl;
} 

int main() 
{
    //fast
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE*/
    
    ll ntc=1;
    //cin>>ntc;

    f(i,1,ntc+1)
    {
      //cout<<"Case #"<<i<<": ";
      func();
    }
 
    return 0;
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

vector<vector<int>> dp;

string S; 
int recurse(int ind, bool carry) {
	int L = S[ind] - '0' + carry;

	if (ind == 0) {
		return min(L, 1 + 10 - L);
	}

	if (dp[ind][carry] != -1) return dp[ind][carry];

	int ans;
	if (L == 10) {
		ans = recurse(ind - 1, true);
	} else {
		ans = min(L + recurse(ind - 1, false), 
			   10 - L + recurse(ind - 1, true));
	}
	dp[ind][carry] = ans;
	return ans;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> S;
	dp = vector<vector<int>> (S.size(), vector<int> (2, -1));
	print(recurse(S.size() - 1, false));
}

Measured memory_bytes: 102812
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = INT32_MAX;
const ll INFL = INT64_MAX;
const int mod = 1e9 + 7;

template <typename T>
void print_vec(vector<T> v) {
  for (T i : v) cout << i << " ";
  cout << endl;
}

int main() {
  int n, m;
  cin >> n >> m;
  int lm = 0, rm = INF;
  rep(i, m) {
    int l,r;
    cin >> l >> r;
    lm = max(lm, l);
    rm = min(rm, r);
  }
  int ans= max(rm - lm + 1, 0);
  cout << ans << endl;
  return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	
	string S;
	int t=0,h=0;
	while(cin>>S){
		int a,b,c;
		sscanf(S.c_str(),"%d,%d,%d",&a,&b,&c);
		if(a*a+b*b==c*c && max({a,b,c})==c) t++;
		else if(a==b) h++;
	}
	out(t);
	out(h);
	return 0;
}


Measured memory_bytes: 3244
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s,t;
	while(getline(cin,s)){t=s;
	for(int i=0;i<26;i++){
		s=t;
		for(int j=0;j<s.size();j++){
			if(s[j]>='a'&&s[j]<='z')for(int k=0;k<i;k++){
				s[j]++;
				if(s[j]>'z')s[j]-=26;
			}
		}
		if((s.find("the")!=s.npos||s.find("this")!=s.npos||s.find("that")!=s.npos))break;
	}
	cout<<s<<endl;}
}

Measured memory_bytes: 3216
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>

const int INF = 1000000009;
const long LINF = 1123456789012345678;

int a, b;
int main(){
	scanf("%d%d", &a, &b);
	if(a > b){
		printf("%d\n", a-1);
	}else{
		printf("%d\n", a);
	}
	return 0;
}


Measured memory_bytes: 256
s=int(input())
k=1
a=[]
while True:
    if k==1:
        a.append(s)
        k+=1
    elif a[-1]%2==0:
        p=a[-1]/2
        a.append(p)
        k+=1
    else:
        p=3*a[-1]+1
        a.append(p)
        k+=1
    if len(set(a))!=len(a):
            print(k-1)
            exit()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,y;
	int t;
	int sum=0,num=0;
	cin>>t;
	for(int i=1;i<=t;i++){
		cin>>x>>y;		
		if(x==y){
			sum++;
			if(sum>=3){
				num=1;
			}
		}
		else{
			sum=0;
		}
	}
	if(num==1){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
vector<pair<long long,char> >cnt;
int main(){
	string s;int k;
	cin>>s>>k;
	int c=1;
	for(int i=1;i<s.size();i++){
		if(s[i]!=s[i-1])
			cnt.push_back(make_pair(c,s[i-1])),
			c=1;
		else
			c++;
	}
	cnt.push_back(make_pair(c,s[s.size()-1]));
	long long ans=0;
	if(cnt.size()==1)
		cout<<(cnt[0].first*k)/2;
	else{
		for(int i=1;i<cnt.size()-1;i++)
			ans=ans+(cnt[i].first/2)*k;
		ans+=cnt[0].first/2+cnt.back().first/2;
		if(cnt[0].second==cnt.back().second)
			cout<<ans+(cnt[0].first+cnt.back().first)/2*(k-1);
		else
			cout<<ans+cnt[0].first/2*(k-1)+cnt.back().first/2*(k-1);
	}
}

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

int main() {
	priority_queue<int> Q;
	int n, m; cin >> n >> m;
	for (int i = 0; i < n; i++) {
		int num; cin >> num;
		Q.push(num);
	}
	for (int i = 0; i < m; i++) {
		int a = Q.top(); Q.pop();
		Q.push(a / 2);
	}
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		int a = Q.top(); Q.pop();
		ans += a;
	}
	cout << ans << endl;
}


Measured memory_bytes: 892
#include <iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<list>
#include<deque>
#include<ctime>
#include<map>
#include<set>
using namespace std;
int main()
{
	int q, w, e;
	cin >> q >> w >> e;
	vector<int>v(q, w-e);
	map<int, int>m;
	for (int x=0;x<e;x++)
	{
		int t;
		cin >> t;
		v[t - 1]++;
	}
	
	for (int x = 0; x < v.size(); x++)
	{
		if (v[x] < 1)cout << "No";
		else cout << "Yes";
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e6 + 6;
bool A = true;
bool B = true;
int lp[N];
vector<int> pr;
bitset<N> b;

void compute() {
	for (int i = 2; i < N; ++i) {
		if (lp[i] == 0) {
			lp[i] = i;
			pr.push_back (i);
		}
    for (int j = 0; j < (int)pr.size() && pr[j] <= lp[i] && i * pr[j] < N ; ++j)
        lp[i * pr[j]] = pr[j];
	}
}

int main() {
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	compute();
	
	int n;
	cin >> n;
	
	int g = 0;
	
	for(int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		g = __gcd(g, x);
		while(x != 1) {
			int now = lp[x];
			while(lp[x] == now) x /= lp[x];
			if(b[now] == 1) {
				A = false;
			}
			b[now] = 1;
		}
			
	}
	
	if (g != 1) B = false;
	if (A) cout << "pairwise coprime"; else if(B) cout << "setwise coprime"; else cout << "not coprime";
	cout << '\n';
	
	return 0;
}


Measured memory_bytes: 7808
// 4_abc139_d
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
#define MOD (1000000007)
typedef long long ll;


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

    ll ans = (n - 1) * n / 2;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    let x = io.readn::<i64>(4);
    let l = x.iter().take(2).fold(0, |sm, x| sm + x);
    let r = x.iter().skip(2).take(2).fold(0, |sm, x| sm + x);
    if l == r {
        io.writeln("Balanced");
    } else if l > r {
        io.writeln("Left");
    } else {
        io.writeln("Right")
    };
}

static MX: usize = 1010101;
static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn chari(&mut self) -> Vec<i64> {
        self.chars()
            .iter()
            .map(|&c| (c as u8 - b'0') as i64)
            .collect::<Vec<i64>>()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


Measured memory_bytes: 2192
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Comparator;
import java.util.Collections;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author Silviase
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    CPoll solver = new CPoll();
    solver.solve(1, in, out);
    out.close();
  }

  static class CPoll {

    public void solve(int testNumber, Scanner in, PrintWriter out) {
      HashMap<String, Integer> mp = new HashMap<>();
      int n = in.nextInt();
      int max = 0;
      List<String> ans = new ArrayList<>();
      for (int i = 0; i < n; i++) {
        String s = in.next();
        mp.merge(s, 1, Integer::sum);
      }
      for (int i : mp.values()) {
        max = Math.max(max, i);
      }
      List<String> l = new ArrayList<>();
      for (Map.Entry<String, Integer> e : mp.entrySet()) {
        if (e.getValue() == max) {
          ans.add(e.getKey());
        }
      }
      Collections.sort(ans, Comparator.naturalOrder());
      StringBuffer sb = new StringBuffer();
      for (String s : ans) {
        sb.append(s);
        sb.append("\n");
      }
      out.println(new String(sb));

    }

  }
}



Measured memory_bytes: 84464