akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const int maxn=5e5+5;
//unordered_map<int,int> mapp;
int n,r;
int read() {
	char ch = getchar();
	int x = 0, f = 1;
	while (ch < '0' || ch > '9') f = (ch == '-' ? -1 : 1), ch = getchar();
	while (ch >= '0' && ch <= '9') x = x*10 + ch - 48, ch = getchar();
	return x * f;
}
int main() {
    cin>>n>>r;
    if(n>=10) cout<<r;
    else cout<<r+100*(10-n);
	return 0;
}

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



int main(){
    string S;
    string T;
    cin >> S >> T;
    int Slen = S.length();
    int Tlen = T.length();
    string ans = "~";
    for(int i=0;i<=Slen-Tlen;i++){
        bool ok = true;
        string S2 = S;
        for(int j=0;j<Tlen;j++){
            if(S2[i+j]!='?'&&S2[i+j]!=T[j])ok=false;
            S2[i+j]=T[j];
        }
        if(ok){
            replace(S2.begin(),S2.end(),'?','a');
            ans =S2;
        }
        
    }
    
    if(ans=="~")
        cout << "UNRESTORABLE" << endl;
    else
        cout << ans << endl;
        
    return 0;
    
}




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

using namespace std;
int main()
{
	uint64_t N, A, B;
	cin >> N >> A >> B;

	
	uint64_t amari = 0;
	if (N%(A+B) > A) {
		amari = A;
	}
	else{
		amari = N % (A + B);
	}

	cout<< (N / (A + B))*A + amari;




}



Measured memory_bytes: 256
import java.util.Scanner;

//X-Ray Screening System
public class Main{

	int h, w, n;
	char[][] map;
	int[][] r;//0: top 1:bottom 2:left 3:bottom
	int[] order;
	boolean[] u;
	boolean[] used;
	
	boolean check(){
		boolean[] checked = new boolean[26];
		for(int k=0;k<n;k++){
			int x = order[k];
			checked[x] = true;
			for(int i=r[x][0];i<=r[x][1];i++){
				for(int j=r[x][2];j<=r[x][3];j++){
					if(map[i][j]=='.')return false;
					int c = map[i][j] - 'A';
					if(!checked[c])return false;
				}
			}
		}
		return true;
	}
	
	boolean dfs(int k){
		if(k==n){
			return check();
		}
		for(int i=0;i<26;i++){
			if(u[i]&&!used[i]){
				used[i] = true;
				order[k] = i;
				if(dfs(k+1))return true;
				used[i] = false;
			}
		}
		return false;
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		while(t--!=0){
			h = sc.nextInt();
			w = sc.nextInt();
			map = new char[h][w];
			u = new boolean[26];
			r = new int[26][4];
			n = 0;
			for(int i=0;i<h;i++){
				char[] ch = sc.next().toCharArray();
				for(int j=0;j<w;j++){
					map[i][j] = ch[j];
					if(map[i][j]=='.')continue;
					int x = map[i][j]-'A';
					if(!u[x]){
						n++;
						u[x] = true;
						r[x][0] = r[x][1] = i;
						r[x][2] = r[x][3] = j;
					}
					else{
						r[x][0] = Math.min(r[x][0], i);
						r[x][1] = Math.max(r[x][1], i);
						r[x][2] = Math.min(r[x][2], j);
						r[x][3] = Math.max(r[x][3], j);
					}
				}
			}
			order = new int[n];
			used = new boolean[26];
			System.out.println(dfs(0)?"SAFE":"SUSPICIOUS");
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int D;
  cin>>D;
  vector<int> c(26);
  for(int &i:c)
    cin>>i;
  vector<vector<int>> s(D,vector<int>(26));
  for(vector<int> &v:s)
    for(int &i:v)
      cin>>i;
  vector<int> t(D);
  for(int &i:t)
    cin>>i;
  vector<int> A(26,0);
  vector<int> mz(D,0);
  int mzint=0;
  for(int i=0;i<D;i++){
    A[t[i]-1]=i+1;
    mz[i]=mzint+s[i][t[i]-1];
    for(int j=0;j<26;j++)
      mz[i]-=(i+1-A[j])*c[j];
    mzint=mz[i];
  }
  int M,ans=mz[D-1];
  cin>>M;
  while(M--){
    int d,q;
    cin>>d>>q;
    d--,q--;
    ans+=s[d][q]-s[d][t[d]-1];
    int mae=-1,ato=D;
    for(int i=d-1;i>=0;i--){
      if(t[i]==t[d]){
        mae=i;
        break;
      }
    }
    for(int i=d+1;i<D;i++){
      if(t[i]==t[d]){
        ato=i;
        break;
      }
    }
    ans-=(ato-d)*(d-mae)*c[t[d]-1];
    mae=-1,ato=D;
    for(int i=d;i>=0;i--){
      if(t[i]==q+1){
        mae=i;
        break;
      }
    }
    for(int i=d;i<D;i++){
      if(t[i]==q+1){
        ato=i;
        break;
      }
    }
    ans+=(ato-d)*(d-mae)*c[q];
    cout<<ans<<endl;
    t[d]=q+1;
  }
}

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

using namespace std;

int main(void){
    int N,temp;
    vector<int> A;
    long long int num[200001] = {0};
    vector<long long int> pair_num(200001,0);
    long long int sum = 0;
    cin >> N;
    for (int i= 0;i < N;i++){
        cin >> temp;
        num[temp] += 1;
        if(num[temp] > 1){
            pair_num.at(temp) += (num[temp]-1); 
        }
        A.push_back(temp);
    }

    for (int i=1; i < N+1 ; i++){
        sum += pair_num.at(i);
    }

    
    for(int k=0;k<N;k++){
        cout << sum - (num[A[k]] - 1) << endl;
    }


    // for(int i=0; i< N;i++ ){
    //     cout << num[i] << " ";
    // }
}



Measured memory_bytes: 6644
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
#define pi 3.14159265359
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, p;
    cin >> n;
    ll arr[n+1] = {0};
    for(i = 1; i*i <= n; i++){
        for(j = 1; j*j <= n; j++){
            for(k = 1; k*k <= n; k++){
                x = i*i + j*j + k*k + i*j + j*k + i*k;
                if(x <= n){
                    arr[x]++;
                }
            }
        }
    }
    for(i = 1; i <= n; i++){
        cout << arr[i] << endl;
    }


    return 0;
}


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

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

void solve(){
    ll Q; cin >> Q;
    //    vector<ll> A(Q),B(Q);
    //    for(int i = 0; i < Q; i++) cin >> A[i] >> B[i];
    while(Q--){
        ll x,y; cin >> x >> y;
        if(x > y) swap(x,y);
        ll S = x*y;
        
        ll l = 0, r = x;
        while(r-l>1){
            ll m = (l+r)/2;
            ll _x = m;
            
            ll _y = y + 1;
          //  cout << l << " " << r << " " << m << " " << _x << " " << _y << endl;
            if(_x*_y >= S){
                r = m;
            }else{
                l = m;
            }
        }
        ll xcnt = l;
        
        l = 0; r = y;
        while(r-l>1){
            ll m = (l+r)/2;
            ll _x = x + 1;
            ll _y = m;
            if(_y > x){
                ll ave = (_x + _y)/2;
                if((_x+_y)%2 == 0) _x = _y = ave;
                else {_x = ave; _y = ave+1;}
            }
          //  cout << l << " " << r << " " << m << " " << _x << " " << _y << " " << _x*_y << endl;
            if(_x*_y >= S){
                r = m;
            }else{
                l = m;
            }
        }
        ll ycnt = l;
        
        ll cnt_add = min(x-1-xcnt,y-1-ycnt);
        
     //   cout << " ++++++++++ " << endl;
     //   cout << xcnt << " " << ycnt << " " << cnt_add << endl;
        cout << xcnt + ycnt + cnt_add << endl;
    }
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve();
    return 0;
}


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

int main()
{
ll n , m , q ;
cin >> n >> m >> q ;
string s[n];
rep(i,n){
  cin >> s[i];
}
vector<vector<ll>> cnt(n+1, vector<ll>(m+1,0) );
rep(i,n)rep(j,m){
  cnt[i+1][j+1]=(s[i][j]=='1' ? 1 : 0)+cnt[i][j+1]+cnt[i+1][j]-cnt[i][j];
}
vector<vector<ll>> ed(n+1, vector<ll>(m+1,0) );
rep(i,n)rep(j,m){
  ed[i+1][j+1]=(i+1<n&&s[i][j]=='1'&&s[i+1][j]=='1' ? 1 : 0)+ed[i][j+1]+ed[i+1][j]-ed[i][j];
}
vector<vector<ll>> ed1(n+1, vector<ll>(m+1,0) );
rep(i,n)rep(j,m){
  ed1[i+1][j+1]=(j+1<m&&s[i][j]=='1'&&s[i][j+1]=='1' ? 1 : 0)+ed1[i][j+1]+ed1[i+1][j]-ed1[i][j];
}
rep(i,q){
  ll x1 , y1 , x2 , y2 ;
  cin >> x1 >> y1 >> x2 >> y2 ;
  cout << cnt[x2][y2]-cnt[x1-1][y2]-cnt[x2][y1-1]+cnt[x1-1][y1-1]-(ed[x2-1][y2]-ed[x1-1][y2]-ed[x2-1][y1-1]+ed[x1-1][y1-1])-(ed1[x2][y2-1]-ed1[x1-1][y2-1]-ed1[x2][y1-1]+ed1[x1-1][y1-1]) << endl;
}
return 0;
}

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

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

using namespace std;

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

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

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
string cha[55];
int point[50];
bool flag[50][50];
int main(){
	int n;
	while(cin>>n,n){
		for(int i =0;i <=30;i++){
			point[i] = n+1;
		}
		for(int i =0;i <=30;i++){
			for(int j=0;j <=30;j++){
				flag[i][j] =false;
			}
		}
		for(int i =0;i < n;i++){
			string str;
			int x;
			cin>>str>>x;
			cha[i] = str;
			for(int j = 0;j < x;j++){
				int y;
				cin>>y;
				point[y]--;
				flag[i][y] =true;
			}
		}
		vector<pair<int,string> > ans;
		ans.clear();

		for(int i =0;i < n;i++){
			int tmp  =0;
			for(int j =0;j <=30;j++){
				if(flag[i][j]&&point[j]!=n+1){
					tmp +=point[j];
				}
			}
			ans.push_back(mp(tmp,cha[i]));
		}
		sort(ans.begin(),ans.end());
		cout <<ans[0].first<<" "<<ans[0].second<<endl;
	}
	return 0;
}

Measured memory_bytes: 1228
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <list>
#include <set>
using namespace  std;

constexpr int INF = std::numeric_limits<int>::max();

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, Q;
    cin >> N >> Q;

    vector<tuple<int, int, int>> E;
    for (int i = 0; i < N; i++) {
        int s, t, x;
        cin >> s >> t >> x;
        E.emplace_back(s - x,  1, x);
        E.emplace_back(t - x, -1, x);
    }

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

    vector<int> D(Q);
    vector<int> ANS(Q);
    set<int> set;
    for (int &d: D) {
        cin >> d;
    }

    int i = 0;
    for (auto &tuple : E) {
        int t = get<0>(tuple);
        int s = get<1>(tuple);
        int x = get<2>(tuple);

        while (D[i] < t && i < Q) {
            if (set.empty()) {
                ANS[i] = -1;
            } else {
                ANS[i] = *set.begin();
            }
            i++;
        }

        if (s == 1) {
            set.insert(x);
        } else {
            set.erase(x);
        }
    }

    while (i < Q) {
        if (set.empty()) {
            ANS[i] = -1;
        } else {
            ANS[i] = *set.begin();
        }
        i++;
    }

    for (auto ans : ANS) {
        cout << ans << endl;
    }
}

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

long long solve(long long a,long long b){
  while(a>0&&b>0){
    if(a>b)swap(a,b);
    b%=a;
  }
  return a;
}



int main(){
  long long a,b;
  cin>>a>>b;
  cout<<solve(a,b)<<endl;
}

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

int main(){
  char t;
  int n;
  double w, h;
  while(cin>>n>>t>>w>>t>>h){
    if(w/(double)(h*h)>=25.0)cout<<n<<endl;
  }
  return 0;
}

Measured memory_bytes: 1232
#include<stdio.h>
#include<stdlib.h>
int int_comp(const void*a,const void*b){return *(int*)a-*(int*)b;}
int main(void)
{
  int n;
  int a[200000];
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  int flg=0;
  qsort(a,n,sizeof(int),int_comp);
  for(int i=1;i<n;i++){
    if(a[i]==a[i-1]){
      flg=1;
      break;
    }
  }
  if(flg==0){
    printf("YES\n");
  }else{
    printf("NO\n");
  }
  return 0;
}
    

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, Y;
  int x = -1;
  int y = -1;
  int z = -1;
  cin >> N >> Y;
  for(int i=0; i<=N; i++){
    for(int j=0; j<=N-i; j++){
      if(10000*i+5000*j+1000*(N-i-j) == Y){
        x = i;
        y = j;
        z = N-i-j;
      }
    }
  }
  cout << x << " " << y << " " << z << endl;
}

Measured memory_bytes: 256
import java.util.*
import java.math.*
import kotlin.math.*

fun readLn()=readLine()!!
fun readInt()=readLn().toInt()
fun readInts()=readLn().split(" ").map{it.toInt()}
fun readLong()=readLn().toLong()
fun readLongs()=readLn().split(" ").map{it.toLong()}

val out=mutableListOf<String>()
fun printLine(s:String){out.add(s)}
fun output(){println(out.joinToString("\n"))}

fun main(){
    var (n,m)=readInts()
    var k=(m+1)/2
    if(n%2==1){
        k=m
    }
    var l=k;var r=k+1
    for(i in 1..k){
        printLine("$l $r")
        l--;r++
    }
    l=k*2+m-k;r=l+2
    for(i in 1..m-k){
        printLine("$l $r")
        l--;r++
    }
    output()
}

Measured memory_bytes: 59080
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  char c;
  cin >> c;
  cout << (char)(c+1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

int main() {
	int ans = 0, n, now = 0;
	string str;
	cin >> n >> str;
	REP(i, n){
		if(str[i] == 'I') now++;
		if(str[i] == 'D') now--;
		ans = max(ans, now);
	}
	ans = max(ans, now);

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

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

#define MAX_H 50
#define MAX_W 50

int H, W;
char G[MAX_H + 10][MAX_W + 10];

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

int check(int x, int y) {
    if (x < 0 || x >= W) return 0;
    if (y < 0 || y >= H) return 0;
    return 1;
}

int main() {

    scanf("%d %d", &H, &W);
    for (int y = 0; y < H; y++) {
        scanf("%s", G[y]);
    }

    for (int y = 0; y < H; y++) {
        for (int x = 0; x < W; x++) {
            if (G[y][x] == '.') {
                int res = 0;
                for (int i = 0; i < 8; i++) {
                    if (!check(x, y)) continue;
                    if (G[y + dy[i]][x + dx[i]] == '#') res++;
                }
                G[y][x] = res + '0';
            }
        }
    }

    for (int y = 0; y < H; y++) {
        for (int x = 0; x < W; x++) {
            printf("%c", G[y][x]);
        }
        puts("");
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int count = 0;
    for (int i = 0; i < N; i++) {
      int a = scanner.nextInt();
      while (a % 2 == 0) {
        count++;
        a /= 2;
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 34196
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdlib>

using namespace std;
int mgcd(int a,int b);

int main(){
	int N,X,t;
	cin >> N >> X;
	int gcd;
	cin >> gcd;
	gcd -= X;
	gcd = abs(gcd);
	for(int i=1;i<N;i++){
		cin >> t;
		t -= X;
		t = abs(t);
		gcd = mgcd(gcd,t);
	}
	cout << gcd << endl;
	return 0;
}

int mgcd(int a,int b){
	if(a<b){
		int t = a;
		a = b;
		b = t;
	}
	int r = a % b;
	while(r != 0){
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<algorithm>
using namespace std;
#define ll long long



int main()
{
    ll n,w,i,j;
    cin>>n>>w;
    ll a[n][2];
    ll dp[n+1][w+1];
    for(i=0;i<n;i++)
    {    
    	cin>>a[i][0]>>a[i][1];
    }
    //memset(dp,0,sizeof(dp));
    for(i=0;i<=n;i++)
    {
    	dp[i][0]=0;
    }
    for(i=0;i<=w;i++)
    {
    	dp[0][i]=0;
    }
    for(i=1;i<=n;i++)
    {
    	for(j=0;j<=w;j++)
    	{
    		if(j>=a[i-1][0])
    		{
    			dp[i][j]=max(dp[i-1][j],dp[i-1][j-a[i-1][0]]+a[i-1][1]);
    		}
    		else
    		{
    			dp[i][j]=dp[i-1][j];
    		}
    	}
    }

    cout<<dp[n][w]<<"\n";
}

Measured memory_bytes: 82480
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,r,p;
    cin>>a>>b>>c>>d;
    if(a>b){
    p=(a-b);
    r=(b*c+p*d);
    cout<<r<<endl;
    }
    else{
        cout<<a*c<<endl;
    }
    return 0;
}


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

int main()
{
	int find = 0, a, b;
	string str;
	scanf("%d %d", &a, &b);
	cin >> str;
	if(str[a] == '-') {
		for(int i = 0; i < a; i++) {
			if(str[i] >= '0' && str[i] <='9') ;
			else { find = 1; break;}
		}
		for(int i = a + 1; i <= a + b; i++) {
			if(str[i] >= '0' && str[i] <= '9') ;
			else {find = 1; break;}
		}
		if(find == 1) printf("No\n");
		else printf("Yes\n");
	}
	else printf("No\n");
}

Measured memory_bytes: 256
n=int(input())
A=list(map(int,input().split()))
ans = [0]*(n+1)
for i in range(n):
  ans[i+1] = ans[i]+A[i]
prin = 10**100
for i in range(1,n):
  prin = min(prin,abs(ans[i]-(ans[n]-ans[i])))
print(prin)

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

int N;
int h[110];
int c[110];
int res;

int water(int l, int r){
  int cnt=0;
  bool water_all = true;
  
  //cout << "(l,r)=(" << l << "," << r << "); c=";
  //for(int i=0;i<N;i++) cout << c[i] << " ";
  //cout << endl;
  
  if(l>r) return 0;
  while(water_all){
    int idx;
    for(int i=l;i<=r;i++){
      if(h[i]<=c[i]){
        //cout << "..... Found " << i << "th floor reached its goal." << endl;
        idx = i;
        water_all = false;
        break;
      }
    }
    if(water_all){
      for(int i=l;i<=r;i++) {
        c[i]+=1;
      }
      cnt+=1+water(l,r);
    } else {
        cnt+=water(l,idx-1)+water(idx+1,r);
    }
  }
  return cnt;
}

int main()
{
  cin >> N;
  for(int i=0;i<N;i++) cin >> h[i];
  for(int i=0;i<N;i++) c[i]=0;
  
  int res=0;

  res = water(0,N-1);
  
  cout << res << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)>(b)?(b):(a))
int c(int n){
	if(!n)return 0;
	return c(n>>1)+(n&1);
}
int N, K, a[20];
long long ans=1ll<<60;
int main(){
	scanf("%d%d",&N,&K);
	for(int i=0; i<N; i++)scanf("%d",&a[i]);
	for(int i=0; i<(1<<N-1); i++)if(c(i)>=K-1){
		int maxi=a[0];
		long sum=0;
		for(int j=1; j<N; j++){
			if((i>>j-1)&1){
				if(a[j] <= maxi){
					sum += maxi-a[j]+1;
					maxi++;
				}else {
					maxi = a[j];
				}
			}else {
				maxi = max(maxi,a[j]);
			}
		}
		ans = min(ans,sum);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1716
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}

	int a[26] = {};
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			a[s[i][j] - 'a']++;
		}
	}

	int sum4 = 0, sum2 = 0;
	for (int i = 0; i < 26; i++) {
		int tmp = a[i] / 4;
		a[i] -= tmp * 4;
		sum4 += tmp;
		sum2 += a[i] / 2;
	}
	if ((h / 2) * (w / 2) <= sum4) {
		sum4 -= (h / 2) * (w / 2);

		int t = 0;
		if (h % 2 == 1) {
			t += w / 2;
		}
		if (w % 2 == 1) {
			t += h / 2;
		}
		if (t <= sum2 + sum4 * 2) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	} else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] arg) {
		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			int max = 0;
			int start = 0;
			String sa = in.next();
			String sb = in.next();
			StringBuilder sbb = new StringBuilder();
			int s = sa.length() + sb.length() - 1;
			for (int i = 0; i < s; i++) {
				if (max > sa.length() - start) {
					break;
				}
				if (i < sb.length()) {
					sbb.insert(0, sb.charAt(sb.length() - i - 1));
				} else {
					sbb.insert(0, ' ');
					start++;
				}
				if (i >= sa.length()) {
					sbb.setLength(sbb.length() - 1);
				}
				int count = 0;
				for (int posi = start; posi < sbb.length(); posi++) {
					if (max > sbb.length() - start) {
						break;
					}
					if (sa.charAt(posi) == sbb.charAt(posi)) {
						count++;
					} else if (count != 0) {
						count = 0;
					}
					max = Math.max(count, max);
				}
			}
			System.out.println(max);
		}
		in.close();
	}
}

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

//プロセスを表す構造体
struct Process{
    public:
        string name;
        int time;
};

//リングバッファとしてキューを実装するクラス
class Queue{
    private:
        int head;
        int tail;

    public:
        Process p[100001];
        Queue();
        void enqueue(Process x);
        Process dequeue();
        bool is_empty();
        bool is_full();
};

Queue::Queue(){
    head = 0;
    tail = 0;
}

bool Queue::is_empty(){
    return (head == tail);
}

bool Queue::is_full(){
    return (tail + 1 == head);
}

void Queue::enqueue(Process x){
    p[tail] = x;
    if (tail + 1 == 100001){
        tail = 0;
    }
    else{
        tail++;
    }
}

Process Queue::dequeue(){
    Process keep = p[head];
    if (head + 1 == 100001){
        head = 0;
    }
    else{
        head++;
    }
    return keep;
}

int main(){
    int n, q;
    cin >> n >> q;
    Queue qu;
    Process p[n];
    for (int i = 0; i < n; i++){
        cin >> p[i].name >> p[i].time;
        qu.enqueue(p[i]);
    }
    int time = 0;
    while (!qu.is_empty()){
        Process x = qu.dequeue();
        if (x.time - q <= 0) {
            time += x.time;
            cout << x.name << ' ' << time << endl;
        }
        else{
            x.time -= q;
          	time += q;
            qu.enqueue(x);
        }
    }
}


Measured memory_bytes: 7900
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_left, bisect_right

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, H = MAP()
A, B = [0] * N, [0] * N
for i in range(N):
    A[i], B[i] = MAP()

max_a = max(A)
B.sort(reverse=True)

ans = 0
for i in range(N):
    if max_a >= B[i]:
        ans += -(-H // max_a)
        print(ans)
        break
    else:
        H -= B[i]
        ans += 1
    if H <= 0:
        print(ans)
        break
else:
    ans += -(-H // max_a)
    print(ans)



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

using namespace std;

typedef long long ll;

int main(){
  ll N,M;
  ll A[1111111];
  ll i;
  cin >> N >> M;
  for(i=0;i<=M-1;i++)
    cin >> A[i];
  for(i=0;i<=M-1;i++)
    N -= A[i];
  if(N>=0) cout << N << endl;
  else cout << -1 <<endl;
}



Measured memory_bytes: 3676
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define EPS 10e-8

using namespace std;
typedef pair<int, int> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }

int N;
map<string, int> nums;

int main(int argc, char **argv) {
    cin >> N;

    llong res = 0;
    for(int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        
        sort(s.begin(), s.end());
        if(nums.find(s) == nums.end()) {
            nums[s] = 1;
        } else {
            res += nums[s];
            nums[s]++;
        }
    }


    cout << res << endl;
}

Measured memory_bytes: 11136
# include <stdio.h>

int main(void){
	int n,t,i,a[100][100];

	while(1){
		
		scanf("%d",&n);
		if(n==0){
			return 0;
		}
		
		for(t=0;t<=n;t++){
			for(i=0;i<=n;i++){
				a[t][i]=0;
			}
		}
		
		for(t=0;t<n;t++){
			for(i=0;i<n;i++){
				scanf("%d",&a[t][i]);
			}
		}
		for(t=0;t<n;t++){
			for(i=0;i<n;i++){
				a[t][n] += a[t][i];
			}
		}
		for(t=0;t<=n;t++){
			for(i=0;i<n;i++){
				a[n][t] += a[i][t];
			}
		}
		for(t=0;t<=n;t++){
			for(i=0;i<=n;i++){
				if(a[t][i]<10){
					printf(" ");
				}
				if(a[t][i]<100){
					printf(" ");
				}
				if(a[t][i]<1000){
					printf(" ");
				}
				if(a[t][i]<10000){
					printf(" ");
				}
				printf("%d",a[t][i]);
			}
			printf("\n");
		}
	}
}

Measured memory_bytes: 616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){
  if(a<b) swap(a,b);
  if(a%b==0) return b;
  return gcd(b,a%b);
}
ll lcm(ll a,ll b){
  if(a<b) swap(a,b);
  for(ll i=1;;i++){
    if((a*i)%b==0){
      return a*i;
      break;
    }
  }
}
    
int main(){
  ll n,m;cin>>n>>m;
  string s,t;
  cin>>s;cin>>t;
  ll c=lcm(n,m);
  ll a=c/n;
  ll b=c/m;
  ll d=lcm(a,b);
  ll e=n/b;
  ll che=1;
  for(ll i=0;i<e;i++){
    if(s[i*b]!=t[i*a]){
      che=0;
      break;
    }
  }
  if(che==0) cout<<-1<<endl;
  if(che==1) cout<<c<<endl;
}
      
  

Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Azhan Khan
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        FLCS solver = new FLCS();
        solver.solve(1, in, out);
        out.close();
    }

    static class FLCS {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String s = in.next();
            String t = in.next();

            int[][] dp = new int[s.length() + 1][t.length() + 1];

            for (int i = 0; i <= s.length(); i++) {
                for (int j = 0; j <= t.length(); j++) {
                    if (i == 0 || j == 0) dp[i][j] = 0;
                    else if (s.charAt(i - 1) == t.charAt(j - 1)) {
                        dp[i][j] = dp[i - 1][j - 1] + 1;
                    } else {
                        dp[i][j] = Math.max(dp[i][j - 1], dp[i - 1][j]);
                    }
                }
            }

            int len = dp[s.length()][t.length()];
            String ans = "";

            int i = s.length();
            int j = t.length();
            while (i > 0 && j > 0) {
                if (s.charAt(i - 1) == t.charAt(j - 1)) {
                    ans = s.charAt(i - 1) + ans;
                    i--;
                    j--;
                } else if (dp[i - 1][j] > dp[i][j - 1]) {
                    i--;
                } else j--;
            }

            out.println(ans);
        }

    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

    }
}



Measured memory_bytes: 86484
n,m = map(int, input().split())
a = []
for i in range(m):
  x,y = map(int, input().split())
  a.append((x,y))
a.sort(key=lambda x:x[1])
ans = 1
l,r = a[0]
for x,y in a[1:]:
  if r <= x:
    ans += 1
    l = x
    r = y

print(ans)

Measured memory_bytes: 57596
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<set>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<queue>
#define mem(x) memset(x,0,sizeof(x)) 
#define sca(x) scanf("%d",&x)
#define scaa(x,y) scanf("%d%d",&x,&y)
#define inf 0x7f7f7f7f
#define io ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#pragma GCC optimize(2)
using namespace std;
const double pi=acos(-1); 
const double eps=1e-6;
typedef pair<long,long> pll;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<string,string> pcc;
int a[1000006];
int main()
{
	for(int i=1;i<=100;i++)
	{
		for(int j=1;j<=100;j++)
		{
			for(int k=1;k<=100;k++)
			{
				a[i*i+j*j+k*k+i*j+i*k+j*k]++;
			}
		}
	}
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	cout<<a[i]<<endl;
}

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

def query(i):
    print(i)
    s = input()[0]
    if s=='V':
        exit()
    return s

a = query(0)

def is_ok(k):
    if k==N: return False
    r = query(k)
    if k%2:
        return r != a
    else:
        return r == a

ok = 0
ng = N
while ng-ok > 1:
    m = (ok+ng)//2
    if is_ok(m):
        ok = m
    else:
        ng = m

Measured memory_bytes: 9152
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// Look at me please ... that's what she said
#define MOD 1000000007
using namespace std;
const ll INF = 1e6 + 9;
int main(){
    ios::sync_with_stdio(false);
    //cin.tie(0); ///activate when submit
    int n;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<(int)s.size();i++){
    	s[i]=char(((s[i]-'A')+n)%26+'A');
    }
    cout<<s<<endl;
    return 0;
}    

Measured memory_bytes: 256
#include <stdio.h>

int SelectionSort(int n, int num[]) {
  int i, j;
  int min;
  int count = 0;

  for (i = 0; i < n-1; i++) {
    min = i;
    for (j = i+1; j < n; j++) {
      if (num[j] < num[min]) {
	min = j;
      }
    }
    if (min != i) {
      int tmp;
      tmp = num[i];
      num[i] = num[min];
      num[min] = tmp;
      count++;
    }
  }

  return count;
}

int main() {
  int n;
  int num[100];
  int i;
  int cnt;

  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%d", &num[i]);
  }

  cnt = SelectionSort(n, num);

  for (i = 0; i < n; i++) {
    printf("%d", num[i]);
    if (i == n-1) break;
    putchar(' ');
  }
  putchar('\n');
  printf("%d\n", cnt);

  return 0;
}



Measured memory_bytes: 2056
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>

using namespace std;
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H& b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H& b) const { return x == b.x && y == b.y; }
	bool operator!=(const H& b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T& a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T& a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
/*ll fact_[200000];
ll comb(ll x, ll y, ll mod = Mod) {
	if (!fact_[0]) {
		fact_[0] = 1;
		for (int i = 1; i < 200000; i++) {
			fact_[i] = fact_[i - 1] * i % mod;
		}
	}
	if (x < y) return 0;
	return mod_pow(fact_[x], mod, mod) *
		mod_pow(fact_[x - y], mod - 2, mod) % mod *
		mod_pow(fact_[y], mod - 2, mod) % mod;
}//xCy*/
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n, k;
int a[300000], b[300000];
signed main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	sort(a, a + n);
	sort(b, b + n, greater<int>());
	int ok = Inf, ng = -1, t;
	while (abs(ok - ng) > 1) {
		t = (ok + ng) / 2;
		int sum = 0;
		for (int i = 0; i < n; i++) {
			sum += max(0ll, a[i] - t / b[i]);
		}
		if (sum > k) ng = t;
		else ok = t;
	}
	cout << ok << endl;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int x; cin >> x;
    cout << x / 500 * 1000 + (x % 500) / 5 * 5 << '\n';

}


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

using namespace std;

char l[601][601];
char r[601][601];

int main () {
	int n, m;
	cin >> n >> m;
	for (int i = 1;i <= n;i ++) {
		for (int j = 1;j <= m;j ++) {
			char f;
			cin >> f;
			l[i][j] = f;
			r[i][j] = f;
		}
	}
	for (int i = 1;i <= n;i ++) {
		if (i % 2 == 1) {
			for (int j = 1;j < m;j ++) {
				l[i][j] = '#';
			}
			r[i][m] = '#';
		}
		else {
			for (int j = 2;j <= m;j ++) {
				r[i][j] = '#';
			}
			l[i][1] = '#';
		}
	}
	for  (int i = 1;i <= n;i ++) {
		for (int j = 1;j <= m;j ++) {
			cout << l[i][j];
		}
		cout << endl;
	}     
	cout << endl;
	for  (int i = 1;i <= n;i ++) {
		for (int j = 1;j <= m;j ++) {	
			cout << r[i][j];
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
int c[21], v[21], sum,x;
int main(){
	int n;
	cin>>n;
	for(int i=0; i<n; i++)
		cin>>c[i];
	for(int i=0; i<n; i++)
		cin>>v[i];
	for(int i=0; i<n; i++){
		x = c[i] - v[i];
		if (x>0)
			sum+=x;
	}
	cout<<sum;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    char s;
    cin >> s;
    int x = s;
    if (x == 97||x ==101||x ==105||x==111||x ==117) cout<<"vowel\n";
    else cout<<"consonant\n";
}

Measured memory_bytes: 256
N,A,B=map(int,input().split())
 
if A==0:
  print(0)
elif N<=A:
  print(N)
elif N<=A+B:
  print(A)
elif N>A+B:
  C=A+B
  q = N // C
  mod = N % C
  if mod>=A:
    mod=A
  print(A*q+mod)

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

int main() {
    long N, T;
    cin>>N>>T;
    long A[N];
    for(long i=0;i<N;++i){
        cin>>A[i];
    }
    long buy = A[0];
    long rieki = 0;
    int ans = 0;
    for(int i=1;i<N;++i){
        if(buy > A[i]) buy = A[i];
        if(rieki < A[i] - buy){
            rieki = A[i] - buy;
            ans = 1;
        }
        else if(rieki == A[i] - buy){
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
MOD = 10**9 + 7


class modint():
    def __init__(self, value):
        self.value = value % MOD

    def __int__(self):
        return int(self.value)

    def __float__(self):
        return float(self.value)

    def __str__(self):
        return str(self.value)

    def __repr__(self):
        return str(self.value)

    def __add__(self, other):
        return (modint(self.value + other.value) if isinstance(other, modint)
                else modint(self.value + other))

    def __sub__(self, other):
        return (modint(self.value - other.value) if isinstance(other, modint)
                else modint(self.value - other))

    def __mul__(self, other):
        return (modint(self.value * other.value) if isinstance(other, modint)
                else modint(self.value * other))

    def __truediv__(self, other):
        return (modint(self.value * pow(other.value, MOD - 2, MOD))
                if isinstance(other, modint)
                else modint(self.value * pow(other, MOD - 2, MOD)))

    def __pow__(self, other):
        return (modint(pow(self.value, other.value, MOD))
                if isinstance(other, modint)
                else modint(pow(self.value, other, MOD)))

    def __eq__(self, other):
        return (self.value == other.value if isinstance(other, modint)
                else self.value == (other % MOD))

    def __ne__(self, other):
        return (self.value == other.value if isinstance(other, modint)
                else self.value == (other % MOD))

    def __radd__(self, other):
        return (modint(other.value + self.value) if isinstance(other, modint)
                else modint(other + self.value))

    def __rsub__(self, other):
        return (modint(other.value - self.value) if isinstance(other, modint)
                else modint(other - self.value))

    def __rmul__(self, other):
        return (modint(other.value * self.value) if isinstance(other, modint)
                else modint(other * self.value))

    def __rtruediv__(self, other):
        return (modint(other.value * pow(self.value, MOD - 2, MOD))
                if isinstance(other, modint)
                else modint(other * pow(self.value, MOD - 2, MOD)))

    def __rpow__(self, other):
        return (modint(pow(other.value, self.value, MOD))
                if isinstance(other, modint)
                else modint(pow(other, self.value, MOD)))

    def modinv(self):
        return modint(pow(self.value, MOD - 2, MOD))


def main():
    import sys
    input = sys.stdin.buffer.readline
    N = int(input())
    A = [int(i) for i in input().split()]

    def gcd(x, y):
        if y == 0:
            return x
        while y != 0:
            x, y = y, x % y
        return x

    def lcm(x, y):
        return x*y//gcd(x, y)

    num = 1
    for a in A:
        num = lcm(num, a)
    n = modint(num)

    ans = 0
    for i, a in enumerate(A):
        ans += n/a
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 42460
import java.util.Scanner;

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

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        if(N >= 30) {
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }


    }
}


Measured memory_bytes: 35688
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {



	int n[100] = { 0 };
	int x[100] = { 0 };

	int answer[100] = { 0 };

	int temp_n, temp_x;

	int i = 0;
	for (; i < 100; i++) {
		scanf("%d %d", &temp_n, &temp_x);
		if (temp_n == 0 && temp_x == 0) {
			break;
		}
		n[i] = temp_n;
		x[i] = temp_x;
	}


	int dataset = 0;
	int start_ans1 = 1;
	int start_ans2 = 2;
	int start_ans3 = 3;

	for (dataset = 0; dataset < i; dataset++) { // データセット
		for (start_ans1 = 1; start_ans1 <= n[dataset] - 2; start_ans1++) {
			for (start_ans2 = start_ans1 +1; start_ans2 <= n[dataset] - 1; start_ans2++) {
				for (start_ans3 = start_ans2+1; start_ans3 <= n[dataset]; start_ans3++) {
					if (start_ans1 != start_ans2 && start_ans1 != start_ans3 && start_ans2 != start_ans3) {
						
						if (start_ans1 + start_ans2 + start_ans3 == x[dataset]) {
							answer[dataset]++;
						}
					}
					
				}
			}
		}

	}
	for (dataset = 0; dataset < i; dataset++) {
		printf("%d\n", answer[dataset]);
	}
	

	return 0;
}


Measured memory_bytes: 2080
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<iostream>

using namespace std;

int main()
{
    int a[]={3,13,23,43,53,73,83,103,113,163,173,193,223,233,263,283,293,313,353,373,383,433,
                443,463,503,523,563,593,613,643,653,673,683,733,743,773,823,853,863,883,953,983,
                1013,1033,1063,1093,1103,1123,1153,1163,1193,1213,1223,1283,1303,1373,1423,1433,
                1453,1483,1493},n,i;
    cin>>n;
    for(i=0;i<n-1;i++)
        cout<<a[i]<<' ';
    cout<<a[i]<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
typedef long long ll;

using namespace std;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const double PI = acos(-1);
vector<P> edge[100005];
vl seen(100005,INFL);
int main(){
	int n;cin>>n;
    ll a=0;
    bool f =true;
    rep(i,n){
        ll x;cin>>x;
        if(x%2)f=false;
    }
    if(!f)cout<<"first"<<endl;
    else cout<<"second"<<endl;
}

Measured memory_bytes: 6228
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define rep_r(i,s,n)for(ll i=n-1;i>=s;i--)
#define repe_r(i,s,n)for(ll i=s;i<=n;i++)
static const ll MOD = 1e9 + 7;
static const ll MAX_L = 1e9 + 7;

ll c[3][3] = {};
int main() {
	rep(i, 0, 3)rep(j, 0, 3)cin >> c[i][j];
	ll diff = c[0][0];
	rep(i, 0, 3) rep(j, 0, 3) c[i][j] -= diff;

	ll a1 = 0, b1 = 0;
	ll a2 = c[1][0];
	ll a3 = c[2][0];
	ll b2 = c[0][1];
	ll b3 = c[0][2];

	if (c[1][1] == a2 + b2 &&
		c[1][2] == a2 + b3 &&
		c[2][1] == a3 + b2 &&
		c[2][2] == a3 + b3) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cctype>

inline int read() {
	int ret, f = 1;
	char ch;
	while(!isdigit(ch = getchar())) (ch == '-') && (f = -1);
	for(ret = ch - '0'; isdigit(ch = getchar()); ret *= 10, ret += ch - '0');
	return ret * f;
}

inline void print(int x) {
	if(x < 0) putchar('-'), x = -x;
	if(x > 9) print(x / 10);
	putchar(x % 10 + '0');
}

int main() {
	int a = read(), b = read();
	print(b * 2 - a);
	return 0;
}

Measured memory_bytes: 128
/// Kazuki Hoshino


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
//#define endl '\n'
typedef tree<
int,
null_type,less<int>,
rb_tree_tag,tree_order_statistics_node_update>
ordered_set;
int n,ans;
string a,b,c;
set<char> s;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);

#ifndef ONLINE_JUDGE
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
#endif

cin >> n;
cin >> a >> b >> c;
for(int i=0;i<n;i++){
	s.insert(a[i]);
	s.insert(b[i]);
	s.insert(c[i]);
	ans+= s.size()-1;
	s.clear();
}

cout << ans << endl;




return 0;}
///....


Measured memory_bytes: 256
N = int(input())
H = list(map(int,input().split()))
count = 0
ans = 0
posi = H[0]
for i in range(1,N):
    if(posi>=H[i]):
        posi = H[i]
        count +=1
    else:
        posi = H[i]
        ans=max(ans,count)
        count=0
print(max(ans,count))

Measured memory_bytes: 20420
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod = 1e9 + 7;

int main() {
  int x;
  cin >> x;
  cout << x / 500 * 1000 + (x % 500) / 5 * 5 << endl;
  return 0;
}

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

int main(){
    int N;
    cin>>N;
    vector<int>a(N);
    rep(i,N)scanf("%d",&a[i]);

    map<int,int>cnts;
    rep(i,N)cnts[a[i]]++;
    long long ans=0;
    for(pair<int,int>e :cnts){
        if(e.first>e.second)ans+=e.second;
        else ans+=e.second-e.first;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 5120