akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T&a,T b){if(a>b){a=b;return 1;}return 0;}
typedef long long ll;

ll n,k;
string s,t;

int main() {
  cin >> n;
  ll a[5];
  rep(i,5) cin >> a[i];
  sort(a,a+5);
  cout << (n+a[0]-1)/a[0]+4 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int N;
int denkyu[114514];

int tomatu;
int sumipe[114514];

int main(void) {
	int i;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &denkyu[i]) != 1) return 1;
	}
	tomatu = 1;
	sumipe[0] = 1;
	for (i = 1; i < N; i++) {
		if (denkyu[i - 1] != denkyu[i]) {
			sumipe[tomatu - 1]++;
		} else {
			sumipe[tomatu] = 1;
			tomatu++;
		}
	}
	if (tomatu == 1) {
		printf("%d\n", sumipe[0]);
	} else if (tomatu == 2) {
		printf("%d\n", sumipe[0] + sumipe[1]);
	} else {
		int asumikana = 0;
		for (i = 2; i < tomatu; i++) {
			int igutiyuka = sumipe[i - 2] + sumipe[i - 1] + sumipe[i];
			if (igutiyuka > asumikana) asumikana = igutiyuka;
		}
		printf("%d\n", asumikana);
	}
	return 0;
}



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

using namespace std;

int vis[100005]={0};

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

	int tl,tr;
	int l=-1,r=1000000;

	while(m--)
	{
		cin>>tl>>tr;
		vis[tl]++;
		vis[tr]++;
		l=max(l,tl);
		r=min(r,tr);
	}
	
	if(r>=l)
		cout<<(r-l)+1<<'\n';
	else
		cout<<0<<'\n';


	return 0;
}

Measured memory_bytes: 640
N = int,input().split()
A = list(map(int,input().split()))

def solve(A):
    ret = 0
    if len(A) == 0:
        return 0

    if 0 in A:
        idx = A.index(0)
        left = A[:idx]
        right = A[idx+1:]
        ret += solve(left)
        ret += solve(right)
    else:
        min_a = min(A)
        for i in range(len(A)):
            A[i] -= min_a
        ret += solve(A) + min_a

    return ret

ans = solve(A)
print(ans)







Measured memory_bytes: 3188
MOD = 10**9 + 7
def comb(n, k, MOD):
    if n < k or n < 0 or k < 0:
        return 0
    if k == 0:
        return 1
    iinv = [1] * (k + 1)
    ans = n
    for i in range(2, k + 1):
        iinv[i] = MOD - iinv[MOD % i] * (MOD // i) % MOD
        ans *= (n + 1 - i) * iinv[i] % MOD
        ans %= MOD
    return ans
n, a, b = map(int, input().split())
ans = pow(2,n,MOD)
print(((ans-comb(n,a,MOD))%MOD-comb(n,b,MOD))%MOD-1)

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

using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int MIN = abs(a - b) + abs(b - c);
	MIN = min(MIN, abs(a - c) + abs(c - b));
	MIN = min(MIN, abs(b - a) + abs(a - c));
	MIN = min(MIN, abs(b - c) + abs(c - a));
	MIN = min(MIN, abs(c - a) + abs(c - b));
	MIN = min(MIN, abs(c - b) + abs(b - a));
	cout << MIN << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n,m,k,tmp;
  bool can=false;
  cin >> n >> m >> k;
  for(int i=0;i<=n;i++){
    for(int j=0;j<=m;j++){
      tmp = (i*m)+(j*n)-(i*j)*2;
      if(tmp==k){
        can=true;
        break;
      }
    }
  }
  if(can){
    cout <<"Yes\n";
  }else{
    cout <<"No\n";
  }
}


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

int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	
	bool f=0;
	for(int i=0;i<a;i++){
		if((b*i+c)%a==0){
			f=1;
			break;
		}
	}
	
	cout<<(f? "YES":"NO")<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>

using namespace std;
 
#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  f              first                 
#define  s              second
#define  endl           "\n"
#define  pb             push_back  
#define  mset(a,x)      memset(a,x,sizeof(a))
#define  debv(a)        for(auto it: a)cout<<it<<" ";cout<<endl;
#define  deb1(a)        cout<<a<<endl;
#define  deb2(a,b)      cout<<a<<" "<<b<<endl;
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<endl;
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;            
 
typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  unordered_map<ll,ll>  um;
typedef  vector<pll>           vpll;
 
const ll   N     =  3e5+5;
const ll   mod   =  1e9+7;
const ll   INF   =  1e18;
const int  INFi  =  0x7f7f7f7f;

ll test = 1, n, ans[N];

void solve(){
	cin>>n;
	for(int i = 1; i*i < n; i++){
		for(int j = 1; j*j < n; j++){
			for(int k = 1; k*k < n; k++){
				ll x = i*i+j*j+k*k+i*j+i*k+j*k;
				if(x > n) break;
				ans[x]++;
			}
		}
	}
	for(int i = 1; i <= n; i++) deb1(ans[i])
}

int main(){
	fastio;
	//cin>>test;
	for(int i = 1; i <= test; i++){
		solve();
	}
}

Measured memory_bytes: 3688
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <bitset>
class JNum{
	static constexpr uint64_t mod = 1000000007;
	uint64_t num;
public:
	JNum(uint64_t x):num(x%mod){}
	JNum operator+(const JNum& j)const{
		return (num + j.num)%mod;
	}
	JNum operator*(const JNum& j)const{
		return (num * j.num)%mod;
	}
	void operator+=(const JNum& j){
		num += j.num;
		num %= mod;
	}
	void operator*=(const JNum& j){
		num *= j.num;
		num %=mod;
	}
	uint64_t out()const{return num;}
};

int main(void){
	int N, M;
	std::cin >> N;
	std::cin >> M;
	std::bitset<200001> to, from;
	for(int i=0;i<M;i++){
		int a, b;
		std::cin >> a;
		std::cin >> b;
		if(a == 1){
			to.set(b, true);
		}
		if(b == N){
			from.set(a, true);
		}
	}
	from &= to;
	if(from.none()){
		std::cout << "IMPOSSIBLE"<<std::endl;
	}else{
		std::cout << "POSSIBLE" << std::endl;
	}
	return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define POW(n) ((n)*(n))
#define ALL(a) (a).begin(),(a).end()
#define cerr if(false) cerr
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<unsigned long long> vull;

void solve(long long N, long long x, vector<long long> a){
  ll ans = 0;
  
  REP(i,N){
     int buf = (a[i] - x > 0)?a[i] - x:0;
     ans += buf;
     a[i] -= buf;
  }
  
  FOR(i,1,N){
    ll buf = a[i-1] + a[i];
    if(buf > x){
      // while(buf > x){
      //   a[i]--; ans++;
      //   buf = a[i-1] + a[i];
      // }
      ans += buf - x;
      a[i] -= buf - x;
    }
  }
  
  cout << ans << endl;
}



int main(){	
	ios::sync_with_stdio(false);
	long long N;
	long long x;
	cin >> N;
	vector<long long> a(N-1+1);
	cin >> x;
	for(int i = 0 ; i <= N-1 ; i++){
		cin >> a[i];
	}
	solve(N, x, a);
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };
static const int mod = 1000000007;

int N,M;

int ans=INF;
map < P1,vector<P2> > E;
map < P1,int > dist;

void dijkstra(int s){

    priority_queue< P2,vector<P2>,greater<P2> > pq;

    dist[P1(s,0)] = 0;
    dist[P1(N-1,0)] = INF;
    pq.push(P2(0,P1(s,0)));
    while(!pq.empty()){
        P2 p = pq.top();
        pq.pop();
        int v = p.second.first;
        int c = p.second.second;
        if(dist[P1(v,c)]==0&&P1(v,c)!=P1(s,0))dist[P1(v,c)]=INF;
        if(dist[P1(v,c)]<p.first)continue;
        //cout<<"now "<<v<<" "<<c<<endl;
        //cout<<"now cost "<<dist[P1(v,c)]<<endl;
        for(auto u : E[P1(v,c)]){
            P1 to = P1(u.first,u.second.first);
            int cost = u.second.second;
            if(dist[to]==0&&to!=P1(s,0))dist[to]=INF;
            //cout<<"next "<<to.first<<" "<<to.second<<endl;
            //cout<<"next cost "<<cost<<endl;
            // to u.first , camp u.second.first , cost u.second.second
             if(dist[to]>dist[P1(v,c)]+cost){
                dist[to] = dist[P1(v,c)]+cost;
                pq.push(P2(dist[to],to));
             }
        }
    }
    /*for(map<P1,int>::iterator it = dist.begin(); it != dist.end(); it++){
        if(it->first.first == N-1 && it->first.second != 0){
            P1 to  = P1(it->first.first,it->first.second);
            int c = it->second;
            //cout<< to.first <<" "<< to.second <<" "<< c <<endl;
            ans=min(ans,it->second);
        }
    }*/
    ans = dist[P1(N-1,0)];
}

signed main(){
    cin>>N>>M;
    for(int i=0;i<M;++i){
        int a,b,c;
        cin>>a>>b>>c;
        a--,b--;
        E[P1(a,c)].PB(P2(b,P1(c,0)));
        E[P1(b,c)].PB(P2(a,P1(c,0)));

        E[P1(a,c)].PB(P2(a,P1(0,0)));
        E[P1(a,0)].PB(P2(a,P1(c,1)));
        E[P1(b,c)].PB(P2(b,P1(0,0)));
        E[P1(b,0)].PB(P2(b,P1(c,1)));

        /////////////////////////////
        dist[P1(a,c)] = INF;
        dist[P1(b,c)] = INF;

        dist[P1(a,c)] = INF;
        dist[P1(a,0)] = INF;
        dist[P1(b,c)] = INF;
        dist[P1(b,0)] = INF;

    }
    dijkstra(0);
    if(ans==INF)cout<<-1<<endl;
    else cout<<ans<<endl;
    //if(dist[N-1]<INF)cout<<dist[N-1]<<endl;
   // else cout<<-1<<endl;
}


Measured memory_bytes: 115120
#include <stdio.h>
     
    int main(){
    	int num_children;
    	scanf("%d", &num_children);
    	int count = num_children;
    	int sum = 0;
    	while(count > 0){
    		sum += count--;
    	}
    	printf("%d",sum);
     
    	return 0;
    }

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

constexpr int64_t mod = 1'000'000'007; //'

int main(){
    int n;
    static int64_t a[300000];

    cin >> n;
    for(int i=0;i<n;++i) cin >> a[i];

    int64_t ans = 0;
    for(int b=0;b<60;++b){
        int64_t k = 0;
        for(int i=0;i<n;++i) k += ((a[i] >> b) & 1);
        ans = (ans + (1LL<<b) % mod * k % mod * (n-k) % mod) % mod;
    }

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

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9+7;
int gcd(int a,int b)
{
	if(b==0)
	return a;
	
	return gcd(b,a%b);
}
int power(int x,int y,int p)
{
	int res=1;
	x=x%p;
	while(y>0)
	{
		if(y&1)
		res=(res*x)%p;
		
		y=y>>1;
		x=(x*x)%p;
	}
	return res;
}
struct Matrix{ 
	int a[2][2] = {{0,0},{0,0}};
	Matrix operator *(const Matrix& other){
		Matrix product;
		for(int i=0;i<2;i++){
			for(int j=0;j<2;j++){
				for(int k=0;k<2;k++){
						product.a[i][k] =product.a[i][k] + (ll)a[i][j]*other.a[j][k];
				}
			}
		}
		return product;
	}
};
int modInverse(int n,int p)
{
	return power(n,p-2,p);
}
int main() {
	// your code goes here
	 ios_base::sync_with_stdio(0);
	 cin.tie(0);
	 int n;
	 cin>>n;
	 vector<ll> v(n);
	 for(int i=0;i<n;i++)
	 {
		 cin>>v[i];
	 }
	 vector<ll> pre(n);
	 pre[0] = v[0];
	 for(int i=1;i<n;i++)
	 {
		 pre[i] = (pre[i-1]+v[i])%mod;
	 }
	 ll ans = 0;
	 for(int i=0;i<n;i++)
	 {
		 ans = (ans%mod+(v[i]%mod * (pre[n-1]-pre[i]+mod)%mod))%mod;
		 
	 }
	 cout<<ans<<'\n';
	 
	 return 0;
}


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

#define thegamebegins   ios_base::sync_with_stdio(false); cin.tie(NULL); //cout.tie(NULL);
#define fileio          freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define int             long long
#define float           long double
#define test            int TESTS; cin>>TESTS; for(int CASE=1; CASE<=TESTS; ++CASE)
#define in(a,n)         for(int i=0; i<(n); ++i)  cin>>a[i]
#define r0              return 0
#define E               "\n"
#define S               " "
#define elif            else if 
#define M               1000000007
#define fi(i,x,y)       for(int i=(x); i<(y); ++i)
#define fb(i,x,y)       for(int i=(x); i>=(y); --i)
#define fa(i,s)         for(auto i:(s))
#define fp(i,s)         for(auto i=(s).begin(); i!=(s).end(); ++i)
#define pf(i,s)         for(auto i=(s).rbegin(); i!=(s).rend(); ++i)
#define all(s)          (s).begin(), (s).end()
#define rev(s)          (s).rbegin(), (s).rend()
#define sz(s)           (int)(s).size()
#define vi              vector <int>
#define vpii            vector <pair <int,int> >
#define mii             map <int,int>
#define pii             pair <int,int>
#define seti            set <int>
#define setd            set <int,greater <int> >
#define sortd(a,n)      sort(a, a+n, greater<int>())
#define pb              push_back
#define fr              first
#define sc              second
#define lb              lower_bound
#define ub              upper_bound
#define er              equal_range
 
const int INF = 0x3f3f3f3f;

signed main()
{
    thegamebegins

    string s,t; cin>>s>>t;
    if(sz(s)+1==sz(t) && s==t.substr(0,sz(t)-1))  cout<<"Yes";
    else    cout<<"No";
    r0;
}


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

int main(){
  cin.tie(0); ios::sync_with_stdio(0);
  int n,k;
  cin >> n >> k;
  vi c(n),r(n);
  rep(i,n)cin >> c[i] >> r[i];

  vector<vi> g1(n);
  rep(i,k){
    int a,b;
    cin >> a >> b; a--; b--;
    g1[a].push_back(b);
    g1[b].push_back(a);
  }

  vector< vi > g2(n);
  rep(v,n){
    vi d(n,-1);
    d[v] = 0;
    queue<int> q;
    q.push(v);

    while(q.size()){
      int cur = q.front(); q.pop();
      if(d[cur]==r[v])break;
      for(int nxt : g1[cur]){
	if(d[nxt] < 0){
	  d[nxt] = d[cur] + 1;
	  q.push(nxt);
	  g2[v].push_back(nxt);
	}
      }
    }
  }

  vi dis(n,1e9), use(n,0);
  dis[0] = 0;
  for(;;){
    int v = -1;
    rep(i,n){
      if(!use[i] && (v<0 || dis[v] > dis[i]))v = i;
    }
    if(v<0)break;
    use[v] = 1;

    for(int u : g2[v]){
      dis[u] = min(dis[u], dis[v] + c[v]);
    }
  }
  cout << dis[n-1] << endl;
}

Measured memory_bytes: 68580
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input()) + -1])

Measured memory_bytes: 3060
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		long a,b,z,A,B;
		while(scan.hasNext()){
			a = scan.nextInt();
			b = scan.nextInt();
			z = 1;
			A = a;
			B = b;
			while(z != 0){
				z = a % b;
				a = b;
				b = z;
			}
			for(int i = 1 ; i > 0 ; i++){
				if(A*B == a*i){
					System.out.println(a + " " + i);
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 19420
from heapq import heappop, heappush


def solve(n, m, s):
    curr = n
    l = max(0, n - m)
    r = n
    ans = []
    while r > 0:
        for i, c in enumerate(s[l:r], start=l):
            if c == '0':
                dice = curr - i
                ans.append(dice)
                curr = i
                l = max(0, i - m)
                r = i
                break
        else:
            return (-1,)

    return reversed(ans)


n, m = map(int, input().split())
s = input()
print(*solve(n, m, s))


Measured memory_bytes: 5604
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<tuple>
#include<utility>
#include<vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<vector<int>> vvi;

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define REP(i, n)  for(int i=0; i<(int)(n); i++)
#define REPS(i, n)  for(int i=1; i<=(int)(n); i++)
#define PER(i, n) for(int i=(int)(n)-1; i>= 0; i--)
#define PERS(i, n)  for(int i=(int)(n)-1; i>0; i--)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define RFOR(i, c)  for(__typeof((c).rbegin()) i=(c).rbegin(); i!=(c).end(); i++)
#define ALL(container)  (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) (container).size()
#define FILL0(n)  setfill('0') << right << setw(n)
#define mp(a, b)  make_pair(a, b)
#define toLower(c)  c+0x20
#define toUpper(c)  c-0x20
#define pb  push_back
#define eb  emplace_back

const int INF = 1e9;
const long long LLINF = 1e18;
const int MOD = 1000000007;

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

int main(){
  ll a, b, c, d;  cin >> a >> b >> c >> d;
  ll num = b-a+1, e = c*d/Euclid(c, d);
  a--;
  cout << num - ((b/c + b/d - b/e) - (a/c + a/d - a/e)) << endl;
  return 0;
}


Measured memory_bytes: 256
from collections import Counter
 
n = int(input())
v_array = list(map(int,input().split()))
 
v_odd = v_array[0::2]
v_even = v_array[1::2]
 
v_odd_common = Counter(v_odd).most_common()
v_even_common = Counter(v_even).most_common()

v_odd_common.append((0,0))
v_even_common.append((0,0))

if v_odd_common[0] != v_even_common[0]:
    print(n-v_odd_common[0][1]-v_even_common[0][1])
else:
    print(min(n-v_odd_common[0][1]-v_even_common[1][1],n-v_odd_common[1][1]-v_even_common[0][1]))

Measured memory_bytes: 21084
# -*- coding: utf-8 -*-
from math import floor

def solve():
    T1, T2 = map(int, input().split())
    A1, A2 = map(int, input().split())
    B1, B2 = map(int, input().split())
    C1 = T1*(A1-B1)
    C = C1 + T2*(A2-B2)
    if C == 0:
        return 'infinity'
    elif C1/C > 0:
        return '0'
    elif C1/C > -1:
        return '1'
    else:
        res =  2*(floor(-C1/C)+1)-1-(C1/C).is_integer()
        return str(res)

if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 3064
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

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

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

long double dp[110][100100];

int main(void){
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;

    vector<int> l(q);
    vector<int> r(q);

    for(int i = 0; i < q; i++){
        cin >> l[i] >> r[i];
        l[i]--;
        r[i]--;
    }

    vector<int> sum(n);
    for(int i = 0; i < n; i++){
        sum[i] = 0;
    }

    for(int i = 0; i < n; i++){
        if(i == n - 1)continue;
        if(s[i] == 'A' && s[i + 1] == 'C'){
            sum[i + 1] += sum[i] + 1; 
        } else {
            sum[i + 1] = sum[i];
        }
    }

    for(int i = 0; i < q; i++){
        cout << sum[r[i]] - sum[l[i]] << endl;
    }
}



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

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

    int ans = 0, sum = 0;
    int n = s.size();
    rep (i, n)
        if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T')
            sum++;
        else
        {
            ans = max(sum, ans);
            sum = 0;
        }

    cout << max(sum, ans) << endl;
    return 0;
}

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

int main(){
    int N;
    string S;
    cin >> N >> S;
    if(N % 2 == 1){
        cout << "No" << endl;
        return 0;
    }
    else{
        int A = N / 2;
        for(int i = 0; A < N; i++){
            if(S.at(i) != S.at(A)){
                cout << "No" << endl;
                return 0;
            }
            A++;
        }
    }
    cout << "Yes" << endl;
}

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

using namespace std;
#define rep(j,n) for(int j=0;j<(n);j++)

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

int main(int, char**)
{
  int n;
  cin >> n;

  vector<string> sl = {"AC","WA","TLE","RE"};
  map<string,int> mp;
  for (auto s : sl) mp[s] = 0;
  string tmp;
  rep(i,n) { cin >> tmp; mp[tmp]++; } 

  for (auto s : sl) {
    cout << s << " x " << mp[s] << endl;
  }

  return 0;
}

Measured memory_bytes: 3632
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

func main() {
	sc.Split(bufio.ScanWords)
	K, X := nextInt(), nextInt()

	min := X - K + 1
	max := X + K - 1

	for i := min; i <= max; i++ {
		fmt.Printf("%d ", i)
	}
	fmt.Println()
}


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

int maxtime(int x) {
  // 引数を10の倍数に切り上げた値を返す。
  // 引数が10の倍数である場合は、その値を返す。
  return (x + 9) / 10 * 10;
}

int remtime(int x) {
  // 引数を10の倍数に切り上げた値と、引数の差分を返す。
  return maxtime(x) - x;
}

int main() {
  int A, B, C, D, E;
  scanf("%d%d%d%d%d", &A, &B, &C, &D, &E);
  int sum = maxtime(A) + maxtime(B) + maxtime(C) + maxtime(D) + maxtime(E);
  // 最後に注文した場合、最も待機時間が短くなるものを引く
  sum -= max({remtime(A), remtime(B), remtime(C), remtime(D), remtime(E)});
  printf("%d", sum);
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int D = A+B+C;
    System.out.println(D >= 22 ? "bust" : "win");
  }
}

Measured memory_bytes: 23764
#include <iostream>
#include <map>
#include <string>

using namespace std;

map<char, string> keys;

int main() {
    keys['1'] = ".,!? ";
    keys['2'] = "abc";
    keys['3'] = "def";
    keys['4'] = "ghi";
    keys['5'] = "jkl";
    keys['6'] = "mno";
    keys['7'] = "pqrs";
    keys['8'] = "tuv";
    keys['9'] = "wxyz";

    int n; cin >> n;
    while (n--) {
        string s; cin >> s;
        string out;
        char outc = '\0';
        int n = 0;
        for (size_t i = 0; i < s.size(); ++i) {
            char inc = s[i];
            if (inc == '0') {
                if (outc != '\0') {
                    out += outc;
                }
                n = 0;
                outc = '\0';
            } else {
                outc = keys[inc][n++ % keys[inc].size()];
            }
        }
        cout << out << endl;
    }
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9) + 7;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")

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

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

ll factorial(ll n){
    ll t = 1;
    rep1(i, n){
        t *= i;
        t %= mod;
    }
    return t;
}

ll power(ll a, ll b){
    a %= mod;
    if(b == 0){
        return 1;
    }
    ll ans = power(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    ll ans = 1;
    for(ll i = 0; i < b; i++) {
        ans *= (a - i);
        ans /= (i + 1);
        ans %= mod;
    }
    return ans;
}

int main(){
    double r;
    cin >> r;
    printf("%.9lf",r * 2 * 3.141592);
    return 0;
}



Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define PII pair<int, int>
using namespace std;

int n;
int x[100], y[100];
struct Node {
    int x, y;
} a[100];
map<PII, int> num;

bool cmp(Node a, Node b) {
    return a.x == b.x ? a.y < b.y : a.x < b.x;
}

int main() {
#ifdef whyqx
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif
    cin >> n;
    for (int i = 1; i <= n; ++i)
        scanf("%d%d", &a[i].x, &a[i].y);
    sort(a + 1, a + n + 1, cmp);
    for (int i = 1; i <= n; ++i)
        x[i] = a[i].x, y[i] = a[i].y;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= n; ++j) {
            if (j == i) continue;
            num[make_pair(x[i] - x[j], y[i] - y[j])]++;
            //num[make_pair(x[j] - x[i], y[j] - y[i])]++;
        }
    int ans = 0;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= n; ++j) {
            ans = max(ans, num[make_pair(x[i] - x[j], y[i] - y[j])]);
            //ans = max(ans, num[make_pair(x[j] - x[i], y[j] - y[i])]);
        }
    cout <<  n - ans;
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>

//question_a
using namespace std;
using ll = long long;
int main() {
	constexpr ll mod = 1e9 + 7;
	ll n;
	cin >> n;
	ll* non_09 = new ll[n];
	ll* only_0 = new ll[n];
	ll* only_9 = new ll[n];
	ll* ok_09 = new ll[n];
	non_09[0] = 8;
	only_0[0] = 1;
	only_9[0] = 1;
	ok_09[0] = 0;
	for (int i = 1;i < n;i++) {
		non_09[i] = non_09[i - 1] * 8;
		only_0[i] = only_0[i - 1] * 9 + non_09[i - 1];
		only_9[i] = only_9[i - 1] * 9 + non_09[i - 1];
		ok_09[i] = ok_09[i - 1] * 10 + only_0[i - 1] + only_9[i - 1];
		non_09[i] %= mod;
		only_0[i] %= mod;
		only_9[i] %= mod;
		ok_09[i] %= mod;
	}
	cout << ok_09[n - 1] << endl;
}

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

const int MAX_N = 110000;

int memo[MAX_N]; 
int rec(int n) {
    if (n == 0) return 0; 
    if (memo[n] != -1) return memo[n];

    int res = n; 


    for (int pow6 = 1; pow6 <= n; pow6 *= 6) res = min(res, rec(n - pow6) + 1);

    
    for (int pow9 = 1; pow9 <= n; pow9 *= 9) res = min(res, rec(n - pow9) + 1);

    return memo[n] = res;
}

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

    for (int i = 0; i < MAX_N; ++i) memo[i] = -1;
    cout << rec(N) << endl;
}

Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n,p;
  cin>>n>>p;
  string s;
  cin>>s;
  int ans=0;
  int a=0,cls=1;
  int two=0,five=0;
  map<int,int> mp;
  mp[0]++;
  repn(i,s.size() - 1){
    int num=s[i]-'0';
    a+=(cls*num)%p;
    a%=p;
    mp[a]++;
    cls*=10;
    cls%=p;
    if(p==2 && num%2==0) two+=(i+1);
    if(p==5 && num%5==0) five+=(i+1);
  }
  if(p==2) cout<<two<<endl;
  else if(p==5) cout<<five<<endl;
  else{
    for(auto itr=mp.begin();itr!=mp.end();itr++){
      int num=itr->S;
      //cout<<num<<endl;
      ans+=(num*(num-1))/2;
    }
    
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 1044
n,k = map(int,input().split())
# k = int(input())
a = 1
B = [b-1 for b in map(int,input().split())]
d = [-1]*n
d[a-1] = 0
now = a-1
while True:
    if d[B[now]] == -1:
        d[B[now]] = d[now] + 1
        now = B[now]
    else:
        loop = d[now] - d[B[now]] + 1
        start = d[B[now]]
        break
print(d.index((k-start)%loop + start) + 1 if start < k else d.index(k) + 1)


Measured memory_bytes: 32336
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main(){
  int R[MAX], n;

  cin >> n;
  for ( int i = 0; i < n; i++) cin >> R[i];

  int maxv = -2000000000;
  int minv = R[0];

  for ( int i = 1; i < n; i++){
    maxv = max(maxv,R[i]-minv);
    minv = min(minv,R[i]);
  }
  cout << maxv << endl;

  return 0;
}

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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///



void _case()
{
    long double a,b;
    cin>>a>>b;
    b*=1000;
    a*=b;
    a/=1000;
    cout<<(ll) a el;

}

main()
{
//      fastio();
        _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


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

using namespace std;
typedef long long ll;


int n;
int h[100100];
int dp[100100];

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
        scanf("%d", &h[i]);
    for (int i = 1; i < n; ++i)
    {
        dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
        if (i > 1)
            dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
    }
    printf("%d\n", dp[n-1]);

    return 0;
}


Measured memory_bytes: 1024
n = int(input())
S = list(map(int, input().split()))

def merge(A, left, mid, right):
    cnt = 0
    n1 = mid - left
    n2 = right - mid
    L = [0]*(n1+1)
    R = [0]*(n2+1)
    for i in range(n1):
        L[i] = A[left + i]
    for i in range(n2):
        R[i] = A[mid + i]
    L[n1] = float("inf")
    R[n2] = float("inf")
    i = 0
    j = 0
    for k in range(left, right):
        cnt += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
    return cnt
            
def merge_sort(A, left, right):
    if left + 1 < right:
        mid = (left + right)//2
        cnt_left = merge_sort(A, left, mid)
        cnt_right = merge_sort(A, mid, right)
        cnt_merge = merge(A, left, mid, right)
        cnt = cnt_left + cnt_right + cnt_merge
    else:
        cnt = 0
    return cnt

cnt = merge_sort(S, 0, n)
print(' '.join( map(str, S) ))
print(cnt)


Measured memory_bytes: 66716
import sys
from fractions import Fraction
input = sys.stdin.readline

h, n = list(map(int, input().split()))

mp = 0

a = []
b = []

for i in range(n):
    ai, bi = list(map(int, input().split()))
    a.append(ai)
    b.append(bi)

dp = [0] * (h+1)

dp[0] = 0

for i in range(1, h+1):
    m = 1000000000
    for j in range(n):
        l = 0
        if i - a[j] < 0:
            l = b[j]
        else:
            l = b[j] + dp[i - a[j]]
        m = min(l, m)
    dp[i] = m

print(dp[h])



Measured memory_bytes: 78636
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);


ll N, W;
vector<ll> w, v;

void solve() {
    vector<ll> v0;
    vector<ll> v1;
    vector<ll> v2;
    vector<ll> v3;
    rep(i, N) {
        if (w[i] == w[0]) v0.emplace_back(v[i]);
        if (w[i] == w[0] + 1) v1.emplace_back(v[i]);
        if (w[i] == w[0] + 2) v2.emplace_back(v[i]);
        if (w[i] == w[0] + 3) v3.emplace_back(v[i]);
    }
    sort(v0.begin(), v0.end(), greater<>());
    sort(v1.begin(), v1.end(), greater<>());
    sort(v2.begin(), v2.end(), greater<>());
    sort(v3.begin(), v3.end(), greater<>());
    rep(i, v0.size() - 1) v0[i + 1] += v0[i];
    rep(i, v1.size() - 1) v1[i + 1] += v1[i];
    rep(i, v2.size() - 1) v2[i + 1] += v2[i];
    rep(i, v3.size() - 1) v3[i + 1] += v3[i];
    v0.insert(v0.begin(), 0);
    v1.insert(v1.begin(), 0);
    v2.insert(v2.begin(), 0);
    v3.insert(v3.begin(), 0);

    ll ans = 0;
    rep(i, v0.size()) {
        rep(j, v1.size()) {
            rep(k, v2.size()) {
                rep(l, v3.size()) {
                    if (w[0] * i + (w[0] + 1) * j + (w[0] + 2) * k + (w[0] + 3) * l <= W) {
                        ans = max(ans, v0[i] + v1[j] + v2[k] + v3[l]);
                    }
                }
            }
        }
    }
    cout << ans << endl;
}

int main() {
    cin >> N >> W;
    w.resize(N), v.resize(N);
    rep(i, N) cin >> w[i] >> v[i];
    solve();
    return 0;
}	

Measured memory_bytes: 256
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		x: u128,
		y: u128,
	}

	let mut ans = 0;
	let mut num = x;
	loop {
		if y < num {
			println!("{}", ans);
			return;
		}
		ans += 1;
		num *= 2;
	}
}



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


int main() {
  int n;
  cin>>n;
  vector<int>a(10010);
  rep2(i,1,100){
    rep2(j,1,100){
      rep2(k,1,100){
        if(i*i+j*j+k*k+i*j+j*k+i*k<=n){
          a[i*i+j*j+k*k+i*j+j*k+i*k]++;
        }
      }
    }
  }
  rep2(i,1,n+1){
    cout<<a[i]<<endl;
  }

}




Measured memory_bytes: 3648
#include<iostream>
#include<cstdio>
const int N=2e5+5,M=1e6+1;
typedef long long ll;
const ll mod=998244353;
int n,a[N];
ll f[M];
ll qpow(ll x,ll y) {
    ll res=1;
    for(;y;y>>=1,x=x*x%mod) if(y&1) res=res*x%mod;
    return res;
}
int main() {
    scanf("%d",&n);
    ll ans=0;
    for(int i=1;i<=n;i++) {
        scanf("%d",a+i);
        for(int j=1;j*j<=a[i];j++) {
            if(a[i]%j) continue;
            f[j]=(f[j]+a[i])%mod;
            if(a[i]/j!=j) f[a[i]/j]=(f[a[i]/j]+a[i])%mod;
        }
        ans=(ans-a[i]+mod)%mod;
    }
    for(int i=M-1;i;i--) {
        f[i]=f[i]*f[i]%mod;
        for(int j=i+i;j<M;j+=i) f[i]=(f[i]-f[j]+mod)%mod;
        ans=(ans+f[i]*qpow(i,mod-2))%mod;
    }
    printf("%lld\n",ans*qpow(2,mod-2)%mod);
    return 0;
}


Measured memory_bytes: 8832
#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <numeric>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
//#define int long long
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define loop(s, v, it) for (s::iterator it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (int i = head[x]; i; i = e[i].nxt)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, sum) memset(a, sum, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define se second
#define iv inline void
#define enter cout << endl
#define siz(x) ((int)x.size())
#define file(x) freopen(x".in", "r", stdin),freopen(x".out", "w", stdout)
typedef double db ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair <int, int> pii ;
typedef vector <int> vi ;
typedef vector <pii> vii ;
typedef queue <int> qi ;
typedef queue <pii> qii ;
typedef set <int> si ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
const int N = 100010 ;
const int INF = 0x3f3f3f3f ;
const int iinf = 1 << 30 ;
const ll linf = 2e18 ;
const int MOD = 1000000007 ;
const double eps = 1e-7 ;
void douout(double x){ printf("%lf\n", x + 0.0000000001) ; }
template <class T> void print(T a) { cout << a << endl ; exit(0) ; }
template <class T> void chmin(T &a, T b) { if (a > b) a = b ; }
template <class T> void chmax(T &a, T b) { if (a < b) a = b ; }
template <class T> void upd(T &a, T b) { (a += b) %= MOD ; }
template <class T> void mul(T &a, T b) { a = (ll) a * b % MOD ; }

int r, g, b, n, ans ;

signed main() {
	scanf("%d%d%d%d", &r, &g, &b, &n) ;
	rep(i, 0, floor(1.0 * n / r))
	rep(j, 0, floor(1.0 * (n - i * r) / g)) {
		int rst = n - i * r - j * g ;
		if (rst % b == 0) ans++ ;
	}
	printf("%d\n", ans) ;
	return 0 ;
}

/*
写代码时请注意：
	1.ll？数组大小，边界？数据范围？
	2.精度？
	3.特判？
	4.至少做一些
思考提醒：
	1.最大值最小->二分？
	2.可以贪心么？不行dp可以么
	3.可以优化么
	4.维护区间用什么数据结构？
	5.统计方案是用dp？模了么？
	6.逆向思维？
*/




Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] ar = new int[n];
        Map<Integer,Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            ar[i] = scan.nextInt();
            map.put(ar[i],map.getOrDefault(ar[i],0)+1);
        }

        long sumAll = 0;
        for(Map.Entry<Integer,Integer> e : map.entrySet()){
            long value = (long)e.getValue();
            sumAll+= (value*(value-1))/2;
        }

        for (int i = 0; i < n; i++) {
            long sol = 0;
            long v = map.get(ar[i]);
            long t = (v*(v-1))/2;
            long p = ((v-1)*(v-2))/2;
            sol= sumAll - t + p;
            System.out.println(sol);
        }
//        for (int i = 0; i < n; i++) {
//            long sol = 0;
//            for(Map.Entry<Integer,Integer> e : map.entrySet()){
//                long x = e.getValue();
//                if(ar[i] == e.getKey()){
//                    sol+=((x-1) * (x-2))/2;
//                }else{
//                    sol+=(x*(x-1))/2;
//                }
//            }
//            System.out.println(sol);
//        }
    }
}

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

typedef long long ll;
#define MOD = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) { s >> x; } return s;}
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
#define ANS(a) cout<<a<<endl
void yes(bool f){cout<<(f?"yes":"no")<<endl;}
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
void YES(bool f){cout<<(f?"YES":"NO")<<endl;}


int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int A,B,C; cin >>A>>B>>C;

    bool f = false;
    for (int m = 1; m <= B; m++) {
        if (m * A % B ==C) {
            f = true;
            break;
        }
    }
    YES(f);
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  double N;
  cin >> N;
  // 入力終わり

  // Xのdoubleを計算
  double tmp = N*100/108;
  // doubleの値を切り上げ
  int X = tmp;
  if(tmp != X)
    X++;
  // Nに一致するかの確認
  double money = X*1.08;

  if((int)money == N)
    cout << X << endl;
  else
    cout << ":(" << endl;
      
  return 0;
}


Measured memory_bytes: 3724
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

int main(){
    int count = 0;
    int d1,d2;
    int i;
    int N;
    bool flag=false;
    cin >> N;
    for(i=0;i<N;i++){
        cin >> d1 >> d2;
        if( d1 == d2 ){
            count++;
            if( count >= 3){
                flag = true;
            }
        }else{
            count = 0;
        }
    }
    if( flag == true){
        cout << "Yes" <<endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3644
def main():
  A,B,K = list(map(int, input().split()))
  o = 0

  for i in range(min(A, B), 0, -1):
    if(A % i == 0 and B % i == 0):
      o += 1

      if(K == o):
        print(i)
        break
    

if __name__ == "__main__":
  main()

Measured memory_bytes: 2940
n = int(input())
d = {}
d['AC'] = 0
d['WA'] = 0
d['TLE'] = 0
d['RE'] = 0
for i in range(n):
    s = str(input())
    d[s] += 1

print('AC', 'x', d['AC'])
print('WA', 'x', d['WA'])
print('TLE', 'x', d['TLE'])
print('RE', 'x', d['RE'])


Measured memory_bytes: 9196
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); (i)--)
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
using namespace std;
typedef long long lint;

typedef struct UnionFindTree{
  vector<int> par;
  vector<int> treerank;
  
  UnionFindTree(int n){
    par.resize(n); treerank.resize(n);
    rep(i, n) par[i] = i, treerank[i] = 0;
  }
  
  int find(int x){
    if(par[x] == x) return x;
    return par[x] = find(par[x]);
  }
  
  void unite(int x, int y){
    x = find(x); y = find(y);
    if(x == y) return;
    if(treerank[x] < treerank[y]) swap(x, y);
    if(treerank[x] == treerank[y]) treerank[x]++;
    par[y] = x;
    return;
  }
  
  bool same(int x, int y){
    return find(x) == find(y);
  }
}UF;

template<class T> struct edge{
    int from, to; T cost;
    edge(int f, int t, T c){
        from = f; to = t; cost = c;
    }
};

template<class T> struct Graph{
    vector<vector<edge<T>>> G;
    int n;
    
    Graph(int n_){
        n = n_;
        G.resize(n);
    }
    
    void add_edge(int f, int t, T c){
        G[f].emplace_back(f, t, c);
    }
    
    vector<T> dijkstra(int s){
        using P = pair<T, int>;
        priority_queue<P, vector<P>, greater<P>> que;
        vector<T> d(n, numeric_limits<T>::max());
        d[s] = 0;
        que.push(P((T)0, s));
        while(!que.empty()){
            P p = que.top(); que.pop();
            int v = p.second;
            if(d[v] < p.first) continue;
            for(edge<T> &e : G[v]){
                if(d[e.to] > d[v] + e.cost){
                    d[e.to] = d[v] + e.cost;
                    que.push(P(d[e.to], e.to));
                }
            }
        }
        return d;
    }
    
    T kruskal(){
        vector<edge<T>> E;
        rep(i, n)for(edge<T> &e : G[i]) E.push_back(e);
        sort(E.begin(), E.end(), [](const edge<T> &e1, const edge<T> &e2){return e1.cost < e2.cost;});
        UF uf(n);
        T res = 0;
        for(edge<T> &e : E){
            if(!uf.same(e.from, e.to)){
                uf.unite(e.from, e.to);
                res += e.cost;
            }
        }
        return res;
    }
};

int n;
vector<int> c(100010, -1);

void dfs(int v, Graph<lint> &g, lint d){
    c[v] = d;
    for(edge<lint> &e : g.G[v])if(c[e.to] < 0){
        dfs(e.to, g, (d+e.cost)%2);
    }
    return;
}

int main(){
    cin >> n;
    Graph<lint> g(n);
    rep(i, n-1){
        int u, v; lint w; cin >> u >> v >> w;
        u--; v--;
        g.add_edge(u, v, w);
        g.add_edge(v, u, w);
    }
    dfs(0, g, 0);
    rep(i, n) cout << c[i] << endl;
}

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

int main(){
	int n;
	double p;
	cin>>n;
	vector<double>dp(n+1);
	dp[0]=1;
	for(int i=0;i<n;i++){
		cin>>p;
		//~ cout<<"Work";	
		for(int ipro=i+1;ipro>=0;--ipro){	
			 //~ if(ipro==0){dp[ipro]=0; continue;}
			 dp[ipro]=(ipro==0?0:dp[ipro-1]*p) + (dp[ipro]*(1-p))	;
			 }
		}
	 double ans=0;
	 //~ cout<<dp[0]<<"0"<<endl;
	 for(int i=0;i<=n;i++){
		  //~ cout<<dp[i];
		  int t=n-i;
		if(i>t){
			   ans+=dp[i];}
		  }
	 printf("%.10f",ans);
	
	return 0;
	}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
#define MOD 1000000007
//#define MOD 998244353
#define INF 2305843009213693951
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define all1(i) begin(i),end(i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false

//小数点以下切り上げ
long long roundup(long long a,long long b){
    /*
    Copyright (c) 2020 0214sh7
    https://github.com/0214sh7/library/
    */
    return (a+b-1)/b;
}

int main(void){
    
    ll N,X,T;
    cin >> N >> X >> T;
    cout << roundup(N,X)*T << endl;
    
    return 0;
}



Measured memory_bytes: 3592
#include<iostream>
using namespace std;
int main(){
	int n,s[1100];
	cin>>n;
	int tmp;
  	for(int i=0;i<=n;i++) s[i]=0;
	for(int i=2;i<=n;++i){
		tmp=i;
		for(int j=2;j<=n;++j){
			if(tmp==0) break;
			while(tmp%j==0){
				tmp/=j;
				++s[j];
			}
		}
	}
	long long cnt=1;
	for(int i=2;i<=n;++i) cnt=cnt*(s[i]+1)%1000000007;
	cout<<cnt<<endl;
	return 0;
}

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

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

    int cnt = 0;
    for (int i = 1; i <= N; i++) {
        string S = to_string(i);
        if ((int)S.size() % 2 != 0) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3700
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int cnt = 0;
	string s1 = "";
	string s2 = "";
	cin >> s1;
	cin >> s2;
	for (int i = 0; i < 3; i++) {
		if (s1[i] == s2[i])
			cnt++;
	}
	cout << cnt << endl;

	return 0;
}



Measured memory_bytes: 256