akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

int gcd(int x, int y);
int fac(ll n, vector<int> num);

const int INF = 1001001001;

//mint�p�̕ϐ� (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

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

    sort(a.begin(), a.end());
    vector<int> tyo(2, 0);
    int num = 0;
    for (int i = a.size() - 1; i >= 0; i--) {
        if (num == a[i]) {
            if (tyo[0] == 0)
                tyo[0] = num;
            else {
                tyo[1] = num;
                break;
            }
            num = 0;
        }
        else {
            num = a[i];
        }
    }

    cout << (ll)(tyo[0]) * tyo[1] << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

Measured memory_bytes: 3644
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
int a, b;
void solve() {
	cin >> a >> b;
	if (a > 8 && b < 8) {
		cout << ":(" << endl;
	} else if(b > 8 && a < 8) {
		cout << ":(" << endl;
	} else {
		cout << "Yay!" << endl;
	}
	return;
}

int main(int args, char* argv[]) {
	solve();
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
map<long long int,long long int> dp;
long long int xyq=1e9+7;
long long int m;
long long  dfs(long long int pp)
{
	if(dp[pp]!=0)
	{
		return dp[pp];
	}
	else
	{
		return dp[pp]=((dfs(pp/2)%xyq+dfs((pp-1)/2)%xyq)%xyq+dfs((pp-2)/2)%xyq)%xyq;
	}
}
int main()
{
	cin>>m;
	dp[0]=1;
	dp[1]=2;
	cout<<dfs(m)<<endl;
}



Measured memory_bytes: 256
#include <stdio.h>

#define MAX      500000
#define SENTINEL 2000000000

static int L[MAX / 2 + 1];
static int R[MAX / 2 + 1];
static int num_comparison;

void merge(int A[], int n, int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;

    for (int i = 0; i < n1; i++) {
        L[i] = A[left + i];
    }
    for (int i = 0; i < n2; i++) {
        R[i] = A[mid + i];
    }
    L[n1] = R[n2] = SENTINEL;

    int i = 0, j = 0;
    for (int k = left; k < right; k++) {
        num_comparison++;
        if (L[i] <= R[j]) {
            A[k] = L[i++];
        } else {
            A[k] = R[j++];
        }
    }
}

void mergeSort(int A[], int n,  int left, int right)
{
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        mergeSort(A, n, left, mid);
        mergeSort(A, n, mid, right);
        merge(A, n, left, mid, right);
    }
}

int main()
{
    int n;
    int A[MAX];

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

    mergeSort(A, n, 0, n);

    for (int i = 0; i < n; i++) {
        if (i > 0) {
            printf(" ");
        }
        printf("%d", A[i]);
    }
    printf("\n");
    printf("%d\n", num_comparison);

    return 0;
}


Measured memory_bytes: 5760
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

import java.util.StringTokenizer;

public class Main {
	private static final int MOD = (int)Math.pow(10, 9);
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		if (a + b >= c) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
		
	}
	
	static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}


Measured memory_bytes: 20948
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<queue>
using namespace std;

int main() {
	int N, X; cin >> N >> X;
	vector<int> L(N);
	for (int i = 0; i < N; i++)cin >> L[i];
	int d = 0,ans=0;
	for (int i = 0; i < N; i++) {
		d = d + L[i];
		if (d > X)break;
		ans++;
	}
	cout << ans+1 << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int n, a[20][20];
long long prep[1 << 16], dp[1 << 16];

signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			cin >> a[i][j];
		}
	}
	for(int mask = 0; mask < (1 << n); mask ++){
		vector <int> sv;
		for(int i = 0; i < n; i++){
			if(mask & (1 << i)){
				sv.pb(i + 1);
			}
		}
		for(int x : sv){
			for(int y : sv){
				prep[mask] += a[x][y];
			}
		}
		prep[mask] /= 2LL;
	}
	for(int mask = 1; mask < (1 << n); mask ++){
		dp[mask] = -1e18;
		for(int submask = mask; submask; submask = (submask - 1) & mask){
			dp[mask] = max(dp[mask], dp[mask ^ submask] + prep[submask]);
		}
	}
	cout << dp[(1 << n) - 1];
}


Measured memory_bytes: 1280
#include<stdio.h>
long long dp[21][100];
int main(){
	int m,n;
	int i,j;
	scanf("%d",&n);
	for(i=0;i<21;i++)for(j=0;j<n;j++)dp[i][j]=0;
	for(i=0;i<n-1;i++){
		scanf("%d",&m);
		if(i==0){
			dp[m][1]=1;
			continue;
		}
		for(j=0;j<=20;j++){
			if(dp[j][i]!=0){
				if(j+m<=20){
					dp[j+m][i+1]+=dp[j][i];
				}
				if(j-m>=0){
					dp[j-m][i+1]+=dp[j][i];
				}
			}
		}
	}
	scanf("%d",&m);
	printf("%lld\n",dp[m][n-1]);
	return 0;
}

Measured memory_bytes: 1044
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {in_h1: usize, in_m1: usize, in_h2: usize, in_m2: usize, in_k: usize};
    let m = (in_h2 * 60 + in_m2) - (in_h1 * 60 + in_m1);
    let r = m - in_k;

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


Measured memory_bytes: 2168
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			int n=sc.nextInt();
			int count=0;
			for(int a=0;a<10;a++){
				for(int b=0;b<10;b++){
					for(int c=0;c<10;c++){
						for(int d=0;d<10;d++){
							if((a+b+c+d)==n){
								count++;
							}
						}
					}
				}
			}
			System.out.println(count);
		}
	}
}

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

long long lcm(long long a, long long b){return a/__gcd(a,b)*b;}

signed main(){
	int n, a, b = 1;
	
	cin>>n;
	
	for(int i = 0; i < n; i++){
		cin>>a;
		 b = lcm(a,b);
	}
	
	cout<<b<<endl;
	
	return 0;
}


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

int main(void)
{
	int N, K;
	cin >> N >> K;

	int cnt = 0;

	while(N>0){
		int x = (N-1)/(K+1)+1;
		N -= x;
		cnt++;
	}

	cout << cnt << endl;

	
}


Measured memory_bytes: 3104
#include<stdio.h>
int main(void)
{
	int i,j,n,p[10],sum,r;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&p[i]);
	}
	for(i=0;i<n;i++){
		sum+=p[i];
	}
	for(i=0;i<n-1;i++){
		for(i=i+1;i<n;i++){
			if(p[i]>p[j]){
				r=p[i];
				p[i]=p[j];
				p[j]=r;
			}
		}
	}
	sum=sum-(p[0]/2);
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 128
import sys
from operator import itemgetter #sortedの対象を決めたい
from fractions import gcd #最大公約数求めたい
from math import ceil, floor, sqrt #小数点切り上げ、切り捨て、平方根求めたい
from copy import deepcopy #参照で影響されないコピーが作られる
from collections import Counter, deque #要素ごとの出現回数を数える。双方向アクセス可能データ型
import heapq
from functools import reduce
sys.setrecursionlimit(200000)

input = sys.stdin.readline
# template


s = input()
c = input()

count = 0
for i in range(3):
    if s[i] == c[i]:
        count+=1
print(count)

Measured memory_bytes: 5048
// ITP1_5_C Print a Chessboard
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  
  // 初期値
  int H, W;
  bool finished = false;
  
  //Main loop
  while(!finished){
    cin >> H >> W;
    if (H == 0 && W == 0){
      finished = true;
      break;
    }
    for (int i = 0; i < H; i++){
      for (int j = 0; j < W; j++){
        if (j % 2 == i % 2){
          cout << "#";
        } else {
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3100
a,b,c=map(int,input().split())
d=max(a,b,c)
count=0
while (d>=(a+2)):
    a+=2
    count+=1
while d>=(b+2):
    b+=2
    count+=1
while d>=(c+2):
    c+=2
    count+=1
if a+b+c==3*d-2:
    print(count+1)
elif a+b+c==3*d-1:
    print(count+2)
elif a+b+c==3*d:
    print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fi first
#define se second
#define ii pair<int, int>
#define iii tuple<int, int, int>
#define int long long
using namespace std;

const int INF = 1e18;
int n, m, s;
int cost[55][55], tim[55][55];
int silver[55], lost[55];
vector<int> ed[200005];
int ans[55][5505];
bool done[55][5505];
int lim;

void bfs()
{
    for (int i = 1; i <= n; i++)
       for (int j = 0; j <= 5005; j++)
        ans[i][j] = INF;

    ans[1][s] = 0;

    priority_queue<iii, vector<iii>, greater<iii> > q;
    q.push(iii(0, 1, s));

    while(!q.empty())
    {
        int u = get<1>(q.top());
        int cur = get<2>(q.top());
        q.pop();
        int save = cur;

        if (done[u][cur])
            continue;
        done[u][cur] = 1;

        for (auto v : ed[u])
        {
            int cnt = 0;
            while (cur - cost[u][v] <= lim)
            {
                if (cur - cost[u][v] >= 0 && ans[v][cur - cost[u][v]] > ans[u][save] + cnt * lost[u] + tim[u][v]) {
                    ans[v][cur - cost[u][v]] = ans[u][save] + cnt * lost[u] + tim[u][v];
                    q.push(iii(ans[v][cur - cost[u][v]], v, cur - cost[u][v]));
                }

                cnt++;
                cur += silver[u];
            }
            cur = save;
        }
    }
}

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

//    freopen("depart.inp", "r", stdin);
//    freopen("depart.out", "w", stdout);

    cin >> n >> m >> s;
    for (int i = 1; i <= m; i++)
    {
        int a, b, c, t;
        cin >> a >> b >> c >> t;
        c = min(5000LL, c);
        lim = max(lim, c);
        cost[a][b] = c;
        cost[b][a] = c;
        tim[b][a] = t;
        tim[a][b] = t;
        ed[a].push_back(b);
        ed[b].push_back(a);
    }

    lim *= m;
    s = min(s, lim);
    for (int i = 1; i <= n; i++)
    {
        int a, b;
        cin >> a >> b;
        silver[i] = a;
        lost[i] = b;
    }

    bfs();

    for (int i = 2; i <= n; i++)
    {
        int res = INF;
        for (int j = 0; j <= 5000; j++)
            res = min(res, ans[i][j]);
        cout << res << "\n";
    }

}


Measured memory_bytes: 206992
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#include <string>
#include <sstream>
#define ll long long
#define F first
#define S second
#define pb push_back
#define ld long double
#define pll pair<long long,long long>
#define pld pair<long double,long double>
#define ios     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll mod=1000000007;
ll gcd (ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll fastexp(ll x ,ll n)
{
    ll result =1;
    while(n>0)
    {
        if(n%2==1)
            result*=x;
        x*=x;
        n=n/2;
    }
    return result;
}

ll modularExp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n>0)
    {
        if(n%2==1)
            result=(result*x)%mod;
        x=((x%mod)*(x%mod))%mod;
        n=n/2;
    }
    return (result)%mod;
}
bool isPrime(ll n)
{
    for(ll i=2;i*i<=n;i++)
        if(n%i==0)
            return false;
    return true;
}
bool mycomp(pll &a,pll &b)
{
    if(a.F!=b.F)
        return a.F < b.F;
    else
        return a.S < b.S;
}

vector<ll> v[100005];
vector<ll> visited(100005),dp(100005);

void dfs(ll node)
{
     visited[node]=1;
     ll val =0;
     if(v[node].size()==0)
          return;
     ll cnt =0;
     for(auto it:v[node])
     {
          if(!visited[it])
               dfs(it);
          cnt=max(cnt,dp[it]);
     }
     dp[node]=1+cnt;
     return;
}

void solve()
{
     ll n,m;
     cin>>n>>m;
     ll i;
     for(i=1;i<=m;i++)
     {
          ll x,y;
          cin>>x>>y;
          v[x].pb(y);
     }
     for(i=1;i<=n;i++)
     {
          if(!visited[i])
               dfs(i);
     }
     ll ans =0;
     for(i=1;i<=n;i++)
          ans=max(ans,dp[i]);
     cout<<ans;
     
}

int main()
{
    ios;
    ll t;
//    cin>>t;
  t=1;
    while(t--)
        solve();
}

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

int gcd(int a,int b)
{
    if(a%b==0)return b;
    return gcd(b,a%b);
}

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


 //  cout<<a<<" "<<b<<endl;
   if(a==b)
    cout<<a*2;
   else
   {
       cout<<(a*b)/gcd(a,b);
   }


    return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <math.h>
#include <string>
#include <stack>
#include <stdlib.h>
#include <iomanip>
#include <queue>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define mset(a, b) memset(a, b, sizeof(a))
#define LL long long
#define P pair<int, int>
#define PLL pair<LL, LL>
const int MAX = 1e5 + 5;
const int inf = 0x3f3f3f3f;
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, 0, n)
        cin >> a[i];
    sort(a.begin(), a.end());
    int ans = inf;
    for(int i = 0; i+k <= n; i++){
        ans = min(ans, a[i+k-1]- a[i]);
        //printf("%d %d\n", a[i+k-1], a[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse = True)

L = len(A) // 2

if len(A) % 2 == 0:
    #偶数の時
    ans = sum(A[:L]) + sum(A[1:L])
else:
    #奇数の時
    ans = sum(A[:L]) + sum(A[1:L+1])

print(ans)


Measured memory_bytes: 31408
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
	int a, b, h;
	cin >> a >> b >> h;
	cout << (a + b) * h / 2 << endl;
	return 0;
}

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

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

	return 0;
}

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

int main() {
    long n, c, x[100007], y[100007], ansr[100007], ansl[100007];
    cin >> n >> c;
    for(int i=0; i<n; i++)
    {
        cin >> x[i+1] >> y[i+1];
    }

    x[n+1] = c;
    x[0] = 0;
    ansr[n+1] = 0;
    ansl[0] = 0;
    long s=0, t=0;

    for(int i=1; i<=n; i++){
        s += y[i] - (x[i] - x[i-1]);
        ansl[i] = max(ansl[i-1], s);
    }
    for(int i=n; i>=1; i--){
        t += y[i] - (x[i+1] - x[i]);
        ansr[i] = max(ansr[i+1], t);
    }

    long ansR=0, ansL=0;
    long u=0, v=0, test;

    for(int i=1; i<=n; i++)
    {
        u += y[i] - (x[i] - x[i-1]);
        test = u + ansr[i+1] - x[i];
        test = max(u, test);
        ansR = max(ansR, test);
    }

    for(int i=n; i>=1; i--)
    {
        v += y[i] - (x[i+1] - x[i]);
        test = v + ansl[i-1] - (c - x[i]);
        test = max(v, test);
        ansL = max(ansL, test);
    }

    cout << max(ansR, ansL);


}


Measured memory_bytes: 3328
/*
BROKEN AF
CODING IS JOINING THE BODY PARTS AND THE SOUL
*/
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<numeric>
#include<vector>
#include<math.h>
using namespace std;
#define dude             ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mesc(number,character)   char f[number];memset(f,character,number);
#define mesi(number,value)   int f[number];memset(f,value,number);
#define fr(i,start,end)  for(i=start;i<=end;i++)
#define rf(i,start,end)  for(i=start;i>=end;i--)
#define tst              int t;cin>>t;while(t--)
#define ai               ll n,i;cin>>n;ll a[n];
#define pi               3.14159265358979323846
#define ll               long long int
#define ld               long double
#define pb               push_back
#define r0               return 0;
#define pp               pop_back
#define vec              vector
#define S                string
#define D                double
#define len              length
#define br               break;
#define wh               while
#define F                float
#define gcd              __gcd
#define sz               size
#define endl             "\n"
#define sp              " "
const ll ifn=-1000000007;
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; 
} 
/*bool prim(ll n) { 
     int x=0;
    if (n<=1) {
        return false; 
    }
    for (ll i=2;i<=sqrt(n);i++) 
        if (n%i==0) {
            x=1;
            return false;
        }
        if(x==0) {
    return true;
        }
}*/
/*int fib(int n) {
    int i;
    int f[n];
    memset(f,n,int(-1));
    if(f[n]==-1) {
        if(n<=1) {
            f[n]=n;
        }
        else {
            f[n]=fib(n-1)+fib(n-2);
        }
    }
    else {
    return f[n];
    }
}
int prime(ll n) { 
    bool prim[n+1]; 
    memset(prime,true,sizeof(prim)); 
    for(int p=2;p*p<=n;p++) { 
        if(prime[p]==true) {
            for(inti=p*p;i<=n;i+=p) 
                prime[i]=false; 
        } 
    }
    return prim[n];
}*/
void swap(int x,int y) {
    int t=x;
    x=y;
    y=t;
}
bool vow(char c) {
    if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u') {
        return true;
    }
    else {
        return false;
    }
}
/*int mmsed() {
    ll f[n];
    memset(f,1,n) {
        
    }
}*/
int fact(ll x) {
    ll i=1,cnt=1;
    fr(i,1,x) {
        cnt*=i;
    }
    return cnt;
}
bool isPrime(ll n) { 
    if (n<=1)  return false; 
    if (n<=3)  return true;
    if (n%2==0||n%3==0) return false; 
  
    for (ll i=5;i*i<=n;i=i+6) 
        if (n%i==0||n%(i+2)==0) 
           return false; 
  
    return true; 
} 
void solve() {
   ll a,b,c,d;
   cin>>a>>b>>c>>d;
   ll x,y;
   if(a%d==0) {
       x=a/d;
   }
   else {
       x=(a/d)+1;
   }
   (c%b==0)?y=(c/b):y=(c/b)+1;
   if(y==1) {
       cout<<"Yes"<<endl;
   }
   else {
       if(x<y) {
           cout<<"No"<<endl;
       }
       else {
           cout<<"Yes"<<endl;
       }
   }
}
int main() {
    dude
    solve();
    
   r0
}

Measured memory_bytes: 3640
#include <stdio.h>

int countminus(int a,int b){
  int i,judge;
  long count=0;
  for(i=a;i<=b;i++) count++;
  if(count%2) judge=-1;
  else judge=1;
  return(judge);
}

int main(void){
  int a,b;
  int judge;
  scanf("%d %d",&a,&b);
  if(a<=0 && b>=0) judge=0;
  else if(a>0 && b>0) judge=1;
  else judge=countminus(a,b);
  if(judge==1) printf("Positive\n");
  else if(judge==0) printf("Zero\n");
  else printf("Negative\n");
  return(0);
}

Measured memory_bytes: 128
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))






A=input1()
B=input1()
ans=[1,2,3]
for i in ans:
	if i!=A and i!=B:
		print(i)
		break

Measured memory_bytes: 3060
n = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(n):
	minj = min(range(i, n), key=lambda j: a[j])
	if i != minj:
		a[i], a[minj] = a[minj], a[i]
		count += 1
print(*a)
print(count)


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

#define ll long long
#define mii make_pair<int, int>
#define mll make_pair<ll, ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define all(v) (v).begin(), (v).end()

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

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

Measured memory_bytes: 3652
#include<iostream>

using namespace std;

int main()
{
    int x;
    
    cin >> x;
    int h = x/3600;
    x -= (h*3600);
    int m = x/60;
    int s = (x - (m*60));
    
    cout << h <<":"<<m<<":"<<s<<endl;
    
    
}



Measured memory_bytes: 3096
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#include <bits/stdc++.h>
#define MOD 1000000007
#define int long long
using namespace std;
#define ss second
#define ff first
int32_t main()
{
    fastio;
    int T,n,m,i,j,k,a,b,c;
    T=1;
    string str;
    while(T --> 0)
    {
        cin>>n>>str;
        vector<int> R,G;
        unordered_map<int,bool> B;
        for(i=0;i<n;i++)
        if( str[i] == 'R')
            R.emplace_back(i);
        else if( str[i] == 'G')
            G.emplace_back(i);
        else
            B[i]=true;
 
        m=B.size();
        int ans=R.size()*G.size()*m;
        for(auto a:R)
        for(auto b:G)
        {
            if( (a+b)%2==0 and B[(a+b)/2] )
                ans--;
            if( B[2*a-b])
                ans--;
            if( B[2*b-a])
                ans--;
        }
        cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 4076
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=998244353,N=400010;
ll n,m,k,ans,jc[N],in[N],jcin[N];
ll exp(ll b,ll e,ll l){
	if(e==0) return 1;
	ll tmp=exp(b,e>>1,l);
	if(e&1) return tmp*tmp%l*b%l;
	else return tmp*tmp%l;
}
ll c(ll x,ll y){
	return jc[x]*jcin[y]%mod*jcin[x-y]%mod;
}
int main()
{
	scanf("%lld %lld %lld",&n,&m,&k);
	jc[0]=jcin[0]=1;
	jc[1]=in[1]=jcin[1]=1;
	for(ll i=2;i<N;++i){
		jc[i]=jc[i-1]*i%mod;
		in[i]=(mod-mod/i)*in[mod%i]%mod;
		jcin[i]=jcin[i-1]*in[i]%mod;
	}
	for(ll i=0;i<=k;++i){
		ll j=n-i;
		ans+=m*exp(m-1,j-1,mod)%mod*c(i+j-1,j-1)%mod;
		ans%=mod;
		//printf("%lld\n",ans);
	}
	printf("%lld\n",ans);
}

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

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

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

const int mod = 1000000007;
//const int mod = 998244353;



signed main(){

    int T; cin >> T;
    REP(_, T){
        int n, m, a, b; cin >> n >> m >> a >> b;
        int ans = floor_sum(n, m, a, b);
        Out(ans);
    }

    return 0;
}


Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var nm = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var dic = new Dictionary<int, int>();
        for(var i = 0; i < nm[0]; i++)
        {
            var input = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
            for (var j = 1; j < input.Length; j++)
                if (dic.ContainsKey(input[j])) dic[input[j]]++;
                else dic[input[j]] = 1;
        }
        WriteLine(dic.Values.Count(v => v == nm[0]));
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 13280
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  vector<bool> f(26);
  for(char c='a'; c<='z'; c++){
    for(int i=0; i<s.size(); i++){
      if(c == s.at(i)){
              if(f.at(c-'a'+0)){
        cout << "no" << endl;
        return 0;
      }
        f.at(c-'a'+0) = true;
      }
    }
  }
  cout << "yes" << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        int n=sc.nextInt();
        int m=sc.nextInt();
        
        int[][] cost = new int[n+1][n+1];
        
        for(int i=0;i<=n;i++){
            Arrays.fill(cost[i], 10000);
        }
        
        for(int i=0;i<m;i++){
            String[] str = sc.next().split(",");
            cost[Integer.parseInt(str[0])][Integer.parseInt(str[1])]
                    =Integer.parseInt(str[2]);
            cost[Integer.parseInt(str[1])][Integer.parseInt(str[0])]
                    =Integer.parseInt(str[3]);
        }
        
        String[] str = sc.next().split(",");
        int s = Integer.parseInt(str[0]);
        int g = Integer.parseInt(str[1]);
        int salary = Integer.parseInt(str[2]);  //殿様ァ！
        int daikin = Integer.parseInt(str[3]);  //柱の代金
        
        
        for(int k=1;k<=n;k++){            
            for(int i=0;i<=n;i++){
                for(int j=0;j<=n;j++){
                    if(cost[i][j] >cost[i][k]+cost[k][j]){
                        cost[i][j] = cost[i][k]+cost[k][j];
                    }
                }
            }
        }
        
        System.out.println(salary-daikin-cost[s][g]-cost[g][s]);
        
    }
    
    
}

Measured memory_bytes: 17200
#include <stdio.h>
#define N 100
#define W 0
#define G 1
#define B 2

int n, M[N][N];
int col[N],d[N],f[N],t;

void dfs1(int u){
  int v;
  col[u]=G;
  d[u]=++t;

  for(v=0; v<n; v++){
    if(M[u][v]==0) continue;
    if(col[v]==0) dfs1(v);
  }

  col[u]=B;
  f[u]=++t;
}

void dfs2(){
  int u;
  for(u=0; u<n; u++){
    col[u]=0;
  }

  t=W;

  for(u=0; u<n; u++){
    if(col[u]==0) dfs1(u);
  }

  for(u=0; u<n; u++){
    printf("%d %d %d\n",u+1,d[u],f[u]);
  }
}

int main(){
  int u, v, k, i, j;

  scanf("%d", &n);
  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      M[i][j]=0;
    }
  }
  for(i=0; i<n; i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0; j<k; j++){
      scanf("%d",&v);
      v--;
      M[u][v]=G;
    }
  }
  dfs2();
  return 0;
}



Measured memory_bytes: 2052
import numpy as np
n = int(input())
if n == 1:
    print(1)
else:
    points = np.zeros((n, 2), dtype=np.int)
    for i in range(n):
        x, y = [int(x) for x in input().split()]
        points[i, 0] = x
        points[i, 1] = y

    diffs = {}
    for i in range(n):
        for j in range(n):
            if i != j:
                diff = (points[i, 0] - points[j, 0], points[i, 1] - points[j, 1])
                if diff in diffs:
                    diffs[diff] += 1
                else:
                    diffs[diff] = 1

    count = sorted(diffs.items(), key=lambda kv: kv[1])[-1][1]
    print(n-count)

Measured memory_bytes: 20624
n,m=map(int,input().split())
x,y,z=[],[],[]
for i in range(n):
  xi,yi,zi=map(int,input().split())
  x.append(xi)
  y.append(yi)
  z.append(zi)

ans=0
for i in range(2**3):
  op=['-','-','-']
  for j in range(3):
    if (i>>j)&1:
      op[j]='+'

  tx=x[::]
  ty=y[::]
  tz=z[::]

  if op[0]=='-':
    tx=list(map(lambda a : -1*a, tx))
  if op[1]=='-':
    ty=list(map(lambda a : -1*a, ty))
  if op[2]=='-':
    tz=list(map(lambda a : -1*a, tz))

  xyz_l=[tx[i]+ty[i]+tz[i] for i in range(n)]
  xyz_l.sort(reverse=True)

  ans=max(ans,sum(xyz_l[:m]))

print(ans)

Measured memory_bytes: 3324
/*
ID: allengu01
TASK: 
LANG: C++
*/
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
long long n, w, dp[100007];
pair<long long, long long> items[101];

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n >> w;
	for (long long i = 0; i < n; i++) {
		long long a, b;
		cin >> a >> b;
		items[i] = { a, b };
	}

	dp[0] = 0;

	for (long long i = 0; i <= n; i++) {
		for (long long j = w; j >= 0; j--) {
			if (j-items[i].first == 0 || (j-items[i].first > 0 && dp[j-items[i].first])) {
				dp[j] = max(dp[j-items[i].first] + items[i].second, dp[j]);
			}
		}
	}

	long long ans;
	for (long long i = 0; i <= w; i++) {
		ans = max(ans, dp[i]);
	}
	cout << ans;

	return 0;
}



Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class Program
{
    static void Main()
    {
        var nq = ReadLine().Split().Select(int.Parse).ToArray();
        var n = nq[0];
        var q = nq[1];
        var segtree = new RAQRSQSegmentTree(n);
        for (int i = 0; i < q; i++)
        {
            var com = ReadLine().Split().Select(int.Parse).ToArray();
            if (com[0] == 0)
            {
                segtree.Add(com[1] - 1, com[2], com[3]);
            }
            else
            {
                WriteLine(segtree.Query(com[1] - 1, com[2]));
            }
        }
    }
}

public class RAQRSQSegmentTree
{
    long[] buffer;
    long[] lazy;
    int N;

    public RAQRSQSegmentTree(int cap)
    {
        var c = 1;
        while (c < cap) c <<= 1;

        N = c;
        buffer = new long[N * 2 - 1];
        lazy = new long[N * 2 - 1];
    }

    public RAQRSQSegmentTree(int[] init)
    {
        var c = 1;
        while (c < init.Length) c <<= 1;

        N = c;
        buffer = new long[N * 2 - 1];
        lazy = new long[N * 2 - 1];

        Array.Copy(init, 0, buffer, N - 1, init.Length);
        for (int i = N - 2; i >= 0; i--)
        {
            buffer[i] = buffer[i * 2 + 1] + buffer[i * 2 + 2];
        }
    }

    public void Add(int index, long value)
    {
        index += N - 1;
        buffer[index] += value;
        while (index > 0)
        {
            index = (index - 1) >> 1;
            buffer[index] = buffer[index * 2 + 1] + buffer[index * 2 + 2];
        }
    }

    public long this[int index]
    {
        set
        {
            Add(index, value);
        }
        get
        {
            return buffer[index + N - 1];
        }
    }

    void Eval(int k, int l, int r)
    {
        if (lazy[k] != 0)
        {
            buffer[k] += lazy[k];
            if (r - l > 1)
            {
                lazy[2 * k + 1] += lazy[k] / 2;
                lazy[2 * k + 2] += lazy[k] / 2;
            }
            lazy[k] = 0;
        }
    }

    public void Add(int a, int b, long x, int k, int l, int r)
    {
        Eval(k, l, r);
        if (b <= l || r <= a) return;
        if (a <= l && r <= b)
        {
            lazy[k] += (r - l) * x;
            Eval(k, l, r);
        }
        else
        {
            Add(a, b, x, 2 * k + 1, l, (l + r) / 2);
            Add(a, b, x, 2 * k + 2, (l + r) / 2, r);
            buffer[k] = buffer[2 * k + 1] + buffer[2 * k + 2];
        }
    }

    public void Add(int l, int r, long v)
    {
        Add(l, r, v, 0, 0, N);
    }

    public long Query(int a, int b, int k = 0, int l = 0, int r = -1)
    {
        if (r < 0) r = N;
        if (b <= l || r <= a) return 0;
        Eval(k, l, r);
        if (a <= l && r <= b) return buffer[k];
        var vl = Query(a, b, 2 * k + 1, l, (l + r) / 2);
        var vr = Query(a, b, 2 * k + 2, (l + r) / 2, r);
        return vl + vr;
    }
}



Measured memory_bytes: 25080
N = input().strip()
import copy

import sys
loop = []
cccs = set()
first = True
for line in sys.stdin:
    x, y, h = [int(x) for x in line.strip().split(' ')]
    if h != 0 and first:
        for cx in range(101):
            for cy in range(101):
                H = h + abs(x-cx) + abs(y-cy)
                cccs.add((cx,cy,H))
        first = False
    else:
        loop.append((x,y,h))
ncc = set()
for x,y,h in loop:
    for cx, cy, H in cccs:
        if h == max(H - abs(x-cx) - abs(y-cy), 0):
            ncc.add((cx,cy,H))
    cccs = ncc
    ncc = set()

for i in cccs:
    print(i[0], i[1], i[2])


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

int seps[] = {5, 7, 5, 7, 7};

int n;
char buf[114514];
int gs[114514];

int main() {
  while (1) {
    scanf("%d", &n);
    if (n == 0) return 0;

    for (int i=0; i<n; i++) {
      scanf("%s", buf);
      gs[i] = strlen(buf);
    }

    for (int i=0; i<n; i++) {
      int k = 0;
      int sum = 0;
      bool fail = false;
      for (int j=i; j<n; j++) {
        sum += gs[j];

        if (seps[k] < sum) {
          fail = true;
          break;
        }

        if (seps[k] == sum) {
          ++k;
          sum = 0;
        }

        if (k == 5) break;
      }

      if (k != 5) fail = true;
      if (!fail) {
        printf("%d\n", i+1);
        break;
      }
    }
  }
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
ll fun(ll m,ll arr[],ll k,ll n)
{
	ll sum=0;
	for(int i=0;i<n;i++)
	{
		sum+=pow(abs(m-arr[i]),k);
	}
	return sum;
}
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    t=1;
    while(t--)
    {
    	int x;
    	cin>>x;
    	if(x>=400 && x<=599)
    	{
    		cout<<8<<endl;
		}
		else if(x>=600 && x<=799)
		{
			cout<<7<<endl;
		}
		else if(x>=800 && x<=999)
		{
			cout<<6<<endl;
		}
		else if(x>=1000 && x<=1199)
		{
			cout<<5<<endl;
			
		}
		else if(x>=1200 && x<=1399)
		{
			cout<<4<<endl;
		}
		else if(x>=1400 && x<=1599)
		{
			cout<<3<<endl;
		}
		else if(x>=1600 && x<=1799)
		{
			cout<<2<<endl;
		}
		else
		{
			cout<<1<<endl;
		}
	}
}

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    ll k;
    cin >> k;
    queue<ll> q;
    repd(i, 1, 10) { q.push(i); }

    ll ans;
    rep(i, k) {
        ll temp = q.front();
        ans = temp;
        q.pop();
        if (temp % 10 != 0) {
            q.push(temp * 10 + (temp % 10) - 1);
        }
        q.push(temp * 10 + temp % 10);
        if (temp % 10 != 9) {
            q.push(temp * 10 + (temp % 10 + 1));
        }
    }
    cout << ans << endl;
    return 0;
}



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

typedef string::iterator S;
const int MAX = 105;

struct Node{
    Node* left;
    Node* right;
};


void makeTree(Node*& ni, S& s){
    s++;
    Node* tmp = ni;
    if( *s == '(' ){
        ni->left = tmp+1;
        tmp++;
        makeTree(tmp, s);
    }else{
        tmp->left = NULL;
    }
    s++;
    if( *s == '(' ){
        ni->right = tmp+1;
        tmp++;
        makeTree(tmp, s);
    }else{
        tmp->right = NULL;
    }
    ni = tmp;
    s++;
}

void showIntersect(Node* n1, Node* n2){
    cout << "(";
    Node *p1 = n1?n1->left:NULL, *p2 = n2?n2->left:NULL;
    if( p1 && p2 ){
        showIntersect(p1, p2);
    }
    cout << ",";
    p1 = n1?n1->right:NULL, p2 = n2?n2->right:NULL;
    if( p1 && p2 ){
        showIntersect(p1, p2);
    }
    cout << ")";
}

void showUnion(Node* n1, Node* n2){
    cout << "(";
    Node *p1 = n1?n1->left:NULL, *p2 = n2?n2->left:NULL;
    if( p1 || p2 ){
        showUnion(p1, p2);
    }
    cout << ",";
    p1 = n1?n1->right:NULL, p2 = n2?n2->right:NULL;
    if( p1 || p2 ){
        showUnion(p1, p2);
    }
    cout << ")";
}

int main(){
    while(true){
        string cmd, str1, str2;
        cin >> cmd >> str1 >> str2;
        if(cmd.length()==0) break;
        Node t1[MAX], t2[MAX];
        for(int i = 0; i < MAX; i++){
            t1[i].left = NULL;
            t1[i].right = NULL;
            t2[i].left = NULL;
            t2[i].right = NULL;
        }
        Node* i1 = t1;
        Node* i2 = t2;
        S s1 = str1.begin();
        S s2 = str2.begin();
        makeTree(i1, s1);
        makeTree(i2, s2);
        if(cmd == "i"){
            showIntersect(t1, t2);
        }else{
            showUnion(t1, t2);
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <cmath>
#include <cstring>

using namespace std;

int pedras[100100];
long long dp[100100]; ///Guardo os valores da funcao frog;

int n,k;
const int inf =1e9;

int frog2(int i,int j){

    if(dp[i] != -1){
        return dp[i];
    }

    int menor = inf;

    if(i>=j) return dp[i]=0;

    for(int x=1;x<=k;x++){ ///i=0; i=1;i=2;i=3;
        if(i+x <= j){      ///x=1, x=1;x=1;x=1;
            long long cost = (frog2(i+x,j)+ abs(pedras[i]-pedras[i+x]));

            if(cost < menor){
                menor = cost;
            }
        }
    }

    return dp[i] = menor;
}

int main(){

    memset(dp,-1,sizeof(dp));

    cin >>n>>k;

    for(int i=0;i<n;i++){
        cin >> pedras[i];
    }

    cout<<frog2(0,n-1)<<endl;
}


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

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll oo = 1e8;
const double pi = 3.1415926535897;


const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/

string nx[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

int main(){
    fIO

    int n;
    cin >> n;

    string s;
    cin >> s;

    for(auto c : s) {
        cout << (char)((c - 'A'+ n) % 26 + 'A');
    }



}









Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <climits>
#include <iomanip>
#define endl "\n"
#define debug(x) cout << #x << " : " << x << endl;
#define debug2(x, y) cout << #x << " : " << x  << ", " << #y << " : " << y << endl;
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0);
typedef long long ll;
using namespace std;

int main()
{
	FASTIO

	ll n;
	cin >> n;

	ll x[n], y[n];
	ll maxSum = LONG_MIN;
	ll maxDiff = LONG_MIN;
	ll minSum = LONG_MAX;
	ll minDiff = LONG_MAX;
	for(ll i = 0; i < n; i ++)
	{
		cin >> x[i] >> y[i];
		maxSum = max(maxSum, x[i] + y[i]);
		minSum = min(minSum, x[i] + y[i]);
		maxDiff = max(maxDiff, x[i] - y[i]);
		minDiff = min(minDiff, x[i] - y[i]);
	}	

	ll ans = max(maxSum - minSum, maxDiff - minDiff);
	cout << ans << endl;


}

Measured memory_bytes: 6768
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
using static Prog;
using NX = System.Int64;

public class Solver
{
    public void Solve()
    {
        int N = NextInt();
        String S = NextString();
        int[,] dp = new int[N + 1, N + 1];
        for (int i = N - 1; i >= 0; i--)
        {
            for (int k = N - 1; k >= 0; k--)
            {
                if (S[i] != S[k]) dp[i, k] = 0;
                else dp[i, k] = Math.Max(dp[i, k], dp[i + 1, k + 1] + 1);
            }
        }
        int ans = 0;
        for (int i = 0; i < N; i++) for (int k = i + 1; k < N; k++) {
                if ((k - i) >= dp[i, k]) ans = Math.Max(ans, dp[i, k]);
            }
        Console.WriteLine(ans);
    }
}


public class Prog
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    public struct Pair { public int x, y; public Pair(int a, int b) { x = a; y = b; } }
    static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        new Solver().Solve();
        Console.Out.Flush();
        return;
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


Measured memory_bytes: 108768
import sys
n,m = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(m)]
 
b=[pow(10,n-1)]
count=0
for i in range(0,m):
    
    if A[i][0]==1 and A[i][1]==0 and n>1:
        print(-1)
        sys.exit()
    else:
        b.append(A[i][1]*pow(10,n-A[i][0]))
        if n-A[i][0]==n-1:
            count+=1

#print(b,count)          
if count>0 or n==1:
    b.remove(pow(10,n-1))

if n>1:
    #print([i for i in b if i != 0])
    b=[i for i in b if i != 0]


#print(b)

b=list(set(b))
 
c=[]
for i in range(len(b)):
    c.append(len(str(b[i])))
    
c=list(set(c))

#print(b,c)
 
if len(b)==len(c) and len(str(sum(b)))==n:
    print(sum(b))
else:
    print(-1)

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

typedef long long int ll;

int main(){
  ll S, x1,y1,x2,y2,x3,y3;
  cin >> S;
  x1 = y1 = 0;
  x2 = 1e9;
  x3 = 1;
  y3 = S / x2;
  if(S % x2 != 0)y3++;
  y2 = x2 * y3 - S;
  cout << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << ' ' << x3 << ' ' << y3 << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;
struct node{
	int key;
	node *parent,*left,*right;
};
node *NIL,*root;

void inorder(struct	node *u){
	if(u==NIL)return;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
}
void preorder(struct node *u){
	if(u==NIL)return;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}
void pr(){
	inorder(root);
	printf("\n");
	preorder(root);
	printf("\n");
}
void insert(int key){
	node *y = NIL;
	node *x = root;
	node *z;
	z = (node *)malloc(sizeof(node));
	z->key = key;
	z->left = NIL;
	z->right = NIL;
	
	while(x!=NIL){//when x==NIL break
		y = x;
		if(z->key < x->key)x = x->left;
		else x = x->right;
	}
	z->parent = y;
	if(y == NIL)root = z;//z became root,insert root
	else if(z->key < y->key)y->left = z;
	else y->right = z;
}
int main()
{
	int n;
	scanf("%d",&n);
	char s[20];
	for(int i=0;i<n;++i){
		scanf("%s",s);
		if(s[0]=='i'){
			int k;
			scanf("%d",&k);
			insert(k);
		}else pr();
	}
	return 0;
}

Measured memory_bytes: 26576
import Control.Applicative

main = do hws <- (map read) . (concatMap words) . lines <$> getContents
          putStr . unlines $ map unlines (solve hws)

solve :: [Int] -> [[String]]
solve (h:w:res) | h == 0 && w == 0 = []
                | otherwise = (replicate h . concat $ replicate w "#") : solve res

Measured memory_bytes: 5160
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
	Integer A[] = new Integer[N];
	int ans = 0;
        for ( int i = 0; i < N; i++ ) {
            A[i] = sc.nextInt();
	    ans += A[i]-1;
        }
	System.out.println(ans);
    }
}


Measured memory_bytes: 26104