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

using namespace std;

int N, M;
vector< int > g[100000];
int in[100000];


int main()
{
  int N, M;
  cin >> N >> M;
  while(M--) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    g[x].push_back(y);
    in[y]++;
  }

  queue< int > que;

  for(int i = 0; i < N; i++) {
    if(in[i] == 0) que.emplace(i);
  }
  bool multiple = false;
  vector< int > order;
  while(que.size()) {
    multiple |= que.size() >= 2;
    int p = que.front();
    que.pop();
    order.emplace_back(p);
    for(auto &to : g[p]) {
      --in[to];
      if(in[to] == 0) que.emplace(to);
    }
  }

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





Measured memory_bytes: 6036
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
//using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
using pii=pair<ll,ll>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void get(){}template<class H,class...T>void get(H&h,T&...t){cin>>h;get(t...);}
#define dcl(...) int __VA_ARGS__;get(__VA_ARGS__);


int main(){
    dcl(x,y);
    if(x%y==0)cout<<-1<<endl;
    else cout<<x<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

#define MAX_N 1000010
ll inv[MAX_N+10],fac[MAX_N+10],ifac[MAX_N+10];

void setComb(){
  inv[0]=1;inv[1]=1;fac[1]=1;ifac[1]=1;fac[0]=1;ifac[0]=1;
  for(int i=2;i<MAX_N;i++){
    inv[i]=(-MOD/i)*inv[MOD%i]%MOD;
    fac[i]=fac[i-1]*i%MOD;
    ifac[i]=ifac[i-1]*inv[i]%MOD;

    inv[i]=(inv[i]+MOD)%MOD;
    fac[i]=(fac[i]+MOD)%MOD;
    ifac[i]=(ifac[i]+MOD)%MOD;
  }
  return;
}

ll comb(ll n,ll k){
  if(n<k||n<0||k<0) return 0;
  else return ((fac[n]*ifac[k]%MOD*ifac[n-k]%MOD+MOD)%MOD);
}

ll hcomb(ll n,ll r){// this size is really ok??
  if(n==0&&r==0) return 1;
  else if(n<0||r<0) return 0;
  else return comb(n+r-1,r);
}

ll mod_pow(ll x,ll n){
  x%=MOD;
  ll res=1;
  while(n>0){
    if(n&1) res=res*x%MOD;
    x=x*x%MOD;
    n>>=1;
  }
  return res;
}

void add(ll &a,ll b){
  a=(a+b)%MOD;
}

void mul(ll &a,ll b){
  a%=MOD;b%=MOD;
  a=a*b%MOD;
}

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

  ll N,K;
  cin>>N>>K;

  setComb();

  ll ans=0;
  for(ll i=0;i<=min(N-1,K);i++){
    ll res=comb(N,i);
    mul(res,hcomb(N-i,N-(N-i)));
    add(ans,res);
  }

  cout<<ans<<endl;



  return 0;
}


Measured memory_bytes: 23680
//
//AtCoder Beginner Contest 139
//A - Tenki
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    string s, t;
    cin >> s >> t;
    
    int ans=0;
    REP(i, s.size()) if (s[i]==t[i]) ans++;
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
#sys.setrecursionlimit(150000)


def solve(K: int):
    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[K-1])
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    solve(K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
n = int(input())
cou1 = 0
cou2 = 0
cou4 = 0
lis = list(map(int,input().split()))
for i in range(n):
    if lis[i] % 2 == 0:
        if lis[i] % 4 == 0:
            cou4 += 1
        else:
            cou2 += 1
    else:
        cou1 += 1
if cou2 == 0:
    if cou1 <= cou4 + 1:
        print("Yes")
    else:
        print("No")
else:
    if cou1 <= cou4:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 14484
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
vector<int> v[200001];
int c=0;
int d[200001];
string s;
bool used[200001];
void dfs(int now,int par){
    if(c)return;
    int num=(d[now]+1)%4;
    used[now]=true;
    //cout<<now<<" "<<d[now]<<" "<<num<<endl;
    rep(i,0,v[now].size()){
        int ne=v[now][i];
       // cout<<ne<<" "<<s[ne-1]<<" "<<num<<" "<<d[ne]<<endl;
        if(num<=1){
            if(s[ne-1]=='A'){
                if(d[ne]==num||d[ne]==5){
                    c=1;
                    //cout<<ne<<" "<<now<<" "<<par<<endl;
                    //rep(j,1,91)cout<<d[j]<<" ";
                    //cout<<endl;
                    return;
                }
                else{
                    if(par==ne)continue;
                    if(ne==now){
                        d[ne]=num+4;
                    }
                    else d[ne]=num;
                    dfs(ne,now);
                    d[ne]=-1;
                }
            }
        }
        else{
            if(s[ne-1]=='B'){
                if(d[ne]==num||d[ne]==7){
                    c=1;
                    //cout<<ne<<" "<<now<<" "<<par<<endl;
                    return;
                }
                else{
                    if(par==ne)continue;
                    if(ne==now){
                        d[ne]=num+4;
                    }
                    else d[ne]=num;
                    dfs(ne,now);
                    d[ne]=-1;
                }
            }
        }
    }
}
int main(){
    int n,m;cin>>n>>m;
    cin>>s;
    set<int> st[n+1];
    rep(i,0,m){
        int a,b;cin>>a>>b;
        st[a].insert(b);
        st[b].insert(a);
    }
    rep(i,1,n+1){
        for(auto itr=st[i].begin();itr!=st[i].end();itr++){
            v[i].push_back(*itr);
            //cout<<v[i].back()<<" ";
        }
        //cout<<endl;
    }
    fill(d,d+n+1,-1);
    fill(used,used+n+1,false);
    rep(i,1,n+1){
        if(used[i])continue;
        d[i]=0;
        dfs(i,-1);
        d[i]=-1;
    }
    if(c)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    rep(i,1,n+1){
        //cout<<i+1<<" "<<s[i]<<" ";
        //cout<<i<<endl;
        //rep(j,0,v[i].size())cout<<v[i][j]<<" ";
        //cout<<endl;
    }
}


Measured memory_bytes: 45828
N = gets.to_i
S = gets.chomp.chars.take(N)
stack = []
S.each do |s|
  top = stack.last
  if s == '('
    stack.push(s)
  else # ')'
    if top == '('
      stack.pop
    else
      stack.push(s)
    end
  end
end
left_count = stack.count(')')
right_count = stack.count('(')
ans = ('(' * left_count) + S.join('') + (')' * right_count)
puts ans


Measured memory_bytes: 1788
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws NumberFormatException, IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    System.out.println("ABC" + Integer.parseInt(br.readLine()));
  }

}


Measured memory_bytes: 21204
def main():
    n = int(input())
    s = input()
    l, r = 0, s[1:].count("E")  # people needed to change the direction
    cnt = l + r
    for i in range(1, n):
        if s[i - 1] == "W":
            l += 1
        if s[i] == "E":
            r -= 1
        cnt = min(cnt, l + r)
    print(cnt)


if __name__ == "__main__":
    main()


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

int main() {
    long long int x;
    cin >> x;
    long long int a = 100, y = 0;
    while(a < x) {
        a = a + a/100;
        y++;
    }
    cout << y << '\n';

    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<stack>
using namespace std;
int main()
{
	int w,h;
	while(cin>>h>>w,h) 
	{
		int f[h][w+1];
		for(int i = 0; i < h; ++i)
		{
			for(int j = 0; j < w+1; ++j)
			{
				if(j==w)
				{
					f[i][j]=0;
					continue;
				}
				char t; cin>>t;
				if(i==0)
				{
					if(t=='*') f[i][j]=0;
					else f[i][j]=1;
				}
				else 
				{
					if(t=='*') f[i][j]=0;
					else f[i][j]=f[i-1][j]+1;
				}
				//cout<<" "<<f[i][j];
			}
			//cout<<endl;
		}

		int ans=0;
		for(int i = 0; i < h; ++i)
		{
			stack<int> pos,height;
			for(int j = 0; j < w+1; ++j)
			{
				if(pos.empty())
				{
					pos.push(j); height.push(f[i][j]);
				}
				else if(height.top()<f[i][j])
				{
					pos.push(j); height.push(f[i][j]);
				}
				else if(height.top()>f[i][j])
				{
					int he,p;
					while(!height.empty()&&height.top()>f[i][j])
					{
						p=pos.top(); pos.pop();
						he=height.top(); height.pop();
						ans=max(ans,he*(j-p));
					}
					height.push(f[i][j]); pos.push(p);
				}
			}
		}
		cout<<ans<<endl;
	}
  return 0;
}

Measured memory_bytes: 2172
N,K = map(int,input().split())
P = [0]+list(map(int,input().split()))
C = [0]+list(map(int,input().split()))
ans = -float("INF")
for i in range(1,N+1):
    scores = [None]*(N+1)
    steps = [None]*(N+1)
    score = 0
    step = 0
    cur = i
    while step <= K:
        if step != 0:
            ans = max(ans,score)
        if step <= N:
            scores[cur] = score
            steps[cur] = step
        else:
            if scores[cur] >= score:
                #一周してもスコアが同じか小さくなるので、それ以上は回る意味がない。したがって、この時点でBreak
                break
            else:
                #一周分ループを残す形でワープする
                loopStep = step-steps[cur]
                loopScore = score-scores[cur]
                restLoop = (K-step)//loopStep
                if restLoop > 0:
                    restLoop -= 1
                step += restLoop*loopStep
                score += restLoop*loopScore
                scores[cur] = score
                steps[cur] = step
        step += 1
        cur = P[cur]
        score += C[cur]
print(ans)

        

Measured memory_bytes: 129228
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;

int main(void) {
    UInt a, b, x;
    cin >> a >> b >> x;
    UInt answer;
    if (a == 0) {
        answer = b / x + 1;
    } else {
        answer = b / x - (a - 1) / x;
    }
    cout << answer << endl;
    return 0;
}



Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;







//DFS
vector<vector<pair<int, int>>> g;
const int N = 200;
int used[N];
int col[N];
int no=0;

void dfs(int i, int c) {
  if (i==k){
    col[i]=max(col[i],c);
    if (c%2==1){
      //cout<<"-1"<<endl;
      //return;
      no=1;
    }
  }
  if(used[i]) return;
  used[i] = 1;
  col[i] = c;
  for(auto to : g[i]) {
    dfs(to.first, c + 1);
  }
  return;
}



void bfs(int i,int c){
  REP(i,N){
    used[i]=-1;
  }
  used[i] = c;
  queue<int> que;
  que.push(i);
  int id;
  //col[i] = c;
  while (!que.empty()) {
      //cout << que.front() << " "; // 先頭要素を参照する
      id=que.front();
      int lootlen=used[id];
      for(auto to : g[id]) {
          if (used[to.first]==-1){
            que.push(to.first);
            used[to.first]=lootlen+1;
          }
      }
      que.pop(); // 先頭要素を削除
  }
  return;
}




int main() {
  cin>>n;
  g.resize(n);

  string s;
  for(int i = 0; i < n; i++) {
    int a;
    cin >> s;
    REP(j,n){
      a=s[j]-48;
      if (a==1){
        g[i].emplace_back(j, 0);
      }
    }
  }



  int ans=0;
  REP(i,n){
    k=i;
    dfs(i, 0);
    REP(j,n){
      used[j]=0;
      col[j]=0;
    }
    //ans=max(col[i],ans);
  }

  if (no==1){
    cout<<-1<<endl;
    return 0;
  }




  REP(j,n){
        used[j]=-1;
  }

  REP(i,n){
    bfs(i,0);
    REP(j,n){
      ans=max(used[j],ans);
      used[j]=-1;
    }
  }

    




  cout<<(ans+1)<<endl;
  return 0;
}











Measured memory_bytes: 640
cmds = {
    'North': [0, 1, 5, 4],
    'South': [0, 4, 5, 1],
    'East': [0, 3, 5, 2],
    'West': [0, 2, 5, 3],
    'Right': [1, 2, 4, 3],
    'Left': [1, 3, 4, 2]
}

while 1:
    n = int(raw_input())
    if n == 0: break
    nums = range(1, 7)
    ans = 1
    for i in range(n):
        idxs = cmds[raw_input()]
        nums[idxs[0]], nums[idxs[1]], nums[idxs[2]], nums[idxs[3]] = (
                nums[idxs[1]], nums[idxs[2]], nums[idxs[3]], nums[idxs[0]])
        ans += nums[0]
    print ans

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

namespace AtCoderContest
{
    class Program
    {
        static void Main()
        {
            Console.ReadLine();
            var an = Console.ReadLine().Split(" ").Select(long.Parse);

            var anWithStools = an.Aggregate(new List<long>(), (prevlist, current) =>
            {
                var last = prevlist.LastOrDefault();
                if (last > current)
                {
                    prevlist.Add(last);
                }
                else
                {
                    prevlist.Add(current);
                }
                return prevlist;
            });

            var answer = an.Zip(anWithStools, (a, aWithStool) => aWithStool - a).Sum();
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 50048
def main():
    from math import sqrt
    N = int(input())
    ans = 10**12
    for i in range(1, int(sqrt(N))+3):
        if N % i:
            continue
        j = N//i
        ans = min(ans, i+j-2)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
#define all(a) (a).begin(), (a).end()

int N;

int main () {
  cin >> N;
  map<int, int> c;
  rep(i,N){
    int a;
    cin >> a;
    c[a]++;
  }

  ll ans = 0;
  for(auto p: c) {
    ans += p.second >= p.first ? (p.second - p.first) : p.second;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4736
n,k=map(int,input().split())
a=list(map(int,input().split()))
import math
x=0
y=10**9
z=5*(10**8)
s=0
for i in range(100):
    t=0
    for j in range(n):
        t+=a[j]//z
    if t<=k:
        s=t
        y=z
        z=(x+y)/2
    else:
        x=z
        z=(x+y)/2
print(math.ceil(z))


Measured memory_bytes: 104604
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <limits.h>
#include <assert.h>
#define FOR(i,a,n) for(i=(a);i<(n);i++)
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define MOD 1000000007
#define SIZE 100005
#define LOCAL
#ifdef LOCAL
    #define DEBUG(...) printf(" "__VA_ARGS__)
#else
    #define DEBUG(...)
#endif /* LOCAL */
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}

int main(void)
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	printf("%s\n",(b-a)%2?"Borys":"Alice");
	return 0;
}
    
    


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
// #define endl "\n"

int main(void) {
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // cout.tie(NULL);
    ll a, b, k;
    cin >> a >> b >> k;

    if (k <= a) {
        cout << a-k << " " << b << endl;
        return 0;

    }
    k = k - a;
    cout << "0 " << max((ll)0, b-k) << endl;

    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}


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

  if (n == 3) { cout << "2 5 63" << endl; return 0; }
  if (n == 4) { cout << "2 3 4 9" << endl; return 0; }
  if (n == 5) { cout << "2 3 4 6 9" << endl; return 0; }

  int k = min(n/6, 2500);
  rep(i, k) {
    cout << (12*i + 2) << " ";
    cout << (12*i + 3) << " ";
    cout << (12*i + 4) << " ";
    cout << (12*i + 8) << " ";
    cout << (12*i + 9) << " ";
    cout << (12*i + 10) << " ";
  }
  rep(i, n-6*k) {
    cout << (6*i + 6) << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 384
#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, *A = map(int, read().split())

cnt = 0
acc = 0
for a in A:
    if a != 0:
        acc += a
    else:
        cnt += acc // 2
        acc = 0
cnt += acc // 2

print(cnt)


Measured memory_bytes: 36524
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

int main() {
	int a[12];
	for (int i = 0; i < 12; ++i)
		cin >> a[i];
	sort(a, a + 12);
	for (int i = 0; i < 3; ++i) {
		for (int j = 0; j < 4; ++j) {
			if (a[i * 4] != a[i * 4 + j]) {
				no();
				return 0;
			}
		}
	}
	yes();

	return 0;
}

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

using namespace std;
#define ll long long
#define ld long double
const int N=2e5+5;
 
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    int n, m;
    cin >> n >> m;
    int sum = 0;
    for(int i=0,x;i<m;i++) {
        cin >> x;
        sum += x;
    }
    cout << ((sum > n) ? -1 : (n - sum)) << endl;
    return 0;
}


Measured memory_bytes: 3660
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;
typedef struct pair<int,int> P;
int A,B,C,D,E;
int main() {
	cin>>A>>B>>C>>D>>E;

	int R=0;
	if(A>0)R=(B-A)*E;
	if(A<0)R=(0-A)*C+D+B*E;

	cout<<R<<endl;
	return 0;
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<string> s(n);
    map<string,long long> mp;
    map<string,long long> inc;
    for(int i=0;i<n;i++){
        cin>>s[i];
        sort(s[i].begin(),s[i].end());
        if(mp.find(s[i])!=mp.end()){
            mp[s[i]]+=++inc[s[i]];
        }else{
            inc[s[i]]=0;
            mp[s[i]]=0;
        }
    }
    long long ans=0;
    for(auto itr=mp.begin();itr!=mp.end();itr++){
        ans+=itr->second;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 29184
### constant

INF = 1 << 30

### subroutines

def sed(str, a, b)
  pos = 0
  str0 = ''
  while pos < str.length
    if str[pos, a.length] == a
      str0 += b
      pos += a.length
    else
      str0 += str[pos]
      pos += 1
    end
  end
  str0
end

### main

loop do
  n = gets.to_i
  break if n == 0

  substs = n.times.map{gets.strip.split}
  st = gets.strip
  gl = gets.strip
  #p substs
  #p [st, gl]

  dists = Hash.new{INF}
  dists[st] = 0

  q = [st]
  glen = gl.length
  
  while ! q.empty?
    u = q.shift
    break if u == gl

    nvd = dists[u] + 1
    
    substs.each do |a, b|
      v = sed(u, a, b)
      if v.length <= glen && dists[v] >= INF
        dists[v] = nvd
        q << v
      end
    end
  end

  puts (dists[gl] >= INF ? -1 : dists[gl])
end

Measured memory_bytes: 6140
#include<stdio.h>

int main(void) {
	char str[1001];
	char strc[1001];
	char p[1001];
	char o[10];
	char out[100000];
	int sl = 0;
	int l = 0;
	int a, b, q;
	int i, j;
	
	out[0] = 'a';
	
	scanf("%s", &str);
	scanf("%d", &q);
	
	for(j = 0; str[j] != '\0'; j++) {
		sl++;
	}
	
	for(i = 0; i < q; i++) {
		scanf("%s", &o);
		
		if(o[2] == 'i') {
			//print
			scanf("%d %d", &a, &b);
			for(j = 0; j < b-a+1; j++) {
				out[l+j] = str[j+a];
			}
			l+=b-a+1;
			out[l] = '\n';
			l++;
		} else if(o[2] == 'v') {
			//reverse
			scanf("%d %d", &a, &b);
			for(j = 0; j < sl; j++) {
				strc[j] = str[j];
			}
			for(j = 0; j < b-a+1; j++) {
				str[j+a] = strc[b-j];
			}
			
		} else if(o[2] == 'p') {
			//replace
			scanf("%d %d %s", &a, &b, p);
			for(j = 0; j < b-a+1; j++) {
				str[j+a] = p[j];
			}
		}
	}
	out[l] = '\0';
	
	printf("%s", out);
	
	return 0;
}
	

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


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


Measured memory_bytes: 256
N = int(input())
res = []
for i in range(1, N+1):
    S = list(map(str, input().split()))
    S[1] = int(S[1])
    S.append(i)
    res.append(S)
city = sorted(res, key = lambda x : (x[0], -x[1]))
for i in range(N):
    print(city[i][2])

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

int dp[50][100][100];
bool Lflag[50], Rflag[50];
int arr[100];

const int MOD = 1e9+7;
void add(int& target, int delta){
    target = (target + delta)%MOD;
}

int main(){
    int N; scanf("%d",&N);
    for(int i=0;i<2*N-1;i++) scanf("%d",arr+i);
    sort(arr,arr+2*N-1);

    for(int i=1;i<N;i++) if(arr[N-1-(i-1)] != arr[N-1-i])
        Lflag[i] = true;
    for(int i=1;i<N;i++) if(arr[N-1+(i-1)] != arr[N-1+i])
        Rflag[i] = true;

    dp[0][0][0] = 1;
    for(int i=0;i<N-1;i++) for(int L=0;L<=2*i+1;L++) for(int R=0;R<=2*i+1;R++){
        int nL = L + (Lflag[i+1]?1:0), nR = R + (Rflag[i+1]?1:0);
        int cur = dp[i][L][R];
        add(dp[i+1][nL][nR], cur);
        for(int j=1;j<=nL;j++)
            add(dp[i+1][nL-j][nR+1], cur);
        for(int j=1;j<=nR;j++)
            add(dp[i+1][nL+1][nR-j], cur);
    }

    int ans = 0;
    for(int i=0;i<2*N-1;i++)for(int j=0;j<2*N-1;j++)
        add(ans, dp[N-1][i][j]);
    printf("%d\n", ans);
}


Measured memory_bytes: 1280
{-# LANGUAGE BangPatterns #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Char
import Data.Int
import Data.Foldable
import Data.List
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Debug.Trace

solve :: B.ByteString -> Bool
solve !b = b0 == b1 || b1 == b2 || b2 == b3
 where
  b0 = B.index b 0
  b1 = B.index b 1
  b2 = B.index b 2
  b3 = B.index b 3

main = do
  let readInt :: Integral a => B.ByteString -> Maybe (a, B.ByteString)
      readInt = fmap (first fromIntegral . second B.tail) . B.readInt

  s <- B.getLine
  putStrLn $ if solve s then "Bad" else "Good"


Measured memory_bytes: 380
#include <stdio.h>
#include <math.h>
long long min(long long a,long long b){return (a<b)?a:b;}
//long long max(long long a,long long b){return (a>b)?a:b;}
long long gcd(long long a,long long b){
    if(b==0)return a;
    else return gcd(b,a%b);
}

long long pfactor(long long a){
    long long i=2,count=1;
    while(i<=sqrt(a)){
        if(a%i==0){
            count++;
            while(a%i==0)a/=i;
        }
        i++;
    }
    return (a>1)?count+1:count;
}

int main(void){
    long long a,b;
    scanf("%lld%lld",&a,&b);
    printf("%lld\n",pfactor(gcd(a,b)));
    return 0;
}
    


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
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;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    vector<string> s(3);
    for (int i = 0; i < 3; ++i) {
        cin >> s[i];
    }
    cout << "A" << s[1][0] << "C" << "\n";
    return 0;
}

Measured memory_bytes: 256
s=input()
left=0
right=len(s)-1
cnt=0
while right-left>0:
  if (s[right]==s[left]):
    right-=1
    left+=1
  elif (s[right]!='x')and(s[left]!='x'):
    print(-1)
    exit()
  elif (s[right]!='x')and(s[left]=='x'):
    left+=1
    cnt+=1
  else:
    right-=1
    cnt+=1
print(cnt)

Measured memory_bytes: 3316
#include "bits/stdc++.h"
using namespace std;
const int N = 1e5 + 5;
int n;
int a[N] , b[N];
int c[N] , d[N];
map < int , int > edges[N];
queue < pair < int , int > > q;
int comp[N];
int find(int node){
	if(comp[node] == node){
		return node;
	}
	return comp[node] = find(comp[node]);
}
void insert(int a , int b){
	a = find(a);
	b = find(b);
	if(a != b){
		++edges[a][b];
		++edges[b][a];
		if(edges[a][b] >= 2){
			q.push({a , b});
		}
	}
}
void merge(){
	int a = - 1 , b = -1;
	while(!q.empty()){
		a = find(q.front().first);
		b = find(q.front().second);
		q.pop();
		if(a != b){
			break;
		}
	}
	if(a == b){
		printf("NO\n");
		exit(0);
	}
	if(edges[a].size() > edges[b].size()){
		swap(a , b);
	}
	for(auto it : edges[a]){
		edges[it.first].erase(edges[it.first].find(a));
	}
	comp[a] = b;
	for(auto it : edges[a]){
		if(it.first == b){
			continue;
		}
		if(it.first == a){
			continue;
		}
		while(it.second--){
			insert(b , find(it.first));
		}
	}
	edges[a].clear();
}
int main(){
	scanf("%d" , &n);
	for(int i = 1 ; i < n ; ++i){
		scanf("%d %d" , a + i , b + i);
	}
	for(int i = 1 ; i < n ; ++i){
		scanf("%d %d" , c + i , d + i);
	}
	for(int i = 1 ; i <= n ; ++i){
		comp[i] = i;
	}
	for(int i = 1 ; i < n ; ++i){
		insert(a[i] , b[i]);
		insert(c[i] , d[i]);
	}
	for(int i = 1 ; i < n ; ++i){
		merge();
	}
	printf("YES\n");
}

Measured memory_bytes: 25600
import java.util.*;
public class Main{

 
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long ans = 1;
    for(int i = 1; i <= n; i++){
      ans = (ans * i) % 1000000007;
    }
 
    System.out.println(ans);
  }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
typedef vector<long long> V;
typedef vector<V> VV;
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;}
const long long INFLL = 1LL<<60;
const int INF = 1<<28;
void solve(int a){cout<<( a?"Yes":"No")<<endl;}
int main(){
    VV a(3,V(3,0));
    rep(i,3){
        rep(j,3){
            cin>>a[i][j];
        }
    }
    int n;
    int ans=0;
    cin >>n;
    V b(n,0);
    rep(i,n){
        cin>>b[i];
        rep(A,3){
            rep(B,3){
                if(a[A][B]==b[i]){
                    a[A][B]=-1;
                }
            }
        }
    }
    rep(i,3){
        if(a[i][0]==a[i][1] and a[i][1]==a[i][2]){
            ans++;
        }
    }
    rep(i, 3)
    {
        if (a[0][i] == a[1][i] and a[2][i] == a[1][i])
        {
            ans++;
        }
    }
   if(a[0][0]==a[1][1] and a[1][1]== a[2][2]){
       ans++;
   }
   if (a[0][2] == a[1][1] and a[1][1] == a[2][0])
   {
       ans++;
   }
   solve(ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	double cnt=0;
	for(int i=1;i<=n;i++){
		if(i%2==1) cnt++;
	}
	double x=cnt/n;
	cout<<fixed<<setprecision(10)<<x<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

struct SegmentTree
{
	vector<int> data;
	vector<int> size;

	SegmentTree(int n)
	{
		size = vector<int>(n, 1);
		for (int i = 0; i < n; i++)
		{
			data.push_back(i);
		}
	}

	int Root(int n)
	{
		if (data[n] == n)
			return n;

		return Root(data[n]);
	}

	void Union(int n, int m)
	{
		n = Root(n);
		m = Root(m);

		if (Check(n, m))
			return;

		if (size[n] < size[m])
			swap(n, m);

		size[n] += size[m];
		data[m] = n;
	}

	bool Check(int n, int m)
	{
		return Root(n) == Root(m);
	}

	int Size(int n)
	{
		return size[Root(n)];
	}
};

void execute()
{
	int N;
	int tmp_a = 0, tmp_b = 0;
	int count_a = 0, count_b = 0;
	int ans = 0;
	cin >> N;
	vector<pair<int, int>> A;
	vector<pair<int, int>> B;
	vector<pair<int, pair<int, int>>> C;
	vector<vector<int>> root(N * 2 - 2, vector<int>(4, 0));
	SegmentTree tree(N);

	for (int i = 0; i < N; i++)
	{
		cin >> tmp_a >> tmp_b;
		A.push_back(make_pair(tmp_a, i));
		B.push_back(make_pair(tmp_b, i));
	}

	sort(all(A));
	sort(all(B));

	for (int i = 0; i < N - 1; i++)
	{
		C.push_back(make_pair(A[i + 1].first - A[i].first, make_pair(A[i].second, A[i + 1].second)));
		C.push_back(make_pair(B[i + 1].first - B[i].first, make_pair(B[i].second, B[i + 1].second)));
	}

	sort(all(C));

	for (int i = 0; i < N * 2 - 2; i++)
	{
		if (N == tree.Size(0))
		{
			break;
		}

		if (!tree.Check(C[i].second.first, C[i].second.second))
		{
			tree.Union(C[i].second.first, C[i].second.second);
			ans += C[i].first;
		}
	}
	cout << ans << endl;
	return;
}

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

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 18932
# include<cstdio>
# include<cmath>

int main() {
    while(1) {
        int n, s[1000];
        double m=0, a=0;
        scanf("%d", &n);
        if (n==0) break;
        for (int i=0;i<n;i++) {
            scanf("%d", &s[i]);
            m += s[i];
        }
        m = m/(double)n;
        for (int j=0;j<n;j++) {
            a += pow(s[j]-m, 2);
        }
        a = sqrt(a/(double)n);
        printf("%lf\n", a);
    }
    return 0;
}


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

typedef long long int ll;
typedef long double ld;

//****************************************************                
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define all(X) X.begin(),X.end()
#define endl "\n" //comment it for interactive questions
#define trace1(a) cerr << #a << ": " << a << endl;
#define trace2(a,b) cerr << #a << ": " << a << " " << #b << ": " << b << endl;
#define trace3(a,b,c) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << endl;
#define trace4(a,b,c,d) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << #d << ": " << d << endl;
#define OC freopen("input.txt" , "r", stdin); freopen("output.txt" , "w", stdout) 
#define MOD (ll)1e9+7; //change it for other mods
#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        //*******************************************************
//Some Functions

ll powmod(ll a,ll b)
{
   ll res = 1;
   while(b > 0) {
      if(b & 1) res = (res * a) % MOD;
      a = (a*a)%MOD;
      b = b >> 1; 
  }
  return res % MOD;
}

void solve()
{
    ll x,y;
    cin >> x >> y;
    if(x + y == 3) {
    	cout << "3\n";
    } else if(x+y == 4) {
    	cout << "2\n";
    } else {
    	cout << "1\n";
    }
}

int main()
{
    FAST_IO;
    #ifndef ONLINE_JUDGE 
      // OC;
    #endif
    ll t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 2020
inline int read(){
    int x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-')f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x<<3)+(x<<1)+c-'0';
        c=getchar();
    }
    return x*f;
}
int n,m,Q,a[N][N],s[N][N],b[N][N];
char mp[N][N];
int main(){
	n=read(),m=read(),Q=read();
	for(int i=1;i<=n;i++){
		scanf("%s",mp[i]+1);
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			s[i][j]=mp[i][j]-'0'+s[i-1][j]+s[i][j-1]-s[i-1][j-1];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=2;j<=m;j++){
			if(mp[i][j]=='1'&&mp[i][j-1]=='1'){
				a[i][j]++;
			}
		}
	}
	for(int i=2;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(mp[i][j]=='1'&&mp[i-1][j]=='1'){
				b[i][j]++;
			}
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			a[i][j]+=a[i-1][j]+a[i][j-1]-a[i-1][j-1];
			b[i][j]+=b[i-1][j]+b[i][j-1]-b[i-1][j-1];
		}
	}
	while(Q--){
		int X1=read(),Y1=read(),X2=read(),Y2=read();
		int ans=s[X2][Y2]-s[X2][Y1-1]-s[X1-1][Y2]+s[X1-1][Y1-1];
		ans-=a[X2][Y2]-a[X2][Y1]-a[X1-1][Y2]+a[X1-1][Y1];
		ans-=b[X2][Y2]-b[X2][Y1-1]-b[X1][Y2]+b[X1][Y1-1];
		printf("%d\n",ans);
	}
	return 0;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define MAX_N 300
#define INF 1125899906842624
struct Edge {
    i64 to, cost;
    Edge(i64 to, i64 cost) : to(to), cost(cost) {}
};
using P = pair<i64, i64>;
vector<Edge> G[MAX_N];

int main() {
    i64 N, M, L; cin >> N >> M >> L;
    REP(i, M) {
        i64 u, v, c; cin >> u >> v >> c;
        u--, v--;
        G[u].emplace_back(v, c);
        G[v].emplace_back(u, c);
    }
    i64 Q; cin >> Q;
    vector<P> q(Q);
    REP(i, Q) cin >> q[i].first >> q[i].second;

    using T = pair<P, i64>;
    vector<vector<P>> dp(N, vector<P>(N, {INF, INF}));
    REP(s, N) {
        priority_queue<T, vector<T>, greater<T>> pq;
        dp[s][s] = {0, 0};
        pq.push(T(P(0, 0), s));
        while (!pq.empty()) {
            T t = pq.top(); pq.pop();
            const i64 cnt = t.first.first;
            const i64 cons = t.first.second;
            const i64 u = t.second;
            if (dp[s][u] < t.first) continue;
            for (const Edge &e : G[u]) {
                if (e.cost > L) continue;
                i64 ncnt = cnt;
                i64 ncons = cons + e.cost;
                if (ncons > L) {
                    ncnt++;
                    ncons = e.cost;
                }
                P np = P(ncnt, ncons);
                if (chmin(dp[s][e.to], np)) {
                    pq.push(T(np, e.to));
                }
            }
        }
    }

    REP(i, Q) {
        P p = q[i];
        i64 res = dp[p.first - 1][p.second - 1].first;
        if (res >= INF) {
            cout << -1 << endl;
        } else {
            cout << res << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 7052
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::collections::HashMap;

const MOD: u64 = 1000000000 + 7;

const PRIMES: &'static [u64] = &[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997];


fn prime_decomp(mut n: u64, m: &mut HashMap<u64, u64>) {
    for i in PRIMES {
        if *i > n {
            break;
        }
        while n % i == 0 {
            n /= *i;
            *m.entry(*i).or_insert(0) += 1;
        }
    }
}


fn solve(n: u64) -> u64 {
    let mut m = HashMap::new();
    for i in 2..n+1 {
        prime_decomp(i, &mut m);
    }

    let mut res = 1;
    for i in m.values() {
        res = ((res % MOD) * ((i + 1) % MOD)) % MOD;
    }

    res
}

fn main() {
    input!{
        n: u64,
        };
    println!("{}", solve(n));
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define mod 1000000007

const long double PI = acos(-1);
 
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

int main(){
    char op1[8] = {'+', '+', '+', '+', '-', '-', '-', '-'};
    char op2[8] = {'+', '+', '-', '-', '+', '+', '-', '-'};
    char op3[8] = {'+', '-', '+', '-', '+', '-', '+', '-'};
    string s;
    cin >> s;
    int a, b, c, d;
    a = (int)s[0] - 48;
    b = (int)s[1] - 48;
    c = (int)s[2] - 48;
    d = (int)s[3] - 48;

    for(int i = 0; i < 8; i++){
        int culc = a;
        if(op1[i] == '+') culc += b;
        else culc -= b;
        if(op2[i] == '+') culc += c;
        else culc -= c;

        if(op3[i] == '+') culc += d;
        else culc -= d;

        
        if(culc == 7){
            cout << a << op1[i] << b << op2[i] << c << op3[i] << d << "=7" << endl;
            return 0;
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
n=int(input())
s=input()
S=[]
for i in range(n):
  S.append(int(s[i]))
ans=0
A=[0,1,2,3,4,5,6,7,8,9]
for i in range(n-2):
  if len(A)==0:
    break
  if S[i] not in A:
    continue
  B=[0,1,2,3,4,5,6,7,8,9]
  for j in range(i+1,n-1):
    if len(B)==0:
      break
    if S[j] not in B:
      continue
    C=[0,1,2,3,4,5,6,7,8,9]
    for k in range(j+1,n):
      if len(C)==0:
        break
      if S[k] not in C:
        continue
      ans=ans+1
      C.remove(S[k])
    B.remove(S[j])
  A.remove(S[i])
print(ans)

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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  for(int i = 0; i < n; i++) cin >> s.at(i);
  sort(s.begin(), s.end());
  int c = 0;
  string get;
  for(int i = 0; i < n; i++) {
    if(s.at(i) != get) {
      c++;
      get = s.at(i);
    }
  }
  cout << c << endl;
}

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

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

Measured memory_bytes: 3600
/*
    STARK_BOY
*/
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repe(i,a,b) for(ll i=a;i<=b;i++)
#define bac(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef long long ll;
typedef vector< ll > vi;
typedef vector<pair<ll,ll> > vpii;
typedef pair<ll,ll> pii;
#define all(c) c.begin(),c.end()
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define setbitc(x) __builtin_popcount(x)
#define init(x,a) memset(x,a,sizeof(x))
#define PI           3.14159265358979323846  /* pi */
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
#define N 200005
#define deb(i) cout<<" yo "<<i<<endl; 
//Variables Start
ll inf=1e18,MOD=1e9+7;
ll n,m,k,ar[N],hr[N],dp[N],seg[4*N];
string s,s1;
//Variables End


void build(ll node, ll tl, ll tr) {
    if (tl == tr) 
    {
        seg[node] = ar[tl];
    } 
    else 
    {
        ll tm = (tl + tr) / 2;
        build(node*2, tl, tm);
        build(node*2+1, tm+1, tr);
        seg[node] = max(seg[node*2] , seg[node*2+1] );
    }
}

ll query(ll node, ll tl, ll tr, ll l, ll r) {
	//cout<<node<<" "<<tl<<" "<<tr<<endl;
    if (l > tr || r < tl) 
        return 0;
    if ( l <=tl && tr <= r) 
    {
        return seg[node];
    }
    ll tm = (tl + tr) / 2;
    ll s1=query(node*2, tl, tm, l, r);
    ll s2=query(node*2+1, tm+1, tr, l, r);
    return max(s1,s2);
}

void update(ll node, ll tl, ll tr, ll pos, ll new_val) {
    if (tl == tr) {
        seg[node] = new_val;
    } else {
        ll tm = (tl + tr) / 2;
        if (pos <= tm)
            update(node*2, tl, tm, pos, new_val);
        else
            update(node*2+1, tm+1, tr, pos, new_val);
        seg[node] = max( seg[node*2] , seg[node*2+1] );
    }
}
int main()
{
    ios
    int ti=1;
    //cin>>ti;
    while(ti--)
    {
		cin>>n;  
		rep(i,1,n+1)cin>>hr[i];
		rep(i,1,n+1)cin>>ar[i];
		rep(i,1,n+1)
		{

			dp[i]=ar[i]+query(1,0,n,0,hr[i]-1);
			update(1,0,n,hr[i],dp[i]);
		}

		ll ans=0;
		rep(i,1,n+1)ans=max(ans,dp[i]);
		cout<<ans<<endl;

    }
    return 0;
        
}

Measured memory_bytes: 11264