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

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c;

    if(a > b){
        d = a;
        a = b;
        b = d;
    }
    if(!(c > a)){
        cout << c << " " << a << " " << b << endl;
    }else if(!(b > c)){
        cout << a << " " << b << " " << c << endl;
    }else{
        cout << a << " " << c << " " << b << endl;
    }

    return 0;
}

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

int main(int argc, char const *argv[])
{
    int one = 0, zero = 0;
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++) {
        if (s[i] == '0') {
            zero++;
        } else
        {
            one++;
        }
        
        
    }
    cout << 2 * min(zero, one) << endl;
    return 0;
}

Measured memory_bytes: 512
#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; }
int main(){
ll n,r;
cin>>n>>r;
if(n>=10)cout<<r<<endl;
else cout<<r+100*(10-n)<<endl; 
}

Measured memory_bytes: 256
n,m = map(int,input().split(' '))
i = 0
lmax = 0
rmin = n
while i < m:
    l,r = map(int,input().split(' '))
    if l > lmax:
        lmax = l
    if r < rmin:
        rmin = r
    i += 1
if lmax <= rmin:
    print(rmin-lmax+1)
else:
    print(0)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A,B;
    cin >> A >> B;
    string a = "",b = "";
    for(int i=0;i<B;i++){
        a += to_string(A);
    }
    for(int i=0;i<A;i++){
        b += to_string(B);
    }
    cout << (a<b? a:b) << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
n=int(input())
G=[[]for i in[0]*-~n]
for I in[lambda:map(int,input().split())]*~-n:a,b,c=I();G[a]+=(b,c),;G[b]+=(a,c),
q,k=I()
d=[0]*-~n
def f(v,p,u):
 d[v]=u
 for t,c in G[v]:p==t or f(t,v,u+c)
f(k,0,0)
for p in[print]*q:
 x,y=I()
 p(d[x]+d[y])

Measured memory_bytes: 133024
def compute(subset):
	r = 0
	for i in range(len(subset)):
		r +=  (1 << (subset[i]-1))
	return r	

n,m = map(int, raw_input().split(' '))
keys= []
for _ in range(m):
	cost, nk = map(int, raw_input().split(' '))
	keys.append((cost, compute( map(int, raw_input().split(' ')) )))

h = {0:0}
for cost,mask in keys:
	for uu in range(2 ** n - 1,-1,-1):
		cm = uu & mask
		cm = uu ^ (cm) 
		h[uu] = min(h[uu] if uu in h else +float('inf'), (h[cm] if cm in h else +float('inf')) + cost )
print h[2 ** n -1] if (2 ** n -1) in h and h[(2 ** n) -1] < float('inf') else -1


Measured memory_bytes: 33004
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))
from collections import Counter
c = Counter(a)
ones = sum(v==1 for v in c.values())
ns = [v-1 for v in c.values() if v>1]
ans = ones + len(ns)
ns.sort()
if not ns:
    pass
elif ns[-1]>sum(ns[:-1]):
    after = ns[-1] - sum(ns[:-1])
    if after%2==1:
        ans -= 1
else:
    after = 1 if sum(ns)%2==1 else 0
    if after==1:
        ans -= 1
print(ans)

Measured memory_bytes: 98508
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a=0,b=0;
    cin>>a>>b;

    if(a+b==15){
        cout<<"+"<<endl;
    }else if(a*b==15){
        cout<<"*"<<endl;
    }else{
        cout<<"x"<<endl;
    }
}

Measured memory_bytes: 256
//By Don4ick
//#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;

#define forn(i, n) for (int i = 1; i <= n; i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define y1 qwer1234

const double PI = acos(-1.0);
const int DIR = 4;
const int X[] = {1, 0, -1, 0};
const int Y[] = {0, 1, 0, -1};

using namespace std;

const int N = 1e5 + 123, K = 4e4 + 123;
const ll inf = 1e18;


int n, a[N], b[N], p[N];

int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	//cout.tie(NULL);

	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	cin >> n;
	
	for(int i = 1; i <= n; i++){
		cin >> p[i];
		//p[i] = i;
	}
	      /*
	srand(time(0));
	random_shuffle(p + 1,p + 1 + n);
	        */
	for(int i = 1; i <= n; i++){
		a[i] = K * i;
		b[i] = K * (n - i);
	}
	
	for(int i = 1; i <= n; i++)
		a[p[i]] += i;
	
	for(int i = 1; i < n; i++)
		if(a[p[i]] + b[p[i]] >= a[p[i + 1]] + b[p[i + 1]])
			return 0;
	
	for(int i = 1; i < n; i++)
		if(a[i] >= a[i + 1])
			return 0;
	for(int i = 1; i < n; i++)
		if(b[i] <= b[i + 1])
			return 0;
	
	for(int i = 1; i <= n; i++)
		cout << a[i] + K + K << " ";
	cout << endl;
	for(int i = 1; i <= n; i++)
		cout << b[i] + K + K << " ";
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}
std::vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend
#define all(x) (x).begin(),(x).end()
#define size_t ll
const int mod = 1000000007;
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
string s;std::vector<int> a(4);
int main(){
  cin >> s;
  for (size_t i = 0; i < 4; i++)a[i] = (s[i] - '0');

  int i,l,j;int x=a[0];
  for (i = 0; i < 2; i++) {
    for (l = 0; l < 2; l++) {
      for (j = 0; j < 2; j++) {
        x=a[0];
        if(i == 0){
          x += a[1];
        }else{
          x -= a[1];
        }

        if(l == 0){
          x += a[2];
        }else{
          x -= a[2];
        }

        if(j == 0){
          x += a[3];
        }else{
          x -= a[3];
        }

        if(x == 7)break;
      }
      if(x == 7)break;
    }
    if(x == 7)break;
  }
  cout << a[0] << (i == 0 ? '+':'-') << a[1] << (l == 0 ? '+':'-') << a[2] << (j == 0 ? '+':'-') << a[3] << "=7" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#define llint long long

using namespace std;

llint a, b, k;
bool used[200005];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	for(int i = 2; i < 5000; i++){
		if(used[i]) continue;
		for(int j = 2*i; j < 200005; j+=i) used[j] = true;
	}
	llint x;
	cin >> x;
	for(int i = x; ; i++){
		if(!used[i]){
			cout << i << endl;
			break;
		}
	}
	
	return 0;
}

Measured memory_bytes: 512
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll n;
cin >> n;
ll ans = 0;
vector<vector<ll>> factors(10,vector<ll>(10,0));
for(ll i = 1; i <= n; i++){
    string s = to_string(i);
    ll a = s[0] - '0';
    ll b = s[s.size() - 1] - '0';
    factors[a][b]++;

}
for(ll i = 0; i <= 9; i++){
    for(ll j = 0; j <= 9; j++){
        ans += factors[i][j] * factors[j][i];
    }
}
cout << ans << endl;
}

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	double x;
	priority_queue<double> pq;
	while(n-->0)
		cin>>x, pq.push(-x);
	while(pq.size()>1) {
		double u=-pq.top(); pq.pop();	
		double v=-pq.top(); pq.pop();
		pq.push(-(u+v)/2);
	}
	cout<<setprecision(10)<<fixed<<-pq.top()<<"\n";
	return 0;
}

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

int main(void)
{
	int sump = 0, sumn = 0, num, price, av, count = 0;
	double a;
	char ch;

	while (cin >> price >> ch >> num)
	{
		count++;
		sump += price * num;
		sumn += num;
	}
	a = (double)sumn / count;
	av = a * 10;
	if (av % 10 >= 5)
	{
		av += 10; av /= 10;
	}
	cout << sump << endl << av << endl;
	return 0;
}


Measured memory_bytes: 3084
# coding:UTF-8
import sys


def resultSur97(x):
    return x % (10 ** 9 + 7)


if __name__ == '__main__':
    # ------ 入力 ------#
    # 1行入力
    aList = list(map(int, input().split()))     # スペース区切り連続数字

    x = 5

    # ------ 処理 ------#
    c5 = 0
    c7 = 0
    for a in aList:
        if a == 5:
            c5 += 1
        elif a == 7:
            c7 += 1

    # ------ 出力 ------#
    if c5 == 2 and c7 == 1:
        print("YES")
    else:
        print("NO")


Measured memory_bytes: 9120
N, T = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

AB.sort(reverse=True)
dp = [0] * (T + 1)

for a, b in AB:
    for t in range(T):
        x = dp[t+a]+b if t+a < T else b
        dp[t] = max(dp[t], x)

ans = dp[0]
print(ans)


Measured memory_bytes: 46824
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
const int inf =         1e18;
const int mod =         1e9+7;
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p,int m = inf) {int ans=1;x%=m;while(p>0){if(p&1)ans=(ans*x)%m;p=p>>1;x=(x*x)%m;}return ans;}
int inv(int x,int m=mod){return po(x,m-2,m)%m;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
//=================================================================================




const int N=1e6+6;
int n,m,k,x,y,z,a,b,c,d,i,j,l,r;








void sol()
{   
    cin>>n;
    in(a,n);
    mii m;
    fo(i,n)m[a[i]+i]++;
    // sort(all(a));

    c=0;
    FO(i,n-1,1)
    {
        c+=m[i-a[i]];
    }
    
    
    
    cout<< c <<endl;
}





int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //sp(10);
    // w(t)
    sol();
    return 0;
}

Measured memory_bytes: 27436
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    a, b = Input()
    towers = [1] * 999
    for i in range(1, 999):
        towers[i] = towers[i-1] + i + 1
    n = b - a
    ans = 0
    for i in range(998):
        if towers[i+1] - towers[i] == n:
            ans = towers[i] - a
    print(ans)


main()

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

using namespace std;

int d[55600];

void FIND_PRIME(void) {

	for (int k = 2; k < 240; k++) {
		if (d[k] == 0) {
			for (int n = 2;; n++) {
				d[n*k] = 1;
				if (n*k > 55555) { break; }
			}
		}
	}
}

int main(void)
{
	FIND_PRIME();

	int N;
	cin >> N;

	vector<int> V;

	int count = 0;
	for (int i = 2; i < 55555; i++) {
		if (d[i] == 0 && (i % 5 == 1)) { count++; V.push_back(i); }
	}

	cout << V[0];
	for (int i = 1; i < N; i++) {
		cout << " " << V[i];
	}
	cout << endl;

		//system("pause");
	return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (true) {
            int V = sc.nextInt();
            if (V == 0) {
                break;
            }
            int E = sc.nextInt();
            Prim prim = new Prim(V, E);

            for (int i = 0; i < E; i++) {
                String line = sc.next();
                String[] data = line.split(",");
                int s = Integer.valueOf(data[0]);
                int t = Integer.valueOf(data[1]);
                int w = Integer.valueOf(data[2]) / 100 - 1;
                prim.set(s, t, w);
                prim.set(t, s, w);
            }

            int res = prim.run();
            System.out.println(res);
        }
    }

    private static class Prim {
        int V, E;
        ArrayList<ArrayList<Edge>> edges;

        Prim(int V, int E) {
            this.V = V;
            this.E = E;
            edges = new ArrayList<>();
            for (int i = 0; i < V; i++) {
                edges.add(new ArrayList<>());
            }
        }

        void set(int from, int to, int cost) {
            edges.get(from).add(new Edge(to, cost));
        }

        int run() {
            boolean[] done = new boolean[V];
            Arrays.fill(done, false);
            Queue<Edge> q = new PriorityQueue<>();
            q.add(new Edge(0, 0));
            int costSum = 0;
            while (!q.isEmpty()) {
                Edge e = q.poll();
                if (done[e.t]) {
                    continue;
                }
                done[e.t] = true;
                costSum += e.w;
                q.addAll(edges.get(e.t));
            }
            return costSum;
        }

    }

    public static class Edge implements Comparable<Edge> {
        public int t, w;

        Edge(int t, int w) {
            this.t = t;
            this.w = w;
        }

        @Override
        public int compareTo(Edge o) {
            return this.w - o.w;
        }
    }
}

Measured memory_bytes: 41660
#include<stdio.h>

int main(void){
  int a[100],n,i,j,k,temp,count=0,min,flag=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n-1;i++){
    min=a[i];
    k=i;
    for(j=i+1;j<n;j++){
      if(a[j]<min){
	min=a[j];
	k=j;
	flag=1;
      }
    }
    if(flag==1){
      count++;
      flag=0;
    }
    temp=a[i];
    a[i]=a[k];
    a[k]=temp;
  }
  for(i=0;i<n-1;i++){
      printf("%d ",a[i]);
  }
  printf("%d",a[n-1]);
  printf("\n");
  printf("%d\n",count);
}
  



Measured memory_bytes: 2128
X, Y = map(int, input().split())

if X != 1:
    for turu in range(0, X + 1, 1):
        kame = X - turu
        legs = kame * 4 + turu * 2
        if legs == Y:
            print("Yes")
            break
    else:
        print("No")
else:
    if Y % 2 == 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 9184
a, b, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = min(A)+min(B)
for _ in range(m):
    x, y, c = map(int, input().split())
    x -= 1
    y -= 1
    z = A[x]+B[y]-c
    if z < ans:
        ans = z
print(ans)


Measured memory_bytes: 18648
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main()
{
    int a[5], m=10, k=0, s=0;
    REP(i, 5) cin >> a[i];
    REP(i, 5) {
        if(a[i] % 10 != 0){
            m = min(m, a[i]%10);
            if(m == a[i] % 10) k=i;
        }
    }
    REP(i, 5){
        if(i == k) continue;
        if(a[i] % 10 != 0) s += (a[i] / 10 * 10 + 10);
        else s += a[i];
    }
    s += a[k];
    cout << s << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(){
    while(1){
        int m, f, r;
        scanf(" %d %d %d", &m, &f, &r);
        if(m==-1 && f==-1 && r==-1) break;
     
        if(m==-1 || f==-1 || m+f<30) printf("F\n");
        else if(m+f>=80) printf("A\n");
        else if(m+f>=65) printf("B\n");
        else if(m+f>=50 || (m+f>=30 && r>=50) ) printf("C\n");
        else printf("D\n");
    }
 
    return 0;
}


Measured memory_bytes: 2032
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h, w;
  cin >>h >>w;
  
  //最初の行
  for (int i = 0; i < w+2; i++)
    cout << '#';
  cout << endl;
  
  //中身を含む行
  string s;
  for (int i = 0; i < h; i++) {
    cin >> s;
    cout << '#' << s << '#' << endl;
  }
  
  //最後の行
  for (int i = 0; i < w+2; i++)
    cout << '#';
  cout << endl; 
}

Measured memory_bytes: 3580
#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);

    string S;
    int Q;
    cin >> S >> Q;
    string l="",r="";
    int cou=0;
    rep(i,Q){
        int x;
        cin >> x;
        if(x==1){
            cou++;
            cou%=2;
        }else{
            int f;
            char c;
            cin >> f >> c;
            if((cou==0 && f==1) || (cou==1 && f==2)){
                r=c+r;
            }else{
                l=l+c;
            }
        }
    }
    string ans=r+S+l;
    if(cou==1){
        reverse(ans.begin(),ans.end());
    }
    cout << ans << endl;


}


Measured memory_bytes: 1420
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long A, V, B, W, T;
  cin >> A >> V >> B >> W >>T;
  long long D1 = abs(A-B);
  long long D2 = (V-W)*T;
    
  if(D1 <= D2) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 3584
/*****************************************************************\
    |     IN THE NAME OF ALLAH, MOST GRACIOUS AND MOST MERCIFUL       |
    |                                                                 |
    |     Author     : Mahabub Rahman                                 |
    |     Email      : mahabubrahman618@gmail.com                     |
    |     University : Comilla University, Bangladesh		          |
    |                  Department of Computer Science & Engineering   |
    \*****************************************************************/


    /*...................................Data_Types............................................*/
    #include<bits/stdc++.h>

    using namespace std;
    #define FastIO ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
    #define       ll                  long long int
    #define       ull                  unsigned long long int
    #define       veci                 vector<int>
    #define       vecc                 vector<char>
    #define       vecs                 vector<string>
    #define       vecl                 vector<long long int>
    #define       vecp                 vector<  pair<int,int> >
    #define       mapstrint            map< string , int >
    #define       mapstrstr            map< string , string >
    #define       mapint               map< int, int >
    #define       pb                   push_back
    #define       pob                  pop_back
    #define       mp                   make_pair
    ////============ CONSTANT ===============////
    #define mx9   1000000009
    #define mx7   10000007
    #define mx6   1000006
    #define mx5   100005
    #define inf   1<<30                                           //infinity value
    #define eps   1e-9
    #define mx    (65540)
    #define mod   1000000007
    ////=====================================////

    long double PI = acosl(-1);
    bool compare_int(int a, int b) //This function is use for descending order.
    {
        return (a>b);
    }
    bool compare_string (string a, string b)
    {
        return a.size() < b.size();
    }
    bool compare_pair(const pair<int,int> &a,
                  const pair<int,int> &b)
    {
        if(a.second==b.second) return a.first>b.first;
        else return (a.second > b.second);
    }
    ll fact(ll n)
    {
        if(n==0 || n==1) return 1;
        else return n*fact(n-1);
    }

    ////======================================////
    /*bool check(int n)
    {
        for(int i=2; i<=sqrt(n); i++)
        {
            if(n%i==0)
            {
                return false;
            }
        }
        return true;
    }*/

    int32_t main()
    {
        FastIO;
        int a, b, re;
        cin >> a >> b;
        if(a<b) swap(a, b);
        int cnt = b/0.1;
        int cnt2 = a/0.08;
        //cout << a << endl << b << endl;
        for(int i=cnt-1; i<=cnt2+1; i++)
        {
            if(floor((double)i*(double)0.1)==a && floor((double)i*(double)0.08)==b)
            {
                cout << i << endl;
                return 0;
            }
        }
        cout << -1 << endl;
    }


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

namespace ABC099_D___Good_Grid
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(solver());
        }
        static int solver()
        {
            var NC = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            if (NC[0] == 1) return 0;

            var paintingCost = new int[NC[1] + 1, NC[1] + 1];
            for (int after = 0; after < NC[1]; after++)
            {
                var read = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
                for (int before = 0; before < NC[1]; before++) paintingCost[after + 1, before + 1] = read[before];
            }

            var gridGroup = new List<int>[3];
            for (int i = 0; i < 3; i++) gridGroup[i] = new List<int>();

            for (int cy = 0; cy < NC[0]; cy++)
            {
                var read = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
                for (int cx = 0; cx < NC[0]; cx++) gridGroup[(cx + cy + 2) % 3].Add(read[cx]);
            }

            var paintAllCost = new int[NC[1] + 1, 3];
            for (int group = 0; group < 3; group++)
            {
                for (int color = 1; color <= NC[1]; color++)
                {
                    paintAllCost[color, group] = 0;
                    foreach (int grid in gridGroup[group]) paintAllCost[color, group] += paintingCost[grid, color];
                }
            }

            var result = int.MaxValue;
            for (int color0 = 1; color0 <= NC[1]; color0++)
            {
                for (int color1 = 1; color1 <= NC[1]; color1++)
                {
                    if (color1 == color0) continue;
                    for (int color2 = 1; color2 <= NC[1]; color2++)
                    {
                        if (color0 == color2 || color1 == color2) continue;
                        result = Math.Min(result, paintAllCost[color0, 0] + paintAllCost[color1, 1] + paintAllCost[color2, 2]);
                    }
                }
            }
            return result;
        }
    }
}


Measured memory_bytes: 18264
#include <stdio.h>

void merge_sort(long long x[], int n)
{
	static long long y[100001] = {};
	if (n == 1) return;
	merge_sort(&(x[0]), n/2);
	merge_sort(&(x[n/2]), (n+1)/2);
	
	int i, p, q;
	for (i = 0, p = 0, q = n/2; i < n; i++) {
		if (p >= n/2) y[i] = x[q++];
		else if (q >= n) y[i] = x[p++];
		else y[i] = (x[p] < x[q])? x[p++]: x[q++];
	}
	for (i = 0; i < n; i++) x[i] = y[i];
}

int main()
{
	int i, N;
	long long A, B, h[100001];
	scanf("%d %lld %lld", &N, &A, &B);
	for (i = 0; i < N; i++) scanf("%lld", &(h[i]));
	merge_sort(h, N);
	
	long long l = (h[N-1] - 1) / A + 1, r = (h[N-1] - 1) / B + 1, m, count;
	while (l < r) {
		m = (l + r) / 2;
		count = 0;
		for (i = N - 1; i >= 0; i--) {
			if ((h[i] - B * m) <= 0) break;
			else count += (h[i] - B * m - 1) / (A - B) + 1;
		}
		if (count <= m) r = m;
		else l = m + 1;
	}
	
	printf("%d\n", l);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define dunk(a) cout << (a) << endl
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;

int main() {
	int n, k; cin >> n >> k;
	vector<int> d(k);
	vector<vector<int>> a(k);
	rep(i, k) {
		cin >> d[i];
		rep(j, d[i]) {
			int x;
			cin >> x;
			a[i].push_back(x);
		}
	}

	map<int, int> mp;
	rep(i, n) mp[i+1] = 0;

	rep(i, k) {
		for (int num : a[i]) {
			mp[num]++;
		}
	}

	int ans = 0;
	rep(i, n) {
		if (mp[i+1] == 0) ans++;
	}

	dunk(ans);

	return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <time.h>
#include <map>
using namespace std;
const int N=301;
int n,m;
int g[N][N],head[N],num[N],mn=0x7fffffff,mx,l;
bool ban[N];
int main()
{
    int i,j;
    cin>>n>>m;
    for(i=1;i<=n;i++)	head[i]=1;
    for(i=1;i<=n;i++)
    	for(j=1;j<=m;j++)
    		scanf("%d",&g[i][j]);
    memset(ban,true,sizeof(ban));
    for(i=1;i<=m;i++)
    {
    	memset(num,0,sizeof(num));
    	for(j=1;j<=n;j++)
    		num[g[j][head[j]]]++;
    	mx=0;
    	for(j=1;j<=m;j++)
    		if(num[j]>mx)
    			mx=num[j],l=j;
    	mn=min(mn,mx);
    	ban[l]=false;
    	for(j=1;j<=n;j++)
    		while(!ban[g[j][head[j]]])
    			head[j]++;
	}
    cout<<mn;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<math.h>
#include<algorithm>

using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	int x[200];
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	int lgth = 0;
	for (int i = 0; i < n; i++) {
		lgth += min(x[i], k - x[i])*2;
	}
	cout << lgth << endl;
}

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

int main() {
  string S, ans;
  cin >> S;
  for (int i = 0; i < S.length(); i++) {
    if (S[i] == '0') {
      ans.push_back('0');
    }
    else if (S[i] == '1') {
      ans.push_back('1');
    }
    else {
      if (ans.size()) {
        ans.pop_back();
      }
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;

int main(){
  ll N,K;
  cin >> N >> K;
  vector<ll> v(N+1);
  ll cur=0;
  ll pi=0;
  v[0]=0;
  for(int i=1;i<=N;i++){
    cin >> pi; cur+=pi; v[i]=cur;
  }

  ll ans=0;
  for(int i=K;i<=N;i++){
    ans=max(ans,v[i]-v[i-K]);
  }

  cout << fixed << setprecision(3) << (ans+K)/2. << endl;

  return 0;
}

Measured memory_bytes: 1792
import sys
n, a  = [int(i) for i in sys.stdin.readline().split()]
x_ls = [int(i) - a for i in sys.stdin.readline().split()]
#memo_ls[i][j] : i番目まででj - 50*50ができる通り数
memo_ls = [[0 for i in range(2 * 50 * 50 + 1)] for j in range(n+1)]
memo_ls[0][50*50] = 1
for i, x in enumerate(x_ls, 1):
    for j in range(2*50*50+1):
        memo_ls[i][j] =  memo_ls[i-1][j]
        if 0 <= j - x <= 2*50*50:
            memo_ls[i][j] += memo_ls[i - 1][j - x]
print(memo_ls[-1][50*50] - 1)

Measured memory_bytes: 5748
#include <bits/stdc++.h>
#define cinf(n,x,y,z) for(int i=0;i<(n);i++) cin >> x[i]>>y[i]>>z[i];
typedef long long int ll;
using namespace std;

int main(){
	string s; cin >>s;
	if(s=="keyence"){
		cout << "YES" << endl;
		return 0;
	}
	int n=s.size();
	for(int i=0;i<n;i++){
		for(int j=i;j<n;j++){
			string S = "";
			for(int k=0;k<n;k++){
				if(i<=k&&k<=j) continue;
				else S.push_back(s[k]);
			}
			if(S=="keyence"){
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

using W = ll;
using edge = struct {int to; W cost;};
using G = vector<vector<edge>>;

void add_edge(G &graph, int from, int to, W cost) {
	graph[from].push_back({to, cost});
	graph[to].push_back({from, cost});
}


auto dijkstra(const G &graph, int s) {
	const W inf = 1LL << 60;
	const int n = graph.size();

	vector<W> dist(n, inf);
	using state = tuple<W, int>;

	priority_queue<state, vector<state>, greater<state>> q;
	dist[s] = 0, q.push(state(0, s));

	while (!q.empty()) {
		W c; int v;
		tie(c, v) = q.top(); q.pop();
		for (auto &e : graph[v]) {
			W nc = c + e.cost; int nv = e.to;
			if (chmin(dist[nv], nc)) q.push(state(nc, nv));
		}
	}
	return dist;
}

int main(void){
	int n,m,s,t;
	cin >> n >> m >> s >> t;
	s--,t--;

	G graph1(n),graph2(n);

	rep(i,m){
		ll u,v,a,b;
		cin >> u >> v >> a >> b;
		u--,v--;
		add_edge(graph1,u,v,a);
		add_edge(graph2,u,v,b);
	}

	auto dist1 = dijkstra(graph1,s);
	auto dist2 = dijkstra(graph2,t);

	const ll all = 1000000000000000LL;

	vector<ll> ans(n);
	rep(i,n) ans[i] = all - dist1[i] - dist2[i];
	rrep(i,n) if(i + 1 < n) chmax(ans[i],ans[i+1]);
	rep(i,n) cout  << ans[i] << endl;

	return 0;
}

Measured memory_bytes: 19012
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);
		String s = sc1.next();
		String keyence = "keyence";

		String[] strSta = new String[6];
		String[] strEnd = new String[6];
		for ( int i = 0 ; i < 6 ; i++ ) {
			strSta[i] = keyence.substring(0,6-i);
			strEnd[i] = keyence.substring(6-i);
			//System.out.println(strSta[i]);
			//System.out.println(strEnd[i]);
		}

		if (s.startsWith(keyence)) {
			System.out.println("YES");
		}
		else if (s.endsWith(keyence)) {
			System.out.println("YES");
		}
		else {

			for (int j = 0 ; j < 6 ; j++ ) {

				if (s.startsWith(strSta[j]) && s.endsWith(strEnd[j])) {
					System.out.println("YES");
					break;
				}
				if ( j == 5) {
					System.out.println("NO");
					break;
				}
			}

		}

		sc1.close();

	}

}

Measured memory_bytes: 23764
import math

a, b, x = map(int, input().split())

y = x/a**2

tan = float(0)
theta = float(0)
if y >= b/2:
    theta = math.degrees(math.atan(2*(a**2*b-x)/a**3))
else:
    theta = 90 - math.degrees(math.atan(2*x/(a*b**2)))

print(theta)


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

typedef long long ll;
ll LL = 1000000;

int main() {
	int memo[LL];
	int vari = 0;
	for (int i = 0;i < LL;i++) {
		memo[i] = 0;
	}
	int ans = 0;
	int n,k;
	cin >> n >> k;
	int a[n];
	for (int i = 0;i < n;i++) {
		cin >> a[i];
		if (memo[a[i]] == 0) {
			vari++;
		}
		memo[a[i]]++;
	}
	sort(memo,memo+LL);
	int pos = 0;
	for (int i = 0;i < vari - k;i++) {
		while(memo[pos] == 0) {
			pos++;
		}
		ans += memo[pos];
		pos++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 4992
#include <stdio.h>
int main(void) {
	int a[3],i,j,temp;
	for(i=0;i<3;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<2;i++){
		for(j=i+1;j<3;j++){
			if(a[i]>a[j]){
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;
			}
		}
	}
	for(i=0;i<2;i++){
		printf("%d ",a[i]);
	}
	printf("%d\n",a[2]);
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
    int a[4];
    for (int i = 0; i < 4; ++i) {
        cin >> a[i];
    }
    sort(a, a + 4);
    if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
n = int(raw_input())
A = map(int,raw_input().split())
q = int(raw_input())
m = map(int,raw_input().split())

def solve(i,m):
  if m == 0:
    return 1
  if i >= n or m - sum(A) > 0:
    return 0
  res = solve(i+1,m) or solve(i+1,m-A[i])
  return res

for j in range(q):
  if solve(0,m[j]):
    print "yes"
  else:
    print "no"

Measured memory_bytes: 6452
#include<stdio.h>
int main()
{
	long long int n;
	scanf("%lld", &n);
	long long int ans = n * (n + 1) / 2;
	ans -= (n / 3) * (n / 3 + 1) / 2 * 3;
	ans -= (n / 5) * (n / 5 + 1) / 2 * 5;
	ans += (n / 15) * (n / 15 + 1) / 2 * 15;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
#define rep(i,a) for(int i=0;i<a;i++)
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[n];
    rep(i,n){
        cin>>a[i];
    }
    bool ok=true;
    int ans=0;
    while(1){
        rep(i,n){
            if(a[i]%2==0){
              a[i]/=2;  
            }
            else{
                ok=false;
                break;
            }
        }
        if(!ok)break;
        ans++;
    }
    cout<<ans<<endl;
}

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

    int main() {
        int num,count=1;
        cin >> num;
        vector<int> how_long(num);
        for(int i=0;i<num;i++){
            cin >> how_long.at(i);
        }
        sort(how_long.begin(),how_long.end());
        reverse(how_long.begin(),how_long.end());
        for(int i=1;i<num;i++){
            if(how_long.at(i-1)!=how_long.at(i)){
                count++;
            }
        }
        cout << count << endl;
        }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,minv,sumw[300005]={};
  int sume[300005]={};
  string s;
  cin>>n>>s;
  for(int i=1; i<=n; i++){
    if(s[i-1]=='W'){
      sumw[i]=sumw[i-1]+1;
    }else{
      sumw[i]=sumw[i-1];
    }
  }
  for(int i=n-1; i>=0; i--){
    if(s[i]=='E'){
      sume[i]=sume[i+1]+1;
    }else{
      sume[i]=sume[i+1];
    }
  }
  minv=sumw[0]+sume[0];
  for(int i=0; i<=n; i++){
    if(minv>sumw[i]+sume[i]){
      minv=sumw[i]+sume[i];
    }
  }
  cout<<minv<<'\n';
  return 0;
}


Measured memory_bytes: 3204
#include <stdio.h>
#include <string.h>
#define M 1005

int LCSlen(char *,char *);

int main(){
  int n,i;
  char s1[M],s2[M];
  scanf(" %d ",&n);
  for(i = 0;i < n;i++){
    scanf(" %s %s",&s1[1],&s2[1]);
    printf("%d\n",LCSlen(&s1[1],&s2[1]));
  }

  return 0;
}

int LCSlen(char *x,char *y){
  int c[M + 1][M + 1],i,j,m,n,max = 0;
  m = strlen(x);
  n = strlen(y);
  for(i = 0;i <= m;i++) c[i][0] = 0;
  for(j = 1;j <= n;j++) c[0][j] = 0;
  for(i = 1;i <= m;i++){
    for(j = 1;j <= n;j++){
      if(x[i-1] == y[j-1]) c[i][j] = c[i-1][j-1] + 1;
      else if(c[i-1][j] >= c[i][j-1]) c[i][j] = c[i-1][j];
      else c[i][j] = c[i][j-1];
      //if(max < c[i][j]) max = c[i][j];
    }
  }
  return /*max*/c[m][n];
}



Measured memory_bytes: 5688
#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;}

struct UnionFindTree{
    vector<int>par,sz;
    UnionFindTree(int n){
        par.resize(n);
        sz.resize(n);
        for(int i=0;i<n;i++){
            par[i]=i;
            sz[i]=1;
        }
    }
    int find(int x){
        return x==par[x]?x:par[x]=find(par[x]);
    }
    void unite(int x,int y){
        x=find(x);y=find(y);
        if(x==y)return;
        if(sz[x]<sz[y])swap(x,y);
        sz[x]+=sz[y];
        par[y]=x;
    }
    bool areSame(int x,int y){
        return find(x)==find(y);
    }
    int size(int x){
        return sz[find(x)];
    }
};

int N,M;
vpint G[4444];

int A[444444],B[444444],C[444444];

int cost[4444][4444];

void dfs(int v,int p,int c,int s){
    cost[s][v]=c;
    for(auto &e:G[v]){
        if(e.fi==p)continue;
        dfs(e.fi,v,max(c,e.se),s);
    }
}

signed main(){
    cin>>N>>M;

    vpint ord;
    rep(i,M){
        cin>>A[i]>>B[i]>>C[i];
        A[i]--;B[i]--;
        ord.pb({C[i],i});
    }
    sort(all(ord));

    int sum=0;
    UnionFindTree uf(N);
    rep(i,M){
        int w=ord[i].se;
        if(uf.areSame(A[w],B[w]))continue;
        uf.unite(A[w],B[w]);
        G[A[w]].pb({B[w],C[w]});
        G[B[w]].pb({A[w],C[w]});
        sum+=C[w];
    }

    rep(i,N)dfs(i,-1,0,i);

    int Q;cin>>Q;
    while(Q--){
        int a,b;
        cin>>a>>b;
        a--;b--;
        cout<<sum-cost[a][b]<<endl;
    }
    return 0;
}


Measured memory_bytes: 159592
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-03-22 22:16:02
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

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

  int n; cin >> n;
  vector<int64> cnt(202020, 0LL);
  vector<int> in(n);
  for (int i = 0; i < n; ++i) {
    int a; cin >> a;
    ++cnt[a];
    in[i] = a;
  }

  int64 sum = 0LL;

  for (int i = 0; i < 202020; ++i) {
    if (cnt[i] == 0LL) continue;
    sum += cnt[i] * (cnt[i] - 1LL) / 2LL;
  }

  for (int i = 0; i < n; ++i) {
    cout << sum - (cnt[in[i]] - 1LL) << '\n';
  }

  return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,k,s=0;
	cin>>n;
	cin>>m>>k;
	int a[n];
	for(int i=1;i<=n;i++){
		cin>>a[i];
		int b=a[i];
		int c=0;
		int j=1;
		s++;
		while(c<=m){
			c=b*j+1;
			if(c>m) break; 
			s++;
			j++;
		}
	}
	s+=k;
	cout<<s;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void copy_arr(long a[], long b[], int n)
{
    for (int i = 0; i < n; i++) {
        a[i] = b[i];
    }
}

int main(void)
{
    char s[100001];
    scanf("%s", s);
    long remainder[13] = { 1 };
    long figure_position = 1;
    int num_of_digits = strlen(s);
    const int mod = 1000000007;

    for (int i = num_of_digits - 1; i >= 0; i--) {
        long next_reminder[13] = { 0 };
        if (s[i] == '?') {
            for (int j = 0; j < 10; j++) {
                for (int k = 0; k < 13; k++) {
                    next_reminder[(j * figure_position + k) % 13] += remainder[k];
                    next_reminder[(j * figure_position + k) % 13] %= mod;
                }
            }
        } else {
            int j = s[i] - '0';
            for (int k = 0; k < 13; k++) {
                next_reminder[(j * figure_position + k) % 13] += remainder[k];
                next_reminder[(j * figure_position + k) % 13] %= mod;
            }
        }
        figure_position *= 10;
        figure_position %= 13;
        copy_arr(remainder, next_reminder, 13);
    }

    printf("%ld\n", remainder[5]);

    return 0;
}


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

int main() {
  bool c = false;
  vector<vector<int>> A(3, vector<int>(3));
  for (int i = 0;i < 9;i++) {
    cin >> A.at(i/3).at(i%3);
  }
  int N;
  cin >> N;
  for (int i = 0;i < N;i++) {
    int b;
    cin >> b;
    for (int j = 0;j < 9;j++) {
      if (A.at(j/3).at(j%3) == b) {
        A.at(j/3).at(j%3) = 0;
        break;
      }
    }
  }
  for (int i = 0;i < 3;i++) {
    if (A.at(i).at(0) + A.at(i).at(1) + A.at(i).at(2) == 0) {
      c = true;
      break;
    } else if (A.at(0).at(i) + A.at(1).at(i) + A.at(2).at(i) == 0) {
      c = true;
      break;
    }
  }
  if (A.at(0).at(0) + A.at(1).at(1) + A.at(2).at(2) == 0) {
    c = true;
  } else if (A.at(0).at(2) + A.at(1).at(1) + A.at(2).at(0) == 0) {
    c = true;
  }
  if (c) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

const int MAX_H = 100, MAX_W = 100;
char s[MAX_H][MAX_W];

int main(){
    int h, w;
    cin >> h >> w;
    int dp[h][w];
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> s[i][j];
        }
    }
    if(s[0][0] == '.') dp[0][0] = 0;
    else dp[0][0] = 1;
    for(int i=0; i<h-1; i++){
        if(s[i][0] == '.' && s[i+1][0] == '#') dp[i+1][0] = dp[i][0] + 1;
        else dp[i+1][0] = dp[i][0];
    }
    for(int i=0; i<w-1; i++){
        if(s[0][i] == '.' && s[0][i+1] == '#') dp[0][i+1] = dp[0][i] + 1;
        else dp[0][i+1] = dp[0][i];
    }
    for(int i=0; i<h-1; i++){
        for(int j=0; j<w-1; j++){
            if(s[i+1][j+1] == '#' && s[i+1][j] == '.' && s[i][j+1] == '.') dp[i+1][j+1] = min(dp[i+1][j] + 1, dp[i][j+1] + 1);
            else if(s[i+1][j+1] == '#' && s[i+1][j] == '#' && s[i][j+1] == '.') dp[i+1][j+1] = min(dp[i+1][j], dp[i][j+1] + 1);
            else if(s[i+1][j+1] == '#' && s[i+1][j] == '.' && s[i][j+1] == '#') dp[i+1][j+1] = min(dp[i+1][j] + 1, dp[i][j+1]);
            else dp[i+1][j+1] = min(dp[i+1][j], dp[i][j+1]);
        }
    }
    cout << dp[h-1][w-1] << endl;
}


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

int main()
{
	int m,n;
	
	while (scanf("%d %d", &m, &n) != EOF){
		
		if(m < n) swap(m,n);
	
		while(n != 0){
			int t=n;
			n = m%n;
			m = t;
		}
	
		printf("%d\n", m);
	}
	return (0);
}

Measured memory_bytes: 1024
def main():
    s = input()
    acgt_flag = [0 for i in range(len(s))]

    for i in range(len(s)):
        if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
            acgt_flag[i] = 1

    counter = 0
    counter_max = 0
    for i in range(len(acgt_flag)):
        if acgt_flag[i] == 1:
            counter += 1
            if counter_max < counter:
                counter_max = counter
        else:
            counter = 0

    print(counter_max)


if __name__ == '__main__':
    main()


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

int main() {
  int S;
  cin >> S;
  
  int down = S % 100;
  int up = S / 100;
  
  if (1 <= up && up <= 12) {
    if (1 <= down && down <= 12) {
      cout << "AMBIGUOUS" << endl;
    } else {
      cout << "MMYY" << endl;
    }
  } else {
    if (1 <= down && down <= 12) {
      cout << "YYMM" << endl;
    } else {
      cout << "NA" << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define IOS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define debug(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define IN freopen("in.txt", "r", stdin);
#define endl '\n'
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> pii;
const int inf = 0x3f3f3f3f;

const int N = 305,MOD = 998244353;

int n,m;
int f[2][N][N];
int a[N],cnt;
char s[N];

void up(int &x,int y){
    x=x+y>=MOD?x+y-MOD:x+y;
}
int main(){
    IOS;
    cin>>(s+1)>>m;
    n=strlen(s+1),m=min(n,m);
    int l=1;
    while(l<=n){
        int r=l;
        while(r<=n && s[r]=='1')r++;
        a[++cnt]=r-l;
        l=r+1;
    }
    int now=0;
    f[now][0][0]=1;
    for(int i=cnt;i;i--){
        now^=1;
        memset(f[now],0,sizeof f[now]);
        for(int j=0;j<=m;j++)
            for(int k=0;k<=j;k++){
                if(!f[now^1][j][k])continue;
                int res=f[now^1][j][k];
                for(int t=0;t<=a[i];t++)up(f[now][j+t][k+t],res);
                for(int t=1;t<=k;t++)up(f[now][j][k-t],res);
            }
    }
    int ans=0;
    for(int i=0;i<=m;i++)up(ans,f[now][i][0]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4340