akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 300010
using namespace std;
struct node{
	int l,r;
	bool operator <(const node a)const{return r-l<a.r-a.l;}
}p[N];
int tree[N<<2];
inline int lowbit(int x){return x&(-x);}
void insert(int u,int v){for(;u<N<<2;u+=lowbit(u)) tree[u]+=v;}
int answer(int u){int ans=0;for(;u;u-=lowbit(u)) ans+=tree[u];return ans;}
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%d%d",&p[i].l,&p[i].r),p[i].l++,p[i].r++;
	sort(p+1,p+n+1);
	int u=1;
	for(int i=1;i<=m;i++)
	{
		while(p[u].r-p[u].l+1<i && u<=n)
		{
			insert(p[u].l,1);
			insert(p[u].r+1,-1);
			u++;
		}
		int ans=n-u+1;
		for(int j=0;j<=m;j+=i) ans+=answer(j+1);
		printf("%d\n",ans);
	}
	return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_h(const vector<T>& c, int n=INT_MAX)
{ rep(i, min(n, (int)c.size())) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define D1(a) cout<<#a<<":"<<a<<"\n"
#define D2(a,b) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<endl 
#define D3(a,b,c) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c <<endl
#define D4(a,b,c,d) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c<<","<<#d<<":"<<d<<endl 
#define MOD 1000000007

int main()
{
    string s; cin >> s;
    
    int ans = 0;
    int l = 0, r = s.size()-1;
    while (l < r) {
        if (s[l] == 'x') {
            if (s[r] == 'x') {
                l++;
                r--;
            } else {
                ans++;
                l++;
            }
        } else {
            if (s[r] == 'x') {
                ans++;
                r--;
            } else {
                if (s[l] == s[r]) {
                    l++;
                    r--;
                } else {
                    ans = -1;
                    break;
                }
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>

class WP {
public:
	std::string word;
	int page;
public:
	WP() {
		this->word = "";
		this->page = 0;
	}
	WP( std::string word, int page ) {
		this->word = word;
		this->page = page;
	}
	bool operator>=(const WP& rhs) {
		if (this->word.compare(rhs.word) > 0) return true;
		else if (this->word.compare(rhs.word) < 0) return false;
		else {
			return (this->page >= rhs.page);
		}
	}
	bool operator>(const WP& rhs) {
		if (this->word.compare(rhs.word) > 0) return true;
		else if (this->word.compare(rhs.word) < 0) return false;
		else {
			return (this->page > rhs.page);
		}
	}
	bool operator<=(const WP& rhs) {
		if (this->word.compare(rhs.word) < 0) return true;
		else if (this->word.compare(rhs.word) > 0) return false;
		else {
			return (this->page <= rhs.page);
		}
	}
	bool operator<(const WP& rhs) {
		if (this->word.compare(rhs.word) < 0) return true;
		else if (this->word.compare(rhs.word) > 0) return false;
		else {
			return (this->page < rhs.page);
		}
	}
	bool operator==(const WP& rhs) {
		if (this->word.compare(rhs.word) != 0) return false;
		else {
			return (this->page == rhs.page);
		}
	}
	bool operator!=(const WP& rhs) {
		if (this->word.compare(rhs.word) != 0) return true;
		else {
			return (this->page != rhs.page);
		}
	}
	~WP() {}
};

int main()
{
	WP words_list[100];
	std::string word;
	int page;
	int input_size = 0;
	while (std::cin >> word >> page) {
		words_list[input_size] = WP(word, page);
		input_size++;
	}
	
	std::sort(words_list, words_list + input_size);
	
	for (int i=0; i<input_size; i++) {
		std::cout << words_list[i].word << std::endl;
		std::cout << words_list[i].page;
		while (words_list[i].word == words_list[i+1].word) {
			i++;
			std::cout << " " << words_list[i].page;
		}
		std::cout << std::endl;
	}

	return 0;
}




Measured memory_bytes: 3212
import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs= sys.stdin.buffer.readlines
#rstrip().decode('utf-8')

#import numpy as np
#import operator
import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
#from scipy.sparse import csr_matrix
#from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra
#sys.setrecursionlimit(10**7)

#map(int,input().split())

def main():
    X=int(input())
    li=[i*(i+1)//2 for i in range(10**5) if i*(i+1)//2<10**9]
    print(bisect.bisect_left(li,X))


if __name__ == '__main__':
    main()

Measured memory_bytes: 4848
# -*- coding: utf-8 -*-
from sys import stdin
# import numpy as np
# import sys
# sys.setrecursionlimit(10**4)

def _li(): return list(map(int, stdin.readline().split()))
def _li_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def _lf(): return list(map(float, stdin.readline().split()))
def _ls(): return stdin.readline().split()
def _i(): return int(stdin.readline())
def _f(): return float(stdin.readline())
def _s(): return stdin.readline()[:-1]


S = _s()[::-1]

flag = True
while True:
    if S.startswith('res') and S[:6] == 'eraser'[::-1]:
        S = S[6:]
    elif S.startswith('es') and S[:5] == 'erase'[::-1]:
        S = S[5:]
    elif S.startswith('rem') and S[:7] == 'dreamer'[::-1]:
        S = S[7:]
    elif S.startswith('ma') and S[:5] == 'dream'[::-1]:
        S = S[5:]
    else:
        flag = False
        break

    if len(S) == 0:
        break

if flag:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3188
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int dp[1000000][3];
int main()
{
     int a,b,c,flag=0,ans=0;
     scanf("%d %d %d",&a,&b,&c);
     while(1)
     {int ln=0;
         if(a%2==1||b%2==1||c%2==1)
         {
             printf("%d",flag);
             break;
         }
         int x,y,z;
         x=b/2+c/2;
         y=a/2+c/2;
         z=a/2+b/2;
         a=x;
         b=y;
         c=z;
         for(int i=0;i<ans;i++)
         {
             if(a==dp[i][0]&&b==dp[i][1]&&c==dp[i][2])
             {
                 ln=2;
                 break;
             }
         }
         if(ln==2)
         {
            printf("-1");
            break;
         }
         dp[ans][0]=a;
         dp[ans][1]=b;
         dp[ans][2]=c;
         ans++;
         flag++;
     }


}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#ifdef DEBUG
#define line() cout << "[" << __LINE__ << "] ";
#define dump(i) cout << #i ": " << i << " ";
#define dumpl(i) cout << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

typedef string::const_iterator State;
class ParseError
{
};

int main(int argc, char const *argv[])
{
    int n;
    int st = 0;
    cin >> n;
    bool ok = true;
    rep(i, n)
    {
        string s;
        cin >> s;
        if (s == "A")
        {
            st++;
        }
        else
        {
            st--;
        }
        if (st < 0)
        {
            ok = false;
        }
    }
    if (ok && st == 0)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}



Measured memory_bytes: 3164
#include <stdio.h>
#include <stdlib.h>

int main()
{
  long long int i,n,A1[100005],A[100005];
    scanf("%lld",&n);
    for(i=0;i<n;i++){
        scanf("%lld",&A[i]);

        A1[A[i]-1]=i+1;
    }
    for(i=0;i<n;i++)
    {
        printf("%lld",A1[i]);
        if(i==n-1)
        {
            break;
        }
        else
        {
            printf(" ");
        }
    }


    return 0;
}


Measured memory_bytes: 2304
/**
 * auther: moririn_cocoa
 */
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_)

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define fi first
#define se second

int main(int argc, char* argv[]) {
  
  int N;
  
  cin >> N;
  
  if ( N < 15 ) {
    
    cout << N * 800 << endl;
  }
  
  else if ( 15 <= N && N < 30 ) {
    
    cout << N * 800 - 200 << endl;
  }
  
  else if ( 30 <= N && N < 45 ) {
    
    cout << N * 800 - 400 << endl;
  }
  
  else if ( 45 <= N && N < 60 ) {
    
    cout << N * 800 - 600 << endl;
  }
  
  else if ( 60 <= N && N < 75 ) {
    
    cout << N * 800 - 800 << endl;
  }
  
  else if ( 75 <= N && N < 90 ) {
    
    cout << N * 800 - 1000 << endl;
  }
  
  else {
    
    cout << N * 800 - 1200 << endl;
  }
    
    return 0;
}


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

int main(){
    int N; cin >> N;
    vector<int> P(N, -1);
    for(int i=0; i<N; i++){
        int p; cin >> p;
        P[i] = p;
    }
    vector<int> sorted(N, -1);
    sorted = P;
    sort(sorted.begin(), sorted.end());
    int counter = 0;
    for(int i=0; i<N; i++){
        if(P[i] != sorted[i]){
            counter++;
        }
    }
    if(counter <= 2){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
n = int(input())
list_A = list(map(int, input().split()))
ans = pow(10, 10)
for num in range(-100, 101):
    list_B = list(map(lambda x:(x-num)**2, list_A))
    sum_value = sum(list_B)
    if ans > sum_value:
        ans = sum_value

print(ans)


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

int read(){
    int x=0;bool f=0;char c=getchar();
    while(c<'0'||c>'9') f|=c=='-',c=getchar();
    while(c>='0'&&c<='9') x=x*10+(c^48),c=getchar();
    return f?-x:x;
}

#define MAXN 200000
vector<char> S;
char str[MAXN+5];

int main(){
    //freopen("noodle.in" ,"r", stdin);
    //freopen("noodle.out","w",stdout);
    scanf("%s",str+1);
    long long Ans=0;
    int N=strlen(str+1);
    for(int i=1;i<=N;i++){
        if(str[i]=='B'&&str[i+1]=='C')
            S.push_back('D'),i++;
        else
            S.push_back(str[i]);
    }
    N=S.size();
    //for(int i=0;i<N;i++)
    //    putchar(S[i]);
    int i=0;
    while(i<N){
        long long cnt1=0,cnt2=0;
        while(i<N&&S[i]!='A'&&S[i]!='D')
            i++;
        while(i<N&&(S[i]=='A'||S[i]=='D')){
            if(S[i]=='A')
                cnt1++,i++;
            else{
                cnt2=0;
                while(i<N&&S[i]=='D')
                    cnt2++,i++;
                Ans+=cnt1*cnt2;
            }
        }
    }
    printf("%lld",Ans);
}



Measured memory_bytes: 768
#include<bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

typedef pair<int,int>pi;
typedef vector<int>vi;

const int MAXN=100005;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())

main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int N;cin>>N;
	int A[]={2,4,5,7,9};
	FOR(i,0,4) {
		if (N%10 == A[i]) {
			cout<<"hon";
			exit(0);
		}
	}
	if (N%10==3) cout<<"bon";
	else cout<<"pon";
}


Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <string>
 
using namespace std;
 
int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	
	int ans=0;
	for(int i=1;i<n;i++){
		int cnt=0;
		
		for(char c='a';c<='z';c++){
			bool left=false,right=false;
			
			for(int j=0;j<i;j++)
				if(s[j]==c)
					left=true;
			
			for(int j=i;j<n;j++)
				if(s[j]==c)
					right=true;
			
			if(left&&right)
				cnt++;
		}
		
		if(ans<cnt)
			ans=cnt;
	}
	
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#define rep(i, n) for (int i=0; i<n; i++)
#define ll long long
using namespace std;

void print(int *A, int N) {
    rep(i, N) {
        if (i > 0) cout << " ";
        cout << A[i];
    }
    cout << "\n";
}

void bubbleSort(int *A, int N) {
    int flag = 1;
    int count = 0;
    while (flag) {
        flag = 0;
        for (int j = N-1; j > 0; j--) {
            if (A[j] < A[j-1]) {
                int tmp = A[j];
                A[j] = A[j-1];
                A[j-1] = tmp;
                flag = 1;
                count++;
            }
        }
    }
    print(A, N);
    cout << count << endl;
}

int main() {
    int N;
    cin >> N;
    int A[N];
    rep(i, N) {
        cin >> A[i];
    }
    bubbleSort(A, N);
}


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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  string s;
  cin >> s;
  int i;
  int n = s.size();
  string not_x = "";
  rep(i,n)
  {
    if(s[i] != 'x') not_x += s[i];
  }
  string rev_nx = not_x;
  reverse(all(rev_nx));
  if(rev_nx != not_x) cout << -1 << endl;
  else
  {
    int m = not_x.size();
    vector<int> adds(m+1,0);
    int next = 0;
    rep(i,n)
    {
      if(s[i] == not_x[next])
      {
        next++;
      }
      else
      {
        adds[next]++;
      }
    }
    int ans = 0;
    rep(i,m/2+1)
    {
      ans += 2*max(adds[i], adds[m-i]);
      ans -= (adds[i] + adds[m-i]);
    }
    cout << ans << endl;
  }
  
}



Measured memory_bytes: 1024
n=int(input())
ans=[0]*n
for x in range(1,101):
  for z in range(1,101):
    for y in range(1,101):
      a=(x+y+z)**2-(x*y+y*z+z*x)
      if a<=n:
          ans[a-1]+=1
for i in ans:
  print(i)

Measured memory_bytes: 9108
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);
const long double PI=3.14159265358979;

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    READV(A);
    READV(B);
    cout<<A*B<<endl;

//-----------------------------------------------------------------------------------------------------------//


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

Measured memory_bytes: 3756
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

ll D[200010], T[200010];
int main()
{
	ll N, A, B;
	cin >> N >> A >> B;
	if (A > B)cout << 0;
	else if (N == 1 && A != B) cout << 0;
	else if (A == B) cout << 1;
	else cout << (B - A + 1) + (N - 3) * (B - A) << endl;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
sum_left,sum_right=a[0],sum(a)-a[0]
mi=abs(sum_left-sum_right)
for i in range(1,n-1):
    sum_left+=a[i]
    sum_right-=a[i]
    if abs(sum_left-sum_right)<mi: mi=abs(sum_left-sum_right)
print(mi)

Measured memory_bytes: 76752
import numpy as np
n=int(input())
s=input()
s_int=[0 if x=="." else 1 for x in s]
ruiseki=np.cumsum([0,]+s_int)
 
#print(s_int,ruiseki)
res=float("inf")
for i in range(n+1):
  #print("左黒",ruiseki[i],"右白",(n-i-(ruiseki[-1]-ruiseki[i])),"計",n-i-ruiseki[-1]+2*ruiseki[i])
  res=min(n-i-ruiseki[-1]+2*ruiseki[i],res)
print(res)

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

struct P{
  int x,y;
  long long z;
  bool operator <(const P &a){
    return x<a.x;
  }
};

int a,b,c,d,i,k,n,m,e,dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1};
int o[404111];
int l[404111];

long long x,y,z,mod=1000000007;
string r;
//char r[1];
vector<int> v[1];
queue<int> q;
map<int,int> p;

int main()
{
  scanf("%d",&a);
  b=(1<<a);
  for(int t=0;t<b;t++)
    //o[t]=1;
    scanf("%d",&o[t]);
  l[1]=o[0]+o[1];
  for(int t=2;t<b;t++)
  {
    n=o[0],m=0;
    for(int i=t;i>0;i--,i=(i&t))
      if(n<o[i]) m=n,n=o[i];
      else m=max(m,o[i]);
    l[t]=max(n+m,l[t-1]);
  }
  for(int t=1;t<b;t++)
    printf("%d\n",l[t]);
}



Measured memory_bytes: 5120
n = int(input())
h = list(map(int, input().split()))
t = 0
m = 0
for i in range(n):
    if h[i] > t:
        t = h[i]
    elif t - h[i] >= 2:
        print("No")
        m += 1
        break
if m == 0:
    print("Yes")

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

int main(){
	int n,m,x[10001],y[10001],c;
	bool tomo[600][600],party[600][2];
	while(true){
		memset(tomo,false,sizeof(tomo));
		memset(party,false,sizeof(party));
		cin>>n;
		cin>>m;
		c=0;
		if(n==0 && m==0){
			break;
		}
		for(int i=0;i<m;i++){
			cin>>x[i]>>y[i];
			tomo[x[i]][y[i]]=true;
			tomo[y[i]][x[i]]=true;
		}
		for(int i=2;i<=n;i++){
			if(tomo[1][i]==true){
				party[i][0]=true;
			}
		}
		for(int i=2;i<=n;i++){
			if(party[i][0]==true){
				for(int j=2;j<=n;j++){
					if(tomo[i][j]==true){
						party[j][1]=true;
					}
				}
			}
		}
		for(int i=2;i<=n;i++){
			if(party[i][0]==true || party[i][1]==true){
				c++;
			}
		}
		cout<<c<<endl;
	}
	return 0;
}

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

string s;
int main() {
	cin>>s;
	sort(s.begin(), s.end());
	if(s[0]==s[1] && s[1]!=s[2] && s[2]==s[3]) puts("Yes");
	else puts("No");
	return 0;
}


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

#define fs first
#define sc second

ll MOD = 1e9 + 7;

//a^b % MOD
ll powmod(ll a, ll b){
    ll ret = 1;
    ll c = a;
    while(b > 0){
        if(b % 2 == 1){
            ret *= c;
            ret %= MOD;
        }

        c = (c * c) % MOD;
        b /= 2;
    }

    return ret;
}


ll modinv(ll a, ll mod){
    //a^-1 = a^(mod-2)

    ll ret = 1;
    for(int i = 0; i < 40; i++){
        if((mod - 2) & (1LL << i)){
            ret = ret * a % mod;
        }
        a = a * a % mod;
    }

    return ret;
}

int main() {
    int N, a, b;
    cin >> N >> a >> b;

    //nCa
    ll nca = 1, ncb = 1;
    for(int i = 0; i < a; i++) {
        nca *= (N - i);
        nca %= MOD;
        nca *= modinv(i + 1, MOD);
        nca %= MOD;
    }

    for(int i = 0; i < b; i++) {
        ncb *= (N - i);
        ncb %= MOD;
        ncb *= modinv(i + 1, MOD);
        ncb %= MOD;
    }

    ll ans = powmod(2, N) - nca - ncb - 1;
    ans += 10 * MOD;
    ans %= MOD;

    cout << ans << endl;
    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[] poll = getIntArray(sc);

		if (poll[1] - poll[0] == poll[2] - poll[1]) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をlongで返却
	 *
	 * @return
	 */
	public static long getLong(Scanner sc) {

		return Long.parseLong(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をintで返却
	 *
	 * @return
	 */
	public static int getInt(Scanner sc) {

		return Integer.parseInt(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をStringで返却
	 *
	 * @return
	 */
	public static String getString(Scanner sc) {

		return sc.next();
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をint配列で返却
	 *
	 * @return
	 */
	public static int[] getIntArray(Scanner sc) {
		String line = "";
		// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策
		while (line.equals("")) {
			line = sc.nextLine();
		}

		String[] strArray = line.split(" ");
		int[] intArray = new int[strArray.length];
		for (int i = 0; i < strArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}


Measured memory_bytes: 22868
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var answer = 0;
            for (var i = 0; i < N; i++)
            {
                var lr = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
                answer += lr[1] - lr[0] + 1;
            }
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 28536
N = int(input())
S = [list(input().split()) for i in range(N)]
X = input()

SleepingTime = 0

for i in range(N):
  if S[i][0] == X:
    for j in range(i+1, N):
      SleepingTime += int(S[j][1])

print(SleepingTime)

Measured memory_bytes: 3060
S = input()
li = list(S)
count = 0
re_num = 0
for num in range(3):
    if li[num] == "R" :
        count = count + 1

if count == 0 :
    re_num = 0
elif count == 1 :
    re_num = 1
elif count == 2 and li[1] == "S" :
    re_num = 1
elif count == 2 and li[1] == "R" :
    re_num = 2
else :
    re_num = 3

print(re_num)

Measured memory_bytes: 9004
// B - Even Degrees
#include <bits/stdc++.h>

using namespace std;

vector<vector<int> > g;
vector<int> deg, dep;
vector<pair<int, int> > ans;

void dfs(int u, int par)
{
	for (int i = 0; i < g[u].size(); i++) {
		int v = g[u][i];
		if (dep[v] < 0) {
			dep[v] = dep[u] + 1;
			dfs(v, u);
		} else {
			if (dep[v] > dep[u]) {
				ans.push_back(make_pair(u, v));
				deg[u]++;
			}
		}
	}
	if (deg[u] % 2 == 1) {
		ans.push_back(make_pair(u, par));
		deg[u]++;
	} else if (par >= 0) {
		ans.push_back(make_pair(par, u));
		deg[par]++;
	}
}

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false); cin.tie(0);

	int n, m;
	cin >> n >> m;
	g.resize(n);
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}

	if (m % 2) {
		cout << -1 << '\n';
	} else {
		deg.assign(n, 0);
		dep.assign(n, -1);
		dep[0] = 0;
		dfs(0, -1);
		for (int i = 0; i < ans.size(); i++)
			cout << ans[i].first + 1 << ' ' << ans[i].second + 1 << '\n';
	}

	return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N;
  cin >> N;

  vector<PII> xs(N);
  REP(i,N){
	char c;
	cin >> c >> xs[i].FF;
	xs[i].SS = c == 'y';
  }

  function<int(int,int,int)> dfs = [&](int l, int r, int ub){
	if(l >= r) return 0;
	int res = 0;
	int h = -1, k = -1, n = 0, m = 0;
	for(int i=l;i<r;++i){
	  if(xs[i].FF >= ub) continue;
	  if(xs[i].SS == 0){
		++n;
		if(h < xs[i].FF){
		  h = xs[i].FF;
		  k = i;
		}
	  }
	  else ++m;
	}
	if(n == 0 || m == 0){
	  return m? 1: 0;
	}

	int lg = 0, rg = 0;
	FOR(i,l,k){
	  if(xs[i].SS && h < xs[i].FF && xs[i].FF < ub){
		++lg;
		break;
	  }
	}
	FOR(i,k+1,r){
	  if(xs[i].SS && h < xs[i].FF && xs[i].FF < ub){
		++rg;
		break;
	  }
	}
	if(lg && rg){
	  res += min(dfs(l, k, h+1) + dfs(k+1, r, h+1) + 1,
				 dfs(l, k, ub) + dfs(k+1, r, ub));
	}
	else{
	  res += dfs(l, k, ub) + dfs(k+1, r, ub);
	}

	return res;
  };

  cout << dfs(0, N, 1e9) << endl;

  return 0;
}

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

int main() {
  int A, B, K;
  cin >> A >> B >> K;
  unordered_set<int> s0;
  for (int i = A; i <= B; ++i) {
    if (i <= A + (K - 1) || B - (K - 1) <= i) {
      s0.insert(i);
    } else {
      i = B - (K - 1) - 1;
    }
  }
  vector<int> v0(s0.begin(), s0.end());
  sort(v0.begin(), v0.end());
  for (const auto& x : v0) cout << x << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;

int main() {
  //
  int n;
  cin >> n;
  int sum = 0;
  vi s(n);
  rep(i, n) {
    cin >> s[i];
    sum += s[i];
  }
  sort(ALL(s));
  if (sum % 10) {
    cout << sum << endl;
    return 0;
  } else {
    rep(i, n) {
      if (s[i] % 10) {
        cout << sum - s[i] << endl;
        return 0;
      }
    }
  }
  cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 888
#include"bits/stdc++.h"

#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)

using namespace std;
using ll = long long;
using pos = pair<ll, ll>;

vector<ll> c;
string s;

void solve();

int main() {

   solve();
   return 0;

}

void solve() {

	c.resize(26);
	for(auto& x:c){
		x=0;
	}
	cin >> s;

	REP(i,s.size()){
		c[s[i]-'a']++;
	}
bool found=false;

	REP(i,c.size()){
		if(c[i]==0){
			cout << (char)(i+'a') << endl;
			found=true;
			break;
		}
	}
	if(!found){cout << "None" << endl;}

}

Measured memory_bytes: 512
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
     
using namespace std;
     
typedef long long ll;
typedef pair<int, int> pii;
     
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
     
mt19937 rnd(chrono::steady_clock().now().time_since_epoch().count());

const int N = (int)2e5 + 9;
int L[N], R[N];
int p[N];

int main(){
    fastIO;
    int n;
    cin >> n;
    for(int i = 1 ; i <= n ; i ++ ){
        cin >> p[i];
        L[i] = 0;
        R[i] = n + 1;
    }
    vector<int> vt;
    for(int i = 1; i <= n; i ++ ){
        while(!vt.empty() && p[vt.back()] >= p[i]){
            vt.pop_back();
        }
        if(!vt.empty())
            L[i] = vt.back();
        vt.push_back(i);
    }
    vt.clear();
    for(int i = n; i >= 1; i -- ){
        while(!vt.empty() && p[vt.back()] >= p[i]){
            vt.pop_back();
        }
        if(!vt.empty())
            R[i] = vt.back();
        vt.push_back(i);
    }
    ll cl, cr;
    ll res = 0;
    for(int i = 1; i <= n; i ++ ){
        cl = i - L[i];
        cr = R[i] - i;
        res += p[i] * 1ll * cl * 1ll * cr ;
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 3832
#include <iostream>
#include <vector>
#include <map>
using ll = long long;

int n, a;
ll sum;
std::map<ll, ll> m;
std::vector<ll> vec;

int main() {
    std::cin >> n;
    vec.assign(n, 0);
    for (int i = 0; i < n; i++) {
        std::cin >> a;
        vec[i] = a;
        m[a]++;
    }
    
    for (auto &r: m) {
        sum += r.second * (r.second-1) / 2;
    }
    for (int i = 0; i < n; i++) {
        ll u = m[vec[i]];
        ll p = (sum-(u*(u-1)/2));
        u--;
        ll x = p + (u*(u-1)/2);
        std::cout << x << std::endl;
        
        
    }
}


Measured memory_bytes: 12800
n, m, q = map(int, input().split())
mat = [[0]*(n+1) for _ in range(n+1)]
for _ in range(m):
    l, r = map(int, input().split())
    mat[l][r] += 1

for i in range(n+1):
    for j in range(n+1):
        mat[i][j] += mat[i-1][j]
        mat[i][j] += mat[i][j-1]
        mat[i][j] -= mat[i-1][j-1]
ans = 0
for _ in range(q):
    l, r = map(int, input().split())
    print(mat[r][r]-mat[r][l-1]-mat[l-1][r]+mat[l-1][l-1])


Measured memory_bytes: 78028
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
long nCr(int n, int r) {
	int ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};

signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b + c > 21)cout << "bust" << endl;
	else cout << "win" << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class104
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            long[] start = new long[N];
            long[] end = new long[N];
            for(int i = 0; i < N; i++)
            {
                var XL = Console.ReadLine().Split().Select(long.Parse).ToArray();
                start[i] = XL[0] - XL[1];
                end[i] = XL[0] + XL[1];
            }
            Array.Sort(end, start);
            long now = int.MinValue;
            int count = 0;
            for(int i = 0; i < N; i++)
            {
                if (start[i] >= now)
                {
                    now = end[i];
                    count++;
                }
            }
            Console.WriteLine(count);
        }
    }
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


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

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

using namespace std;

int main(void) {

	int N, K;

	cin >> N >> K;

	if (K == 1) { cout << 0 << endl; }
	else {
		cout << N - (K - 1) - 1 << endl;
	}


	return 0;
}

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

#define rep(i,a,n) for (int i = a;i<=n;++i)
#define per(i,a,n) for (int i = n;i>=a;--i)
#define all(x) (x).begin(), (x).end()     
#define SZ(x) ((int)x.size())

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

mt19937 mrand(random_device{}());
ll rnd(ll a, ll b) { return a + mrand() % (b - a + 1); }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

const int N = 2510;
ll a[N];
ll dp[N][N];
int n;
pll x[N];

int main() {
      ios::sync_with_stdio(false); cin.tie(0);
#ifdef arrias
      freopen("a.txt", "r", stdin);
#endif
      cin >> n;
      rep(i, 1, n) cin >> a[i];

      rep(i, 0, n - 1) {
            x[i] = { a[i + 1], i + 1 };
      }
      sort(x, x + n);
      reverse(x, x + n);

      rep(r, 1, n) {
            per(l, 1, r) {
                  int num = n - r + l - 1;
                  dp[l][r] = max(dp[l + 1][r] + abs(l - x[num].second) * x[num].first, dp[l][r - 1] + abs(r - x[num].second) * x[num].first);
            }
      }
      cout << dp[1][n] << "\n";
      return 0;
}

Measured memory_bytes: 27344
# https://atcoder.jp/contests/abc061/tasks/abc061_c
from collections import defaultdict

n, k = [int(i) for i in input().split()]
d = defaultdict(int)

for _ in range(n):
    a, b = [int(i) for i in input().split()]
    d[a] += b

array = sorted(d.items(), key=lambda x: x[0])
for num, count in array:
    if k > count:
        k -= count
    else:
        print(num)
        quit()


Measured memory_bytes: 89072
index = 0
table_cases = []
while buf = gets.to_i
  break if buf == 0
  table = Array.new(buf) do
    Array.new(buf, 0)
  end
  buf.times do |x|
    buf.times do |y|
      if buf > x + y
        table[x][y] = 1 + (x + y + 1) % 2 * ((x + y + 1) * (x + y) / 2 + y) + (x + y + 2) % 2 * ((x + y + 1) * (x + y) / 2 + x)
      else
        table[x][y] = buf ** 2 - (x + y + 1) % 2 * ((buf * 2 - (x + y + 1)) * (buf * 2 - (x + y + 1) - 1) / 2 + buf - (y + 1)) - (x + y + 2) % 2 * ((buf * 2 - (x + y + 1)) * (buf * 2 - (x + y + 1) - 1) / 2 + buf - (x + 1))
      end
      table[x][y] = ' ' * (3 - table[x][y].to_s.length) + table[x][y].to_s
    end
  end
  index += 1
  table_cases << "Case #{index}:\n" + table.collect{|row| row.join}.join("\n")
end
puts table_cases

Measured memory_bytes: 5892
class UnionFind:
    __slots__ = ["_data_size", "_roots"]

    def __init__(self, N):
        self._data_size = N
        self._roots = [-1] * N

    def find(self, x):
        while self._roots[x] >= 0:
            x = self._roots[x]
        return x

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        elif self._roots[y] < self._roots[x]:
            x, y = y, x
        self._roots[x] += self._roots[y]
        self._roots[y] = x

    def is_connected(self, x, y):
        return self.find(x) == self.find(y)


def main():
    N, Q, *TUV = map(int, open(0).read().split())
    tree = UnionFind(N)
    res = []
    for t, u, v in zip(*[iter(TUV)] * 3):
        if t:
            res.append(int(tree.is_connected(u, v)))
        else:
            tree.unite(u, v)
    print("\n".join(map(str, res)))


if __name__ == "__main__":
    main()


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

#define REP(i,n) for(int (i)=0;i<(n);i++)
#define vi vector<int>

using namespace std;

int main()
{
  int n, m;
  vi v(100005, 1);
  vector<bool> w(100005, 0);
  cin >> n >> m;
  n++;

  w[1] = 1;
  int x, y;
  while (m--) {
    cin >> x >> y;
    if (w[x])
        w[y] = 1;
    v[x]--; v[y]++;
    if(!v[x])
        w[x] = 0;
  }

  int ans = 0;
  REP(i, n){
    ans += (w[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <cstdio>
using namespace std;
int main() {
	int a, b;
	scanf("%d%d", &a, &b);
    
    if(a == b)
    {
	    printf("a == b\n");
    }
    else if(a > b)
    {
        printf("a > b\n");
    }
    else
    {
        printf("a < b\n");
    }
}

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

int main() {
  
  char inputChar = 'A';
  
  cin >> inputChar;
  
  if(inputChar == 'A')
  {
    cout << 'T' << endl;
  }
  else if(inputChar == 'C')
  {
    cout << 'G' << endl;
  }
  else if(inputChar == 'G')
  {
    cout << 'C' << endl;
  }
  else if(inputChar == 'T')
  {
    cout << 'A' << endl;
  }
}

Measured memory_bytes: 256
N = int(input())
minimum = 10**9
num = []
for i in range(1, int(N**0.5)+1):
    if N%i == 0:
        num.append(i)
for i in num:
    A = i
    B = N//i
    minimum = len(str(max(A,B))) if minimum > len(str(max(A,B))) else minimum
print(minimum)

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>

using namespace std;

typedef long long LL;

int count_d(LL x){
	int count=0;
	while(x>0){
		count++;
		x/=10LL;
	}
	return count;
}

int main(){
	LL N;
	while(scanf("%lld",&N)==1){
		LL n_size=sqrt(N)+1LL;
		int ans=count_d(N);
		for(LL A=1;A<=n_size;A++){
			if(N%A!=0)continue;
			LL B=N/A;
			int cur=max(count_d(A),count_d(B));
			if(ans>cur)ans=cur;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


int main(){
	int n, m, c, ans = 0;
	cin >> n >> m >> c;
	vector<int> b(m);
	vector<int> a(m);
	for (int i = 0; i < m; i++){
		cin >> b[i];
	}
	for (int i = 0; i < n; i++){
		int temp = 0;
		for (int j = 0; j < m; j++){
			cin >> a[j];
			temp += a[j]*b[j];
		}
		if (temp + c > 0) ans++;
	}
	cout << ans << endl;
	return 0;
 }



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define f first
#define se second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
typedef long long ll ;
typedef long double ld ;
typedef long long int lli;

using namespace std;
//reference: geeks
ll mult(ll a,ll b, ll p=mod){	return ((a%p)*(b%p))%p;	}
ll add(ll a, ll b, ll p=mod){return (a%p + b%p)%p;}
ll sub(ll a, ll b, ll p=mod){return (a%p - b%p + p)%p;}
ll fpow(ll n, ll k, ll p = mod) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = mod) {return fpow(a, p - 2, p);}
#define INF 10000000000
ll dp[105][100005];
ll n;
ll wei[100005],p[100005];


int main()
{	
	ios
	ll W;
	cin>>n>>W;
	for(int i=0;i<n;i++)	cin>>wei[i]>>p[i];
	
	for(int i=0;i<=n;i++)
	{
		for(ll w=0;w<=W;w++)
		{
			if(i==0||w==0)
				dp[i][w]=0;
			else if(wei[i-1]>w)
				dp[i][w]=dp[i-1][w];
			else
				dp[i][w]=max(dp[i-1][w],dp[i-1][w-wei[i-1]]+p[i-1]);
		}
	}
	cout<<dp[n][W];
}		



Measured memory_bytes: 80640
n=int(input())
p=input().split()
a=0
for i in range(n):
    p[i]=int(p[i])
for i in range(n-2):
    if p[i+1]>p[i]:
        if p[i+1]<p[i+2]:
            a+=1
    if p[i+1]<p[i]:
        if p[i+1]>p[i+2]:
            a+=1
print(a)


Measured memory_bytes: 3060
N = int(input())
A_list = [int(x) for x in input().split()]
B_list = [int(x) for x in input().split()]
cnt = 0
for i, B in enumerate(B_list):
    A = A_list[i]
    cnt += min(A, B)
    if (B > A):
        diff = min(A_list[i+1], B-A)
        A_list[i+1] -= diff
        cnt += diff
print(cnt)      


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

int main(){
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		bool z = true;
		int a[10];
		for(int j=0;j<10;j++) cin >> a[j];
		int b = 0;
		int c = 0;
		for(int j=0;j<10;j++){
			if(b>a[j] and c>a[j]) z = false;
			if(not z) break;
			if(b>c){
				if(b>a[j]) c = a[j];
				else b = a[j];
			}
			else{
				if(c>a[j]) b = a[j];
				else c = a[j];
			}
		}
		if(z) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

Measured memory_bytes: 1152
import           Control.Arrow         (second)
import qualified Data.ByteString.Char8 as BSC8
import qualified Data.Vector.Unboxed   as VU

getI :: BSC8.ByteString -> Maybe (Int, BSC8.ByteString)
getI = fmap (second BSC8.tail) . BSC8.readInt

getAB :: IO (Int, Int)
getAB = (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 getI <$> BSC8.getLine

main :: IO ()
main = getAB >>= print . (\(a, b) -> a * b) 

Measured memory_bytes: 4128
#include <stdio.h>

int Num, Sum, Ans;

void FuncCheckSum(int i, int sum, int n);

int main(void)
{
	while (1) {
		scanf("%d %d", &Num, &Sum);
		if (Num == 0 && Sum == 0) break;
		
		Ans = 0;
		
		FuncCheckSum(0, 0, 0);
		printf("%d\n", Ans);
	}

	return 0;
}

void FuncCheckSum(int i, int sum, int n)
{
	if (sum == Sum && n == Num) Ans++;
	if (i == 10 || n == Num) return;
	FuncCheckSum(i + 1, sum, n);
	FuncCheckSum(i + 1, sum + i, n + 1);
}

Measured memory_bytes: 596
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
    double a,b,C;
    double S,L,h,d;
    cin >>a >>b >>C;
    
    d=(acos(-1.0)*C)/180.0;
    S=a*b*sin(d)/2.0;
    L=a+b+sqrt(a*a+b*b-2*a*b*cos(d));
    h=b*sin(d);
    
    printf("%lf\n%lf\n%lf\n",S,L,h);
    
    return 0;
    
}


Measured memory_bytes: 3600
line = input()
for _ in range(int(input())):
    proc_line = input().split()
    proc = proc_line[0]
    a = int(proc_line[1])
    b = int(proc_line[2])
    if proc == "print":
        print(line[a:b+1])
    elif proc == "reverse":
        line = line[:a] + line[a:b+1][::-1] + line[b+1:]
    elif proc == "replace":
        line = line[:a] + proc_line[3] + line[b+1:]


Measured memory_bytes: 5612
n, m = map(int, input().split())
if m%2 == 0:
  x = m//2
  y = m//2
else:
  x = m//2
  y = m//2+1
for i in range(x):
  print(i+1, 2*x+1-i)
for i in range(y):
  print(i+2*x+2, 2*y+2*x+1-i)

Measured memory_bytes: 9288
k = input().split()
a = int(k[0])

def b(n):
    return int(n/2)
def c(n):
    return int((3*n)+1)

Counter = 0

flag = True
IntSet = set()
IntSet.add(a)
Buffer = int(a)
for i in range(1,1000000+1):
    if Buffer%2 == 0:
        Buffer = b(Buffer)
        Counter+=1
    else:
        Buffer = c(Buffer)
        Counter+=1
    if Buffer in IntSet:
        print(Counter+1)
        break
    else:
        IntSet.add(Buffer)

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

const ll MAXN = 200000;
const ll INF = 1001001001;

ll N, ans=0, tmp=0;
vector<ll> A;

signed main(){
    cin >> N;
    if(N==0) {
        cout << 0 << endl;
        return 0;
    }
    while(N!=1) {
        if(N%2==0) {
            N = N/2;
            N = -N;
            A.push_back(0);
        }
        else {
            N = (N-1)/2;
            N = -N;
            A.push_back(1);
        }
        //cout << N << endl;
    }
    A.push_back(1);
    while(!A.empty()) {
        cout << A.back();
        A.pop_back();
    }

    return 0;
}

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

int main() {
    int a, b, k, cnt = 0;
    cin >> a >> b >> k;
    for (int i = 100; i >= 1; i--) {
        if (a % i == 0 && b % i == 0) cnt++;
        if (cnt == k) {
            cout << i << endl;
            return 0;
        }
    }
}

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

int main(){
    int n;
    int d,x;
    int a[101];
    int sum = 0;
    cin >> n;
    cin >> d >> x;
    for(int i=0;i<n;i++){
        cin >> a[i];
        sum++;
    }
    for(int i=0;i<n;i++){
        for(int j=1;j<100;j++){
            if(j*a[i]+1 <= d) sum++;
            else break;
        }
    }
    cout << sum + x << endl;
    return 0;
}

Measured memory_bytes: 256