akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    int N, i;
    cin >> N >> i;
    cout << N - i + 1 << endl;
    return 0;
}


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

int c[9];

bool dfs(bool s, int i) {
  if (!s) {
    if (c[i] >= 2) {
      c[i] -= 2;
      if (dfs(true, 1)) return true;
      c[i] += 2;
    }
    if (i<9) {
      if (dfs(false, i+1)) return true;;
    }
  } else {
    if (c[i] && c[i+1] && c[i+2]) {
      int j;
      --c[i]; --c[i+1]; --c[i+2];
      for (j=1; j<=9; j++) {
        if (c[j]%3) break;
      }
      if (j==10) return true;
      if (dfs(true, i)) return true;
      ++c[i]; ++c[i+1]; ++c[i+2];
    }
    if (i<7) {
      if (dfs(true, i+1)) return true;
    }
  }
  return false;
}

int main() {
  char buf[20];
  int count[10];
  bool noans;

  while (fgets(buf, sizeof(buf), stdin)) {
    noans = true;
    memset(count, 0, sizeof(int)*10);
    for (int i=0; i<13; i++) {
      ++count[buf[i] - '0'];
    }
    for (int x=1; x<=9; x++) {
      if (count[x]>=4) continue;
      memcpy(c, count, sizeof(int)*10);
      ++c[x];
      if (dfs(0, 1)) {
        if (!noans) putchar(' ');
        printf("%d", x);
        noans = false;
      }
    }
    if (noans) printf("0");
    printf("\n");
  }
}

Measured memory_bytes: 952
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
pnts = [0] * N

for i in A:
    pnts[i - 1] += 1

for i in pnts:
    if K - Q + i > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 8640
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    int X = int(N * 100 / 108);
    if (int(X * 1.08) == N) {
        cout << X << endl;
    } else if (int((X+1) * 1.08) == N) {
        cout << X + 1 << endl;
    } else {
        cout << ":(" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	int c;
	int bb=b;
	while(bb!=0)
	{
		a*=10;
		bb/=10;
	}
	c=a+b;
	if(pow(ceil(sqrt(c)),2)==c) puts("Yes");else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define mod 1000000007
typedef long long ll;

using namespace std;

int main(void){
    ll N, A, n[61];
    cin>>N;
    MEMSET(n, 0);
    rep(i, N){
        int t=0;
        cin>>A;
        while(true){
            if(A%2==1) n[t]++;
            A=A/2;
            if(A==0) break;
            t++;
        }
        //rep(i, 61) cout<<n[i]<<" ";
        //cout<<endl<<i<<endl<<endl;
    }
    ll count=0;
    ll th;
    rep(i, 61){
        th=n[i]*(N-n[i]);
        rep(j, i){
            th*=2;
            th%=mod;
        }
        count+=th;
        count%=mod;
    }
    cout<<count%mod<<endl;
    
    return 0;
}


Measured memory_bytes: 256
package main

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

var rdr = bufio.NewReaderSize(os.Stdin, 1024)

func readLine() string {
	buf := make([]byte, 0, 1024)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func atoi(s string) int {
	i, e := strconv.Atoi(s)
	if e != nil {
		panic(e)
	}
	return i
}

func readStringArray() []string {
	return strings.Split(strings.TrimSpace(readLine()), " ")
}

func readInt() int {
	return atoi(readLine())
}

func readIntArray() []int {
	var a []int
	sa := readStringArray()
	for _, s := range sa {
		a = append(a, atoi(s))
	}
	return a
}

func main() {
	nq := readIntArray()
	n := nq[0]
	q := nq[1]
	s := readLine()

	var acSum [100005]int
	cnt := 0
	prevA := false
	for j := 0; j < n; j++ {
		if prevA && s[j] == 'C' {
			cnt++
		}
		acSum[j] = cnt
		if s[j] == 'A' {
			prevA = true
		} else {
			prevA = false
		}
	}
	for i := 0; i < q; i++ {
		lr := readIntArray()
		l := lr[0] - 1
		r := lr[1] - 1
		ans := acSum[r] - acSum[l]
		fmt.Println(ans)
	}
}


Measured memory_bytes: 6912
N,M=gets.split(/ /).map{|s| s.to_i}
H=gets.split(/ /).map{|s| s.to_i}
H.unshift(nil)
good = H.map {|v| true }

1.upto(M) do |i|
    a,b = gets.split(/ /).map{|s| s.to_i}
    if H[a] <= H[b]
        good[a] = false
    end
    if H[b] <= H[a]
        good[b] = false
    end
end
puts good.select {|v| v }.size - 1


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

using namespace std;

#define ll long long
//typedef long long ll;

int main(){
  ll L, R, begin, end;
  cin >> L >> R;
  ll int ans = 2018;
  if((R-L)>= 2018) cout << 0 << endl;
  else{
    for(ll int i = L; i <= R-1; i++){
      for(ll int j = i+1; j <= R; j++){
        ans = min((i*j)%2019, ans);
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 256
/*
          ,     \    /      ,
         / \    )\__/(     / \
        /   \  (_\  /_)   /   \
   ____/_____\__\@  @/___/_____\____
  |             |\../|              |
  |              \VV/               |
  |        ------hoi-------         |
  |_________________________________|
   |    /\ /      \\       \ /\    |
   |  /   V        ))       V   \  |
   |/     `       //        '     \|
   `              V                '
*/

#include <bits/stdc++.h>

#define ld long double
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define f first
#define se second
#define Speedforce boost();
#define fop(s1, s2) freopen(s1, "r", stdin);freopen(s2, "w", stdout);

using namespace std;

void boost(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int N = 1e6;
const ll inf = 1e9 + 9;
const ld PI = acos(-1);

ll bin_pow(ll x, ll y){
    ll res = 1, base = x;
    while(y){
        if(y & 1){
            res *= base;
            res %= inf;
        }
        base *= base;
        base %= inf;
        y /= 2;
    }
    return res;
}

int a, b;

int main(){
    Speedforce
    //fop("", "")
    cin >> a >> b;
    int cnt = 0;
    int x = 1;
    while(x < b){
        x += a - 1;
        cnt ++;
    }
    cout << cnt;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define vi vector <int>
#define vl vector <ll>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define MOD 1000000007
ll power(ll a, ll b) { //a^b
	ll res = 1;
	while (b > 0) {
		if (b & 1) {res = (res * a); b--;}
		a = (a * a);
		b >>= 1;
	}
	return res;
}
ll n;
ll gcd(ll a, ll b) {return (b == 0) ? a : gcd(b, a % b);}


int main() {
	string s,t;
	cin>>s;
	cin>>t;
	ll n,m;
	n=s.length();
	m=t.length();
	vector < vector <ll> > dp(n+1, vector <ll> (m+1,0));
	for(ll i=0;i<=n;i++){
		for(ll j=0;j<=m;j++){
			if(i==0||j==0)
				continue;
			if(s[i-1]==t[j-1])
				dp[i][j]=dp[i-1][j-1]+1;
			else
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	string ans="";
	ll i=n,j=m;
	while(i>=1&&j>=1){
		if(s[i-1]==t[j-1]){
			ans=s[i-1]+ans;
			i--;
			j--;
		}
		else if(dp[i-1][j]>dp[i][j-1])
			i--;
		else
			j--;
	}
	cout<<ans<<"\n";
}


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

int a[10],l,r;

bool dfs(int n)
{
	if(n>=10)return true;
	int x;
	if(a[n]>l)
	{
		x=l;
		l=a[n];
		if(dfs(n+1))return true;
		l=x;
	}
	if(a[n]>r)
	{
		x=r;
		r=a[n];
		if(dfs(n+1))return true;
		r=x;
	}
	return false;
}

int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		l=0;r=0;
		for(int i=0;i<10;i++)scanf("%d",a+i);
		if(dfs(0))printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 1168
#include <stdio.h>

typedef struct {
    int Up;
    int South;
    int East;
    int West;
    int North;
    int Down;
    
} Dice;

Dice moveNorth(Dice *d);
Dice moveWest(Dice *d);
Dice moveSouth(Dice *d);
Dice moveEast(Dice *d);

int main(int argc, const char * argv[]) {
    int d[6];
    int i;
    for(i=0;i<6;i++){
        scanf("%d",&d[i]);
    }
    
    Dice dice = {d[0],d[1],d[2],d[3],d[4],d[5]};
    
    char op[100];
    scanf("%s",op);
    
    int j=0;
    while(1){
        if(op[j]=='\0'){
            break;
        }
        
        switch (op[j]) {
            case 'N':
                dice = moveNorth(&dice);
                break;
            case 'W':
                dice = moveWest(&dice);
                break;
            case 'S':
                dice = moveSouth(&dice);
                break;
            case 'E':
                dice = moveEast(&dice);
                break;
            default:
                break;
        }
        
        j++;
    }
    
    printf("%d\n",dice.Up);
    
    return 0;
}

Dice moveNorth(Dice *d){
    Dice tmp = {d->South,d->Down,d->East ,d->West,d->Up,d->North};
    return tmp;
}

Dice moveWest(Dice *d){
    Dice tmp = {d->East,d->South,d->Down,d->Up,d->North,d->West};
    return tmp;
}

Dice moveSouth(Dice *d){
    Dice tmp = {d->North,d->Up,d->East ,d->West,d->Down,d->South};
    return tmp;
}

Dice moveEast(Dice *d){
    Dice tmp = {d->West,d->South,d->Up,d->Down,d->North,d->East};
    return tmp;
}

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

using namespace std;

#define ll long long
#define fi first
#define se second

void test_case(){
	ll h,n;
	scanf("%lld%lld",&h,&n);
	vector<ll> arr(n);
	ll s=0;
	for(int i=0;i<n;i++)scanf("%lld",&arr[i]),s+=arr[i];
	if(s>=h)
		puts("Yes");
	else
		puts("No");
	

}

int main(){
	int t=1;
	//scanf("%d",&t);
	
	while(t--)
		test_case();

}


Measured memory_bytes: 1024
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>

bool Check(const std::vector<int>::const_iterator It, int m)
{
    if(m == 0) return true;
    if(m <  0) return false;
    if(*It == -1) return false;
    return
        Check(It+1, m - *It) ||
        Check(It+1, m);
}

int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    int n;
    std::cin >> n;
    std::vector<int> A;
    A.reserve(std::pow(2, n));
    for(int i = 0; i < n; ++i){
        int a;
        std::cin >> a;
        int size = A.size();
        for(int j = 0; j < size; ++j){
            A.push_back(A[j] + a);
        }
        A.push_back(a);
    }
    std::sort(A.begin(), A.end());
    
    int q;
    std::cin >> q;
    for(int i = 0; i < q; ++i){
        int m;
        std::cin >> m;
        std::cout << (std::binary_search(A.begin(), A.end(), m) ? "yes" : "no") << std::endl;
    }
    
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	string s; cin>>s;
	int n = s.size();
	vector<int> dp(n + 1, 0);
	dp[0] = 1;
	for(int i = 1; i <= n; i++){
		if(i >= 5 && s.substr(i - 5, 5) == "dream")dp[i] += dp[i - 5];
		if(i >= 5 && s.substr(i - 5, 5) == "erase")dp[i] += dp[i - 5];
		if(i >= 7 && s.substr(i - 7, 7) == "dreamer")dp[i] += dp[i - 7];
		if(i >= 6 && s.substr(i - 6, 6) == "eraser")dp[i] += dp[i - 6];
		if(dp[i] >= 1)dp[i] = 1;
	}
	if(dp[n])cout<<"YES"<<endl;
	else cout<<"NO"<<endl;

	return 0;
}

Measured memory_bytes: 848
#include <cstdio>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

using ll = long long;

constexpr ll MAX_N = 1000, mod = 1000000007;

ll N;
ll A, B, C, D;
ll dp[MAX_N+2][MAX_N+2];
ll fact[MAX_N+2], inv[MAX_N+2], invF[MAX_N+2];

ll powMod( ll x, ll y )
{
  ll ret = 1;

  while( y > 0 )
  {
    if( y & 1 )
      ret = (ret*x) % mod;

    x = (x*x) % mod;
    y >>= 1;
  }

  return ret;
}

int main()
{
  scanf( "%lld%lld%lld%lld%lld", &N, &A, &B, &C, &D );

  fact[0] = 1;
  rep( i, N )
    fact[i+1] = (ll)((i+1)*fact[i]) % mod;

  inv[0] = 1;
  invF[0] = 1;
  invF[N] = powMod( fact[N], mod-2 );
  rep( i, N )
    inv[i+1] = powMod( i+1, mod-2 );
  for( int i = N-1; i >= 0; --i )
    invF[i] = invF[i+1]*(i+1)%mod;

  rep( i, B+2 )
    dp[i][0] = 1;
  repi( k, A, B+1 ) repi( n, 0, N+1 )
  {
    if( !dp[k][n] )
      continue;

    if( n )
      dp[k+1][n] = ( dp[k+1][n] + dp[k][n] ) % mod;

    ll tmp = 1;

    repi( x, 1, D+1 )
    {
      if( N-n-k*x < 0 )
        break;

      tmp = (tmp * fact[N-n-k*(x-1)]%mod*invF[k]%mod*invF[N-n-k*x]%mod*inv[x]) % mod;
      
      if( C <= x && x <= D )
        dp[k+1][n+k*x] = ( dp[k+1][n+k*x] +  tmp*dp[k][n]%mod ) % mod;
    }
  }

  printf( "%lld\n", dp[B+1][N] );
  
  return 0;
}


Measured memory_bytes: 8064
import math

n = int(input())
#a, b, c= [int(i) for i in input().split()]
#table = [[int(i) for i in input().split()] for n in range(n)]
list = [int(i) for i in input().split()]
#s = input()
#list = list(s)

#print(n, m)
#print(table)
#print(light)

s1 = 0
s2 = sum(list)
kotae = 10000

for i in range(0, n) :
    s1 += list[i]
    s2 -= list[i]
    kotae = min(kotae, abs(s1 - s2))


print(kotae)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

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

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
string s, t, u;
int si, ti;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> s >> t >> si >> ti >> u;
  if(s == u) cout << si - 1 << " " << ti << endl;
  else cout << si << " " << ti  - 1<< endl;
}


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

public class Test
{
	public static void Main()
	{
		var s = Console.ReadLine()
			.Split(' ')
			.Select(x=>int.Parse(x))
			.ToList();
		var count = 0;
		var min = 0;
		var max = 0;
		while((min=s.Min())!=(max=s.Max()))
		{
			var minIndex = s.IndexOf(min);
			var maxIndex = s.IndexOf(max);
			if(2 <= max - min)
			{
				s[minIndex] += 2;
			}
			else
			{
				s[minIndex] += 1;
				if((minIndex==0&&maxIndex==1)
				 ||(maxIndex==0&&minIndex==1))
				s[2] += 1;
				if((minIndex==1&&maxIndex==2)
				 ||(maxIndex==1&&minIndex==2))
				s[0] += 1;
				if((minIndex==0&&maxIndex==2)
				 ||(maxIndex==0&&minIndex==2))
				s[1] += 1;
			}
			count += 1;
		}
		Console.WriteLine(count);
		// DEBUG
		//var a = s.Select(x=>x.ToString());
		//Console.WriteLine(string.Join(" ", a));
	}
}

Measured memory_bytes: 11348
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


int main(){
    int n;
    cin>>n;
    map<int,int> mp;
    rep(i,n){
        int d;
        cin>>d;
        mp[d]++;
    }
    int m;
    cin>>m;
    vector<int> t(m);
    rep(i,m) cin>>t[i];

    rep(i,m){
        if(mp[t[i]]==0){
            cout<<"NO"<<endl;
            return 0;
        }

        mp[t[i]]--;
    }

    cout<<"YES"<<endl;
}



Measured memory_bytes: 13408
n = int(input())
a =[]
for i in range(n):
  a.append(int(input())-1)

u = [False for _ in range(n)]
i = 0
ans = 0
while(i != 1):
  u[i] = True
  i = a[i]
  if u[i]:
    print(-1)
    exit()
  ans += 1
print(ans)

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

template<typename T>
istream& operator >> (istream& istr, vector<T>& v){
    for(T& x: v) istr >> x;
    return istr;
}

template<typename T, typename U>
istream& operator >> (istream& istr, pair<T,U>& p){
    istr >> p.first >> p.second;
    return istr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& v){
    if(!v.empty()){
        ostr << v.front();
        for(auto itr = ++v.begin(); itr != v.end(); itr++)
            // ostr << *itr;
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, pair<T,U>& p){
    // ostr << p.first << p.second;
    ostr << p.first << ", " << p.second;
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& vv){
    if(!vv.empty()){
        ostr << vv.front();
        for(auto itr = ++vv.begin(); itr != vv.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& vp){
    if(!vp.empty()){
        ostr << vp.front();
        for(auto itr = ++vp.begin(); itr != vp.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<double> vd;
// vll x(n); x[i]=a;
typedef vector<vll> vvll;
typedef vector<vc> vvc;
typedef vector<vd> vvd;
// vvll x(m,vi(n)); x[i][j]=a;
typedef pair<ll,ll> pll;
typedef pair<double,double> pd;
typedef vector<pll> vpll;
typedef vector<pd> vpd;
// vpll x(n); x[i]={a,b}; x[i].first/second;

#define PI 3.1415926535897932
// cout << fixed << setprecision(10) << PI << endl;
#define EPS 1e-12
#define INF (ll)1e+12
#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORR(i,a,b) for(ll i=(b)-1; i>=(a); i--)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()
// sort(all(x));

ll sum(vll &v) {return accumulate(all(v), 0);}

int main(){
    ll n, m, ans = 0;
    cin >> n >> m;
    ans = n*(n-1)/2 + m*(m-1)/2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)

def input():
    return sys.stdin.readline()[:-1]


def dfs(v, parent, d):
    depth[v] = d
    for to, cost in tree[v]:
        if to == parent:
            continue
        dfs(to, v, d + cost)


depth = defaultdict(int)
tree = defaultdict(list)
n = int(input())
for i in range(n - 1):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    tree[a].append((b, c))
    tree[b].append((a, c))

q, k = map(int, input().split())
k -= 1

dfs(k, -1, 0)
for i in range(q):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    print(depth[x] + depth[y])


Measured memory_bytes: 142776
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		@SuppressWarnings("unused")
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		List<int[]> list1 = new ArrayList<>();

		StringBuilder buf = new StringBuilder();
		String s1 = "0";
		String s = "";

		for(int i=0; i<M;i++) {
			int a[] = new int[3];
			a[0] = Integer.parseInt(sc.next());
			a[1] = Integer.parseInt(sc.next());
			a[2] = i;
			list1.add(a);
		}
		List<int[]> list2 = new ArrayList<>(list1);
		List<int[]> list3 = new ArrayList<>();

		list2.sort((a1,a2)->a1[1]-a2[1]);
		list2.sort((a1,a2)->a1[0]-a2[0]);
		int cnt=0,before0=0;
		for(int[]a:list2) {
			int b[] = new int[3];

			if(before0 < a[0]) {
				cnt=1;
			}else {
				cnt++;
			}

			before0 = a[0];
			b[0] = a[0];
			b[1] = cnt;
			b[2] = a[2];
			list3.add(b);

		}

		cnt=0;
		list3.sort((a1,a2)->a1[2]-a2[2]);
		for(int[]a:list3) {
			int keta = String.valueOf(a[0]).length();
			for(int i = 6;i>keta;i--) {
				buf.append(s1);
			}
			buf.append(a[0]);
			keta = String.valueOf(a[1]).length();
			for(int i = 6;i>keta;i--) {
				buf.append(s1);
			}
			buf.append(a[1]+"\n");

			s += buf.toString();
			if(cnt == 50) {
				System.out.println(s);
				s = "";
				cnt = 0;
			}else {
				cnt++;
			}
			buf.setLength(0);
		}
		System.out.println(s);

		sc.close();
	}

}

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

using namespace std;

vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

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

    int k;
    cin >> k;
    cout << a[k - 1] << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    int N, D, X;
    cin >> N >> D >> X;
    vector<int> A(N);
    REP(i, N)cin >> A[i];

    int ans = X;
    REP(i, N) {
        ans += round_up(D, A[i]);
    }
    cout << ans << endl;;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
struct Node {
    int key;
    Node *parent, *left, *right;
};

Node *root, *NIL;

void preOrder(Node *n) {
    if (n == NIL) {
        return;
    }

    cout << " " << n->key;
    preOrder(n->left);
    preOrder(n->right);
}

void inOrder(Node *n) {
    if (n == NIL) {
        return;
    }

    inOrder(n->left);
    cout << " " << n->key;
    inOrder(n->right);
}

void print() {
    inOrder(root);
    cout << endl;
    preOrder(root);
    cout << endl;
}

void insert(int k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while (x != NIL) {
        y = x;
        if (z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }

    z->parent = y;
    if (y == NIL) {
        root = z;
    } else if (z->key < y->key) {
        y->left = z;
    } else {
        y->right = z;
    }
}

Node* find(int k) {
    Node *x = root;
    while (x != NIL && k != x->key) {
        if (k < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }

    return x;
}

int main() {
    int64_t N;
    cin >> N;
    for (int i=0; i < N; i++) {
        string op;
        cin >> op;
        if (op == "insert") {
            int64_t num;
            cin >> num;
            insert(num);
        } else if (op == "find") {
            int num;
            cin >> num;
            Node *x = find(num);
            if (x == NIL) {
                cout << "no" << endl;
            } else {
                cout << "yes" << endl;
            }
        } else {
            print();
        }
    }
    return 0;
}


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

int main() {
  int data[3][3];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> data[i][j];
    }
  }

  int N;
  cin >> N;
  vector<vector<bool>> bingo(3, vector<bool>(3, false));
  for (int k = 0; k < N; k++) {
    int number;
    cin >> number;
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (data[i][j] == number) {
          bingo[i][j] = true;
          break;
        }
      }
    }
  }
  bool yoko = false;
  for (int i = 0; i < 3; i++) {
    int count = 0;
    for (int j = 0; j < 3; j++) {
      if (bingo[i][j]) count ++;
    }
    if (count == 3) yoko = true;
  }
  bool tate = false;
  for (int i = 0; i < 3; i++) {
    int count = 0;
    for (int j = 0; j < 3; j++) {
      if (bingo[j][i]) count ++;
    }
    if (count == 3) tate = true;
  }
  bool naname1 = false;
  if (bingo[0][0] && bingo[1][1] && bingo[2][2]) naname1 = true;
  bool naname2 = false;
  if (bingo[0][2] && bingo[1][1] && bingo[2][0]) naname2 = true;
  string yes = yoko || tate || naname1 || naname2 ? "Yes" : "No";
  cout << yes << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define w(x) scanf("%d",&x);while(x--)
#define rep(i,a,b) for(i=a;i<=b;i++)
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 2*acos(0.0)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

long long int mod=1e9+9;
const int N=100000;
int t,i,j,cs=0,n,a,b;
string s;

int main()
{
    cin>>a>>b>>n;
    cout<<n<<" "<<a<<" "<<b<<endl;
}




Measured memory_bytes: 3612
# -*- coding: utf-8 -*-
"""
Dictionary - Map: Range Search
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_8_C&lang=jp

"""
from bisect import insort, bisect_right, bisect_left

class Range_map:
    def __init__(self):
        self.rm = dict()
        self.lr = []

    def insert(self, x, y):
        if x not in self.rm:
            insort(self.lr, x)
        self.rm[x] = y

    def get(self, x):
        print(self.rm.get(x, 0))

    def delete(self, x):
        if x in self.rm:
            self.rm[x] = 0

    def dump(self, l, r):
        lb = bisect_left(self.lr, l)
        ub = bisect_right(self.lr, r)
        for i in range(lb, ub):
            k = self.lr[i]
            if k in self.rm and self.rm[k] != 0:
                print(f'{k} {self.rm[k]}')


rm = Range_map()
for _ in range(int(input())):
    op, x, y = (input() + ' 1').split()[:3]
    if op == '0':
        rm.insert(x, int(y))
    elif op == '1':
        rm.get(x)
    elif op == '2':
        rm.delete(x)
    else:
        rm.dump(x, y)



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

int main() {
  int n;
  cin >> n;
  vector<char> s(10);
  map<string,long long> num;

  for(int i=0;i<n;i++) {
    string temp;
    cin >> temp;
    for(int j=0;j<10;j++) {
      s.at(j)=temp.at(j);
    }
    sort(s.begin(),s.end());
    temp="";
    for(int j=0;j<10;j++) {
      temp+=s.at(j);
    }
    num[temp]++;
  }
  long long ans=0;
  for(auto p: num) {
    ans+=(p.second-1)*p.second/2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long ll;
typedef pair<int, int> ii;

ll N = 200010;
ll MOD = 1000000007;
ll fac[200010], facInv[200010];
ll inv[200010];
ll ans[100000];

int main(){

	fac[0] = facInv[0] = inv[1] = 1;
	for (int i = 2; i <= N; ++i)
		inv[i] = MOD - (MOD / i) * inv[MOD % i] % MOD;

	for (int i = 1; i <= N; ++i) {
		fac[i] = (fac[i - 1] * i) % MOD;
		facInv[i] = (facInv[i - 1] * inv[i]) % MOD;
	}
	
	ll h, w, a, b;
	cin >> h >> w >> a >> b;
	
	ll res = 0;
	ll sum1 = h - a - 1 + b;
	ll sum2 = w - b - 1 + a;
	for(int i = 0; i < min(h-a, w-b); i++){
		ans[i] = fac[sum1];
		ans[i] = (ans[i] * facInv[h - a - 1 - i]) % MOD;
		ans[i] = (ans[i] * facInv[b + i]) % MOD;
		ans[i] = (ans[i] * fac[sum2]) % MOD;
		ans[i] = (ans[i] * facInv[a + i] % MOD);
		ans[i] = (ans[i] * facInv[w - b - 1 - i]) % MOD;
		res = (res +ans[i]) % MOD;
	}
	
	cout << res << endl;
 
	return 0;
}

Measured memory_bytes: 5632
#include <bits/stdc++.h>
#include <string>
#include <cmath>

using namespace std;
typedef long long ll;

vector<long long> divisor(int n) {
    vector<long long> ret;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return ret;
}

int main()
{
    int N = 0;
    cin >> N;
    int Nsize = N;
    int ans = 0;
    for (int i = 1; i < Nsize; i++) {
        N--;
        ans += divisor(N).size();

    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <unordered_map>
#include <stack>

using namespace std;

//long long MOD = 1000000007;

int main()
{

    int n;
    cin >> n;

    std::cout << std::pow(n, 3) << std::endl;
    return 0;
}




Measured memory_bytes: 256
// +build ignore
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []byte {
	return []byte(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

func gcd(x, y int) int {
	if x%y != 0 {
		return gcd(y, x%y)
	}
	return y
}

func run(input io.Reader, output io.Writer) int {
	sc := NewScanner()
	A := sc.nextFloat()
	B := sc.nextFloat()
	H := sc.nextFloat()
	M := sc.nextFloat()

	radA := float64(H*60+M) * 0.5
	radB := float64(M * 6)
	var radAB float64
	radAB = radA - radB

	aa := float64(A*A+B*B) - float64(2*A*B)*math.Cos(radAB*math.Pi/180.0)

	fmt.Printf("%0.15f", math.Sqrt(aa))

	return 0
}

func main() {
	os.Exit(run(os.Stdin, os.Stdout))
}


Measured memory_bytes: 1728
#[allow(unused_macros)]
macro_rules! input {
    ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } };
    ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ( $ next : expr ) => { };
    ( $ next : expr , ) => { };
    ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) };
    ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) };
    ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) };
    ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

#[allow(unused_macros)]
macro_rules! vec_md {
    ( $ init : expr ; $ ( $ dim : expr ) ;* ) => { vec_md ! ( $ ( $ dim ) ;* => $ init ) };
    ( $ head : expr ; $ ( $ tail : expr ) ;* => $ init : expr ) => { vec ! [ vec_md ! ( $ ( $ tail ) ;* => $ init ) ; $ head ] };
    ( $ head : expr => $ init : expr ) => { vec ! [ $ init ; $ head ] };
}

#[allow(unused_macros)]
macro_rules! chmin {
    ( $ x : expr , $ y : expr ) => { if $ x > $ y { $ x = $ y ; true } else { false } };
}

#[allow(unused_macros)]
macro_rules! chmax {
    ( $ x : expr , $ y : expr ) => { if $ x < $ y { $ x = $ y ; true } else { false } };
}

fn main() {
    input! {
        n: usize, w_max: u64,
        wv: [(u64, usize); n]
    }

    let vsum = wv.iter().map(|&(_, v)| v).fold(0, |acc, x| acc + x);

    let mut dp = vec_md![1u64 << 60;n+1;vsum+1];
    dp[0][0] = 0;
    for i in 0..n {
        for j in 0..vsum+1 {
            chmin!(dp[i+1][j], dp[i][j]);
            if j + wv[i].1 < vsum+1 {
                chmin!(dp[i+1][j + wv[i].1], dp[i][j] + wv[i].0);
            }
        }
    }
    let mut ret = 0;
    for i in 0..vsum+1 {
        if dp[n][i] <= w_max {
            chmax!(ret, i);
        }
    }
    println!("{}", ret);
}


Measured memory_bytes: 106748
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
#include <algorithm>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <math.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
//#define cocount cout << count << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define Cinint(n) int n;\
cin >> n;
#define Cinvecint(a, n) vector<int> a(n);\
for (int i = 0; i < (int)(n); i++) {\
  int num;\
  cin >> num;\
  a.at(i) = num;\
}
#define Cinstring(s) string s;\
cin >>s;

  

int main() {
  Cinint(r);
  cout << 2*r*3.141592 << endl;
}


Measured memory_bytes: 3704
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
	private static final int MAX = 50000;
	private static final Integer[] PRIMES = getPrimeNumbers(MAX);
	
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			int target = Integer.parseInt(br.readLine());
			if(target == 0)	break;
			System.out.println(getNumCombination(target, PRIMES));
		}
	}
	
	public static int getNumCombination(final int targetNumber, final Integer[] primeTable){
		int c = 0;
		int pl = 0;
		int pr = primeTable.length - 1;		//targetNumberに近似する値を持つindexを代入すればより高速
		while(pl <= pr){
			if(primeTable[pl] + primeTable[pr] > targetNumber){
				pr--;
			}else if(primeTable[pl] + primeTable[pr] == targetNumber){
				c++;
				pl++;
			}else{
				pl++;
			}
		}
		return c;
	}
	
    private static Integer[] getPrimeNumbers(final int n){
    	ArrayList<Integer> list = new ArrayList<Integer>();
        for(int i = 2; i < n + 1; i++){
            if(isPrimeNumber(i))	list.add(i);
        }
        return list.toArray(new Integer[list.size()]);
    }
    
    private static boolean isPrimeNumber(final int n){
    	if(n == 2){
    		return true;
    	}
    	else if(n % 2 == 0){
    		return false;
    	}
    	for(int i = 3; i  * i < n + 1; i = i + 2){
    		if(n % i == 0){
    			return false;
    		}
    	}
    	return true;
    }
}

Measured memory_bytes: 25924
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
int r = Integer.parseInt(sc.next());
int g = Integer.parseInt(sc.next());
int b = Integer.parseInt(sc.next());
if((100*r+10*g+b)%4==0){out.println("YES");}else{out.println("NO");}
}
}

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

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

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  for (int i=0;i<S.size();i++) {
    cout << (char)(S.at(i)+N<='Z' ? S.at(i)+N : S.at(i)+N-26);
  }
}

Measured memory_bytes: 256
//  Mayank Agarwal
//  IIIT Hyderabad



#include<bits/stdc++.h>
using namespace std;
const long long int M = 1000000007; 
#define ll long long int
#define ld double
#define pb push_back
#define mp make_pair
ll power(ll x, ll y,  ll p) 
{ 
    ll res = 1;      
    x = x % p;   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;x = (x*x) % p; 
    } return res%p; 
} 
ll modinver(ll a,ll b)
{
    return (power(a,1,M)*power(b,M-2,M))%M;
}
void SieveOfEratosthenes(int n) 
{   
    bool prime[10005]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
} 
ll dp[3003][3003];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n;
    cin>>n;
    std::vector<ll> v(n);
    for(ll&x:v)
    {
        cin>>x;
    }
    for (int i = 0; i < n; ++i)
    {
        dp[i][i]=v[i];
    }
    for (int i = n-1; i>=0; --i)
    {
        for (int j = i+1; j<n ; ++j)
        {
            dp[i][j]=max(v[i]-dp[i+1][j],-dp[i][j-1]+v[j]);
        }
    }
    cout<<dp[0][n-1]<<'\n';
}


Measured memory_bytes: 70016
def check(str):
	for i in range(len(str)//5+1):
		if str=="":
			return "YES"
		elif str[-5:]=="dream" or str[-5:]=="erase" :
			str=str[:-5]
		elif str[-6:]=="eraser":
			str=str[:-6]
		elif str[-7:]=="dreamer":
			str=str[:-7]
		else:
			return "NO"

str=input()
print(check(str))

Measured memory_bytes: 3316
A, B, C, X, Y = map(int,input().split())
Sum=[0 for i in range(max(X,Y)+1)]


for AB in range(0, 2*max(X,Y)+1,2):
    Sum[AB//2]=max((X-AB//2),0)*A+max((Y-AB//2),0)*B+AB*C

print(min(Sum))

Measured memory_bytes: 7064
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define LL long long int
using namespace std;

const int N = 1e6 + 5;

void solve() {
    int n, x;
    cin >> x >> n;
    vector<int> v(201, 0);
    for (int i=0;i<n;++i) {
        int x; cin >> x;
        v[x]++;
    }
    int ans = 1e9, val = -1;
    for (int i=0;i<=200;++i) if (!v[i]) {
        if (abs(x - i) < ans) {
            ans = abs(x - i);
            val = i;
        }
    }
    cout << val << '\n';
}
int main() {
    FASTIO;
    int t = 1;
    // cin >> t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" << endl;
#define dump(v) cerr<<#v":[ ";for (auto macro_vi:v){cerr<<macro_vi<< " ";}cerr<<"]"<<endl;
#define ddump(v) cerr<<#v":"<<endl;for(auto macro_row:v) {cerr<<"["; for (auto macro__vi:macro_row){cerr<<macro__vi<< " ";}cerr<<"]"<<endl;}
#define damp(m) for(auto macro_pair:m){cerr<< macro_pair.first<<":"<<macro_pair.second<<endl;}
#define dpair(p) cerr << #p":"<<"(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define all(v) v.begin(), v.end()
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;

    cout << (int)(1900*m+100*(n-m))*pow(2,m) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
constexpr ll mod = 1000000007;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
    int n;cin>>n;
    int a=1,b=1,c=1;
    int sum=0;
    for (a = 1; a < n; a++)
    {
        for (b = 1; a*b < n; b++)
        {
            ++sum;
        }
        
    }
    cout<<sum<<endl;
    
}



Measured memory_bytes: 3632
N=int(input())
S=input()
R=S.count("R")
G=S.count("G")
B=S.count("B")
ans=R*G*B
for i in range(N):
    for j in range(i+1,N):
        k=j+j-i
        if k>=N:
            continue
        if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]:
            ans-=1
print(ans)

Measured memory_bytes: 9188
import sys
input = sys.stdin.readline
MOD = 10**9 + 7
INF = float('INF')

def main():
    n = int(input())
    s = input()
    p = 'ABC'
    ans = 0

    for i in range(n-2):
        for j in range(3):
            if s[i+j] == p[j]:
                if j == 2:
                    ans += 1
            else:
                break
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
import itertools
import math
import fractions
import functools
import copy
n = int(input())
h  = list(map(int, input().split()))

ans = 0
active = 0
for i in range(n):
    if h[i] <= active:
        active = h[i]
    else:
        ans += h[i] - active;    
        active = h[i]
print(ans)

Measured memory_bytes: 63980
#include<bits/stdc++.h>
using namespace std;
int main(){
    int r,c;
    cin>>r>>c;
    int a[r+1][c+1];
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<c;i++){
        int n=0;
        for(int j=0;j<r;j++){
            n+=a[j][i];
        }
        a[r][i]=n;
    }
    for(int i=0;i<r+1;i++){
        int n=0;
        for(int j=0;j<c;j++){
            n+=a[i][j];
        }
        a[i][c]=n;
    }
    for(int i=0;i<r+1;i++){
        for(int j=0;j<c+1;j++){
            if(j==0){
                cout<<a[i][j];
            }
            else{
            cout<<' '<<a[i][j];
            }
        }
        cout<<endl;
    }
}


Measured memory_bytes: 3116
import java.io.*;
import java.util.*;

public class Main {
  private static int getGroupIndex(int v) {
    if (v == 2) {
      return 0;
    }
    for (int g : new int[]{4, 6, 9, 11}) {
      if (g == v) {
        return 1;
      }
    }
    return 2;
  }
  
  private static boolean solve(int x, int y) {
    return getGroupIndex(x) == getGroupIndex(y);
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int x = reader.nextInt();
    int y = reader.nextInt();
    out.println(solve(x, y) ? "Yes" : "No");
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 20564
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
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;}
const int inf = 1001001001;

int main() {
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    auto cnt = [](ll a,ll b,ll n) {
        ll ret = 0;
        ret += b/n;
        ret -= (a-1)/n;
        return ret;
    };
    ll ans = b-a+1;
    ans -= cnt(a,b,c);
    ans -= cnt(a,b,d);
    ll cd = c*d/__gcd(c,d);
    ans += cnt(a,b,cd);
    cout << ans << endl;
}

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

typedef long long int ll;

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

	int n;
	cin >> n;
	if (n >= 30) cout << "Yes\n";
	else cout << "No\n";	
}

Measured memory_bytes: 3616
#include<stdio.h>

int table[101];

int main()
{
	int d,n,i;
	scanf("%d %d", &d, &n);

	for (i = 1; i <= 100; i ++) {
		if (d == 0) {
			if (i == 100) {
				table[i] = 101;
			} else {
				table[i] = i;
			}
		} else if (d == 1) {
			if (i == 100) {
				table[i] = 101 * 100;
			} else {
				table[i] = i * 100;
			}
		} else {
			if (i == 100) {
				table[i] = 101 * 10000;
			} else {
				table[i] = i * 10000;
			}
		}
	}
	printf("%d",table[n]);
	return 0;
}


Measured memory_bytes: 128