akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#ifndef ONLINE_JUDGE
    #define debug(x) cerr << #x << ": " << x << endl;
#else
    #define debug(x)
#endif

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

    ll N;
    cin >> N;

    string ans = "";
    while(N > 0) {
        if(N % 26 == 0) ans += 'z';
        else ans += 'a' + ((N-1) % 26);
        N--;
        N /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main(){
    string A, B;
    cin >> A >> B;

    if(A.size() > B.size()) {
        cout << "GREATER" << endl;
        return 0;
    }

    if(A.size() < B.size()) {
        cout << "LESS" << endl;
        return 0;
    }

    REP(i, A.size()) {
        if(A[i] > B[i]) {
            cout << "GREATER" << endl;
            return 0;
        }

        if(A[i] < B[i]) {
            cout << "LESS" << endl;
            return 0;
        }
    }

    cout << "EQUAL" << endl;
    return 0;
}



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

n, k = map(int, input().split())
*a, = map(int, input().split())

s = [0]*(n+1)
for i in range(len(a)):
    s[i+1] = s[i] + a[i]
for i in range(len(s)):
    s[i] = (s[i] - i)%k

from collections import defaultdict
cnt = defaultdict(int)

left = 0
right = k-1
if right > n:
    right = n

for i in range(right+1):
    cnt[s[i]] += 1

ans = 0
while left < right:
    ans += cnt[s[left]]-1
    if right == n:
        cnt[s[left]] -= 1
        left += 1
    else:
        cnt[s[left]] -= 1 
        left += 1
        right += 1
        cnt[s[right]] += 1 

print(ans)


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

#define rep(i, n) for (int i = 0; i < n; ++i)
using p = pair<int, int>;

int n, m, q;
vector<int> a, b, c, d;
int ans;

void fnc(vector<int> A) {
  if (A.size() == n + 1) {
    int now = 0;
    rep(i, q) {
      if (A[b[i]] - A[a[i]] == c[i])
        now += d[i];
    }
    ans = max(ans, now);
    return;
  }

  A.push_back(A.back());
  while (A.back() <= m) {
    fnc(A);
    A.back()++;
  }
}

int main() {
  cin >> n >> m >> q;
  a = b = c = d = vector<int>(q);
  rep(i, q) { cin >> a[i] >> b[i] >> c[i] >> d[i]; }

  fnc(vector<int>(1, 1));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007 
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--){
        long long n;
        cin>>n;
        int ans=0;
        for(long long i=2;i<=sqrt(n);i++){
            if(n%i==0){
                int ctr=0;
                while(n%i==0){
                    n/=i;
                    ctr++;
                }
                int ctr1=0;
                while(((ctr1+1)*(ctr1+2))/2<=ctr){
                    ctr1++;
                }
                ans+=ctr1;
            }
        }
        if(n>1)
            ans++;
        cout<<ans<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3696
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)


#define INF (1e9)
typedef long long unsigned int ll;


int main()
{

    double t,x;
    cin >> t>>x;
    double b = t / x;
    cout << b << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
#define int long long int
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define mp make_pair
using namespace std;
int N=1e6+3;
vi sieve(N,1);
vi vis(N,0);
void sievex(int n)
{
    int i,j;
    sieve[1]=1;
    for(i=2;i<=n;i++)
    {
        if(vis[i])
        continue;
        for(j=i;j<=n;j+=i)
        {
            sieve[j]=i;
            vis[j]=1;
        }
    }
}
int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 
int32_t main() {
	// your code goes here

	  //cout<<"Case #"<<x++<<":\n";
	 int n,i,j,k;
	 double d,t,s;
	 cin>>d>>t>>s;
	 if(d/s<=t)
	 cout<<"Yes\n";
	 else cout<<"No\n";

	return 0;
}


Measured memory_bytes: 18636
import java.util.*;
import java.util.Arrays;
import java.util.Set;
public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int D=sc.nextInt();
        int X=sc.nextInt();
        int[]A=new int[N];
        for(int i=0;i<N;i++){
            A[i]=sc.nextInt();
        }
        int sum=N;
        for(int i=0;i<N;i++){
            for(int j=1;j*A[i]+1<=D;j++){
                sum++;
            }
        }
        System.out.println(sum+X);
        

       
        
    }}

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

using VP = vector<pair<int, int> >;

void merge(const VP &v1, const VP &v2, VP &result) {
    auto it1 = v1.begin(), it2 = v2.begin();
    int vmax = 0;
    while (it1 != v1.end() || it2 != v2.end()) {
        if (it1 == v1.end()) { result.push_back(*it2); it2++; }
        else if (it2 == v2.end()) { result.push_back(*it1); it1++; }
        else if (it1->first == it2->first) {
            result.push_back(max(*it1, *it2));
            it1++;
            it2++;
        } else if (it1->first < it2->first) {
            result.push_back(*it1);
            it1++;
        } else {
            result.push_back(*it2);
            it2++;
        }
        vmax = max(vmax, result.back().second);
        result.back().second = vmax;
    }
}

vector<pair<int, int> > buf(1000);

void update(const VP &prev, VP &result, int v, int w) {
    buf.clear();
    for (auto p : prev) {
        int j = p.first + w;
        if (j <= 1e5) {
            buf.push_back({j, p.second + v});
        } else
            break;
    }
    merge(prev, buf, result);
}

int main() {
    int n; cin >> n;
    int v[n+1], w[n+1];
    for (int i = 1; i <= n; i++) cin >> v[i] >> w[i];

    const int S = 1024;
    vector<pair<int, int> > dp[S];
    dp[1].push_back({0, 0});
    dp[1].push_back({w[1], v[1]});
    for (int i = 2; i <= min(n, S-1); i++) {
        update(dp[i/2], dp[i], v[i], w[i]);
    }
    // for (int i = 1; i <= min(n, S-1); i++) {
    //     cerr << "i = " << i << " size = " << dp[i].size() << endl;
    //     for (auto x : dp[i]) cerr << x.first << " " << x.second << endl;
    // }

    int q; cin >> q;
    while (q--) {
        int i, l; cin >> i >> l;
        vector<pair<int, int> > temp, save;
        temp.push_back({0, 0});
        while (i >= S) {
            swap(save, temp);
            temp.clear();
            update(save, temp, v[i], w[i]);
            i /= 2;
        }

        // cerr << "q = " << i << " " << "size = " << temp.size() << endl;
        // for (auto x : temp) cerr << x.first << " " << x.second << endl;
        int ans = 0;
        auto it1 = dp[i].begin();
        auto it2 = temp.rbegin();
        while (it1 != dp[i].end() && it2 != temp.rend()) {
            while (it2 != temp.rend() && it1->first + it2->first > l) it2++;
            if (it2 != temp.rend()) {
                ans = max(ans, it1->second + it2->second);
            }
            it1++;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 11180
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;
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, K; cin >> N >> K;
  vector<int> P(N); rep(i,N) cin >> P[i];
  vector<double> PP(N);
  rep(i,N) PP[i] = ((double)P[i]+1)/2.0;
  vector<double> sums(N+1,0);
  rep(i,N) sums[i+1] = sums[i] + PP[i];
  double ans = 0;
  for(int i=K; i<=N;i++){
    ans = max(ans, sums[i]-sums[i-K]);
  }
  cout << setprecision(20) << ans << endl;
  return 0;
}


Measured memory_bytes: 4096
PA = list(input())
PB = list(input())
PC = list(input())

t = PA[0]
P = PA
while True:
    if t == "a":
        if PA == []:
            print("A") 
            break
        t = PA[0]
        PA.pop(0)
    elif t == "b":
        if PB == []:
            print("B")
            break
        t = PB[0]
        PB.pop(0)
    elif t == "c":
        if PC == []:
            print("C") 
            break
        t = PC[0]
        PC.pop(0)

Measured memory_bytes: 3064
// AOJ 2013: Osaki
// 2017.11.1 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int tbl[86400];  // 24*60*60 

char buf[30], *p;
int getint2()
{
	int n;
	n = *p++ & 0xf;
	n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int main()
{
	int n, i, h, m, s, t, ans;

	while (fgets(buf, 10, stdin) && *buf != '0') {
		memset(tbl, 0, sizeof(tbl));
		n = atoi(buf);
		while (n--) {
			fgets(p=buf, 30, stdin);
			h = getint2(), p++, m = getint2(), p++, s = getint2(), p++;
			t = ((h*60)+m)*60+s, tbl[t]++;

			h = getint2(), p++, m = getint2(), p++, s = getint2();
			t = ((h*60)+m)*60+s, tbl[t]--;
		}
		for (ans = 0, i = 1; i < 86400; i++) {
			tbl[i] += tbl[i-1];
			if (tbl[i] > ans) ans = tbl[i];
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 2080
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll n;
  cin >> n;
  cout << n * (n+1) / 2 << endl;

  return 0;
}


Measured memory_bytes: 3592
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n; cin >> n;
	long long a[110][110] = {};
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			int k; cin >> k;
			a[i][j] = a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1] + k;
		}
	}
	long long ans = -10000;
	for (int i = 1; i <= n; i++) {
		for (int j = i; j <= n; j++) {
			for (int k = 1; k <= n; k++) {
				for (int l = k; l <= n; l++) {
					ans = max(ans, a[j][l] - a[i - 1][l] - a[j][k - 1] + a[i - 1][k - 1]);
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3184
#include <algorithm>
#include <complex>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;

#define rep(i, n) repi(i, 0, n)
#define rep1(i, n) repi(i, 1, n + 1)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)

typedef long long ll;

int main()
{
    int w, h, n;
    cin >> w >> h >> n;
    int x0 = 0, y0 = 0, x1 = w, y1 = h;
    rep(i, n) {
        int x, y, a;
        cin >> x >> y >> a;
        switch (a) {
        case 1: if (x0 < x) x0 = x; break;
        case 2: if (x1 > x) x1 = x; break;
        case 3: if (y0 < y) y0 = y; break;
        case 4: if (y1 > y) y1 = y; break;
        }
    }
    if (x0 >= x1 || y0 >= y1) cout << 0 << endl;
    else cout << (x1 - x0) * (y1 - y0) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  int64_t d;
  cin>>n>>d;
  int answer=0;
  for(int i=0;i<n;i++){
    int64_t x,y;
    cin>>x>>y;
    if(x*x+y*y<=d*d){
      answer++;
    }
  }
  cout<<answer<<endl;
}


Measured memory_bytes: 3592
base = ord("a")
alst = [i for i in range(1, 26, 2) if i % 13]
def restore(s):
  for a in alst:
    for b in range(26):
      new = "".join([chr((a * (ord(x) - base) + b) % 26 + base) if x != " " else " " for x in s])
      if "that" in new or "this" in new:
        return new

n = int(input())

for _ in range(n):
  print(restore(input()))


Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define per(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
#define LINF 1e18
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n; cin >> n;
    vector<int> p(n);
    rep(i, n) cin >> p[i];

    int cnt = 0;
    rep(i, n) {
        if (p[i] != i+1) cnt++;
    }

    if (cnt == 0 || cnt == 2) cout << "YES" << endl;
    else cout << "NO" << endl;

}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;
using llong = long long;
const int MOD=1000000007;


int main(int argc, char**argv){
    int n;
    cin >> n;
    vector<llong> a(3*n);
    for(int i = 0; i < 3*n; i++) cin >> a[i];

    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());

    llong ans = 0;
    for (int i = 1; i <= 2*n - 1; i+=2){
        ans += a[i];
    }
    // for (int i = n; i < 2*n; i++){
    //     ans += a[i];
    // }
    cout << ans << endl;

    return 0;
}








Measured memory_bytes: 2560
#include  <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 1000000007
//P pa(114,514);   ,vector<P>vec(N,0);
//vector<vector<int>> vec(縦, vector<int>(横));
#define REP(i,N) for(int i=0;i<N;i++)
int gcd(int a, int b) {
    if(a>b){
        swap(a,b);
        }
    while(b%a!=0){
        b%=a;
        swap(a,b);
    }
    return a;
}
//cout << setprecision(123);
int main(){
  int N,s=0,ss=0,sss=0;
  cin>>N;
  vector<int>v(N);
  REP(i,N){
    cin>>v[i];
  s+=v[i];
  }
  
  REP(i,N){
    ss+=v[i];
    if(s-2*ss==0){
      cout<<0<<endl;
      break;
    }
    else if(s-2*ss<0){
      if(-s+2*ss>s-2*sss){
        cout<<s-2*sss<<endl;
        break;
      }
      else {
        cout<<-s+2*ss<<endl;
        break;
      }
    }
        
        
        
        sss=ss;
    }
}

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



int main(){
        int n, k,max,temp,num,total;
        while(true) {  //ベクターに格納
                cin >> n>>k;
                if(n==k!=0) break;
                vector<double> v;
                total=0;
                v.push_back(total);
                for(int i=0;i<n;i++){
                  cin>>num; //入力をnumに代入
                  total+=num;
                  v.push_back(total); //ベクターvにプッシュ
                }

                max=0;
                temp=0;
                for(int i=0; i+k<=n; i++) {
                        temp=v[i+k]-v[i];
                        if(temp>max) max=temp; //tempが最も大きい数値ならmaxを更新
                        temp=0; //tempの初帰化
                }
                cout<<max<<endl;
        }
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,k;
  cin >> a >> b >> k;
  if(b-a+1 < 2*k) {
    for(int i=a; i<=b; i++)
      cout << i << endl;
  } else {
    for(int i=a; i<=a+k-1; i++) {
      cout << i << endl;
    }
    for(int i=b-k+1; i<=b; i++) {
      cout << i << endl;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

struct Comparator {
  bool operator()(const int *l, const int *r) {
    return l[0] < r[0];
  }
};

using namespace std;

int main(int argc, char *argv[]) {
  while (true) {
    int n, m, a;
    cin >> n >> m >> a;
    if (n == 0 && m == 0 && a == 0)
      break;

    int tate[100];
    for (int i = 0; i < n; i++)
      tate[i] = i+1;

    vector<int*> yoko;
    for (int i = 0; i < m; i++) {
      int *line = new int[3];
      cin >> line[0] >> line[1] >> line[2];
      yoko.push_back(line);
    }
    struct Comparator comparator;
    sort(yoko.begin(), yoko.end(), comparator);

    for (int i = 0; i < yoko.size(); i++) {
      int p = yoko[i][1]-1, q = yoko[i][2]-1, tmp;
      tmp = tate[p];
      tate[p] = tate[q];
      tate[q] = tmp;
    }

    cout << tate[a-1] << endl;
    yoko.clear();
  }
  return 0;
}

Measured memory_bytes: 2480
import java.util.Scanner;

/**
 * Created by enpingkuang on 2020/9/10 11:18 下午
 */
public class Main {
    private static final int MOD = 1000000007;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        long ans = 0;
        long[] sum = new long[n+1];
        for(int i = 1;i<=n;i++){
            int tmp = scanner.nextInt();
            sum[i] = (sum[i-1] + tmp)%MOD;
            ans = (ans + (sum[i-1]*tmp) % MOD)%MOD;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 61920
#include <bits/stdc++.h>
using namespace std;
#define DEBUG 0
#define nl          '\n'
#define fori(n)			for(int i = 0; i < n; ++i) 
#define forj(n)			for(int j = 0; j < n; ++j)
#define fork(n)			for(int k = 0; k < n; ++k)
#define forl(n)			for(int l = 0; l < n; ++l)
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define ppb push_back
typedef long long ll;typedef pair<int,int> pii;typedef vector<bool> vbool;
typedef vector<int> vint;typedef vector<ll> vll;typedef long double ld;
typedef vector<vector<int>> vvi; typedef vector<vbool> vvb;

const ll N = 100010;
const ll INF = 0x3f3f3f3f;
const ll MOD = 1e9 + 7;
ll pow2(ll n, ll k) {
	if (n == 0) return 0;
	if (n == 1 || k == 0) return 1;
	if (k%2) return (n*(pow2(n, k-1)%MOD))%MOD;
	else {
		ll ans = pow2(n, k/2)%MOD;
		return (ans*ans)%MOD;
	}
}


ll choose(ll n, ll k) {
	ll ans = 1;
	fori(k) {
		ans *= (n - (k - (i+1)));
		ans %= MOD;
		ans *= pow2(i+1, MOD-2);
		ans %= MOD;
	}
	return ans%MOD;
}
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, a, b; cin >> n >> a >> b;
	ll ans = pow2(2, n) - 1 - choose(n, a) - choose(n, b);
	ans %= MOD;
	ans += MOD;
	ans %= MOD;
	cout << ans << nl;
	
	#if DEBUG
	cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << " s" << nl;
	#endif
	return 0;
}


Measured memory_bytes: 256
var
	A:Array[1..3,1..3]of Longint;
	N,b,i,j,k:Longint;
	c:Array[1..3,1..3]of Boolean;
begin
	for i:=1 to 3 do for j:=1 to 3 do read(A[i,j]);
	read(N);
	for k:=1 to N do begin
		read(b);
		for i:=1 to 3 do for j:=1 to 3 do if A[i,j]=b then C[i,j]:=True;
	end;
	if(C[1,1]and C[1,2]and C[1,3])or(C[2,1]and C[2,2]and C[2,3])or(C[3,1]and C[3,2]and C[3,3])or(C[1,1]and C[2,1]and C[3,1])or(C[1,2]and C[2,2]and C[3,2])or(C[1,3]and C[2,3]and C[3,3])or(C[1,1]and C[2,2]and C[3,3])or(C[3,1]and C[2,2]and C[1,3])then writeln('Yes')else writeln('No');
end.


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

  cin>>n;
  b=100;
  while(1)
  {
      t++;
      a=b*(1+.01);
      b=a;
      if(b>=n)
        break;
  }
  cout<<t<<endl;


  return 0;
}


Measured memory_bytes: 3588
use std::io::{stdin, BufRead};
use std::cmp;

fn main() {
    let stdin = stdin();
    let mut cin = stdin.lock();
    let n = {
        let mut buf = String::new();
        cin.read_line(&mut buf).unwrap();
        buf.trim().parse::<usize>().unwrap()
    };
    let mut lr = Vec::with_capacity(n);
    for _ in 0..n {
        let (l, r) = {
            let mut buf = String::new();
            cin.read_line(&mut buf).unwrap();
            let mut words = buf.split(' ');
            (
                words.next().unwrap().trim().parse::<i32>().unwrap(),
                words.next().unwrap().trim().parse::<i32>().unwrap(),
            )
        };
        lr.push((l, r));
    }
    lr.sort();
    
    let mut l_start = Vec::new();
    let mut l_end = Vec::new();
    let mut min = 2000000000;
    for &(l, r) in lr.iter() {
        l_start.push(l);
        min = cmp::min(min, r);
        l_end.push(min);
    }
    let mut r_start = vec![lr.last().unwrap().0; n];
    let mut r_end = Vec::new();
    let mut min = 2000000000;
    for &(_, r) in lr.iter().rev() {
        min = cmp::min(min, r);
        r_end.push(min);
    }
    r_start = r_start.iter().rev().map(|x| *x).collect::<Vec<_>>();
    r_end = r_end.iter().rev().map(|x| *x).collect::<Vec<_>>();

    let mut best = -1;
    for i in 1..n {
        let l_widht = cmp::max(0, l_end[i-1] - l_start[i-1] + 1);
        let r_widht = cmp::max(0, r_end[i] - r_start[i] + 1);
        best = cmp::max(best, l_widht + r_widht);
    }
    for i in 1..n-1 {
        let start = cmp::max(l_start[i-1], r_start[i+1]);
        let end = cmp::min(l_end[i-1], r_end[i+1]);
        let width = cmp::max(0, end - start + 1) + lr[i].1 - lr[i].0 + 1;
        best = cmp::max(best, width);
    }

    println!("{}", best);
}


Measured memory_bytes: 8444
;;(declaim (optimize (speed 0) (safety 3) (debug 3)))
#+sbcl (declaim (sb-ext:unmuffle-conditions sb-ext:compiler-note))
(declaim (optimize (speed 3) (safety 0) (debug 0)))

(princ (if (string= (read-line) "ABC")
	   "ARC"
	 "ABC"))


Measured memory_bytes: 24352
#include <iostream>
#include <vector>
#include <map>
#include <functional>
#include <cmath>
using namespace std;

int main(){
    int N, D;

    cin >> N >> D;

    int  X[N][D];

    for (size_t i = 0; i < N; i++)
    {
        for (size_t j = 0; j < D; j++)
        {
            cin >> X[i][j];
        }
    }

    int count =0;

    for (size_t i = 0; i < N; i++)
    {
        for (size_t j = i+1; j < N; j++)
        {
            double d=0;
            for (size_t k = 0; k < D; k++)
            {
                d += (X[i][k]-X[j][k])*((X[i][k]-X[j][k]));
            }
            double id = round(sqrt(d));
            if( abs(id*id -d)<0.1 ) count++; 
        }        
    }


    cout << count << endl << flush;

    return 0;
}


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

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    
    long long int h[N];
    vector<long long int> dp(N, 10000000000);
    dp[0]=0;
    for(int i=0; i<N; i++) {
        cin >> h[i];
        
        int k=min(i, K);
        for(int j=0; j<=k; j++) {
            dp[i] = min(dp[i], dp[i-j]+abs(h[i]-h[i-j]));
        }
    }
    
    cout << dp[N-1] << endl;

    return 0;
    
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <vector>
#include <iostream>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;


int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    string s;
    cin >> s;
    if (s=="Sunny"){
        cout << "Cloudy" << endl;
    }else if(s=="Cloudy"){
        cout << "Rainy" << endl;
    }else{
        cout << "Sunny" << endl;
    }
    return 0;
}


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

int main(){
    int k,s;
    cin >> k >> s;
    long long ans = 0;
    for(int i = 0; i <= k; i++){
        for(int j = 0; j <= k; j++){
            if(s-i-j <= k and s-i-j >= 0 ){
                ans++;
            }
        }
    }
    cout << ans << endl;
}

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


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

    string s; cin >> s;
    string ans = "";
    if(s == "Sunny") ans = "Cloudy";
    if(s == "Cloudy") ans = "Rainy";
    if(s == "Rainy") ans = "Sunny";
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
int main(void){
  int n,a,b;
  cin >> n >> a >> b;
  
  vector<int>p(n);
  for(int i=0;i<n;i++){
    cin >> p[i];
    if(p[i] <= a) p[i] = 1;
    else if(p[i] <= b) p[i] = 2;
    else p[i] = 3;
  }
  
  int s = 0;
  int t = 0;
  int u = 0;
  
  for(int i=0;i<n;i++){
    if(p[i] == 1) s++;
    if(p[i] == 2) t++;
    if(p[i] == 3) u++;
  }
  
  cout << min(min(s,t),u) << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

// http://noshi91.hatenablog.com/entry/2019/03/31/174006
template <uint_fast64_t Mod>
struct modint {
  using u64 = uint_fast64_t;

  u64 n;

  modint(const u64 x = 0) : n(x % Mod) {}
  modint operator+(const modint r) const { return modint(*this) += r; }
  modint operator-(const modint r) const { return modint(*this) -= r; }
  modint operator*(const modint r) const { return modint(*this) *= r; }
  modint operator/(const modint r) const { return modint(*this) /= r; }
  modint &operator+=(const modint r) {
    n += r.n;
    if (n >= Mod) n -= Mod;
    return *this;
  }
  modint &operator-=(const modint r) {
    if (n < r.n) n += Mod;
    n -= r.n;
    return *this;
  }
  modint &operator*=(const modint r) {
    n = n * r.n % Mod;
    return *this;
  }
  modint &operator/=(const modint r) {
    *this *= r.inv();
    return *this;
  }
  modint pow(u64 x) const {
    modint<Mod> ret(1), tmp(*this);
    while (x) {
      if (x&1) ret *= tmp;
      tmp *= tmp;
      x >>= 1;
    }
    return ret;
  }
  modint inv() const {
    return pow(Mod-2);
  }
};
constexpr ll mod = 1000000007;
using mint = modint<mod>;

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

  ll n;
  cin >> n;
  vector<mint> x(n);
  rep(i, n) {
    cin >> x[i].n;
  }

  mint ans(0);
  mint sum(0);
  rep(i, n-1) {
    sum += mint(i+1).inv();
    ans += (x[i+1]-x[i])*sum;
  }
  mint fac(1);
  rep(i, n-1) {
    fac *= mint(i+1);
  }
  ans *= fac;
  cout << ans.n << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5])
    {
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    switch(n % 10){
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
        cout << "hon" << endl;
        break;
    case 0:
    case 1:
    case 6:
    case 8:
        cout << "pon" << endl;
        break;
    case 3:
        cout << "bon" << endl;
        break;
    default:
        break;
    }
    return 0;
}


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

using namespace std;

int main()
{
  int N, T; cin >> N >> T;
  int c, t, ans = 1001;
  for (int i = 0; i < N; ++i) {
    cin >> c >> t;

    if (t <= T) {
      ans = min(c, ans);
    }
  }

  if (ans == 1001) {
    cout << "TLE";
  } else {
    cout << ans;
  }
}

Measured memory_bytes: 256
//#typedef int ll
// include
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <tuple>
// namespace
using namespace std;
// typedef
typedef long long ll;
typedef long double ld;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pint;
// const
const int inf = 1e9;
const ll mod = ((ll)1e9 + 7);
// loop
#define rep(i, n) for(ll i = 0, i##_mx = n; i < i##_mx; i++)
#define brep(i, b, e) for(ll i = b; i < e; i++)
#define erep(i, b, e) for(ll i = b; i <= e; i++)
#define rrep(i, b, e) for(ll i = b; i >= e; i--)
// STL
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(), (v).end()
// sort
#define vsort(v, b) sort(all(v), [](auto l, auto r){return (b);})
// access
#define gt(i, n) get<n>(i)
// debug
#define debug(x) cout << (#x) << ": " << x << endl;
// function
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);}
void prime(vll& v, ll n){brep(i, 2, n){bool fg = false; for(auto e : v){if(i % e == 0){fg = true;}} if(fg){continue;} v.pb(i);}}
void in(vint& v){for(auto& i : v){cin >> i;}}
void in(vll& v){for(auto& i : v){cin >> i;}}
ll egcd(ll a, ll b, ll& x, ll& y){if(b == 0){x = 1; y = 0; return a;} ll d = egcd(b, a % b, y, x); y -= a / b * x; return d;}

signed main(){
    int64_t a, b, k;
    cin >> a >> b >> k;
    
    if(a >= k){
        a -= k;
    }else if(a + b >= k){
        b -= (k - a);
        a = 0;
    }else{
        a = b = 0;
    }
    
    printf("%lld %lld\n", a, b);
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int s = Integer.parseInt(Integer.valueOf(A).toString() + Integer.valueOf(B).toString());
		int a = (int)Math.sqrt(s);
		if (a*a==s) System.out.println("Yes");
		else System.out.println("No");
	}
}


Measured memory_bytes: 21716
#include<iostream>

using namespace std;

int main(){
  int n, cnt = 1;
  cin >> n;

  int h[n];
  for(int i = 0; i < n; i++){
    cin >> h[i];
  }
  for(int i = 1; i < n; i++){
    for(int j = i; j >= 0; j--){
      if(h[i] < h[j]) break;
      if(j == 0) cnt++;
    }
  }

  cout << cnt << endl;
}


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

/*
  ll n , m ;
  cin >> n >> m ;
  ll a , b , c ;
  cin >> a >> b >> c ;
  vector<ll> A(n) ;
  cout << "Yes" << endl ;
  cout << "No"  << endl ;
*/

int main(){
  ll n ;
  cin >> n ;
  if( n >= 400 && n <= 599 )cout << 8 << endl ; 
  if( n >= 600 && n <= 799 )cout << 7 << endl ; 
  if( n >= 800 && n <= 999 )cout << 6 << endl ; 
  if( n >= 1000 && n <= 1199 )cout << 5  << endl ;
  if( n >= 1200 && n <= 1399 )cout << 4  << endl ;
  if( n >= 1400 && n <= 1599 )cout << 3 << endl ; 
  if( n >= 1600 && n <= 1799 )cout << 2 << endl ; 
  if( n >= 1800 && n <= 1999 )cout << 1 << endl ; 
}


Measured memory_bytes: 3616
#abc124 c
s=input()
ans1=0
ans2=0
for i in range(len(s)):
    if i%2==0:
        if s[i]=="1":
            ans1+=1
        else:
            ans2+=1
    else:
        if s[i]=="0":
            ans1+=1
        else:
            ans2+=1
ans=min(ans1,ans2)
print(ans)


Measured memory_bytes: 3188
// Problem : B - Magic 2
// Contest : AtCoder - M-SOLUTIONS Programming Contest 2020
// URL : https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'
int main()
{
	ll i,j,k,m,n,t,a,b,c;
	cin>>a>>b>>c;
	cin>>k;
	ll ctr=0;
	while(b<=a)
	{
		b*=2;
		ctr++;
	}
	while(c<=b)
	{
		c*=2;
		ctr++;
	}
//	cout<<ctr<<' ';
	if(ctr<=k)
	cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define OJ \
        freopen("input.txt","r",stdin); \
        freopen("output.txt","w",stdout);

int main()
{ 
   
//  OJ;
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
 string s;
 cin>>s;
 for(int i=0;i<3;i++)
 {
         cout<<s[i];
 }
}


Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
        int x,y;
        while(1){
                cin >> x >> y;
                if(x == 0 && y == 0)break;
                cout << min(x,y) << " " << max(x,y) << endl;
        }
        return 0;
}

Measured memory_bytes: 3052
#include <iostream>
using namespace std;
bool check(int x)
{
    int nr=x,nr2=0;
    while(nr)
        nr2=nr2*10+nr%10,nr/=10;
    if(nr2==x)
        return 1;
    return 0;
}
int main(){
     int a,b,z=0;
     cin>>a>>b;
     while(b>=a)
     {
         z+=check(b);
         --b;
     }
     cout<<z;
     return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>  
using namespace std;  
bool isprime(int n){  
    int m = sqrt(n);  
    for(int i = 2; i <= m; i++){  
        if(n % i == 0) return 0;  
    }  
    return 1;  
}  
int main()  
{  
    int n;  
    cin >> n;  
    int k = 11;  
    while(n){  
        if(isprime(k) && k % 10 == 1){  
            cout << k << ' ';  
            n--;  
        }  
        k += 10;  
    }  
    cout << endl;  
    return 0;  
}  

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <bits/stdc++.h>
#include <vector>
using namespace std;
using ll = long long int;
int main() {
  int n;
  cin>>n;
  vector<int> a(n+3);
  for (int i=0;i<n;i++) cin>>a.at(i);
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int bob=0;
  int alice=0;
  for (int i=0;i<n;i+=2){
	bob+=a.at(i+1);
	alice+=a.at(i);
  }
  cout << alice-bob;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define hell 1000000007
#define PI 3.14159265358979323846
#include <fstream>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--) {
      ll n,x,ti;
      cin>>n>>x>>ti;
      ll a=n/x;
      if(n%x)
        ++a;
      cout<<ti*a;
    }
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    i64 n;
    std::cin >> n;
    std::vector<i64> v { n };

    for (i64 i = 2; i * i <= n; i++) {
        i64 m = n;
        while (m % i == 0) m /= i;
        if (m % i == 1) v.push_back(i);
    }

    const i64 x = n - 1;
    for (i64 i = 1; i * i <= x; i++) {
        if (x % i) continue;
        const i64 k = x / i;
        if (n % k == 1) v.push_back(k);
    }

    std::sort(v.begin(), v.end());
    const int c = std::unique(v.begin(), v.end()) - v.begin();

    std::cout << c << std::endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())

def solve(x1, y1, x2, y2, n):
    if n == 0:
        return print(x1, y1)
    else:
        solve(x1, y1, (2 * x1 + x2) / 3, (2 * y1 + y2) / 3, n - 1)
        solve((2 * x1 + x2) / 3, (2 * y1 + y2) / 3, (x1 + x2) / 2 + (y1 - y2) * (3 ** (1 / 2)) / 6, (y1 + y2) / 2 + (x2 - x1) * (3 ** (1 / 2)) / 6, n - 1)
        solve((x1 + x2) / 2 + (y1 - y2) * (3 ** (1 / 2)) / 6, (y1 + y2) / 2 + (x2 - x1) * (3 ** (1 / 2)) / 6, (x1 + 2 * x2) / 3, (y1 + 2 * y2) / 3, n - 1)
        solve((x1 + 2 * x2) / 3, (y1 + 2 * y2) / 3, x2, y2, n - 1)

solve(0, 0, 100, 0, N)
print(100, 0)



Measured memory_bytes: 5712
/* author:hellojim */
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define m_p make_pair
#define re return
#define pb push_back
#define si set<int>
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
#define LLINF 0x3f3f3f3f3f3f3f3fLL
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll quickpower(ll n,ll k){
	ll ans=1;
	while(k){
		if(k%2){
			ans*=n;
			ans%=mod;
		}
		n*=n;
		n%=mod;
		k/=2;
	}
	return ans;
}
string int_to_string(int n)
{
	string s="";
	while(n)
	{
		int now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
int string_to_int(string s)
{
	int n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
int n;
ll ans=0;
ll a[200100];
ll pr[200100];
int main()
{
	ios::sync_with_stdio(0);
	//think twice,code once
	cin>>n;
	rep(i,n)cin>>a[i];
	pr[0]=a[0];
	forn(i,1,n-1)pr[i]=pr[i-1]+a[i];
	forn(i,1,n-1)ans=(ans+(pr[i-1]%mod*a[i]%mod))%mod;
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 6780
import Data.List
import Data.Ord

parsePair :: IO (Int, Int)
parsePair = do
    [a,b] <- (map read . words) <$> getLine
    return (a,b)

main = do
    (n,m) <- parsePair
    pairList <- sequence $ replicate n parsePair
    let sorted = sortBy (comparing fst) pairList
    print $ solve m 0 sorted


solve :: Int -> Int -> [(Int,Int)] -> Int
solve rest ac ((p,n):xs)
    | n >= rest     = (ac + p*rest)
    | otherwise     = solve (rest - n) (ac + p*n) xs

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n; cin>>n;
	vll a(n), cnt(n+1, 0), ans;
	rep(i, n) cin>>a[i];
	for(int i=n; i>=1; i--){
		if (cnt[i]%2 != a[i-1]){
			ans.pb(i);
		}else{
			continue;
		}
		int root = sqrt(i);
		cnt[1]++;
		for(int j=2; j<=root; j++){
			if (i % j == 0){
				cnt[j]++;
				if (j!=i/j) cnt[i/j]++;
			}
		}
	}

	cout << ans.size() << "\n";
	rep(i, ans.size()){
		if (i!=0) cout << " ";
		cout << ans[i];
	}
	if (ans.size()) cout << "\n";
	return 0;
}

Measured memory_bytes: 5108
#include<iostream>
#include<vector>
#include<stack>
#define MAX 100000
#define NIL -1
using namespace std;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r,int c)
{
  stack<int> s;
  s.push(r);
  color[r]=c;
  while(!s.empty())
    {
      int u=s.top(); s.pop();
      for(int i=0;i<G[u].size();i++)
	{
	  int v=G[u][i];
	  if(color[v]==NIL)
	    {
	      color[v]=c;
	      s.push(v);
	    }
	}
    }
}

void assign()
{
  int id=1;
  for(int i=0;i<n;i++) color[i]=NIL;
  for(int u=0;u<n;u++)
    {
      if(color[u]==NIL) dfs(u,id++);
    }
}

int main()
{
  int s,t,m,q;

  cin>>n>>m;

  for(int i=0;i<m;i++)
    {
      cin>>s>>t;
      G[s].push_back(t);
      G[t].push_back(s);
    }

  assign();

  cin >> q;

  for(int i=0;i<q;i++)
    {
      cin>>s>>t;
      if(color[s]==color[t])
	{
	  cout << "yes" << endl;
	}
      else
	{
	  cout << "no" <<endl;
	}
    }

  return 0;
}



Measured memory_bytes: 8920
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

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

int main(){
	int x[3]={0};
	cin>>x[0]>>x[1]>>x[2];
	if((x[0]&&x[1]&&!x[2])||(!x[0]&&!x[1]&&x[2])){
		cout <<"Open"<<endl;
	}else{
		cout <<"Close"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <string>

using namespace std;
int main(void){
    // Your code here!
    string s;cin >> s;

    if(s.size()==2){
        if(s[0]==s[1]) cout << 1<<" "<<2;
        else cout<<-1<<" "<<-1;
    }
    
    else{
        for(int i=0;i<s.size()-2;i++){
            if(s[i] == s[i+1] || s[i] == s[i+2] || s[i+1]==s[i+2]){
                cout << 1+i << " "<<3+i;
                return 0;
            }
        }
        cout << -1<<" "<<-1;
    }
    
    return 0;
    
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()

#define PI 3.14159265359

using namespace std;
typedef long long unsigned int ll;

int main() {
	int n;
	cin >> n;
	vector<int>x;
	REP(i, n) {
		int tmp;
		cin >> tmp;
		x.emplace_back(tmp);
	}
	sort(ALL(x));
	x.erase(std::unique(ALL(x)), x.end());
	if (x.size() == n)cout << "YES";
	else cout << "NO";
}

Measured memory_bytes: 1400
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define dup(x) x.erase(unique(x.begin(), x.end()),x.end())
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
// https://atcoder.jp/contests/abc170/tasks/abc170_c
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    bool isNone[200];
    memset(isNone, 0, sizeof(isNone));
    ll ans = 0;
    ll mn = 1e9+7;
    ll x,n;
    cin >> x >> n;
    vector<ll> v(n);
    for(int i = 0;i<n;i++){\
        cin >> v[i];
        isNone[v[i]] = true;
    }
    if(n == 0) ans = x;
    else{
        for(int i = 0;i<=101;i++){
            if(abs(x-i) < mn && !isNone[i]){
                mn = abs(x-i);
                ans = i;
            }
        }
    }
    cout << ans;

	return 0;
}

Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_3_C&lang=jp>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

struct Rectangle {
    ll h;
    ll p;  // position from left
};

ll max_area_of_histgram(ll n, vector<ll>& height) {
    stack<Rectangle> S;
    ll maxv = 0;
    
    for (int i = 0; i <= n; i++) {
        Rectangle rect;
        rect.h = height[i];
        rect.p = i;
        
        if (S.empty()) {
            S.push(rect);
        }
        else if (S.top().h < rect.h) {
            S.push(rect);
        }
        else if (S.top().h > rect.h) {
            ll now = i;
            while ((!S.empty()) && (S.top().h >= rect.h)) {
                Rectangle pre = S.top(); S.pop();
                ll area = 1LL * pre.h * (i - pre.p);
                maxv = max(maxv, area);
                now = pre.p;
            }
            rect.p = now;
            S.push(rect);
        }
    }
    return maxv;
}

ll solve(){
    ll N; cin >> N;
    vector<ll> dp(N,0); for(auto& in:dp) cin >> in;
    dp.push_back(0);
    return max_area_of_histgram(N, dp);
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}



Measured memory_bytes: 5396
N = int(input())
S = input()
from collections import deque

def f(m):
    se = set()
    q = deque()
    for i in range(0,N-m+1):
        h = hash(S[i:i+m])
        q.append(h)
        if h in se:
            return True
        if len(q) >= m:
            se.add(q.popleft())
    return False

l = 0
r = N//2+1
while (r-l)>1:
    mid = (r+l)//2
    if f(mid):
        l = mid
    else:
        r = mid
print(l)

Measured memory_bytes: 3712
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<string> S(n);
	for (int i = 0; i < n; i++)
	{
		cin >> S[i];
	}
	int cNum[26] = {};
	for (int j = 0; j < 26; j++)
	{
		cNum[j] = 50;
	}
	for (int i = 0; i < n; i++)
	{
		int tNum[26] = { 0 };
		for (int j = 0; j < S[i].length(); j++)
		{
			tNum[(int)(S[i][j] - 'a')]++;
		}
		for (int j = 0; j < 26; j++)
		{
			cNum[j] = min(cNum[j], tNum[j]);
		}
	}


	string ans = "";
	for (int i = 0; i < 26; i++)
	{
		string s(cNum[i], char('a' + i));
		ans += s;
	}

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>

//解説見た
using namespace std;

int main()
{
  unsigned int H,N;
  cin>>H>>N;
  vector<unsigned int> v;
  unsigned int k;
  for(int i=0;i<N;i++)
  {
    cin>>k;
    v.push_back(k);
  }

  string s=(H<=accumulate(v.begin(),v.end(),0)) ? "Yes":"No";
  cout<<s<<endl;

  return 0;
}

Measured memory_bytes: 892
#include<iostream>
#include<cstdio>
using namespace std;
const int MOD=1000003;
int Q;
long long ksm(long long a,long long b)
{
	long long res=1;
	while(b)
	{
		if(b&1) res=res*a%MOD;
		a=a*a%MOD,b>>=1;
	}
	return res;
}
long long fac[MOD],inv[MOD];
void init(int n=1000002)
{
	fac[0]=1;
	for(int i=1;i<=n;i++)
		fac[i]=fac[i-1]*i%MOD;
	inv[n]=ksm(fac[n],MOD-2);
	for(int i=n;i>=1;i--)
		inv[i-1]=inv[i]*i%MOD;
	return;
}
void solve()
{
	int x,d,n;
	scanf("%d%d%d",&x,&d,&n);
	if(d==0)
	{
		printf("%lld\n",ksm(x,n));
		return;
	}
	x=x*ksm(d,MOD-2)%MOD;
	if(x==0||x+n-1>=MOD)
	{
		printf("0\n");
		return;
	}
	long long ans=fac[x+n-1]*inv[x-1]%MOD;
	printf("%lld\n",ans*ksm(d,n)%MOD);
	return;
}
int main()
{
	init();
	scanf("%d",&Q);
	while(Q--)
		solve();
	return 0;
}

Measured memory_bytes: 19468