akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
/*        string[] input = ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int m = int.Parse(input[1]);*/
//        int b = int.Parse(input[2]);
//        string temp = ReadLine();
//        int a = int.Parse(ReadLine());
        WriteLine("ABC{0}",ReadLine());
    }
}

Measured memory_bytes: 13140
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(N: int, H: "List[int]"):
    for i in range(len(H)-1)[::-1]:
        if H[i] > H[i+1]:
            H[i] = H[i] - 1
    for i in range(len(H)-1):
        if H[i] > H[i+1]:
            return NO
    return YES


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    H = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    print(solve(N, H))

if __name__ == '__main__':
    main()


Measured memory_bytes: 15764
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public Main() {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        Card bArray[] = new Card[36];
        Card sArray[] = new Card[36];


        for (int i = 0; i < n; i++) {
            String cardInfo = scan.next();
            bArray[i] = new Card(cardInfo.charAt(0), Integer.valueOf(cardInfo.substring(1, cardInfo.length())));
        }
        sArray = Arrays.copyOf(bArray, n);

        bubbleSort(n, bArray);
        selectionSort(n, sArray);

        printArray(n, bArray);
        System.out.println("Stable");
        printArray(n, sArray);
        if(isStable(n,bArray,sArray)){
            System.out.println("Stable");
        }else{
            System.out.println("Not stable");
        }

    }

    public static boolean isStable(int n, Card[] cards1, Card[] cards2) {
        for (int i = 0; i < n; i++) {
            if (!cards1[i].equals(cards2[i])) {
                return false;
            }
        }
        return true;
    }

    public static void bubbleSort(int n, Card[] cards) {
        boolean flag = true;
        while (flag) {
            flag = false;
            for (int i = n - 1; i >= 1; i--) {
                if (cards[i].number < cards[i - 1].number) {
                    // 要素の交換
                    Card tmp = cards[i];
                    cards[i] = cards[i - 1];
                    cards[i - 1] = tmp;
                    flag = true;
                }
            }
        }
    }

    public static void selectionSort(int n, Card[] cards) {
        int minj;
        int i, j;
        for (i = 0; i < n - 1; i++) {
            minj = i;
            for (j = i; j < n; j++) {
                if (cards[minj].number > cards[j].number) {
                    minj = j;
                }
            }
            if (i != minj) {
                Card tmp;
                tmp = cards[i];
                cards[i] = cards[minj];
                cards[minj] = tmp;
            }

        }
    }

    // スペース区切りで表示
    public static void printArray(int n, Card A[]) {
        int i;
        for (i = 0; i < n - 1; i++) {
            System.out.print(A[i] + " ");
        }
        System.out.println(A[i]);
    }

    public class Card {
        public char suit;
        public int number;

        public Card(char suit, int number) {
            this.suit = suit;
            this.number = number;
        }

        @Override
        public String toString() {
            return suit + String.valueOf(number);
        }

        // 簡易比較
        @Override
        public boolean equals(Object target) {
            Card tCard = (Card) target;
            return number == tCard.number && suit == tCard.suit;
        }
    }

    public static void main(String[] args) {
        new Main();
    }

}

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

void solve() {
  int n;
  cin >> n;
  long long ans = 0;
  for (int i = 1; i < n; ++i) {
    int now = i;
    for (int j = 1; j * j <= now; ++j) {
      if (now % j == 0) {
        ans += 1 + (j * j != now);
      }
    }
  }
  cout << ans << '\n';
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int t = 1;
  // cin >> t;
  while (t--) solve();
  
  return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		int cnt=0;
		for(int i=0;i<n;i++) {
			int a=sc.nextInt();
			if(a>=k) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}

}

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

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

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

    sort(A.begin(), A.end());

    for (size_t i = 0; i < N - 1; i++)
    {
        if (A[i] == A[i + 1])
        {
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

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

        boolean result = true;
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();

            if (a % 2 == 0) {
                if (a % 3 != 0 && a % 5 != 0) {
                    result = false;
                    break;
                }
            }
        }

        System.out.println(result ? "APPROVED" : "DENIED");
    }
}

Measured memory_bytes: 23252
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########

def resolve():
    n = ii()
    a = mi()
    if 0 in a:
        print(0)
        return
    res = 1
    for i in a:
        res = res * i
        if(res > 10**18):
            print(-1)
            return
    print(res)

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 22436
#include <iostream>
using namespace std;
int main(){
  int x ;
  while(1){
    cin >> x ;
    int total = 0;
    if( x==0 )break;
    int yen500 = 0;
    int yen100 = 0;
    int yen50 = 0;
    int yen10 = 0;
    int yen5 = 0;
    int yen1 = 0;
    x = 1000- x;
    yen500 = x /500 ;
    x = x%500;
    yen100 = x /100;
    x = x%100;
    yen50 = x / 50 ;
    x = x %50;
    yen10 = x/10;
    x = x%10;
    yen5 = x/5;
    x = x%5;
    yen1 = x;
    total = yen500 + yen100 + yen50 + yen10 + yen1 + yen5;
    cout << total << endl;
  }
}

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

const int Mask = (1 << 17) - 1;
const int mod = 1e9 + 7;

int f[47][Mask + 5];

int append(int status, int x) {
	return ((status << x) | (1 << (x - 1))) & Mask;
}

int main(){
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
	int n, x, y, z;
	
	cin >> n >> x >> y >> z;
	
	int S = 0;
	S = append(S, x);
	S = append(S, y);
	S = append(S, z);
	
	f[0][0] = 1;
	
	for(int i = 1; i <= n; i++) {
		for(int j = 0; j <= Mask; j++) 
			for(int k = 1; k <= 10; k++) {
				int NewStatus = append(j, k);
				if((NewStatus & S) == S) continue;
				f[i][NewStatus] = (f[i][NewStatus] + f[i - 1][j]) % mod;
			}
	}
	int ans = 1;
	for(int i = 1; i <= n; i++) ans = 10LL * ans % mod;
		
	for(int i = 0; i <= Mask; i++) ans = (ans - f[n][i]) % mod;
		cout << (ans + mod) % mod;
			 
    return 0;
}


Measured memory_bytes: 22272
#include <bits/stdc++.h>
using namespace std;
const int maxn = 30;
int bin[maxn];
int main()
{
  int n,k;
  scanf("%d%d",&n,&k);
	bin[0] = 1;
	long double ans = 0;
	for(int i = 1 ; i <= 30 ; i++) bin[i] = bin[i-1] * 2;
	for(int i = 1 ; i <= n ; i++)
	{
		for(int j = 28 ; j >= 0 ; j--)
		{
			if(1LL * i * bin[j] < k)
			{
				ans += (long double) 1 / (bin[j+1]);
				break;
			}
		}
	}
	if(n >= k) ans += ((long double)n - (long double )k + (long double)1);
	printf("%.10Lf\n",ans / (long double)n - 1e-10);

}

Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

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

//scanf("%lld", &);
//cin >> ;
//cout << ans << endl;

ll N, M, K, i, j, k, l, ans, cnt = 0;

int main(){
    ll X;
    cin >> X;

    cnt = X / 500;
    ans = int(X / 500) * 1000;
    X -= cnt * 500;

    ans += X / 5 * 5;

    cout << ans;

    return 0;
}

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

struct edge{
	int to,dist;
};

using graph=vector<vector<edge>>;
graph G;

signed main(){
	int N; cin>>N;
	G.assign(N,vector<edge>(0));
	for(int i=0;i<N-1;i++){
		int u,v,w; 
		cin>>u>>v>>w; u--; v--; w%=2;
		edge tmp; tmp.to=v; tmp.dist=w;
		G[u].push_back(tmp);
		tmp.to=u;
		G[v].push_back(tmp);
	}
	vector<int> col(N,-1);
	queue<int> que;
	que.push(0);
	col[0]=0;
	while(!que.empty()){
		int v=que.front();
		que.pop();
		for(auto e : G[v]){
			if(col[e.to]!=-1)continue;
			if(e.dist==0)col[e.to]=col[v];
			else col[e.to]=(col[v]+1)%2;
			que.push(e.to);
		}
	}
	for(int i=0;i<N;i++){
		cout<<col[i]<<endl;
	}

	return 0;

}

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

ll pow(ll a, ll x, ll p){
  	ll tmp=1;
  	while(x>0){
    	if(x%2 == 1){
          	tmp = (a*tmp)%p;
        }
      	a = (a*a)%p;
      	x /= 2;
    }
  	return(tmp);
}

int main(){
  int N,K;
  cin >> N >> K;
  vector<ll> gcd(K+1);
  for(int i=K;i>=1;i--){
    ll a=K/i;
    ll tmp = pow(a,N,mod);
    ll j=2;
    while(i*j<=K){
      tmp = tmp - gcd.at(i*j);
      if(tmp < 0){
        tmp = tmp + mod;
      }
      j++;
    }
    gcd.at(i) = tmp;
  }
  
  /*
  for(int i=1;i<gcd.size();i++){
    cout << gcd.at(i) << endl;
  }
  */
  
  ll ans=0;
  for(int i=1;i<=K;i++){
    ans = (ans + i*gcd.at(i) % mod) % mod;
  }
  
  cout << ans << endl;
  
  return(0);
}

Measured memory_bytes: 4048
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <complex>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
ll mod=1e9+7;
double eps=1e-7;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ull pexp(ull x,ull y){if(y<0) return 0; ull ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2*b)%mod;}return ret;}   
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
ll eadivs(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=i+x/i;if(x%i==0 && i*i==x) ret+=i;}return ret;}
ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;}
ll rev(ll n, ll b){ll ret=0;while(n){ret=b*ret+n%b; n/=b;}return ret;}
ll sq(ll x){ll t=(ll)sqrt(x); for(ll i=t-2 ; i<=t+2 ; i++) if(i*i==x) return abs(i); return -1;}
ll extexp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=extm(x,x)){if(y&1)ret=extm(ret,x);}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
int a, b;
int vv[111][111];

int main(void)
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int i, j; cin>>a>>b; a--; b--;
	for(j=1 ; j<=100 ; j++) vv[1][j]=1; 
	for(i=1 ; a ; i++)
	{
		if(i%2==0)
		{
			for(j=1 ; j<=100 ; j++) 
			{
				if(j%2==1 && a>0)
				{
					a--; 
					vv[i][j]=0; // white
				}
				else vv[i][j]=1; // black
			}
		}
		else for(j=1 ; j<=100 ; j++) vv[i][j]=1;
	}
	for(j=1 ; j<=100 ; j++) vv[i][j]=1; // black
	int st=i+1;
	for(j=1 ; j<=100 ; j++) vv[st][j]=0; // white  
	for(i=st+1 ; b ; i++)
	{
		if(i%2!=st%2)
		{
			for(j=1 ; j<=100 ; j++)
			{
				if(j%2==1 && b>0)
				{
					b--;
					vv[i][j]=1; // black
				}
				else vv[i][j]=0;
			}
		}
		else for(j=1 ; j<=100 ; j++) vv[i][j]=0;
	}
	for(j=1 ; j<=100 ; j++) vv[i][j]=0;
	int tot=i;
	cout<<tot<<" "<<100<<"\n";
	for(i=1 ; i<=tot ; i++)
	{
		for(j=1 ; j<=100 ; j++)
		{
			if(vv[i][j]==0) cout<<'.';
			else cout<<'#';
		}
		cout<<"\n";
	}
	return 0;
}

// 제출하기 전에 생각햇나요?
// it may be easier/harder than you think
// ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * @author khokharnikunj8
 */

public class Main {
    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                new Main().solve();
            }
        }, "1", 1 << 26).start();
    }

    void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        APassword solver = new APassword();
        solver.solve(1, in, out);
        out.close();
    }

    static class APassword {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            out.println(n * n * n);
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}



Measured memory_bytes: 23508
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
/* Precode Start Here *\
     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}
/* Precode Ends */
#define mod 1000000007
ll A[5000001],B[5000001];
vector<ll>v;
map<ll,ll>myMap;
set<ll>mySet;
vector<pair<ll,ll> >vp;
priority_queue<ll> pq;
priority_queue<ll, vector<ll>, std::greater<ll> > first;
ll po(ll a,ll n)
{
  ll ans=1;
  for(int i=1;i<=n;i++)
       ans*=a;
    return ans;
}

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


 ll n,x,t,ans=0,get=0;
 cin>>n>>x>>t;
 while(get<n)
 {
     get+=x;
     ans+=t;
 }
 cout<<ans<<endl;


return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n;
    cin >> n;
    vi a(n);
    rep(i,n) cin >> a.at(i);
    vi odds, twos, fours;
    rep(i,n){
        if(a.at(i) % 4 == 0){
            fours.push_back(a.at(i));
        } else if(a.at(i) % 2 == 0) {
            twos.push_back(a.at(i));
        } else {
            odds.push_back(a.at(i));
        }
    }
    if(fours.size() >= odds.size()){
        cout << "Yes" << endl;
    } else if(odds.size() == 0){
        cout << "Yes" << endl;
    } else if(fours.size() + 1 == odds.size() && twos.size() == 0){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 2296
import sys
input = sys.stdin.readline
def main():
  n=int(input())
  abc=[list(map(int,input().split())) for _ in range(n-1)]
  q,k=map(int,input().split())
  xy=[list(map(int,input().split())) for _ in range(q)]
  # 頂点kを根とした根付き木。kから各頂点への最短距離を求めてクエリごとに足すだけ。
  ki=[[]for _ in range(n)]
  for a,b,c in abc:
    ki[a-1].append([b-1,c])
    ki[b-1].append([a-1,c])
  kakutei=[0]*n
  kyori=[pow(10,14)]*n
  kyori[k-1]=0
  import heapq
  mikakutei=[[0,k-1]]
  heapq.heapify(mikakutei)
  while len(mikakutei)>0:
    k,i=heapq.heappop(mikakutei)
    if kakutei[i]==1:
      continue
    kakutei[i]=1
    l=ki[i]
    for li in l:
      if kakutei[li[0]]==0:
        kyori[li[0]]=min(kyori[li[0]],k+li[1])
        heapq.heappush(mikakutei,[kyori[li[0]],li[0]])
  for x,y in xy:
    print(kyori[x-1]+kyori[y-1])
    

if __name__=='__main__':
  main()


Measured memory_bytes: 92464
#define D(x) cout << #x " = " << x << endl
#define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl
#define DV(v) for (auto __macro_vi : v){ cout << __macro_vi << " ";} cout << endl;
#define DA(a, n) for (int __macro_i = 0; __macro_i < n; ++__macro_i) { cout << a[__macro_i] << " "; } cout << endl;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) (v).begin(), (v).end()
#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p){ os << "(" << p.first << ", " <<  p.second << ")"; return os; }

using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<char>> grid(h, vector<char>(w, '.'));
    REP(i, h) {
        REP(j, w) {
            char c;
            cin >> c;
            grid[i][j] = c;
        }
    }

    int ans = 0;
    REP(row_bit, 1 << h) {
        REP(col_bit, 1 << w) {
            int cnt = 0;
            REP(x, h) {
                REP(y, w) {
                    if (row_bit >> x & 1 || col_bit >> y & 1) continue;
                    if (grid[x][y] == '#') cnt++;
                }
            }
            if (cnt == k) ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define S set<int>
#define pb(v) push_back(v)
int main(){
    string s;cin >> s;
    set<char> c;
    FOREACH(a,s){
        c.insert(a);
    }
    COUT(s.size()==c.size()?"yes":"no");
    return 0;
}


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

int main() {
	int num;
	int a[4];
	cin >> num;
	a[0] = floor(num / 1000);
	a[1] = floor(num / 100) - a[0] * 10;
	a[3] = num % 10;
	a[2] = (num % 100 - a[3]) / 10;
	if (a[0] + a[1] + a[2] + a[3] == 7) {
		cout << a[0] << "+" << a[1] << "+" << a[2] << "+" << a[3] << "=7" << endl;
	}
	else if (a[0] - a[1] + a[2] + a[3] == 7) {
		cout << a[0] << "-" << a[1] << "+" << a[2] << "+" << a[3] << "=7" << endl;
	}
	else if (a[0] + a[1] - a[2] + a[3] == 7) {
		cout << a[0] << "+" << a[1] << "-" << a[2] << "+" << a[3] << "=7" << endl;
	}
	else if (a[0] - a[1] - a[2] + a[3] == 7) {
		cout << a[0] << "-" << a[1] << "-" << a[2] << "+" << a[3] << "=7" << endl;
	}
	else if (a[0] + a[1] + a[2] - a[3] == 7) {
		cout << a[0] << "+" << a[1] << "+" << a[2] << "-" << a[3] << "=7" << endl;
	}
	else if (a[0] - a[1] + a[2] - a[3] == 7) {
		cout << a[0] << "-" << a[1] << "+" << a[2] << "-" << a[3] << "=7" << endl;
	}
	else if (a[0] + a[1] - a[2] - a[3] == 7) {
		cout << a[0] << "+" << a[1] << "-" << a[2] << "-" << a[3] << "=7" << endl;
	}
	else if (a[0] - a[1] - a[2] - a[3] == 7) {
		cout << a[0] << "-" << a[1] << "-" << a[2] << "-" << a[3] << "=7" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <iomanip>
#include <random>
#include <time.h>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <typeinfo>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <list>
#include <stack>
#include <set>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
using namespace std;
int main() {
	ll n, num = 0, a[100010], ansa = 0, ans = 0, now = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	num = a[1];
	if (a[1] >= 0)num = -1, ans += a[1] + 1;
	for (int i = 2; i <= n; i++) {
		num += a[i];
		if (!now) {
			now = 1;
			if (num <= 0)ans += -num + 1, num = 1;
		}
		else {
			now = 0;
			if (num >= 0)ans += num + 1, num = -1;
		}
	}
	num = a[1];
	now = 1;
	if (a[1] <= 0)num = 1, ansa += -a[1] + 1;
	for (int i = 2; i <= n; i++) {
		num += a[i];
		if (!now) {
			now = 1;
			if (num <= 0)ansa += -num + 1, num = 1;
		}
		else {
			now = 0;
			if (num >= 0)ansa += num + 1, num = -1;
		}
	}
	ans = min(ans, ansa);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <math.h>

#define max(a,b) ((a>b)?(a):(b))
#define min(a,b) ((a<b)?(a):(b))

using namespace std;

long N, M;
long *a, *b;
long *ans;

class nodeClass {
public:
	nodeClass() {
		next = NULL;
		num = 0;
	}

	nodeClass *next;
	int id;
	int num;
};

nodeClass *np;

nodeClass *getNode(int i) {
	nodeClass *node = &np[i];
	while (node->next != NULL) {
		node = node->next;
	}
	return node;
}

int main() {
	cin >> N >> M;
	a = new long[M];
	b = new long[M];
	ans = new long[M];
	np = new nodeClass[N];

	ans[M - 1] = (N * (N - 1)) / 2;

	for (int i = 0; i < N; i++) {
		np[i].num = 1;
		np[i].id = i;
	}
	for (int i = 0; i < M; i++) {
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
	}

	for (int k = M - 1; k > 0; k--) {
		int x = a[k], y = b[k];
		nodeClass *nx = getNode(x), *ny = getNode(y);
		if (nx->id == ny->id) {
			ans[k - 1] = ans[k];
		}
		else {
			ans[k - 1] = ans[k] - nx->num * ny->num;
			nodeClass *node = new nodeClass;
			node->id = N + M - k;
			node->num = nx->num + ny->num;
			nx->next = node;
			ny->next = node;
			np[x].next = node;
			np[y].next = node;
		}
	}

	for (int i = 0; i < M; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 8960
import heapq

N,M = map(int,input().split())
A = list(map(int,input().split()))
A = list(map(lambda x:-x,A))

heapq.heapify(A)
for m in range(M):
  a = -heapq.heappop(A)
  heapq.heappush(A,-(a>>1))
print(-sum(A))


Measured memory_bytes: 73196
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 

int main(){

    int A;
    int X;
    
    cin >> X;
    cin >> A;

    if(X<A) cout << 0;
    else cout << 10;
    

}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

N = int(input())
num_list = list(map(int, input().split()))
order_list = sorted(range(len(num_list)), key=lambda k: num_list[k])
order_list = list(map(lambda x: x+1, order_list))
[print(' '.join([str(i) for i in order_list]))]


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

ll gcd(ll a, ll b)
{
  return b ? gcd(b, a % b) : a;
}

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

int main()
{
  int n;
  cin >> n;
  ll ret = 1;
  for (int i = 0; i < n; ++i)
  {
    ll t;
    cin >> t;
    ret = lcm(ret, t);
  }

  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (int argc, char* argv[]) {
  int a[5], k;
  for (int i = 0; i < 5; i++) {
    scanf("%d", &a[i]);
  }
  scanf("%d", &k);

  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 5; j++) {
      if (i == j) continue;
      if (a[j] - a[i] > k) {
	printf(":(\n");
	return 0;
      }
    }
  }

  printf("Yay!\n");
  return 0;
}


Measured memory_bytes: 128
a, b, c, d, e, f = map(int, input().split())

# 濃度,砂糖水の質量、溶けている砂糖の質量
ans = (0, 0, 0)

# まず水の量を考える
for i in range(0, f // (100 * a) + 1):
    for j in range(0, f // (100 * b) + 1):
        if i == 0 and j == 0:
            continue

        # 水の量だけで上限を超えたら終了
        waterV = 100 * a * i + 100 * b * j
        if waterV > f:
            break

        # トータル質量の残り
        leftVolume = f - waterV
        # 砂糖として入れられる最大値
        satouMax = min((a*i + b*j) * e, leftVolume)  # これを作れたら最大

        # 砂糖として入れられる最大値
        sMax = 0
        for si in range(0, satouMax // c + 1):
            blnOk = False
            for sj in range(0, satouMax // d + 1):
                satou = c * si + d * sj
                if satou == satouMax:
                    sMax = satou
                    blnOk = True
                    break
                if satou > satouMax:
                    break
                sMax = max(sMax, satou)

            if blnOk:
                break

        # 濃度計算
        noudo = 100 * sMax / (waterV + sMax)

        if ans[0] <= noudo:
            ans = (noudo, waterV+sMax, sMax)

print(ans[1], ans[2])


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

int main()
{
    int a, b;
    cin >> a >> b;
    int ans = (a - 1) * (b - 1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3568
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  int n, k; cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(ALL(a));
  int ans = 0;
  for (int i = 0; i < k; i++) {
    ans += a[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int n, k;
    cin>>n>>k;
    int a[n+1];
    for(int i=1;i<=n;i++){
      cin>>a[i];
    }
    int dp[n+1];
    memset(dp,0,sizeof(dp));
    dp[1]=0;
    dp[2]=abs(a[2]-a[1]);
    //cout<<"dp[1] is "<<dp[1]<<endl;
    for(int i=3;i<=n;i++)
    { int r=i-k;
      if(r<=0) r = 1;
      int minv = dp[i-1]+abs(a[i]-a[i-1]);
      for(int j=r; j<i; j++){
        minv = min(minv, dp[j]+abs(a[i]-a[j]));
      }
      dp[i]=minv;
    }
    cout<<dp[n]<<endl;
}

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

int main(void){
	int a,b,ans1,ans2,ans3;
	while(cin>>a>>b){
		ans1 = a+b;
		ans2 = a-b;
		ans3 = a*b;
		printf("%d\n",max(ans1,max(ans2,ans3)));
	}
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MOD 1000000007

using namespace std;

int main() {
  vector<vector<ll>> comb(2000, vector<ll>(2000));
  for(int j = 0; j < 2000; j++) {
    for(int i = j; i < 2000; i++) {
      if(i == j)
        comb.at(i).at(j) = 1;
      if(!j) {
        comb.at(i).at(j) = 1;
      } else
        comb.at(i).at(j) =
            (comb.at(i - 1).at(j) + comb.at(i - 1).at(j - 1)) % MOD;
    }
  }

  int n, k;
  ll o = 0;
  cin >> n >> k;
  for(int i = 0; i < k; i++) {
    if(i > n - k)
      cout << 0 << endl;
    else if(i == n - k)
      cout << comb[k - 1][i] << endl;
    else {
      if(i) {
        for(int j = 0; j <= n - k - i; j++) {
          o = (o + comb[k - 1][i] * comb[j + i - 1][i - 1] % MOD *
                       (n - k - i - j + 1) % MOD) %
              MOD;
        }
        cout << o << endl;
      } else
        cout << n - k + 1 << endl;
    }
    o = 0;
  }
}

Measured memory_bytes: 31616
#include <bits/stdc++.h>
using namespace std;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long 

int main(){
	string s;
	cin>>s;
	long long n=s.size();
	int wa=0;
	rep(i,n){
		int x=s[i]-'0';
		wa+=x;
	}
	if(wa%9==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    ll n, k; cin >> n >> k;
    ll high = 1e10, low = 1;
    vector<ll> lis(n);
    REP(i, 0, n){
        cin >> lis[i];
    }
    sort(ALL(lis), greater<>());
    if(k == 0){
        cout << lis[0] << endl;
        return 0;
    }
    while(high - low > 1){
        ll ck = k;
        ll mid = (high + low) / 2;
        REP(i, 0, n){
            if(lis[i] <= mid){
                continue;
            }else{
                ll c = lis[i] / mid;
                ck -= c;
            }
        }
        //cout  << mid  << " " << ck << endl;
        if(ck >= 0 || ck == k){
            high = mid;
        }else{
            low = mid;
        }
    }
    ll ck = k;
    ll mid = low;
    REP(i, 0, n){
        if(lis[i] <= mid){
            continue;
        }else{
            ll c = lis[i] / mid;
            ck -= c;
        }
    }
    if(ck >= 0 || ck == k){
        cout << low << endl;
        return 0;
    }
    cout << high << endl;
}

Measured memory_bytes: 4692
#import<stdio.h>
int a[21],k,i,n,m;
main()
  {
  for(scanf("%d",&n);i++<n;)scanf("%d",a+i);
  for(i=0;i++<n;)scanf("%d",&k),a[i]>k?m+=a[i]-k:0;
  printf("%d",m);
  }

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define lp(i, n) rep(i, n)
#define foreach(i, n) for(auto &i:(n))
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll<(x))
#define MOD ((ll)1e9+7)
#define int long long
using namespace std;

signed main(){
  int t;
  cin>>t;
  int sum=0;
  int al=1,bef=1;
  int ans=1;
  while(1){
    if(bef+al*6<=t){
      bef+=al*6;
      al*=3;
      ans+=2;
      continue;
    }
    break;
  }
  t-=bef;
  //cout<<t<<" "<<bef<<endl;
  while(t!=0){
    ans+=t%3;
    t/=3;
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3124
#include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<complex>
using namespace std;
typedef long long int llint;
int main(){
	char a, b, c, d, e, f, g, h, i;
	cin >> a >> b >> c >> d >> e >> f >> g >> h >> i;
	cout << a << e << i << endl;
	return 0;
}


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

int  R;
int main() {
	cin >> R;
	if (R<1200){
		cout << "ABC" << endl;
	} else if ((1200<=R) && (R<2800)) {
		cout << "ARC" << endl;
	} else {
		cout << "AGC" << endl;
	}
}
	



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

#define MAX_N 300000
bool prime[MAX_N];

int main(int argc, char const* argv[])
{
	for (int i = 0; i < MAX_N; i++) {
		prime[i] = true;
	}
	prime[0] = false;
	prime[1] = false;

	for (int i = 0; i < MAX_N; i++) {
		if (prime[i]) {
			for (int j = i + i; j < MAX_N; j+=i) {
				prime[j] = false;
			}
		}
	}

	int n;
	while (cin >> n, n) {
		int cnt = 0;
		for (int i = n + 1; i <= 2 * n; i++) {
			cnt += prime[i];
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 0
import itertools
N = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
J = set(itertools.permutations(p))
J = sorted(list(J))
for i in range(len(J)):
    if list(J[i]) == p:
        a = i + 1
    if list(J[i]) == q:
        b = i + 1
print(abs(a-b))

Measured memory_bytes: 10348
#include <iostream>
#include <iomanip>
#include <climits>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <unordered_map>
#include <random>
#define _USE_MATH_DEFINES
#include <math.h>
#include <complex>

using namespace std;

#define INF (int)1e8
#define _INF (int)-1e8
#define INFLL (long long)1e15
#define _INFLL (long long)-1e15
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

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

int main() {
  int n; cin >> n;
  vll a(n); Loop(i, n) cin >> a[i];
  ll upper = 2;
  ll lower = 2;
  Loopr(i, n) {
    ll next_lower = (lower % a[i] == 0) ? lower / a[i] : lower / a[i] + 1;
    ll next_upper = upper / a[i];
    if (next_lower > next_upper) { cout << -1 << endl; return 0; }
    next_lower *= a[i];
    next_upper *= a[i];
    next_upper += a[i] - 1;
    lower = next_lower;
    upper = next_upper;
  }
  cout << lower << " " << upper << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
int bsr(int x) { return 31 - __builtin_clz(x); }

template<uint MD>
struct ModInt {
    uint v;
    ModInt() : v{0} {}
    ModInt(ll v) : v{normS(v%MD+MD)} {}
    static uint normS(const uint &x) {return (x<MD)?x:x-MD;};
    static ModInt make(const uint &x) {ModInt m; m.v = x; return m;}
    ModInt operator+(const ModInt &r) const {return make(normS(v+r.v));}
    ModInt operator-(const ModInt &r) const {return make(normS(v+MD-r.v));}
    ModInt operator*(const ModInt &r) const {return make((ull)v*r.v%MD);}
    ModInt& operator+=(const ModInt &r) {return *this=*this+r;}
    ModInt& operator-=(const ModInt &r) {return *this=*this-r;}
    ModInt& operator*=(const ModInt &r) {return *this=*this*r;}
    static ModInt inv(const ModInt &x) {
        return pow(ModInt(x), MD-2);
    }
};
using Mint = ModInt<TEN(9)+7>;

map<ll, Mint> dp;
Mint calc(ll N) {
    if (N == 0) return 1;
    if (dp.count(N)) return dp[N];
    Mint ans = 0;
    for (int i = 0; i <= 2; i++) {
        if (N < i) break;
        ans += calc((N-i)/2);
    }
    return dp[N] = ans;
}

int main() {
    ll n;
    cin >> n;
    cout << calc(n).v << endl;
    return 0;
}


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

#define MP make_pair
#define MAXN 500

using namespace std;

typedef pair<int , int> PII;
typedef pair<PII , int> PIII;

int c[MAXN + 10];

void add(int x) {
	while (x <= MAXN) {
		c[x] += 1;
		x += x & -x;
	}
}

int get(int x) {
	int res = 0;
	while (x) {
		res += c[x];
		x -= x & -x;
	}
	return res;
}

int main() {
	int n, m, q;
	scanf("%d %d %d", &n, &m, &q);
	vector<PII> rail;
	for (int i = 0; i < m; i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		rail.push_back(MP(y, x));
	}
	sort(rail.begin(), rail.end());
	vector<PIII> que;
	for (int i = 0; i < q; i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		que.push_back(MP(MP(y, x), i));
	}
	sort(que.begin(), que.end());
	int idx = 0;
	vector<PII> res;
	for (int i = 0; i < q; i++) {
		PII inv = que[i].first;
		while (idx < m && rail[idx].first <= inv.first) {
			PII r = rail[idx];
			add(r.second);
			idx++;
		}
		int cnt = get(inv.second - 1);
		res.push_back(MP(que[i].second, idx - cnt));
	}
	sort(res.begin(), res.end());
	for (int i = 0; i < q; i++) {
		printf("%d\n", res[i].second);
	}
	return 0;
}

Measured memory_bytes: 5488
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <queue>
typedef long long ll;

using namespace std;

int main() {
    int n;
    cin >> n;
    
    vector<int> v(n);
    for(int i = 0; i < n; i++) {
        cin >> v[i];
    }
    
    sort(v.begin(), v.end(), [](const int &x, const int &y){return x < y;});
    
    ll ans = 0;
    for(int i = n - 1; i >= 0; i--) {
        for(int j = i - 1; j >= 0; j--) {
            int index = upper_bound(v.begin(), v.end(), v[i] - v[j]) - v.begin();
            
            if(j > index) {
                ans += j - index;
            }
        }
    }
    
    
    cout << ans << endl;
    return 0;
}



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

using namespace std;

const int MAXV = 1010, MAXE = 1000010;

int offset[8][2] = {
{0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}, {-1, 1} };
const int MAXN = 100;
char grid[MAXN][MAXN];
char maze[MAXN][MAXN];
int rows, columns, total = 0;

int main(int argc, char *argv[])
{
    

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> rows >> columns;
    
    memset(maze, ' ', sizeof(maze));
    memset(grid, ' ', sizeof(grid));
    
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < columns; j++) {
            cin >> maze[i][j];
        }
    }
    
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < columns; j++) {
            if (maze[i][j] == '#') {
                grid[i][j] = '#';
                continue;
            }
            int cnt = 0;
            for (int k = 0; k < 8; k++){
                int ii = i + offset[k][0], jj = j + offset[k][1];
                
                if (ii < 0 || ii >= rows || jj < 0 || jj >= columns) {
                    continue;
                }
                
                if (maze[ii][jj] == '#') {
                    cnt++;
                }
                
            }
            grid[i][j] = cnt + '0';
        }
    }
    
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < columns; j++) {
            cout << grid[i][j];
        }
        cout << endl;
    }
    
}


Measured memory_bytes: 256
let rec s ?(l = []) n =
  if n = 0 then l else s ~l:(read_int () :: l) (n-1)

let rec solve () =
  let n = read_int () in
  if n == 0 then exit 0
  else
    let l = List.fast_sort compare (s n) in
    let min = List.hd l in
    let max = List.nth l (n-1) in
    let sum = List.fold_left (+) 0 l in
    let ave = (sum-min-max) / (n-2) in
    print_int ave; print_newline ();
    solve ()

let () = solve ()

Measured memory_bytes: 2176
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll x, ll y) {
	ll res = 1;
	for (ll i = 0; i < y; i++) res = res * x % mod;
	return res;
}

int main() {
	string s;
	cin >> s;
	int ans = 0;
	int cnt = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'A' || s[i] == 'G' || s[i] == 'C' || s[i] == 'T') {
			cnt++;
		}
		else {
			ans = max(ans, cnt);
			cnt = 0;
		}
	}
	ans = max(ans, cnt);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3608
while True :
    n = int(input())
    if n == 0 :
        break
    
    for i in range(n) :
        m, e, j = map(int, input().split())
        if m == 100 or e == 100 or j == 100 :
            print("A")
        elif (m + e) / 2 >= 90 :
            print("A")
        elif (m + e + j) / 3 >= 80 :
            print("A")
        elif (m + e + j) / 3 >= 70 :
            print("B")
        elif (m + e + j) / 3 >= 50 and (m >= 80 or e >= 80) :
            print("B")
        else :
            print("C")


Measured memory_bytes: 5612
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

int main() {
  size_t N, M;
  scanf("%zu %zu", &N, &M);

  std::vector<int> denkyu(M);
  for (size_t i = 0; i < M; ++i) {
    size_t k;
    scanf("%zu", &k);
    for (size_t j = 0; j < k; ++j) {
      int s;
      scanf("%d", &s);
      --s;
      denkyu[i] |= 1 << s;
    }
  }

  std::vector<int> tento(M);
  for (auto& pi: tento) scanf("%d", &pi);

  size_t P = 1 << N;
  int res = 0;
  for (size_t i = 0; i < P; ++i) {
    size_t cur = 0;
    for (size_t j = 0; j < M; ++j) {
      if (__builtin_popcount(denkyu[j] & i) % 2 == tento[j]) ++cur;
    }
    if (cur == M) ++res;
  }
  printf("%d\n", res);
}


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

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int K;
  cin >> K;
  int ans = 0;
  for (int i = 1; i <= K; ++i)
    for (int j = 1; j <= K; ++j)
      for (int k = 1; k <= K; ++k)
        ans += gcd(gcd(i, j), k);
  cout << ans << endl;
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
#define int long long
using namespace std;
int a,b,c;
signed main(){;
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>a>>b>>c;
	if(c-a-b<0){
		cout<<"No";
		return 0;
	}
	if(4*a*b<(c-a-b)*(c-a-b))cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
bool comp1(pair<int,int> &a,pair<int,int> &b)
{
    return a.second>b.second;
}
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];

    sort(a,a+n);
    int ans=0;
    for(int i=0;i<k;i++)
    {
        ans+=a[i];
    }
    cout<<ans;
}

Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace ConsoleApp9
{
    class Program
    {
        public static void Main(string[] args)
        {
            double a = double.Parse(Console.ReadLine());
            double b = a * 2 * Math.PI;
            double c = a * a * Math.PI;
            Console.WriteLine("{0} {1}",c,b);
    }
    } }

Measured memory_bytes: 9272