akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define Cout(s) cout << s << endl;
using ll = long long;
using P = pair<ll, ll>;

const ll INF = 100001;
ll MOD = 1e9 + 7;

int main()
{

    int n, m;
    cin >> n >> m;

    int ans = 1;
    for (int i = 1; i * i <= m; i++)
    {
        if (m % i != 0)
            continue;
        int fact = m / i;

        if ((long)i * n <= m)
            ans = max(ans, i);
        if ((long)fact * n <= m)
            ans = max(ans, fact);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()
cnt = 0
for i in range(n):
    for j in range(i + 1, n):
        if s[i] == s[j]:
            continue
        k = 2*j - i
        if j < k < n and s[i] != s[k] and s[j] != s[k]:
            cnt += 1
print(s.count('R') * s.count('G') * s.count('B') - cnt)

Measured memory_bytes: 73684
def main():
    # n, q = map(int, input().split())
    # s = input()
    # # l = list()
    # # r = list()
    # s_list = list()
    # # s_tuple = tuple()
    # for _ in range(q):
    #     l_i, r_i = map(int, input().split())
    #     # l.append(l_i)
    #     # r.append(r_i)
    #     s_list.append(s[l_i - 1:r_i])
    #     # s_tuple = s_tuple + tuple(s[l_i - 1:r_i])
    # 
    # s_tuple = tuple(s_list)
    # 
    # for i in s_tuple:
    #     print(i.count('AC'))
    N, Q = map(int, input().split())
    S = input()
    cnt = [0] * (N + 1)
    for i in range(N):
        cnt[i + 1] = cnt[i] + (1 if S[i:i+2] == 'AC' else 0)
    for i in range(Q):
        l, r = map(int, input().split())
        print(cnt[r - 1] - cnt[l - 1])


if __name__ == '__main__':
    main()

Measured memory_bytes: 7748
using System;

namespace ALDS1_1_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = System.Console.ReadLine();
            var N = System.Int32.Parse(line);
            string[] data = System.Console.ReadLine().Split(' ');
            var key = 0;
            var j = 0;
            
            for (var i = 0; i < N; i++) {
                key = System.Int32.Parse(data[i]);
                j = i - 1;
                while (j >= 0 && System.Int32.Parse(data[j]) > key) {
                    data[j + 1] = data[j];
                    j--;
                }
                data[j + 1] = key.ToString();
                PrintData(data);

            }
        }

        static void PrintData(string[] data) {
            for (var i = 0; i < data.Length; i++) {
                System.Console.Write(data[i]);
                if (i < data.Length - 1)
                    System.Console.Write(" ");
                else
                    System.Console.WriteLine("");
            }
        }
    }
}

Measured memory_bytes: 9152
while 1:
    a,b,c=map(int, input().split())
    if a*b*c==-1 and a<0:break
    if a<0 or b<0:print('F')
    elif a+b>=80:print('A')
    elif a+b>=65:print('B')
    elif a+b>=50:print('C')
    elif a+b>=30:
        if c>=50:print('C')
        else:print('D')
    else:print('F')


Measured memory_bytes: 5592
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pII;
#define pb push_back
#define first X
#define second Y
#define mp make_pair
#define clr(x,y) memset(x,y,sizeof(x))
#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
const int inf=0x3f3f3f3f;
const ll mod=1e9+7;
const int maxn=1e6+5;
//ll fmod(ll x,ll y){ll res=1;while(y){if(y&1)res=res*x%mod;y>>=1;x=x*x%mod;}return res;}
//ll gcd(ll x,ll y){return y==0?x:gcd(y,x%y);}
int judge(int x)
{
    int a = x%10;
    x /= 10;
    int b = x%10;
    x /= 10;
    int c = x%10;
    if(a == b&&b == c)return 0;
    return 1;
}
int main()
{
    int x;
    while(cin>>x)
    {
        while(judge(x))
        {
            x++;
        }
        printf("%d\n",x);
    }
}












Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

#define LET(name, value) __typeof(value) name = value
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define FOREQ(i, a, b) for (int i = (a); i <= (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOREACH(i, c) for (LET(i, (c).begin()); i != (c).end(); ++i)

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

int y[210], x[210];

int main() {
  int N;
  while (scanf("%d", &N), N) {
    int left = 0, top = 0, right = 1, bottom = 1;
    x[0] = y[0] = 0;
    FOR(i, 1, N) {
      int n, d; scanf("%d%d", &n, &d);
      y[i] = y[n] + dy[d];
      x[i] = x[n] + dx[d];
      left = min(left, x[i]);
      right = max(right, x[i]+1);
      top = min(top, y[i]);
      bottom = max(bottom, y[i]+1);
    }
    printf("%d %d\n", right - left, bottom - top);
  }
}

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

int main()
{
    string s ;
    cin >> s ;
    ll T ;
    cin >> T ;
    for(ll i = 0 ; i < T ; i++)
    {
        string a ;
        cin >> a ;
        if(a == "replace")
        {
            ll A , B ;
            string S ;
            cin >> A >> B >> S ;
            ll J = 0 ;
            for(ll j = A ; j <= B ; j++)
            {
                s[j] = S[J] ;
                J++ ;
            }
            //cout << s << endl ;
        }
        else if(a == "reverse")
        {
            ll A , B ;
            cin >> A >> B ;
            reverse(s.begin() + A , s.begin() + B + 1) ;
            //cout << s << endl ;
        }
        else
        {
            ll A , B ;
            cin >> A >> B ;
            for(ll j = A ; j <= B ; j++) cout << s[j] ;
            cout << endl ;
        }
    }
}


Measured memory_bytes: 3212
# include <iostream>
# include <math.h>

using namespace std;


int main()
{
	long long int result=1, help;
	int N;
	cin >> N;

	long long int* A;
	A = new long long int[N];

	int L = 0;

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

	if (result != 0)
	{
		for (int i = 0; i < N; i++)
		{
			result *= A[i];
			help = result;
			while (help != 0)
			{
				L++;
				help /= 10;
			}
			if(i<N-1)
				help = A[i + 1];
			while (help != 0)
			{
				L++;
				help /= 10;
			}
			if (L > 19 && i<N-1)
			{
				if (result * A[i + 1] != 1000000000000000000)
				{
					i = N;
					result = -1;
				}
			}
			L = 0;
		}
	}

	if (result > 1000000000000000000)
		cout << -1;
	else	
		cout << result;

    return 0;
}

Measured memory_bytes: 4388
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll MOD = 1e9+7;
ll LLINF = 1LL << 60;
int INF = INT_MAX;

ll n;
ll a,b,c; 
vector<int> l;
ll ans=0;

ll dfs(ll N, ll asum, ll bsum, ll csum){
    if(N==n){
        if(asum==0 or bsum==0 or csum==0) return INF;
        return abs(a-asum)+abs(b-bsum)+abs(c-csum)-30;
    }
    ll none = dfs(N+1, asum, bsum, csum);
    ll choose_a = dfs(N+1, asum+l[N], bsum, csum) +10;
    ll choose_b = dfs(N+1, asum, bsum+l[N], csum) +10;
    ll choose_c = dfs(N+1, asum, bsum, csum+l[N]) +10;

    return min(none, min(choose_a, min(choose_b, choose_c)));
}
int main(){
    cin>>n>>a>>b>>c;
    l.resize(n);
    rep(i,0,n) cin>>l[i];

    // 全部の合体方法について調べる

    // 8個を, 3個以上のグループに分ける方法を列挙すればいい

    cout<<dfs(0,0,0,0)<<endl;

}

Measured memory_bytes: 256
n = int(input())
arr = list(map(int,input().split()))
temp = [0 for i in range(9)]

for a in arr:
    t = a//400
    if t >= 8:
        t = 8
    temp[t] += 1

ans = 0
for i in range(8):
    if temp[i] > 0:
        ans += 1

if ans >= 1:
    print(ans,ans+temp[-1])
else:
    print(1,ans+temp[-1])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int n, grid[16][16];
ll sum[1 << 16], dp[1 << 16];

ll calc(int mask){
    ll ret = 0;
    for(int i = 0 ; i < n ; i++)
        for(int j = i + 1 ; j < n ; j++)
            if(((1 << i) & mask) && ((1 << j) & mask))
                ret += grid[i][j];
    return ret;
}
ll solve(int mask){
    if(mask == 0) return 0;
    ll &ret = dp[mask];
    if(ret != -1) return ret;
    ret = 0;
    for(int i = mask ; i ; i = (i - 1) & mask)
        ret = max(ret, sum[i] + solve(mask ^ i));
    return ret;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    memset(dp, -1, sizeof dp);
    cin >> n;
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j < n ; j++)
            cin >> grid[i][j];
    for(int i = 0 ; i < (1 << n) ; i++)
        sum[i] = calc(i);
    cout << solve((1 << n) - 1) << endl;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
        

fast();
//ll t;cin>>t;while(t--)
{
    ll n;
    cin>>n;
    ll a[n],ans=0;
    for(int i=0;i<n;i++)
    {
      cin>>a[i];
    }
    for(int i=1;i<n;i++)
    {
      if(a[i]<a[i-1])
      {
        ll x=(a[i-1])-a[i];
        a[i]+=x;
        ans+=x;
      }
    }
    cout<<ans<<endl;
}
return 0;
}

Measured memory_bytes: 5176
N = int(input())
T = list(map(int, input().split()))
M = int(input())
P, X = [0]*M, [0]*M
for i in range(M):
    P[i], X[i] = map(int, input().split())

for i in range(M):
    print(sum(T) - T[P[i]-1] + X[i])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define lli long long int
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF 9223372036854775807+1
#define sosuu 1000000007

int main(){
  vector<int> Ann(5);
  rep(i, 5)
  cin >> Ann[i];
  int k;
  cin >>k;
  sort(ALL(Ann));
  rep(i, 4){
  rep2(j, i+1,5){
  if(Ann[j]-Ann[i]>k){
  cout << ":(" << endl;
    return 0;
  }
  }
  }
  cout << "Yay!" << endl;
}


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

int main()
{
	int counter[26];
	char ch;
	
	for(int i = 0; i < 26; i++)
		counter[i] = 0;
		
	
	while(cin >> ch){
		if(isalpha(ch)){
			ch = tolower(ch);
		int num = ch - 'a';
		counter[num]++;
		}
	}
	
	for(int i = 0; i < 26; i++)
	cout << (char)(97+i) << " : " << counter[i] << endl;
	return 0;
}


Measured memory_bytes: 3048
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod

signed main(){
    int A,B,C; cin>>A>>B>>C;
    if(A%2==0||B%2==0||C%2==0) cout<<"0"<<endl;
    else cout<<min(A*B,min(B*C,C*A))<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int n,a[201],min,i;
  int b[201]={0};
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&a[i]);
      while(a[i]%2==0&&a[i]!=0)
	{
	  b[i]++;
	  a[i]=a[i]/2;
	}
    }
  min=b[0];
  for(i=1;i<n;i++)
    {
      if(b[i]<min)
	{
	  min=b[i];
	}
    }
  printf("%d\n",min);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,t;
  cin>>n>>t;
  vector<pll> p(n);
  rep(i,n){
   cin>>p[i].F>>p[i].S;
  }
  sort(all(p));
  vvll dp(n+1,vll(t+10));
  rep(i,n){
    rep(j,t){
      dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
      if(p[i].F+j<t){
        dp[i+1][j+p[i].F]=max(dp[i+1][j+p[i].F],dp[i][j]+p[i].S);
      }
    }
  }
  ll ans=0;
  rep(i,n){
    ans=max(ans,dp[i][t-1]+p[i].S);
  }
  COUT(ans);
}


Measured memory_bytes: 71040
require 'matrix'
N, D = gets.split.map &:to_i
x = []
N.times do
  x << Vector.elements(gets.split.map &:to_i)
end
cnt = 0
(N-1).times do |i|
  ((i+1)..(N-1)).each do |j|
    dist = ((x[i] - x[j]).norm)
    cnt += 1 if dist - dist.to_i == 0
  end
end
puts cnt

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

using namespace std;
static const int MAX = 2000000;

int H, A[MAX + 1];


void maxHeapify(int i)
{
	int l, r, largest;
	l = 2 * i;
	r = 2 * i + 1;
	largest = i;
	if (l <= H && A[l] > A[i])
	{
		largest = l;
	}
	if (r <= H && A[r] > A[largest])
	{
		largest = r;
	}
	if (largest != i)
	{
		int temp = A[i];
		A[i] = A[largest];
		A[largest] = temp;
		maxHeapify(largest);
	}
}

void solve()
{
	cin >> H;
	for (int i = 1; i <= H; ++i)
	{
		cin >> A[i];
	}
	for (int i = H / 2; i >= 1; --i)
	{
		maxHeapify(i);
	}
	for (int i = 1; i <= H; ++i)
	{
		cout << " " << A[i];
	}
	cout << endl;
}

int main()
{
	solve();
	return(0);
}


Measured memory_bytes: 4932
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def anagram(l,n):
    newletter = uppercase[(uppercase.find(l) + n) % 26]
    return newletter

n = int(input())
string = input()
new_string = ''
for l in string:
    new_string += anagram(l, n)
    
print(new_string)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	n=5;
	int ans=0;
	for(int i=0;i<n;i++)
	{
		int val;
		cin>>val;
		if(val==0)
		{
			ans=i+1;
			break;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3520
N = int(input())
S = [input()[0] for i in range(N)]
from collections import Counter
ctr = Counter(S)
 
ans = 0
import itertools
for ptn in itertools.combinations('MARCH', 3):
    a,b,c = ptn
    ans += ctr[a] * ctr[b] * ctr[c]
print(ans)

Measured memory_bytes: 10044
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1e9+7;

ll fp(ll b,ll p){ 
	if(p==0) return 1;
	if(p&1) return (b*fp(b,p-1))%mod;
	return fp((b*b)%mod,p/2);
}

ll nCr(ll n, ll r){ 
    ll res=1;
    for(int i=0; i<r; ++i) res=res*(n-i)%mod;
    for(int i=1; i<=r; ++i) res=res*fp(i, mod-2)%mod;
    return res;
}

int main()
{   
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,a,b;
    
    cin>>n>>a>>b;
    ll ans=(fp(2,n)-(1%mod)+mod)%mod;
    ans=( (ans%mod)-(nCr(n,a)%mod)+mod)%mod;
    ans=( (ans%mod)-(nCr(n,b)%mod)+mod)%mod;
    cout<<ans<<'\n';
  
  

     
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void) {

int a, b, k, i, count;
scanf("%d", &k);
scanf("%d", &a);
scanf("%d", &b);
count=0;

for (i=1; i < 1000; i++) {
   if (a<=(i*k)&&(i*k)<=b) {
count++;
  }
}
if (count==0) {
  printf("NG");
}
else{
  printf("OK");
}
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<int> vi;

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define all(x) (x).begin(), (x).end()
#define SIZE(x) ((int)(x).size())

int main(void)
{
  // code begin

  int n;
  int a;
  set<int> as = set<int>();
  cin >> n;
  rep(i, n)
  {
    cin >> a;
    as.insert(a);
  }

  if (as.size() < n)
  {
    cout << "NO" << endl;
  }
  else
  {
    cout << "YES" << endl;
  }

  // code end
  return 0;
}


Measured memory_bytes: 9600
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;

#define rep(i, n) for (ll i = 0; i < ll(n); i++)
#define repd(i, n) for (ll i = n - 1; i >= 0; i--)
#define all(x) x.begin(), x.end()

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

    int x;
    cin >> x;

    if(x >= 30) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3620
/**
*    created: 17.05.2020 20:59:53
**/

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int inf =1000000000;

int main() {
    int n;
    cin >> n;
    int a=n%10;
    if(a==3){
        cout << "bon" << endl;
    }else if(a==0||a==1||a==6||a==8){
        cout << "pon" << endl;
    }else{
        cout << "hon" << endl;
    }
}

Measured memory_bytes: 3636
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
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 n, m;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,d;
    cin >> a>>b>>c>>d;
    if(abs(a-c)<=d)return yes,0;
    if (abs(a - b) <= d && abs(b - c) <= d)
        return yes, 0;
    no;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include<unordered_set>
#include<complex>
#include <cassert>

using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false); cin.tie(0);
    LL a;
    string s;
    cin >> a >> s;
    LL b = 0;
    LL c = 0;
    bool wasDot = false;
    FOR(i, 0, SZ(s)) {
        if (s[i] == '.') {
            wasDot = true;
            continue;
        }

        if (wasDot) {
            c = c * 10 + s[i] - '0';
            continue;
        }

        b = b * 10 + s[i] - '0';
    }

    LL res = a * b + (a * c) / 100;
    cout << res << endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;


 
int main() {
	int H, A;
	cin >> H >> A;
	
	int a, b;
	a = H/A;
	b = H % A;
	if (b != 0) a++;
	
	cout << a << endl;
	

	
    return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
using Graph = vector<vector<int>>;
int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    cin>>s;
    int ans=0;
    rep(i,4){
        if(s[i]=='+')ans++;
        else ans--;
    }
    cout<<ans<<endl;

    return 0;
}

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

int main() {
  char c;
  cin >> c;
  string str = "abcdefghijklmnopqrstuvwxyz";
  for (int i = 0; i < str.size(); i++) {
    if (str.at(i) == c) {
      c = str.at(i+1);
      break;
    }
  }
  cout << c << endl;
}

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

int main(){
    int n;
    cin >> n;
    int x = n % 10;
    if(x == 2 || x == 4 || x == 5 || x == 7 || x == 9){
        cout << "hon" << endl;
    }else if(x == 0 || x == 1 || x == 6 || x == 8){
        cout << "pon" << endl;
    }else{
        cout << "bon" << endl;
    }
    return 0;
}

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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010, M = 2 * N;

int n, k;
int h[N], e[M], ne[M], idx;
int d[N];
int color[M];

void add(int a, int b)
{
	e[idx] = b, ne[idx] = h[a], h[a] = idx ++ ;
}

void dfs(int u, int fa, int c)
{
	for (int i = h[u]; ~i; i = ne[i])
	{
		int j = e[i];
		if (j == fa) continue;
		
		if ( ++ c > k) c = 1;
		color[i] = c;
		dfs(j, u, c);
	}
}

int main()
{
	memset(h, -1, sizeof h);
	scanf("%d", &n);
	
	for (int i = 0; i < n - 1; i ++ )
	{
		int a, b;
		scanf("%d%d", &a, &b);
		add(a, b), add(b, a);
		d[a] ++ , d[b] ++ ;
		k = max(k, max(d[a], d[b]));
	}

	dfs(1, -1, 0);

	printf("%d\n", k);
	for (int i = 0; i < idx - 1; i += 2)
		printf("%d\n", max(color[i], color[i + 1]));
	
	return 0;
}

Measured memory_bytes: 5120
n, k = map(int, input().split())
xy = sorted([tuple(map(int, input().split())) for i in range(n)])
ans = float("INF")
en = tuple(enumerate(xy))
for i, (a, b) in en[:n - k + 1]:
    for j, (c, d) in en[i + k - 1:]:
        r = sorted(y for x, y in xy[i:j + 1])
        r2 = r[k - 1:]
        for i2, j2 in zip(r, r2):
            if i2 <= b and d <= j2:
                ans = min(ans, (c - a) * (j2 - i2))
print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int main(){
  int N;
  cin >> N;
  vector<i64> A(N);
  for(auto& x : A){
    cin >> x;
  }
  i64 ans = 0;
  while(true){
    i64 sum = 0;
    bool OK = true;
    for(auto x : A){
      sum += x / N;
      if(x >= N) OK = false;
    }
    if(OK) break;

    ans += sum;
    for(auto & x : A){
      i64 X = x;
      x %= N;
      x += sum - (X / N);
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <regex>

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rFOR(i,a,b) for(int i=(b);i>=(a);i--)
#define SORT(a) sort((a).begin(),(a).end());
#define rSORT(a) sort((a).rbegin(),(a).rend());
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end());
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;

const ll MOD = 1e9+7;

//sankou
//vvi = vector<vector<int>>(20, vector<int>(10, 0));

//seiki
//#include <regex>
/*bubun*/
//regex_search("u32", regex("[0-9]"));      // true
/*kanzen*/
//regex_match("u32", regex("(i|u)\\d+"));   // true

int isP(int n) {
    if(n<=1) return 0;
    FOR(i,2,(int)sqrt(n)) {
        if(n%i==0) return 0;
    }
    return 1;
}

int main() {

    int N,C,ku1=0,ku2=0;
    cin >>N>>C;
    vvi D(C,vi(C));
    int c;
    vvpii Ds(3,vpii(C,mp(0,0)));
    vi mimi(6,0);
    vvi set(6,vi(3));
    set[0][0]=0;
    set[0][1]=1;
    set[0][2]=2;
    set[1][0]=0;
    set[1][1]=2;
    set[1][2]=1;
    set[2][0]=1;
    set[2][1]=0;
    set[2][2]=2;
    set[3][0]=1;
    set[3][1]=2;
    set[3][2]=0;
    set[4][0]=2;
    set[4][1]=0;
    set[4][2]=1;
    set[5][0]=2;
    set[5][1]=1;
    set[5][2]=0;
    FOR(i,0,C-1){
        FOR(j,0,C-1){
            cin >>D[i][j];
        }
        FOR(j,0,2){
            Ds[j][i].se=i;
        }
    }
    FOR(i,0,N-1){
        FOR(j,0,N-1){
            cin >>c;
            FOR(k,0,C-1){
                Ds[(i+j)%3][k].fi+=D[c-1][k];
            }
        }
    }
    SORT(Ds[0]);
    SORT(Ds[1]);
    SORT(Ds[2]);
    
    FOR(l,0,5){
        ku1=Ds[set[l][0]][0].se;
        mimi[l]+=Ds[set[l][0]][0].fi;
        FOR(i,0,C-1){
            if(Ds[set[l][1]][i].se!=ku1) {
                ku2=Ds[set[l][1]][i].se;
                mimi[l]+=Ds[set[l][1]][i].fi;
                break;
            }
        }
        FOR(i,0,C-1){
            if((Ds[set[l][2]][i].se!=ku1)&&(Ds[set[l][2]][i].se!=ku2)) {
                mimi[l]+=Ds[set[l][2]][i].fi;
                break;
            }
        }
    }
    
    SORT(mimi);
    
    cout <<mimi[0]<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
#ifdef _DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif
using ll = int64_t;
using ul = uint64_t;
using namespace std;

void solve() {
  string s, t;
  cin >> s >> t;

  int min_dup = 1001;
  for (size_t i = 0; i < s.size() - t.size() + 1; i++) {
    int sub_dup = 0;
    for (size_t j = 0; j < t.size(); j++) {
      if (s.at(i + j) != t.at(j)) {
        sub_dup++;
      }
    }
    debug(sub_dup);
    min_dup = min(min_dup, sub_dup);
  }
  cout << min_dup << endl;
}

void wrapper() {
  rep(i, 3) {
    cout << "[TEST " << (i + 1) << "]\n";
    solve();
    cout << "\n";
  }
}

int main() {
  fastIO;
#ifdef _DEBUG
  wrapper();
#else
  solve();
#endif
}


Measured memory_bytes: 3644
// https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/include/precompiled/stdc%2B%2B.h
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
//#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i,n) for (int i=0; i<(n); ++i)
#define rrep(i,n) for (int i=1; i<=(n); ++i)
#define drep(i,n) for (int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for (int i=s; i<t; ++i)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int INF = 1001001001;
const double PI = acos(-1);
const int mod=1e9+7;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
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; }
/*------------------------------------------------------------------------------
...................................ENTRY POINT..................................
------------------------------------------------------------------------------*/
int main(void){
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int d, t, s;
  cin >> d >> t >> s;
  if((double)d/s > t) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}


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

using namespace std;
using ll = long long int;

int main(void){
  ll x, y;
  cin >> x >> y;
  
  ll ans = 0;
  ll current = x;
  
  while(current <= y){
    ans++;
    current *= 2;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
x1, y1, x2, y2 = map(int,input().split())
x = x2
y = y2
dx = x2 - x1
dy = y2 - y1
for i in range(2):
    dy, dx = dx, dy
    dx = -1 * dx
    x += dx
    y += dy
    print(x,y,end=" ")

Measured memory_bytes: 3060
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

struct Q {
  bool rev;
  long long t, a;
};

bool operator<(const Q &lhs, const Q &rhs) {
  if (lhs.t == rhs.t)
    return lhs.rev < rhs.rev;
  return lhs.t < rhs.t;
}

int main() {
  long long x, k;
  cin >> x >> k;
  vector<Q> query;
  for (int i = 0; i < k; i++) {
    Q q;
    q.rev = true;
    cin >> q.t;
    query.push_back(q);
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    Q q;
    q.rev = false;
    cin >> q.t >> q.a;
    query.push_back(q);
  }
  sort(query.begin(), query.end());

  long long x1 = 0, x2 = x, t = 0, y = 0;
  bool up = true, flat = false;
  long long height = 0;
  for (int i = 0; i < query.size(); i++) {
    long long delta = query[i].t - t;
    if (query[i].rev) {
      if (up) {
        y -= delta;
        x1 = max(x1, -y);
      } else {
        y += delta;
        x2 = min(x2, x - y);
      }
      if (flat) {
        if (up) {
          height -= delta;
        } else {
          height += delta;
        }
        height = min(x, height);
        height = max(0ll, height);
      } else {
        if (x2 < x1) {
          flat = true;
          if (up) {
            height = 0;
          } else {
            height = x;
          }
        }
      }
      up = !up;
      t = query[i].t;
    } else {
      long long ans;
      if (query[i].a < x1) {
        ans = x1 + y;
      } else if (query[i].a < x2) {
        ans = query[i].a + y;
      } else {
        ans = x2 + y;
      }
      if (flat) {
        ans = height;
      }
      if (up) {
        ans -= delta;
      } else {
        ans += delta;
      }
      ans = min(x, ans);
      ans = max(0ll, ans);
      cout << ans << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 8560
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<queue>
using namespace std;

struct OZAWA
{
	int x;
	int y;
	int c;
};
int Flag[1001][1001];
char MAP[1001][1001];
queue<OZAWA> Q;
OZAWA ba,v;
int main(void)
{
	int H,W,N,Nc=0,X[10],Y[10];
	int mv[4][2]={{0,-1},{1,0},{0,1},{-1,0}};
	char Cheese[10] ={'1','2','3','4','5','6','7','8','9'};
	memset(MAP,'X',sizeof(MAP));
	memset(Flag,0,sizeof(Flag));
	scanf("%d %d %d",&H,&W,&N);
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			//printf("%d %d ",i,j);
			cin >> MAP[i][j];
			//printf("Q");
			if(MAP[i][j] == 'S'){
				ba.x = j;
				ba.y = i;
				ba.c = 0;
				Flag[i][j] = 1;
				Q.push(ba);
				//printf("Sin\n");
			}
			for(int ii=0;ii<9;ii++){
				if(MAP[i][j] == Cheese[ii]){

					X[ii] = j;
					Y[ii] = i;
					//printf("\n@@@\n");
				}
			}
		}
	}
	//printf("S %d %d\n",ba.x,ba.y);
	//for(int ii=0;ii<2;ii++)
	//printf("%d %d\n",X[0],Y[0]);
	while(!Q.empty()){
		//printf("QA\n");
		ba = Q.front();
		Q.pop();
		if(ba.x==X[Nc] && ba.y==Y[Nc]){
			//printf("OZA");
			Nc++;
			memset(Flag,0,sizeof(Flag));
			while(!Q.empty()){
				Q.pop();
			}
			if(Nc == N) break;
			Q.push(ba);
			Flag[ba.y][ba.x] = 1;
		}
		//printf("aaa\n");
		//if(Nc == N) break;
		for(int i=0;i<4;i++){
			if(MAP[ba.y+mv[i][1]][ba.x+mv[i][0]]!='X' && Flag[ba.y+mv[i][1]][ba.x+mv[i][0]]==0 && (ba.x+mv[i][0])>=0&&(ba.x+mv[i][0])<W&&(ba.y+mv[i][1])>=0&&(ba.y+mv[i][1])<H){
				v.x=ba.x+mv[i][0];
				v.y=ba.y+mv[i][1];
				v.c=ba.c+1;
				Q.push(v);
				Flag[v.y][v.x] = 1;
				//printf("%d %d\n",v.x,v.y);
			}
		}
	}
	cout <<ba.c<<endl;
	return 0;
}

Measured memory_bytes: 6140
#include<iostream>
using namespace std;
int nil = -1;

struct tree{
    int p, l, r;
};

tree t[100000];
int n, d[100000];

void print(int a){
    cout << "node " << a << ": ";
    cout << "parent = " << t[a].p << ", ";
    cout << "depth = " << d[a] << ", ";

    if(t[a].p == nil){
        cout << "root";
    }else if(t[a].l == nil){
      cout << "leaf";
    }
    else {
        cout << "internal node";
    }
    cout << ", ";

    cout << "[";

    int c;
    for(int i = 0, c = t[a].l; c != nil; i++, c = t[c].r){
        if(i) cout << ", ";
        cout << c;
    }
    cout << "]" << endl;
}

int depth(int a, int b){
    d[a] = b;
    if(t[a].l != nil)   depth(t[a].l, b+1);
    if(t[a].r != nil)   depth(t[a].r, b);
}

int main(){
    int n;
    int v, d, c, l;
    cin >> n;
    
    for(int i = 0; i < n; i++){
        t[i].p = t[i].l = t[i].r = nil;
    }

    for(int i = 0; i < n; i++){
        cin >> v >> d;
        for(int j = 0; j < d; j++){
            cin >> c;
            if(j == 0){
                t[v].l = c;
            }else{
                t[l].r = c;
            }
            l = c;
            t[c].p = v;
        }
    }

    int r;
    for(int i = 0; i < n; i++){
        if(t[i].p == nil)   r = i;
    }

    depth(r, 0);

    for(int i = 0; i < n; i++){
        print(i);
    }

    return 0;
}



Measured memory_bytes: 4644
package main

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

func main() {
	sc := NewScanner()
	L, R := sc.NextInt(), sc.NextInt()
	if L/2019 != R/2019 {
		fmt.Println(0)
		return
	}
	mn := ((L % 2019) * (R % 2019)) % 2019
	for i := L % 2019; i < R%2019; i++ {
		for j := (L + 1) % 2019; j <= R%2019; j++ {
			p := (i * j) % 2019
			if mn > p {
				mn = p
			}
		}
	}
	fmt.Println(mn)
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt(), W = sc.nextInt();
		String px;
		
		for(int i=0; i<H; i++){
			px = sc.next();
			String sep = System.getProperty("line.separator");
			System.out.println(px+sep+px);
		}
	}
}

Measured memory_bytes: 21972
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, K int
	fmt.Scan(&N)
	fmt.Scan(&K)
	enemies := make([]int, 0)
	enemy := 0
	for i := 0; i < N; i++ {
		fmt.Scan(&enemy)
		enemies = append(enemies, enemy)
	}

	sort.Sort(sort.IntSlice(enemies))
	var res int64
	if len(enemies) <= K {
		res = 0
	} else {
		enemies = enemies[0 : len(enemies)-K]
		for i := 0; i < len(enemies); i++ {
			res += int64(enemies[i])
		}
	}

	fmt.Println(res)
}


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

ll a,b,c,n,m;
ll ans=100000000000;

string s;

int main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  cin>>s;
  if(s=="ABC")cout<<"ARC";
  else cout<<"ABC";

  return 0;
}



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

int main() {
  string S;
  cin >> S;
  if (S[0] != S[1]) {
    if (S[0] == S[2] && S[1] == S[3]) {
      cout << "Yes" << endl;
      return 0;
    }
    if (S[0] == S[3] && S[1] == S[2]) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if (S[0] == S[1] && S[2] == S[3] && S[0] != S[2]) {
    cout << "Yes" << endl;
    return 0;
  }
  
  cout << "No" << endl;
  
  return 0;
}

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

using namespace std;

#define sz(x) (int) x.size()
#define all(a) a.begin(), a.end()

int n, m;
long long sum;

int main() {

    cin >> n >> m;

    for (int i = 0; i < m; i++) {
        int x;
        cin >> x;
        sum += x;
    }

    if (sum > n)
        puts("-1");
    else
        cout << n - sum << endl;

    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define mod 998244353
#define ll long long
using namespace std;
int n,a,b,q[300005],x[300005],ans;
ll k;
int pow(int c,int p){
	int tot=1;
	while(p){
		if(p&1) tot=1ll*c*tot%mod;
		c=1ll*c*c%mod;
		p>>=1;
	}
	return tot;
}
int C(int A,int B){
	if(A==0) return 1; if(A>B) return 0; if(A==B) return 1;
	return 1ll*q[B]*x[A]%mod*x[B-A]%mod;
}
int main(){
	scanf("%d%d%d%lld",&n,&a,&b,&k);
	q[1]=1;for(int i=2;i<=n;++i) q[i]=1ll*q[i-1]*i%mod;
	x[n]=pow(q[n],mod-2);
	for(int i=n-1;i>=0;--i) x[i]=x[i+1]*1ll*(i+1)%mod;
	if(k==0){puts("1");return 0;}
	for(int i=1;i<=n;++i){
		ll j=k-1ll*i*a;
		if(j<0||j%b) continue;
		j/=b;
		ans=(ans+1ll*C(i,n)*C(j,n)%mod)%mod;
	}
	printf("%d",ans);
}

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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
const long long MOD = 1e9 + 7;
///////////////////////////////////////////////
// for template
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////
/// 🍈( '-' 🍈 |AC|
int main() {
    int N,M; cin >> N >> M;
    vector<vector<int>> V(N);
    vector<int> visited(N);
    REP(i,M){
        int A,B; cin >> A >> B;
        A--; B--;
        V[A].push_back(B);
        V[B].push_back(A);
    }

    REP(i,N){
        visited[i] = -1;
    }

    queue<int> Q;
    Q.push(0);
    visited[0] = 0;
    while(!Q.empty()){
        int now = Q.front(); Q.pop();
        REP(i,V[now].size()){
            int next = V[now][i];
            if (visited[next] != -1) continue;

            visited[next] = now;
            Q.push(next);
        }
    }

    REP(i,N){
        if (i == 0){
            puts("Yes");
            continue;
        }
        cout << visited[i] + 1 << "\n";
    }
}

Measured memory_bytes: 10248
#include<iostream>
#include <cmath>
#include<vector>
#define rep(i, n) for (int i=0;i<n;i++)
#include <map> 
#include<algorithm>
#include <numeric>
#include<deque>

using namespace std;
typedef long long ll;

int main(void){
    int r, d, x;
    cin>>r>>d>>x;
    rep(i, 10){
        x=x*r-d;
        cout<<x<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
arr = readlines.map(&:chomp).map(&:split).map do |i|
  i.map(&:to_i)
end

likes = []
n.times do |i|
  likes << arr[i][1..-1]
end

likes.flatten!

ans = 0
likes.map do |i|
  if likes.count(i) == n
    ans += 1
  end
end

p ans / n


Measured memory_bytes: 1788
#include <array>
#include <cassert>
#include <cstdio>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
using namespace std;

bool solve(int h, int w, array<int, 26> cnt) {
    int r1 = (h % 2) * (w % 2);
    int r2 = (h % 2) * (w / 2) + (w % 2) * (h / 2);
    assert  ((h * w - 2 * r2 - r1) % 4 == 0);
    int r4 = (h * w - 2 * r2 - r1) / 4;
    for (int c = 0; r4 --; ) {
        while (c < 26 and cnt[c] < 4) ++ c;
        if (c == 26) return false;
        cnt[c] -= 4;
    }
    for (int c = 0; r2 --; ) {
        while (c < 26 and cnt[c] < 2) ++ c;
        if (c == 26) return false;
        cnt[c] -= 2;
    }
    return true;
}

int main() {
    // input
    int h, w; scanf("%d%d", &h, &w);
    array<int, 26> cnt = {};
    repeat (y, h) repeat (x, w) {
        char c; scanf(" %c", &c);
        cnt[c - 'a'] += 1;
    }
    // solve
    bool result = solve(h, w, cnt);
    // output
    printf("%s\n", result ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 1624
n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())
p = x[0] + y[0] & 1
for i in range(n):
    if x[i] + y[i] & 1 != p:
        print(-1)
        exit()
d = ([1] if p == 0 else []) + [2 ** i for i in range(39)]
print(len(d))
print(*d)

dx = [1,0,-1,0]
dy = [0,1,0,-1]
ch = 'LDRU'

for i in range(n):
    s, t = x[i], y[i]
    ans = []
    now = 2 ** 38
    for _ in range(len(d)):
        min_cur = 10 ** 18
        for i in range(4):
            ts, tt = s + dx[i] * now, t + dy[i] * now
            tm = abs(ts) + abs(tt)
            if tm < min_cur:
                ns, nt = ts, tt
                nc = ch[i]
                min_cur = tm
        s, t = ns, nt
        ans.append(nc)
        now = now // 2 if now > 1 else 1
    print(''.join(reversed(ans)))


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  if( n%1110 < 10 ) {	//ex)5553
  	cout << "Yes" << endl;
  } else if ( (n%1000) % 111 == 0){	//ex)7555
    cout << "Yes" << endl;
  } else{
  	cout << "No" << endl;
  }
}

Measured memory_bytes: 256