akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {
	public static final long MOD = 1000000007L;
	
	public Main() {
		FastScanner scanner = new FastScanner();
		int N = scanner.nextInt();
		
		long[] A  = new long[N];
		
		for (int i = 0; i < N; i++) {
			A[i] = scanner.nextLong();
		}
		
		long[] SUM = new long[N];
		SUM[N-1] = A[N-1];
		for (int i = N-2; i >= 0 ; i--) {
			SUM[i] = ( SUM[i+1] + A[i] ) % MOD;
		}
		
		long Ans = 0;
		
		for (int i = 0; i < N-1; i++) {
			Ans = (Ans + (A[i] * SUM[i+1]) % MOD) % MOD;
		}
		
		System.out.println(Ans);
	}
	
	public static void main(String[] args) {
		new Main();
	}
}

class FastScanner {
	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: 39476
import collections
def prime_factorize(n):
	a = []
	while n % 2 == 0:
		a.append(2)
		n //= 2
	f = 3
	while f * f <= n:
		if n % f == 0:
			a.append(f)
			n //= f
		else:
			f += 2
	if n != 1:
		a.append(n)
	return a

N = int(input())

if N == 1:
	print(0)
	exit()

c = collections.Counter(prime_factorize(N))

ans = 0
for m in c.values():
	n = 1
	while (n*(n+1))//2 <= m:
		ans += 1
		n += 1
print(ans)


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

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

pre = 10**18
stock = 0
money = 1000
goup = False
for a in A:
    if a > pre:
        # buy in pre
        count = money//pre
        money -= count*pre
        stock += count
        goup = True
    else:
        if goup:
            money += stock*pre
            stock = 0
        goup = False
    pre = a

money += stock*A[-1]
print(money)

Measured memory_bytes: 61960
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<(n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) (s.substr(f-1,t-f+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
struct Grid{ll x,y,t;};
struct Edge{ll to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=201010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(ll from,ll to,ll cost){E[from].pb({to,cost});}
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;  
  vector<ll>num(n);
  ll cnt=0;
  for(int i=0;i<n;i++){
    ll a,b;cin>>a>>b;
    num[i]=(cnt+a)%86400;
    num.pb((cnt+a)%86400+86400);
    cnt+=a+b;
  }
  sort(ALL(num));
  num.pb(llINF);
  ll ans=0;
  for(int i=0;i<=86400;i++){
    ll numm=lower_bound(ALL(num),i)-num.begin();
    ll num2=upper_bound(ALL(num),i+10800)-num.begin();
    ans=max(ans,num2-numm);
  }
  cout<<ans<<endl;
  return 0;
}


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

int main()
{
	string a,b,c;
	cin>>a>>b>>c;
	string d= a+b+c;
	if(d=="575" || d=="557" || d=="755")
	cout<<"YES";
	else 
	cout<<"NO";

return 0;
}

Measured memory_bytes: 3564
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int MAX_N = 3010;

ll dp[MAX_N][MAX_N];

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

    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }

    for(int len = 1; len <= n; len++) {
        for(int i = 0; i + len <= n; i++) {

            int j = i + len;

            if( (n-len)%2 == 0) {
                dp[i][j] = max(dp[i+1][j] + a[i], dp[i][j-1] + a[j-1]);
            }
            else {
                dp[i][j] = min(dp[i+1][j] - a[i], dp[i][j-1] - a[j-1]);
            }

        }
    }

    cout <<dp[0][n] << endl;
    return 0;
}

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

int main() {
	int n;cin >>n;
	bool isable = false;
	for(int i=1;i<10 ;++i){
		int div = n/i;
		int res = n%i;
		if(div<10 && res==0){
			isable = true;
			break;
		}
	}
	if(isable){
		cout << "Yes";
	} else {
		cout << "No";
	}
	return 0;
}

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

long c[27], s[366][27], last[27];
int main()
{
    int D; cin>>D;
    for(int i=1; i<=26; ++i) cin>>c[i];
    for(int i=1; i<=D; ++i)
        for(int j=1; j<=26; ++j)
            cin>>s[i][j];

    long score=0;
    for(int d=1; d<=D; ++d) {
        int t; cin>>t;
        score+=s[d][t];
        last[t]=d;
        for(int i=1; i<=26; ++i) score-=c[i]*(d-last[i]);
        cout<<score<<endl;
    }
}


Measured memory_bytes: 3712
n = int(input())

num_list = []

for _ in range(n):
    nums = list(map(int, input().split()))
    num_list.append(nums)

num_list = sorted(num_list, key=lambda x: x[1])

count = 0

for i in range(n):
    count += num_list[i][0]
    if count > num_list[i][1]:
        print('No')
        exit()

print('Yes')

Measured memory_bytes: 55260
#include <iostream>
#include <queue>

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

    std::priority_queue<int> q;
    for (int i = 0; i < n; i++) {
        int temp;
        std::cin >> temp;
        q.push(temp);
    }

    for (int i = 0; i < m; i++) {
        int temp = q.top() / 2;
        q.pop();
        q.push(temp);
    }

    long long ans = 0;
    while (q.size()) {
        ans += q.top();
        q.pop();
    }

    std::cout << ans << std::endl;
}


Measured memory_bytes: 892
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(10000000)
def f():
    while True:
        s, d, m = map(int, raw_input().split())
        lst = []
        for loop in range(s):
            k = input()
            wp = map(int, raw_input().split())
            lst2 = []
            for i in range(k):
                lst2.append((wp[i * 2], wp[i * 2 + 1]))
            lst.append(lst2)
        DP = [0 for i in range(330)]
        f_ = map(int, raw_input().split())
        for f in f_:
            ls = lst[f]
            for item in ls:
                w, p = item
                for i in range(301, p - 1, -1):
                    if DP[i] < DP[i - p] + w:
                        DP[i] = DP[i - p] + w
        wmax = 0
        cmin = 0
        for i in range(m + 1):
            if wmax < DP[i]:
                wmax = DP[i]
                cmin = i
        print wmax, cmin
        try:
            _ = raw_input()
        except:
            break
f()


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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e20;
const int INF = 1e9;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

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

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll e = c * d / gcd(c, d);
  ll ans = b / c - (a - 1) / c + b / d - (a - 1) / d - b / e + (a - 1) / e;
  ans = b - a + 1 - ans;
  out(ans);
  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 N 3010
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
#define INF 1000000000000
const int MAX = 1000000;
const int MOD = 1000000007;
int main(){
    int n;
    cin>>n;
	string s;
    cin>>s;
    int ans=n;
    REP(i,n-1){
        if(s[i]==s[i+1])ans--;
    }
    OUT(ans);
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

string s[] = { "Sunny", "Cloudy", "Rainy" }, t;

int main() {
	cin >> t;
	
	inc(i, 3) {
		if(s[i] == t) {
			cout << s[(i + 1) % 3] << endl;
		}
	}
	
	return 0;
}


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

char c[4]={'E','W','N','S'};

int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(1){
		c=c-b;
		if(c<=0){
			cout<<"Yes"<<endl;
			break;
		}
		a=a-d;
		if(a<=0){
			cout<<"No"<<endl;
			break;
		}
	}
		

}


Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long int ll;
ll s[51];
ll p[51];
ll pt(ll a,ll b);
int main(){
  ll n,x;
  cin >> n>>x;
  s[0]=1;//層の数
  p[0]=1;//全体のパティの数
  for(int i=1;i<50;i++){
    s[i]=s[i-1]*2+3;
    p[i]=p[i-1]*2+1;
  }
  cout <<pt(n,x)<<endl;
}
ll pt(ll a,ll b){//levelaのb層目までもパティの数
  if(a==0) {
  if(b<=0) return 0;
  else return 1;
}
  if(1+s[a-1]>=b) return pt(a-1,b-1);//最初のバーガーの前
  if(b==2+s[a-1]) return p[a-1]+1;//パティまで到達
  if(2+s[a-1]<b&&b<=2+2*s[a-1]) return p[a-1]+1+pt(a-1,b-1-s[a-1]-1);//次のバーガー
  if(b==3+2*s[a-1]) return 2*p[a-1]+1;//最後まで到達
}


Measured memory_bytes: 256
import numpy as np
N,a,b = np.array(input().split()).astype(int)
mod = 10**9+7
def power(x, n):
    ans = 1
    while(n > 0):
        if(bin(n & 1) == bin(1)):
            ans = ans*x%mod
        x = (x*x)%mod
        n = n >> 1 #ビットシフト
    return ans
def fact(m, n):
    val = 1
    for i in range(m, n+1):
        val = val*i % mod
    return val
    
def cmb1(N, r):
    A = fact(N-r+1, N)%mod
    B = fact(1, r)%mod
    return A, B, (A*power(B, mod-2))%mod
def cmb2(a, b, A, B):
    A = fact(N-a+1, N-b)*A%mod
    B = fact(b+1, a)*B%mod
    return (A*power(B, mod-2))%mod
if(a>N//2):
    a = N-a
if(b>N//2):
    b = N-b
tmp = max(a,b)
b = min(a,b)
a = tmp
A, B, K1 = cmb1(N, b)
K2 = cmb2(a, b, A, B)
print((power(2, N)-1-K1-K2)%mod)

Measured memory_bytes: 12488
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    int a,b;
    cin >> a>> b;
    cout << (a+b+1)/2 << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define EPS 1e-10
using namespace std;
typedef long long llong;
class load {
public:
	int d, p;
	bool operator<(const load &other) {
		return this->p > other.p;
	}
};
int main() {
	int n, m;
	while (cin >> n >> m, n) {
		vector<load>v(n);
		for (int i = 0; i < n; i++) {
			cin >> v[i].d >> v[i].p;
		}
		sort(v.begin(), v.end());
		int ans = 0;
		for (int i = 0; i < n; i++) {
			if (m - v[i].d >= 0) {
				m -= v[i].d;
				v[i].d = 0;
			}
			else {
				v[i].d -= m;
				break;
			}

		}
		for (int i = 0; i < n; i++) {
			ans += v[i].d*v[i].p;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3160
#include<bits/stdc++.h>
#define FORN(i,n) for(int i=1;i<=n;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=c.begin();i!=(c).end();i++)
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
using namespace std;
int a[100010];
int b[100010];
vector<int> gr[100010];
vector<int> Root;
bool vis[100010];
int n;
bool flag=false;
void dfs(int x,int y){
	if(vis[x])return ;
	vis[x]=true;
	if(x==y){
		flag=true;
		return ;
	}
	REP(i,gr[x].size()){
		Root.push_back(gr[x][i]);
		dfs(gr[x][i],y);
		if(flag)return ;
		else if(Root.size())Root.erase(Root.begin()+Root.size()-1);
	}
	return ;
}
int answer=0,result=0;
void dfs2(int k,int x,int y,int z){
	if(vis[x])return ;
	vis[x]=true;
	answer+=(k==1);
	result+=(k==2);
	REP(i,gr[x].size()){
		if(x==y&&z==gr[x][i])continue;
		dfs2(k,gr[x][i],y,z); 
	}
} 
int main(){
	cin>>n;
	REP(i,n-1){
		cin>>a[i]>>b[i];
		gr[a[i]].push_back(b[i]);
		gr[b[i]].push_back(a[i]);
	}
	if(n==1){
		cout<<"Fennec"<<endl;
		return 0;
	}
	Root.push_back(1);
	dfs(1,n);
	memset(vis,false,sizeof(vis));
	if(Root.size()%2==1){
		dfs2(1,1,Root[Root.size()/2],Root[Root.size()/2+1]);
		dfs2(2,Root[Root.size()/2+1],n,Root[Root.size()/2]);
	}
	else{
		dfs2(1,1,Root[Root.size()/2-1],Root[Root.size()/2]);
		dfs2(2,Root[Root.size()/2],n,Root[Root.size()/2-1]);
	}
	if(answer>result){
		cout<<"Fennec"<<endl;
	}
	else{
		cout<<"Snuke"<<endl;
	}
	return 0;
}

Measured memory_bytes: 11896
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin, (X).rend()
#define DRI(X) int (X); cin >> X
#define DRII(X, Y) int X, Y; cin >> X >> Y
#define DRIII(X, Y, Z) int X, Y, Z; cin >> X >> Y >> Z
// #define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define readV(X) for(int &ele : (X)) cin >> ele
#define readVI(X) for(int idx = 1; idx < SZ((X)); ++idx) cin >> (X)[idx]
#define REP(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MP make_pair
#define PB push_back
#define F first
#define S second
 
using namespace std;
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
// void err(istream_iterator<string> it) {}
// template<typename T, typename... Args>
// void err(istream_iterator<string> it, T a, Args... args) {
//     cerr << *it << " = " << a << endl;
//     err(++it, args...);
// }
// template<typename... Args>
// void read(Args&... args)
// {
//     ((cin >> args), ...);
// }
 
// template<typename... Args>
// void write(Args... args)
// {
//     ((cout << args), ...);
// }
typedef long long LL;
const int INF = 1<<29;
 
 
int main(){
    FAST_IO
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
    int N, ok = true, n, M = 1e9 + 7; cin >> N;
    vector<int> d(N, 0);

    auto two = [&](int m){
        LL cur = 1;
        while(m){
            cur = cur * 2;
            if(cur >= M) cur -= M;
            m--;
        }
        return cur;
    };

    REP(rep, 0, N){
        cin >> n;
        if(n % 2 == N % 2){
            ok = false;
            break;
        }
        d[n]++;
    }
    // for(int idx = 0; idx < N; ++idx){
    //     cerr << idx << " ----->  " << d[idx] << endl;
    // }
    for(int s = 1 - (N % 2); s < N && ok; s += 2){
        // cerr << s << " ----->  ";
        // cerr << d[s] << endl;
        if(d[s] != 1 + (s > 0)){
            ok = false;
            break;
        }
    }
    if(!ok) cout << "0\n";
    else cout << two(N / 2);
}    

Measured memory_bytes: 640
n = int(input())
a = list(map(int,input().split()))

s = [0]*(n-1)
s[0] = a[0]
A = sum(a)
ans = 1e100
for i in range(n-2):
  s[i+1] = s[i] + a[i+1]

for t in s:
  ans = min(ans, abs(2*t - A))
print(ans)


Measured memory_bytes: 23800
use proconio::{input, fastout};
use whiteread::parse_line;
use std::collections::HashSet;

#[fastout]
fn main() {
    let (N, K): (usize, usize) = parse_line().unwrap();
    let all_unique: HashSet<_> = (1..N+1).collect();
    let mut sunuke: HashSet<usize> = HashSet::new();
    for i in 0..K {
        let d: usize = parse_line().unwrap();
        let a_d: Vec<usize> = parse_line().unwrap();
        for ad in a_d.iter() {
            sunuke.insert(*ad);
        }
    }
    let diff: HashSet<_> = sunuke.symmetric_difference(&all_unique).collect();
    println!("{}", diff.len())
}


Measured memory_bytes: 2228
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int R,flg=2;cin>>R;
    string ans[3] = {"ABC","ARC","AGC"};
    if(R<2800)flg=1;
    if(R<1200)flg=0;
    cout<<ans[flg]<<endl;
}

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

using namespace std;
using namespace atcoder;
using ll = long long;
#define rep(i,a,b) for(ll i=(a); i<(b); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define pai 3.14159265358979323846
ll gcd(ll a, ll b){if (a%b == 0)  return(b);else  return(gcd(b, a%b));}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}

const int mod = 1000000007;
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
/* 辞書順 next_permutation(a.begin(),a.end()) */
void printVec(std::vector<char> &vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}


int main() {
    ll n,m;
    cin >> n >> m;
    dsu d(n);
    ll a,b;
    rep(i,0,m) {
        cin >> a >> b;
        --a;
        --b;
        d.merge(a,b);
    }
    int count = d.groups().size();
    cout << count -1  << endl;
}

Measured memory_bytes: 8888
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n,k = na()
p = na()

p.sort()
x = 0
for i in range(0,k):
  x += p[i]
  
print(x)

Measured memory_bytes: 9240
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define F(i,a,n) for(int i=a;i<n;i++)
#define mod 1000000007 
#define pb push_back
int main(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	int w=1;
	// cin>>w;
	while(w--){
		ll n;
		cin>>n;
		vector<ll>v1(n),v2(n);
		F(i,0,n){
			ll x,y;
			cin>>x>>y;
			v1[i]=x+y;
			v2[i]=x-y;
		}
		ll x1=*max_element(v1.begin(),v1.end()),y1=*min_element(v1.begin(),v1.end());
		ll x2=*max_element(v2.begin(),v2.end()),y2=*min_element(v2.begin(),v2.end());
		cout<<max(x1-y1,x2-y2);
	}
	return 0;
}

Measured memory_bytes: 6352
#include <iostream>
int main(){
	int x[101]={0},a,b,i;
	while (std::cin>>a>>b){
		x[1]++;
		x[2]++;
		while(a!=0&&b!=0){
			x[a]^=1;
			x[b]^=1;
			std::cin>>a>>b;
		}
		a=0;
		for(i=0;i<101;i++)
			if(x[i]){
				a=1;
				break;
			}
		std::cout<<(a==0?"OK\n":"NG\n");
		for(i=0;i<101;i++)x[i]=0;
	}
}

Measured memory_bytes: 1120
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll N,M;
    cin >> N >> M;
    auto A =InputVec(N);
    ll sum = 0;
    for (int i = 0; i < N; ++i) {
        sum += A[i];
    }
    ll count = 0;
    double thr = (double)(sum) / (double)(4.0 * M);
    for (int i = 0; i < N; ++i) {
        if((double)(A[i]) >= thr){
            count++;
        }
    }
    if(count >= M){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}


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

using ll = long long;
using ii = pair<int, int>;

const int maxn = 1e3 + 3;
const int mod = 1e9 + 7;

inline int mul() { return 1; }
template <typename... V>
inline int mul(int a, V... v) {
#if !defined(_WIN32) || defined(_WIN64)
	return (int) ((long long) a * mul(v...) % mod);
#endif
	unsigned long long x = (long long) a * mul(v...);
	unsigned xh = (unsigned) (x >> 32), xl = (unsigned) x, d, m;
	asm(
		"divl %4; \n\t"
		: "=a" (d), "=d" (m)
		: "d" (xh), "a" (xl), "r" (mod)
	);
	return m;
}
template<typename... V>
inline void mulby(int &a, V... v) {
	a = mul(a, v...);
}
inline int add() { return 0; }
template<typename... V>
inline int add(int x, V... v) {
	x += add(v...); if(x >= mod) x -= mod; return x;
}
template<typename... V>
inline void addto(int &a, V... v) {
	a = add(a, v...);
}
inline int sub() { return 0; }
template<typename... V>
inline int sub(int x, V... v) {
	x -= sub(v...); if(x < 0) x += mod; return x;
}
template<typename... V>
inline void subfrom(int &a, V... v) {
	a = sub(a, v...);
}
inline void Addto(int &a, int b) {
	a += b; if(a >= mod) a -= mod;
}

int n, k;
int a[maxn];
int C[maxn][maxn];
int dp[21][maxn];

int main(int argc, char const *argv[])
{
#ifdef LOCAL
	freopen("in", "r", stdin);
#endif
	for(int i = 0; i < maxn; i++) {
		C[i][i] = C[i][0] = 1;
	}
	for(int i = 1; i < maxn; i++) {
		for(int j = 1; j < i; j++) {
			C[i][j] = add(C[i-1][j], C[i-1][j-1]);
		}
	}
	cin >> n >> k;
	for(int i = 1; i <= k; i++) {
		cin >> a[i];
	}
	dp[0][0] = 1;
	for(int i = 1; i <= k; i++) {
		dp[i][0] = mul(dp[i-1][0], C[n][a[i]]);
		for(int j = 1; j <= n; j++) {
			for(int tek = 0; tek <= j and tek <= a[i]; tek++) {
				Addto(dp[i][j], mul(dp[i-1][j-tek], C[j][tek], C[n-tek][a[i]-tek]));
			}
		}
	}
	cout << dp[k][n] << endl;
	return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Test | diff Test.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Test.cpp && ./a.out

/*

 8/11/2020

 22:02-

 */

const int MAX_N=1e5+1;
int P[MAX_N];
int N;

void solve() {
  VI A(N),B(N);
  REP(i,N) A[i]=(i+1)*N,B[i]=(N-i)*N;
  REP(i,N) A[P[i]-1]+=i;
  REP(i,N) cout<<A[i]<<" \n"[i==N-1];
  REP(i,N) cout<<B[i]<<" \n"[i==N-1];
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;

  cin>>N;
  REP(i,N) cin>>P[i];
  solve();

  return 0;
}


Measured memory_bytes: 3868
#include <iostream>
using namespace std;
#define MAX 100000

int n,A[MAX],key;

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

int main(){
  int m;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  cin>>m;
  int count=0;
  for(int i=0;i<m;i++){
    cin>>key;
    count+=binarySerch();
  }

  cout<<count<<endl;

  return 0;
}

Measured memory_bytes: 1548
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}
void comb(vector<vector<long long int>> &v)
{
	for (int i = 0; i < v.size(); i++)
	{
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1; k < v.size(); k++)
	{
		for (int j = 1; j < k; j++)
		{
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}
bool is_not_out_of_range(size_t now, size_t max_num)
{
	return !(now < 0 || max_num <= now);
}
ll repeat_squaring(ll n, ll p, ll m)
{
	if (p == 0)
		return 1;
	if (p % 2 == 0)
	{
		ll t = repeat_squaring(n, p / 2, m);
		return t * t % m;
	}
	return n * repeat_squaring(n, p - 1, m);
}

int main()
{
	size_t n;
	cin >> n;
	vecll a(n);
	bool is_odd = false;
	ll _min = INT_MAX, sum = 0;
	rep(i, n)
	{
		cin >> a[i];
		if (a[i] < 0)
		{
			is_odd = !is_odd;
		}
		_min = min(abs(a[i]), _min);
		sum += abs(a[i]);
	}
	cout << sum - (is_odd ? _min * 2 : 0) << endl;

	return 0;
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
using std::cerr;using std::cin;using std::cout;using std::abs;using std::min;using std::max;using std::swap;using std::map;using std::unordered_map;using std::unordered_set;using std::bitset;using std::pair;using std::set;using std::string;using std::vector;using std::sort;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _dbg(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _dbg(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_dbg(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}
const int N=1e5;
struct kek{int b,l,u,delta;}a[N];
int n,x;
bool check(int m){
    int full=m/x;
    int rest=m%x,sum;
    if(rest){
        sum=0;
        forn(i,n)sum+=a[i].b*a[i].l;
        forn(i,full+1)sum-=a[i].delta;
        int kok=1e18;
        forn(i,full+1){
            upn(kok,(x-rest)*a[i].u);
            upn(kok,-a[i].b*a[i].u+a[i].b*a[i].l+a[i].u*x-a[i].l*rest);
        }
        sum+=kok;
        if(sum<=0)return 1;
    }
    sum=0;
    forn(i,n)sum+=a[i].b*a[i].l;
    forn(i,full)sum-=a[i].delta;
    int best=0;
    for(int i=full;i<n;++i){
        upx(best,rest*a[i].u+a[i].b*(a[i].l-a[i].u));
        upx(best,rest*a[i].l);
    }
    sum-=best;
    return sum<=0;
}
int32_t main() {
    cin>>n>>x;
    forn(i,n){cin>>a[i].b>>a[i].l>>a[i].u;a[i].delta=x*a[i].u+a[i].b*(a[i].l-a[i].u);}
    sort(a,a+n,[](const kek&p1,const kek&p2){return p1.delta>p2.delta;});
    int l=-1,r=n*x;
    while(r-l>1){
        int m=(l+r)/2;
        if(check(m))r=m;
        else l=m;
    }
    cout<<r<<'\n';
    return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>
#include <stdlib.h>

int main()
{
  int a[100];
  int n, v, i, j, k;

  /*n,aの要素の入力*/
  scanf("%d", &n);
  for(i = 0; i < n; i++)
    scanf("%d", &a[i]);
  for(i = 0; i < n - 1; i++)
    printf("%d ", a[i]);
  printf("%d\n", a[n - 1]);

  /*ソートの処理、出力*/
  for(i = 1; i <= n - 1; i++)
    {
    v = a[i];
    j = i - 1;
    while(j >= 0 && a[j] > v)
      {
      a[j + 1] = a[j];
      j--;
      a[j + 1] = v;
      }
    for(k = 0; k < n - 1; k++)
      printf("%d ", a[k]);
    printf("%d\n", a[n - 1]);
    }
  return 0;
}

Measured memory_bytes: 600
var
	N,i:Longint;
	S:int64;
	A,C:Array[1..200000]of Longint;
begin
	read(N);
	for i:=1 to N do begin
		read(A[i]);
		inc(S,C[A[i]]);
		inc(C[A[i]]);
	end;
	for i:=1 to N do writeln(S-C[A[i]]+1);
end.


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

typedef long long ll;
typedef long long int lli;
const int MOD = 1000000007;
#define rep(i,n) for (int i = 0; i < (n); i++)

using namespace std;

lli GCD(ll a, ll b) {return b ? GCD(b, a % b) : a;}
lli LCM(ll a, ll b) { return a / GCD(a, b) * b; }

lli f(lli x, lli a, lli b) {
	lli res = x;
	res -= x / a;
	res -= x / b;
	res += x / LCM(a, b);
	return res;
}

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

	lli A, B, C, D; cin >> A >> B >> C >> D;
	
	lli ans = f(B, C, D) - f(A - 1, C, D);
	cout << ans << endl;

}

Measured memory_bytes: 256
local mod = 1000000007
local function badd(x, y) return (x + y) % mod end
local function bmul(x, y) return (x * y) % mod end
local p2 = {2}
for i = 2, 100010 do
  p2[i] = badd(p2[i - 1], p2[i - 1])
end
local s = io.read()
local max, normal = 1, 0
for i = 1, #s do
  local v = s:byte(i) - 48
  if v == 1 then
    max, normal = badd(max, max), badd(max, bmul(normal, 3))
  else
    max, normal = max, bmul(normal, 3)
  end
end
print(badd(max, normal))


Measured memory_bytes: 4508
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  ll h, w;
  cin >> h >> w;
  
  if(h == 1 || w == 1){
    cout << 1 << endl;
    return 0;
  }
  
  if(h % 2 == 0 || w % 2 == 0) cout << h*w/2 << endl;
  else cout << h*w/2 + 1 << endl;
  
  return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 1; i <= (int)(n); i++)
using namespace std;
int main(){
  int64_t a,b;
  cin>>a>>b;
  int k=1;
  rep(i,min(a,b)){
    if(a%i==0&&b%i==0){k=i;}}
  cout<<a*b/k<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

public class Hello{
    public static void Main(){
        var times = int.Parse(Console.ReadLine());
        var word_dict = new Dictionary<string,int>();
        
        for(var i = 0;i < times ;i++){
            var input = Console.ReadLine();
            if(i == 0){
                word_dict.Add(input,1);
            }else{
                if(word_dict.ContainsKey(input)){
                    word_dict[input]++;
                }else{
                    word_dict.Add(input,1);
                }
            }
        }
       
       var max = word_dict.Values.Max(); 
       
       var wordList = word_dict.Where(x => x.Value == max).Select(x => x.Key).ToList();
       wordList.Sort(StringComparer.Ordinal);
      
      
      foreach(var c in wordList){
          Console.WriteLine(c);
      }
      
    }
    
}

Measured memory_bytes: 41328
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 399;

int h;
int w;
int d;
int q;
int ar[N][N];
long long dist[N*N];

struct loc{
    int row , col;
} getP[N * N];

long long calc(int i , int j){
    int x = abs(getP[i].col - getP[j].col);
    int y = abs(getP[i].row - getP[j].row);
    return x + y;
}

int main(){
    scanf("%d%d%d" , &h , &w , &d);
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            scanf("%d" , &ar[i][j]);
            getP[ar[i][j]] = {i , j};
        }
    }
    for(int i = h * w; i >= 1; i--){
        if(i + d <= h*w){
            dist[i] = dist[i + d] + calc(i , i + d);
        }
    }
    scanf("%d" , &q);
    while(q--){
        int l , r;
        scanf("%d%d" , &l , &r);
        printf("%lld\n" , dist[l] - dist[r]);
    }
}


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

int main(){
  int N,M,count;
  count = 0;
  cin >> N >> M;
  for(int i=N-1;i>0;i--){
    count += i;
  }
  for(int i=M-1;i>0;i--){
    count += i;
  }
  cout << count << endl;
  
  return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int H,W;
string fld[111];

signed main(){
    cin>>H>>W;
    rep(i,H)cin>>fld[i];

    vector<int>xs,ys;
    rep(i,H)rep(j,W)if(fld[i][j]=='#'){
        xs.pb(j);ys.pb(i);
    }
    sort(all(xs));sort(all(ys));
    xs.erase(unique(all(xs)),xs.end());
    ys.erase(unique(all(ys)),ys.end());

    for(auto y:ys){
        for(auto x:xs){
            cout<<fld[y][x];
        }cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,ll>;
using Graph= vector<vector<ll>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}

int main(){
  string s ;
  cin>>s ;
 cout<<s[0]<<s[1]<<s[2]<<endl;
  return 0;
  }

Measured memory_bytes: 3628
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
struct mint{
    using ull=unsigned long long int;
    ull v;
    mint(ll vv=0){s(vv%mod+mod);}
    mint& s(ull vv){
        v=vv<mod?vv:vv-mod;
        return *this;
    }
    //オーバーロード
    mint operator-()const{return mint()-*this;}//符号反転
    mint&operator+=(const mint&val){return s(v+val.v);}
    mint&operator-=(const mint&val){return s(v+mod-val.v);}
    mint&operator*=(const mint&val){
        v=ull(v)*val.v%mod;
        return *this;
    }
    mint&operator/=(const mint&val){return *this*=val.inv();}
    mint operator+(const mint&val){return mint(*this)+=val;}
    mint operator-(const mint&val){return mint(*this)-=val;}
    mint operator*(const mint&val){return mint(*this)*=val;}
    mint operator/(const mint&val){return mint(*this)/=val;}
    mint pow(int n)const{
        mint res(1),x(*this);
        while(n){
            if(n&1)res*=x;
            x*=x;
            n>>=1;
        }
        return res;
    }
    mint inv()const{return pow(mod-2);}
    //拡張ユークリッドの互除法
    /* mint inv()const{
        int x,y;
        int g=extgcd(v,mod,x,y);
        assert(g==1);
        if(x<0)x+=mod;
        return mint(x);
    }*/
    friend ostream& operator<<(ostream&os,const mint&val){
        return os<<val.v;
    }//出力
    bool operator<(const mint&val)const{return v<val.v;}
    bool operator==(const mint&val)const{return v==val.v;}
    bool operator>(const mint&val)const{return v>val.v;}
};
const ll MAX = 2000010;//設定
mint fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void init(){
    fac[0] = fac[1] = 1;
    for(int i=1;i<MAX;i++)fac[i]=fac[i-1]*i;
    finv[MAX-1]=fac[MAX-1].inv();
    for(int i=MAX-2;i>=0;i--)finv[i]=finv[i+1]*(i+1);
    for(int i=MAX-2;i>=1;i--)inv[i]=finv[i]+fac[i-1];
}
//階乗
mint factor(ll n,ll k){
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return fac[n]*finv[k];
}
// 二項係数計算
mint COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * finv[k] * finv[n - k];
}
int main(){
int n;
cin>>n;
V<ll> a(n);
for(int i=0;i<n;i++)cin>>a[i];
sort(all(a));
mint ans=0;
V<mint> sum(n,mint(0));
mint two=2;
for(int i=0;i<n;i++){
    ll l=i,r=n-i-1;
    sum[i]=two.pow(r);
    if(r!=0)sum[i]+=two.pow(r-1)*r;
    sum[i]*=two.pow(l);
}
for(int i=0;i<n;i++){
    ans+=mint(a[i])*sum[i];
}
ans*=two.pow(n);
cout<<ans<<endl;
}

Measured memory_bytes: 50304
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let mut ans = 1;
    for i in 0..10 {
        if (1 << i) <= n {
            ans = 1 << i;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int n,k;
  int counter[SIZE] = {};
  
  scanf("%d%d",&n,&k);
  
  for(int i=0;i<n;i++){
    int a;
    scanf("%d",&a);
    counter[a]++;
  }

  sort(counter, counter+SIZE, greater<int>());

  int ans = n;

  for(int i=0;i<SIZE;i++){
    if(k){
      ans -= counter[i];
      k -= counter[i] > 0;
    }
  }

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


Measured memory_bytes: 1024
/**
 *  author: arpunagar
 *
*/

#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
#define inv(v)         \
    for (auto &it : v) \
        cin >> it;
#define MOD 1000000007
#define pb push_back
#define popb pop_back()
#define endl "\n"
#define fi first
#define se second
typedef priority_queue<ll, vector<ll>, greater<ll>> minheap;
typedef priority_queue<ll> maxheap;
#define sortv(v) sort(v.begin(),v.end())
#define db(x) cout << (#x) << " is " << (x) << endl;
#define rsortv(v) sort(v.begin(),v.end(), greater<>());

ll modPower(ll num,ll r) {
	if(r==0) return 1;
	if(r==1) return num%MOD;
	ll ans=modPower(num,r/2)%MOD;
	if(r%2==0) {
		return (ans*ans)%MOD;
	} return (((ans*ans)%MOD)*num)%MOD;
}

ll nCr(ll n, ll r) {
    ll res = 1;
    if (r > n - r) {
        r = n - r;
    }
    for(int i=0;i<r;i++) {
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

/*******************************************/

void solve(){
	int x;
	cin >> x;
	int y = x^1;
	cout << y;
}

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

        while (t--)
            solve();
        return 0;
}





Measured memory_bytes: 3636
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main(void) {
    int n;
    cin >> n;
    int h[n];
    for (int i = 0; i < n; i++)cin >> h[i];
    int a = 0, b = abs(h[1] - h[0]), c = b;
    for (int i = 2; i < n; i++) {
        c = min(abs(h[i - 2] - h[i]) + a, abs(h[i - 1] - h[i]) + b);
        a = b;
        b = c;
    }
    cout << c << endl;
    return 0;
}


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

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

template<class T> using v = std::vector<T>;
template<class T> using vv = v<v<T>>;

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


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

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

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

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

    string s; cin >> s;

    if (s == "SUN") cout << 7;
    if (s == "MON") cout << 6;
    if (s == "TUE") cout << 5;
    if (s == "WED") cout << 4;
    if (s == "THU") cout << 3;
    if (s == "FRI") cout << 2;
    if (s == "SAT") cout << 1;

    cout << endl;
    return 0;
}


Measured memory_bytes: 256