akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<double, long long> pdl;

#define rep(i, n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 1000000007

int A[1000];
int n;
int ans[1<<20];
bool visited[1<<20];

int main() {
    cin>>n;
    rep(i, n) cin>>A[i+1];

    rep(i, n) {
        int j = i+1;
        ans[A[j]] = j;
    }

    int counter = 0, p = 1;
    for(int i=1;i<=n*n;i++) {
        if(ans[i] == 0) {counter++;continue;}

        if(counter < ans[i]-1) {
            cout<<"No";
            return 0;
        }


        int j = 1;
        while(j < ans[i]) {
            if(ans[p] == 0) {
                ans[p] = ans[i];
                counter -= 1;
                j++;
            }
            p++;
        }
    }

    //rep(i, n*n) cout<<ans[i+1]<<" ";

    counter = 0, p = n*n;

    for(int i=n*n;i>=1;i--) {

        if(visited[ans[i]]) continue;

        if(ans[i] != 0)
            visited[ans[i]] = true;

        if(ans[i] == 0) {counter++;continue;}

        if(counter < n-ans[i]) {
            cout<<"No";
            return 0;
        }

        int j = 0;
        while(j < n-ans[i]) {
            if(ans[p] == 0) {
                ans[p] = ans[i];
                counter -= 1;
                j++;
            }
            p--;
        }
    }

    cout<<"Yes"<<endl;
    rep(i, n*n) cout<<ans[i+1]<<" ";

    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    while(true){
        c -= b;
        if(c <= 0){
             cout << "Yes" << endl;
             break;
        }
        a -= d;
        if(a <= 0){
            cout << "No" << endl;
            break;
        }
    }
}


Measured memory_bytes: 3612
console.log(function(args){
  const [[N],a] = args.trim().split('\n').map( r=>r.split(' ').map( v=>v|0 ) );
  let A = a[0];
  for ( let i = 1; i < N; i++ ) {
    A ^= a[i];
  }
  return a.map(v=>v^A).join(' ');
}(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 68252
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
 
int main(){
  int a,b;
  cin >> a >> b;
  if(b>=a){
    cout << a << endl;
  }
  else{
    cout << a-1 << endl;
  }
}


Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};
// from:
// https://atcoder.jp/contests/abc130/submissions/5990273

#[fastout]
fn main() {
    input! {
        n:usize,
        xyd:[(f64,f64,char);n]
    }
    let mut xd = D::new();
    let mut yd = D::new();
    for &(x, y, d) in xyd.iter() {
        // x,y どちらも速度を +1 する
        match d {
            'L' => {
                xd.add(x, 0);
                yd.add(y, 1);
            }
            'R' => {
                xd.add(x, 2);
                yd.add(y, 1);
            }
            'U' => {
                xd.add(x, 1);
                yd.add(y, 2);
            }
            _ => {
                xd.add(x, 1);
                yd.add(y, 0);
            }
        }
    }
    // 交差する時間リスト
    let mut ts = vec![0f64];
    for &t in xd.events().iter().chain(yd.events().iter()) {
        ts.push(t);
    }
    let mut ans = 1e18;
    for t in ts {
        let now = xd.get(t) * yd.get(t);
        if ans > now {
            ans = now;
        }
    }
    println!("{}", ans);
}

struct D {
    l: Vec<f64>,
    r: Vec<f64>,
}
impl D {
    fn new() -> D {
        D {
            l: vec![INF; 3], //速度が3通り(0,1,2)
            r: vec![-INF; 3],
        }
    }
    fn add(&mut self, x: f64, v: usize) {
        // 向きごとに最大・最小を格納
        if self.l[v] > x {
            self.l[v] = x;
        }
        if self.r[v] < x {
            self.r[v] = x;
        }
    }
    fn get(&mut self, t: f64) -> f64 {
        // 時刻が与えられたときに幅を出力
        let mut nl = INF;
        let mut nr = -INF;
        for i in 0..3 {
            if nl > self.l[i] + i as f64 * t {
                nl = self.l[i] + i as f64 * t;
            }
            if nr < self.r[i] + i as f64 * t {
                nr = self.r[i] + i as f64 * t;
            }
        }
        nr - nl
    }
    fn events(&mut self) -> Vec<f64> {
        // 交差する時間リストを出力
        let mut ts = Vec::new();
        for i in 0..3 {
            for j in 0..i {
                // 座標の差/相対速度
                let mut t = (self.l[j] - self.l[i]) / (i - j) as f64;
                if t > 0f64 {
                    ts.push(t);
                }
                let mut t = (self.r[j] - self.r[i]) / (i - j) as f64;
                if t > 0f64 {
                    ts.push(t);
                }
            }
        }
        ts
    }
}
const INF: f64 = 1e11;


Measured memory_bytes: 6548
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
//#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)};

signed main() {
  int n,a,b;cin>>n>>a>>b;
  if((abs(a-b)+1)%2){
    cout << "Alice" << endl;
  }else{
    cout << "Borys" << endl;
  }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int N = 110;

vector<int> G[N];

void solve(){
    rep(i,N) G[i].clear();

    vector<int> r;
    while(1){
        int v;
        scanf(" %d", &v);
        if(v==0) break;
        r.pb(v);
    }
    int R = r.size();
    if(R==0){
        printf("1\n");
        return;
    }

    int num = 0;
    rep(i,R)if(r[i]>0) ++num;
    assert(num<N);

    // simulate dfs
    int ct = 0;
    int here = 0;
    vector<int> vis;
    vector<int> val;

    assert(r[0]>0);
    vis.pb(ct++);
    val.pb(r[0]);

    for(int i=1; i<R; ++i){
        while(val[here]<=0){
            vis.pop_back();
            if(vis.empty()) assert(false);

            here = vis.back();
        }

        if(r[i]>0){
            // dfs木の辺
            int par = vis.back();
            vis.pb(ct++);
            here = vis.back();

            val.pb(r[i]);
            --val[par];
            --val[here];
            G[par].pb(here);
            G[here].pb(par);
        }
        else{
            // 後退辺
            int V = vis.size();
            int idx = V-1 +r[i];
            assert(idx>=0);

            int par = vis[idx];
            --val[par];
            --val[here];
            G[par].pb(here);
            G[here].pb(par);
        }
    }

    rep(i,num){
        printf("%d", i+1);
        sort(all(G[i]));
        for(int j:G[i]) printf(" %d", j+1);
        printf("\n");
    }
}

int main(){
    int T;
    scanf(" %d", &T);
    while(T--) solve();
    return 0;
}



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

int main()
{
    long long n, i, h[100009], dp[100009];

    cin >> n;
    for(i = 1; i <= n; i++)
        cin >> h[i];

    dp[0] = INT_MAX;
    dp[1] = 0;

    for(i = 2; i <= n; i++)
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));

    cout << dp[n];
}


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

int main(){
  string s, t;
  cin >> s >> t;
  int a, b;
  cin >> a >> b;
  string u;
  cin >> u;
  
  if(s == u) cout << a-1 << " " << b << endl;
  else cout << a << " " << b-1 << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

const int N = (10) + 5;
int n;
ld X[N], Y[N];

ld dist2(ld ax, ld ay, ld bx, ld by) {
  return sqrt((ax - bx) * (ax - bx) +  (ay - by) * (ay - by));
}

ld permutations(int arr[], int n) {
  ld sum = 0;
  sort(arr, arr + n);
  do {
    for (int i = 0; i + 1 < n; ++i) {
      sum += dist2(X[arr[i]], Y[arr[i]], X[arr[i + 1]], Y[arr[i + 1]]);
    }
  } while (next_permutation(arr, arr + n));
  return sum;
}

ll factorial(ll n) {
  if (n == 0) return 1LL;
  return n * factorial(n - 1);
}

int main() { // claudio van
  cout.precision(10); cout << fixed;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> X[i] >> Y[i];
  }
  int a[n];
  for (int i = 0; i < n; ++i) {
    a[i] = i;
  }
  ld prom = permutations(a, n) / (ld) factorial(n);
  //cout << factorial(n) << "\n";
  cout << prom << "\n";
  return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<long long> a(n);
	vector<long long> max;

	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	
	sort(a.begin(), a.end(), greater<long long>());
	
	for(int i = 0; i < (int)a.size(); i++)
	{
		if(a[i] == a[i+1]){
			max.push_back(a[i]);
			i ++;
		}
		if((int)max.size() == 2) break;
	}
	sort(max.begin(), max.end(), greater<long long>());
	
	if((int)max.size() < 2) cout << 0 << endl;
	else cout << max[0]*max[1] << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

int main()
{
	int n;
	cin>>n;
	ll a[100010], b[100010];
	for(int i=0; i<n; i++){
		ll x, l;
		cin>>x>>l;
		a[i]=x-l, b[i]=x+l;
	}
	P p[100010];
	for(int i=0; i<n; i++){
		p[i]=P(b[i], a[i]);
	}
	sort(p, p+n);
	ll mn=p[0].first;
	int ans=1;
	for(int i=1; i<n; i++){
		if(p[i].second>=mn){
			ans++;
			mn=p[i].first;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

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

	string s;
	cin >> s;
	sort(s.begin(), s.end());
	if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) cout << "Yes\n";
	else cout << "No\n";
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.nextLine();
		String str2 = sc.nextLine();
		sc.close();
		boolean flug = false;
		
		for(int i=0; i<str1.length(); i++) {
			if(str1.equals(str2)) {
				flug = true;
				break;
			}
			str2 = str2.substring(str2.length()-1) + str2.substring(0, str2.length()-1);
		}
		
		if(flug) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
      
	}
}

Measured memory_bytes: 22356
#include <stdio.h>

int main(int argc, char const *argv[])
{
	int n, m;
	int i, j, k, l;
	int matrixA[100][100];
	int matrixB[100];
	int matrixC[100] = {0};

	scanf("%d %d", &n, &m);
	for(i=0;i<n;i++) {
		for(j=0;j<m;j++) {
			scanf("%d ", &k);
			matrixA[i][j] = k;
		}
	}
	for(j=0;j<m;j++) {
		scanf("%d", &l);
		matrixB[j] = l;
	}

	for(i=0;i<n;i++) {
		for(j=0;j<m;j++)
		matrixC[i] += matrixA[i][j] * matrixB[j];
	}

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

	return 0;
}


Measured memory_bytes: 2144
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	int n;
	cin >> n;
	while(n--) cout << "ACL";
}

Measured memory_bytes: 3532
#include<stdio.h>
int main()
{
    int a;
    char s[10];
    // 整数の入力
    scanf("%d", &a);
    // スペース区切りの整数の入力
    // 文字列の入力
    scanf("%s",s);
    // 出力
  
  
  if(a>= 3200){
	printf("%s",s);
  }else{
   printf("red");
  }
    return 0;
}


Measured memory_bytes: 128
n,m= map(int,input().split())
unti= [0] * (m+1)
ans=0
for i in range(n):
    x = list(map(int,input().split()))
    for j in range(x[0]):
        unti[x[j+1]]+=1
for i in range(m+1):
    if unti[i] == n:
        ans+=1
print(ans)

Measured memory_bytes: 9124
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split("");
			String inp = br.readLine();
			String chrp[] = inp.split("");
			int ans = 0;
			for (int i = 0; i < 3; i++) {
				if (chr[i].equals(chrp[i])) {
					ans++;
				}
			}
			System.out.println(ans);
		}
	}
}

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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  ll Q, H, S, D; cin >> Q >> H >> S >> D;
  ll N; cin >> N;
  H = min(H,Q*2);
  S = min(S,H*2);
  D = min(D,S*2);
  ll result = N/2*D + N%2*S;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
N,W = map(int,input().split())

dp = [0]*(W+1)
L = []
for i in range(N):
    ta,tb = map(int,input().split())
    L.append([ta,tb])

for i in range(N):
    for w in range(W,-1,-1):
        if w-L[i][1]>=0 :dp[w] = max(dp[w],dp[w-L[i][1]]+L[i][0])
print(dp[-1])


Measured memory_bytes: 5724
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------
def run_length_encoding(String):
    s = String
    cnt = 1
    Res = []
    try:
        for i in range(len(s)):
            if s[i] == s[i+1]:
                cnt += 1
            else:
                Res.append((s[i],cnt))
                cnt = 1
    except:
        Res.append((s[i],cnt))
    return Res

# -------------------------------------------------------------
# main
# -------------------------------------------------------------
S = input().rstrip() + "x"

E = run_length_encoding(S)

Ans = []
for i in range(len(E)//2):
    R = E[i*2][1]
    L = E[i*2+1][1]
    for r in range(R-1):
        Ans.append(0)
    x,y = R//2+L//2, R//2+L//2
    if R%2 == 1:
        x += 1
    if L%2 == 1:
        y += 1
    Ans.append(x)
    Ans.append(y)
    for l in range(L-1):
        Ans.append(0)

print(*Ans)

Measured memory_bytes: 13424
import itertools

N = int(input())

P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

a = -1
b = -1

for i, l in enumerate(itertools.permutations(range(1, N + 1), N)):
    if P == l:
        a = i
    if Q == l:
        b = i

print(abs(a - b))


Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>
 
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>
 
#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;
 
template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

int main() {
  int a, b;
  while (cin >> a >> b) {
    if (a <= 5) cout << 0 << endl;
    else if (a <= 12) cout << b / 2 << endl;
    else cout << b << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define max 1000
#define N 30000
char inttochar(int i);

int main() {
	int num;
	char s[N];
	char s1,s2,s3;
	char* result;
	int i,j;
	int count=0;
	scanf("%d",&num);
	scanf("%s",&s);
	
	for(i=0;i<max;i++) {
		s1=inttochar(i/100);
		s2=inttochar((i/10)%10);
		s3=inttochar(i%10);
		if((result = strchr(s,s1))!=NULL) {
			if((result = strchr(result+1,s2))!=NULL) {
				if((result = strchr(result+1,s3))!=NULL) {
					count++;
				}
			}
		}
	}
	printf("%d",count);
	return 0;
}


char inttochar(int i) {
	char ret='0';
  	switch(i) {
      	case 0:
        	ret = '0';
        	break;
       	case 1:
        	ret = '1';
        	break;
        case 2:
        	ret = '2';
        	break;
        case 3:
        	ret = '3';
        	break;
       	case 4:
        	ret = '4';
        	break;
        case 5:
        	ret = '5';
        	break;
        case 6:
        	ret = '6';
        	break;
       	case 7:
        	ret = '7';
        	break;
        case 8:
        	ret = '8';
        	break;
        case 9:
        	ret = '9';
        	break;
        default :
        	ret = '0';
    }
	return ret;
}

Measured memory_bytes: 128
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <map>
using namespace std;

int n, m;
int possible[100001];
int balls[100001];

int MAIN()
{
	cin >> n >> m;
	for(int i = 1; i <= n; i++)
	{
		possible[i] = false;
		balls[i] = 1;
	}
	possible[1] = true;
	for(int i = 1; i <= m; i++)
	{
		int x, y;
		cin >> x >> y;
		if(possible[x])
			possible[y] = true;
		balls[x] --;
		balls[y] ++;
		if(balls[x] == 0)
			possible[x] = false;
	}
	int cnt = 0;
	for(int i = 1; i <= n; i++)
		cnt += possible[i];
	cout << cnt << endl;
	
	return 0;
}

int main()
{
	int start = clock();
	#ifdef LOCAL_TEST
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
	ios :: sync_with_stdio(false);
	cout << fixed << setprecision(16);
	int ret = MAIN();
	#ifdef LOCAL_TEST
		cout << "[Finished in " << clock() - start << " ms]" << endl;
	#endif
	return ret;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define MAXQ 100001
#define MAXN 100001

ll N,K,Q;
ll A[MAXQ];
int d[MAXN];
int main(){
    cin >> N >> K >> Q;
    rep(i,Q){
        cin >> A[i];
        A[i]--;
    }
    rep(i,N)d[i] = K-Q;
    rep(i,Q){
        d[A[i]]++;
    }
    rep(i,N){
        if(d[i]<=0)cout << "No" << endl;
        else cout << "Yes" << endl;
    }

    return 0;

}

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

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

int main() {
	int a, b;
	cin >> a >> b;
	int i=0;
	for(;i<=1000;++i){
		if((int)((float)i*0.08/1.0)==a&&(int)((float)i*0.1/1.0)==b){
			cout<<i;
			return 0;
		}
	}
	cout<<-1;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define print(x) cout<<(x)<<'\n'
using ll=long long;
using pl=pair<ll,ll>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vs=vector<string>;

void solve() {
    vl vec;
    vec.push_back(2);
    vec.push_back(1);
    rng(i,2,87){
        vec.push_back(vec[i-2] + vec[i-1]);
    }
    ll N;
    cin >> N;
    print(vec[N]);
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}


Measured memory_bytes: 3648
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<bitset>
#define eps 1e-15
#define maxn 105
#define maxm 410
#define inf 1000000007
#define mod 1000000007
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,int>pii;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int K;
int main()
{
    K=read();
    if(K==1)
    {
        puts("1");puts("1");
        return 0;
    }
    int n=(K+3)/4*2;
    printf("%d\n",n);
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            int res=0;
            if(i&1)  res=n+(i+j)%n+1;
            else     res=(i+j)%n+1;
            if(res>K)  res-=n;
            printf("%d ",res);
        }
        puts("");
    }
    return 0;
}


Measured memory_bytes: 1152
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
#define endl '\n'

using ll = long long;
using db = long double;
using ii = pair<int, int>;

const int N = 1e5 + 5, LG = 19, MOD = 998244353;
const int SQ =320;
const long double EPS = 1e-7;

int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

   int n, k;

   cin >> n >> k;
   ll sum = 0;
   f(i,1,n+1){

    if(((k-i%k)*2)%k == 0){
      int val = n / k + ((n % k) >= (k - i % k));
      sum += 1ll * val * val;
    }
   }

   cout<<sum<<'\n';

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dp[100005][5],a[100005][5];
int main()
{
    int i,j,n;
    cin>>n;
    for(i=0;i<n;i++)
    {
        for(j=0;j<3;j++)
        {
            cin>>a[i][j];
        }
    }
    for(i=0;i<n;i++)
    {
        for(j=0;j<3;j++)
        {
            if(i==0)
            {
                dp[i][j]=a[i][j];
            }
            else if(j==0)
            {
                dp[i][j]=a[i][j]+max(dp[i-1][1],dp[i-1][2]);
            }
            else if(j==1)
            {
                dp[i][j]=a[i][j]+max(dp[i-1][0],dp[i-1][2]);
            }
            else if(j==2)
            {
                dp[i][j]=a[i][j]+max(dp[i-1][1],dp[i-1][0]);
            }
        }
    }
    n--;
    cout<<max(dp[n][0],max(dp[n][1],dp[n][2]))<<"\n";
    return 0;
}



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

using namespace std;

int main()
{
    int n,W;
    cin>>n>>W;
    long long int v[n],dp[n+5][W+5],w[n];
    for(int i=1;i<=n;i++)
        cin>>w[i]>>v[i];
    for(int i=0;i<=n;i++)
        dp[i][0]=0;
    for(int i=0;i<=W;i++)
        dp[0][i]=0;
    long long int temp1,temp2;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=W;j++){
            temp1=0; temp2=0;
            temp1=dp[i-1][j];
            if(j>=w[i]){
                temp2 = v[i]+dp[i-1][j-w[i]];
            }
            dp[i][j]=max(temp1,temp2);
            //cout<<dp[i][j]<<" ";
        }
       // cout<<endl;
    }
    
    cout<<dp[n][W]<<endl;
   
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

template <class T>
inline void chmax(T& lhs, const T& rhs){
  if(lhs >= rhs) return;
  lhs = rhs;
}
template <class T>
inline void chmin(T& lhs, const T& rhs){
  if(lhs <= rhs) return;
  lhs = rhs;
}


struct MaxThree {
  priority_queue<int> que;

  void add(int x){
    que.push(x);
  }

  ll get(){
    int a = 0, b = 0, c = 0;
    if(!que.empty()){
      a = que.top(); que.pop();
    }
    if(!que.empty()){
      b = que.top(); que.pop();
    }
    if(!que.empty()){
      c = que.top(); que.pop();
    }
    ll ret = (ll)a + (ll)b + (ll)c;
    que.push(a);
    que.push(b);
    que.push(c);
    return ret;
  }
};


int R, C, K;
int field[3005][3005];

ll dp[3005][3005];


int main(){
  cin >> R >> C >> K;
  rep(i,K){
    int r, c, v;
    cin >> r >> c >> v;
    r--;
    c--;
    field[r][c] = v;
  }

  {
    MaxThree maxthree;
    for(int j=C-1; j>=0; j--){
      maxthree.add(field[R-1][j]);
      dp[R-1][j] = maxthree.get();
    }
  }
  
  for(int i=R-2; i>=0; i--){
    vector<vector<ll>> dp2(4, vector<ll>(C+10, -1));

    dp2[0][C-1] = dp[i+1][C-1];
    dp2[1][C-1] = field[i][C-1] + dp[i+1][C-1];
    for(int j=C-2; j>=0; j--){
      dp2[0][j] = dp[i+1][j];
      dp2[1][j] = field[i][j] + dp[i+1][j];

      rep(jj,4){
        chmax(dp2[jj][j], dp2[jj][j+1]);
      }
      REP(jj,1,4){
        chmax(dp2[jj][j], field[i][j] + dp2[jj-1][j+1]);
      }
    }
    
    rep(j,C){
      rep(jj,4){
        dp[i][j] = max(dp[i][j], dp2[jj][j]);
      }
    }
  }

  cout << dp[0][0] << endl;

  
  return 0;
}


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

using namespace std;

#define ll long long

ll M = 1000000007;

ll bin_pow(ll a, ll pow) {
    if (pow == 0) return 1;
    if (pow == 1) return a;
    if (pow % 2 == 0) {
        ll tmp = bin_pow(a, pow / 2) % M;
        return tmp * tmp % M;
    }
    return a * bin_pow(a, pow - 1) % M;
}

ll inv(ll a) {
    return bin_pow(a, M - 2) % M;
}

ll fact(ll a) {
    ll ans = 1;
    for (int i = 1; i <= a; i++) {
        ans *= i;
        ans %= M;
    }
    return ans;
}

vector<vector<int>> d;
vector<pair<int, int>> a;

int ans(int n, int t) {
    if (t <= 0 || n == 0) return 0;
    if (d[n][t] == -1) {
        d[n][t] = max(ans(n - 1, t), ans(n - 1, t - a[n - 1].first) + a[n - 1].second);
    }

    return d[n][t];
}

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


    int a, b;
    cin >> a >> b;

    cout << (a <= 9 && b <=9 ? a * b : -1);

    return 0;
}

Measured memory_bytes: 256
//============================================================================
// Name        : beginner077.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : atcorder ABC077 in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>

using namespace std;

inline int main001();
inline int main002();
inline int main003();
inline int main004();

int main() {

  main002();

	return 0;
}

inline int main002() {

	int num, res;

	cin >> num;

	res = sqrt(num);

	cout << res * res;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<map>
#include<deque>
#include<string>
#include<algorithm>

#define all(x) (x).begin(),(x).end()
#define puts(x) cout<< x << endl;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fore(i,a) for(auto i:a)
#define ll long long
using namespace std;
int n,m;
int p(int x){
    if(x==1){
        return 0;
    }
    return x*(x-1)/2;
}
int main(){
    cin>>n>>m;
    puts(p(n)+p(m));
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    ll r[a];
    ll g[b];
    ll u[c];
    for(ll i=0;i<a;i++)
    cin>>r[i];
   // cout<<r[0];
    for(ll i=0;i<b;i++)
    cin>>g[i];
    for(ll i=0;i<c;i++)
    cin>>u[i];
    sort(r,r+a);
    sort(g,g+b);
    sort(u,u+c);
    vector<ll>ans;
    ll k=a-1;
    while(x--){
       // cout<<r[k];
        ans.push_back(r[k]);
        k--;
    }
   // cout<<ans[0]<<" ";
    ll q=b-1;
    while(y--){
        ans.push_back(g[q]);
        q--;
    }
    sort(ans.begin(),ans.end());
    
    ll l=ans.size();
    ll sum=0;
    for(ll i=0;i<l;i++)
    sum+=ans[i];
   //cout<<ans[i]<<" ";
   // cout<<sum<<" ";
    ll t=c-1;
    ll w=0;
    while(t>=0&&ans[w]<u[t]){
    sum=sum-ans[w];
    //cout<<sum<<" ";
    sum=sum+u[t];
    w++;
    t--;
    }
    cout<<sum;
	return 0;
}

Measured memory_bytes: 4852
#include <bits/stdc++.h>
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater(){
    #ifndef ONLINE_JUDGE
    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
    #endif
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
#define fastio  cin.sync_with_stdio(0); cin.tie(0);cin.exceptions(cin.failbit);
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a,v) memset(a, v, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll p=1e9+7;
const int N=2e5+5;
int main() {
  
    fastio;
    int T=1;
    // cin>>T;
    while(T--){
        int a,b;cin>>a>>b;
        cout<<(a*b);
    }   
    timecalculater();
    return 0;   
} 

Measured memory_bytes: 3648
#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")

#define fi first
#define se second

const int N = 100010;

using namespace std;

int n;
int m;
int T;
int x[N];
int y[N];
int s[N];
int res[N];
char f[N];
bitset < N / 2 > I[N / 2];

int main()
{
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);

        ios_base::sync_with_stdio(0);

        cin >> n >> m >> T;
        for(int i = 1; i <= m; i++){
                cin >> x[i] >> y[i];
        }
        if(T == 2){
                if(n == 2){
                        cout << -1 << '\n';
                        return 0;
                }
                for(int i = 1; i <= n; i++){
                        res[i] = i;
                        s[i] = 1;
                }
                for(int i = m; i >= 1; i--){
                        int a = res[x[i]], b = res[y[i]];
                        if(s[a] < s[b]){
                                f[i] = '^';
                                s[a] += 1;
                                s[b] -= 1;
                                res[y[i]] = res[x[i]];
                        } else{
                                f[i] = 'v';
                                s[a] -= 1;
                                s[b] += 1;
                                res[x[i]] = res[y[i]];
                        }
                }
                for(int i = 1; i <= m; i++){
                        cout << f[i];
                }
                return 0;
        }
        for(int i = 1; i <= n; i++){
                I[i][i] = 1;
        }
        for(int i = m; i >= 1; i--){
                int a = x[i], b = y[i];
                I[a] |= I[b];
                I[b] = I[a];
        }
        for(int i = 2; i <= n; i++){
                I[1] &= I[i];
        }
        int x = -1;
        for(int i = 1; i <= n; i++){
                if(I[1][i]){
                        x = i;
                }
        }
        if(x == -1){
                cout << -1 << "\n";
                return 0;
        }
        res[x] = 1;
        for(int i = m; i >= 1; i--){
                int a = ::x[i], b = y[i];
                if(res[a]){
                        f[i] = '^';
                        res[b] = 1;
                } else{
                        f[i] = 'v';
                        res[a] |= res[b];
                }
        }
        for(int i = 1; i <= m; i++){
                cout << f[i];
        }
}


Measured memory_bytes: 306944
#include<stdio.h>
int main(){
  long long a,b,x;
  scanf("%lld%lld%lld",&a,&b,&x);
  if(a==0)
    printf("%lld\n",b/x+1);
  else
    printf("%lld\n",b/x-(a-1)/x);
  return 0;
}

Measured memory_bytes: 1732
listC =[]
while True:
    try:
        listC.append(list(map(int,input().split())))
    except:
        break;
N = listC[0][0]
M = listC[0][1]
L = []
R = []
for i in range(1,len(listC)):
    L.append(listC[i][0])
    R.append(listC[i][1])

maxL = max(L)
minR = min(R)
if maxL <= minR:
    output = minR-maxL+1
else:
    output = 0
print(output)

Measured memory_bytes: 28996
#include<map>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
#define N 100005
#define inf (1ll<<60)
#define rep(i,j,k) for (ll i=j;i<=k;++i)
#define per(i,j,k) for (ll i=j;i>=k;--i)
using namespace std;
inline ll read(){
	char ch=getchar(); ll x=0,f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	return x*f;
}
char a[N],b[N],c[N],ans[N]; ll n,m,flag,ok;
int main(){
	scanf("%s%s",a+1,b+1);
	n=strlen(a+1); m=strlen(b+1);
	ans[1]='z'+1;
	rep(i,1,n){
		flag=1;
		rep(j,1,m) if (a[i+j-1]!='?'&&a[i+j-1]!=b[j]) flag=0;
		if (flag){
			memcpy(c,a,sizeof a);
			rep(j,1,m) c[i+j-1]=b[j];
			rep(j,1,n) if (c[j]=='?') c[j]='a';
			rep(j,1,n){
				if (ans[j]>c[j]){
					ok=1;
					memcpy(ans,c,sizeof c);
					break;
				}else if (ans[j]<c[j]) break;
			}
		}
	}
	if (ok) rep(i,1,n) printf("%c",ans[i]);
	else puts("UNRESTORABLE");
}

Measured memory_bytes: 384
/*Second*/
#include <iostream>
using namespace std;

int main() 
{
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
    {
      cin>>arr[i];
    }
    int sum=0;
    for(int i=0;i<n;i++)
    {
      for(int j=i+1;j<n;j++)
      {
        sum=sum+arr[i]*arr[j];
      }
    }
    cout<<sum;
}

Measured memory_bytes: 3568
#include <iostream>
#include <string>
#include <string.h>

using namespace std;

int main(){
    char a[255];
    int b, i, j;
    char *p = NULL;
    cin >> b;
    cin >> a;
    i = strlen(a);
    p = a;
    j = b;
    if(i <= b){
        cout << a << endl;
    }
    else{
        for(j = 0; j < b; j++){
            cout << a[j];
        }
        cout << "..." << endl;
    }
    return 0;
}

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

int sum(int n) {
    if (n == 0) {
        return 0;
    }

    int s = sum(n - 1);
    return s + n;
}
int main() {
    int N, W;
        cin >> N >> W;
        vector<vector<char>>A(N, vector<char>(W));
        
        for (int i = 0;i < N;i++) {
            for (int j = 0;j < W;j++) {
                cin >> A.at(i).at(j);
            }
        }
        bool hantei = true;
        for (int i = 0;i < N;i++) {
            for (int j = 0;j < W;j++){
                    if (j>0&&j<(W-1)&&i>0&&i<(N-1)&&A.at(i).at(j) == '#'&&A.at(i + 1).at(j) == '.' && A.at(i - 1).at(j) == '.' &&
                        A.at(i).at(j + 1) == '.' && A.at(i).at(j - 1) == '.') {
                         hantei=false;
                             break;
                    }
            }
            if (hantei == false) {
                break;
            }
        }
        if (hantei) {
            cout << "Yes";
        }
        else {
            cout << "No";
        }
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<tr1/unordered_map>
#define pb push_back
#define pii pair<int,int>
#define SZ(x) (int)x.size()
#ifdef __linux__
#define getchar getchar_unlocked
#endif
#define mem(a,b) memset(a,b,sizeof(a))
#define  For(i,a,b) for(int i=a,i##E=b;i<=i##E;++i)
#define rFor(i,a,b) for(int i=a,i##E=b;i>=i##E;--i)
typedef long long LL;
using namespace std;
const int N=100010;
const int inf=0x3f3f3f3f;
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
template<typename T>inline void read(T &x)
{
	x=0;int _f(0);char ch=getchar();
	while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
	while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x=_f?-x:x;
}
inline void file()
{
#ifdef ztzshiwo
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
}
int n,S[N];
char str[N];
inline bool check(int l,int r)
{
	if(l>r)return 1;
	return S[r]-S[l-1]==0||S[r]-S[l-1]==r-l+1;
}
int main()
{
	file();
	scanf("%s",str+1);
	n=strlen(str+1);
	For(i,1,n)S[i]=S[i-1]+str[i]-'0';
	rFor(k,n,1)
		if(check(n-k+1,k))
		{
			printf("%d\n",k);
			break;
		}
	return 0;
}


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

#define INF INT_MAX
#define UINF UINT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef std::pair<int,int> pii;

using namespace std;

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

    ll n,k;
    cin >> n >> k;
    vector<bool> aa(n,false);  
    REP(i,k){
        ll d = 0;
        cin >> d;
        REP(i,d){
            ll a = 0;
            cin >> a;
            aa[a-1] = true;
        }
    }

    ll ans = 0;
    REP(i,n)if(!aa[i])ans++;

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

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
long long n,m,i,j,s;
int main()
{
	cin>>n>>m;
	while (n<=m)
	{
		n*=2;
		s++;
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define badi_val 10e13
int main(){	
	ios_base::sync_with_stdio(false);
	    cin.tie(NULL);
	   	int k , s;
  	cin >> k >> s;
  	int ans = 0;
  	for(int i = 0 ; i <= k ; i++){
		for(int j = 0 ; j <= k ; j++){
			if( s >= (i + j) && s - (i + j) <= k)
              ans++;
        }
    }
    cout << ans << endl;

		return 0; 
}

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

int main(void) {
	int n,r,i,j,p,c;
	int huda[50];
	int tmp[50];


	do{
		scanf("%d %d",&n,&r);
				if((n==0)&&(r==0)){
					break;
				}
			for(i=0;i<n;i++){
				huda[i]=i+1;
			}
		for(i=0;i<r;i++){
			scanf("%d %d",&p,&c);
			for(j=0;j<c;j++){
				tmp[j]=huda[n-p-j];
			}
			for(j=0;j<p;j++){
				huda[n-p+1+j-c]=huda[n-p+1+j];
			}
			for(j=0;j<c;j++){
				huda[n-1-j]=tmp[j];
			}
		}
		printf("%d\n",huda[n-1]);
	}while((n!=0)&&(r!=0));

	return 0;
}

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

struct Interval { int min, max; };
Interval intersection(const Interval a, const Interval b) { return {max(a.min, b.min), min(a.max, b.max)}; }
bool contains(const Interval a, const int x) { return a.min <= x && x <= a.max; }

int main()
{
    ios::sync_with_stdio(false);

    int N; cin >> N;
    auto adjacency_list = vector<vector<int>>(N);
    for (auto i = 0; i < N-1; i++)
    {
        int a, b; cin >> a >> b;
        a--; b--;

        adjacency_list[a].push_back(b);
        adjacency_list[b].push_back(a);
    }

    int K; cin >> K;
    auto root = -1;
    auto marked = vector<bool>(N);
    auto marks = vector<int>(N);
    for (auto i = 0; i < K; i++)
    {
        int v, p; cin >> v >> p;
        v--;

        root = v;
        marked[v] = true;
        marks[v] = p;
    }

    auto constraints = vector<Interval>(N);
    function<void(int, int)> preprocess = [&](const int v, const int parent)
    {
        const auto infinity = int(1e9);
        if (marked[v]) constraints[v] = {marks[v], marks[v]};
        else constraints[v] = {-infinity, infinity};

        for (const auto w : adjacency_list[v]) if (w != parent)
        {
            preprocess(w, v);
            constraints[v] = intersection(constraints[v], {constraints[w].min-1, constraints[w].max+1});
        }
    };
    preprocess(root, -1);

    function<bool(int, int)> process = [&](const int v, const int parent)
    {
        auto ok = false;
        const auto options = marked[v] ? vector<int>({marks[v]}) : vector<int>({marks[parent]-1, marks[parent]+1});
        for (const auto x : options) if (contains(constraints[v], x))
        {
            marks[v] = x;
            ok = true;
        }

        for (const auto w : adjacency_list[v]) if (w != parent)
            ok &= process(w, v);

        return ok;
    };

    if (process(root, -1))
    {
        cout << "Yes" << "\n";
        for (const auto x : marks) cout << x << "\n";
    }
    else cout << "No" << "\n";
}


Measured memory_bytes: 20096
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll a[100010];
ll b[100010];
int main()
{
    int n;
    ll ans = 0;
    cin>>n;
    for(int i=1;i<=n+1;i++)
        cin>>a[i];
    for(int i=1;i<=n;i++){
        cin>>b[i];
    }
    for(int i=1;i<=n+1;i++)
    {
        if(b[i-1]){
            if(b[i-1]<=a[i]){
                ans += b[i-1];
                a[i]-=b[i-1];
                b[i-1] = 0;
            }else{
                ans += a[i];
                a[i] = 0;
            }
        }

        if(a[i] <= b[i]){
            ans += a[i];
            b[i] -= a[i];
            a[i] = 0;
        }else{
            ans += b[i];
            a[i] -= b[i];
            b[i] = 0;
        }
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std;
#define ll long long

int a,b,c,d,e,f;
double ee;


int addsugar(int w)
{
    double top=w*ee;int ans=0;
    for(int i=0;i*c<=top;i++)
    {   int num=i*c;
        if(num+w<=f)ans=max(ans,num);
        while(num+d<=top)
        {
            num+=d;
            if(num+w<=f)ans=max(ans,num);
        }

    }
    return ans;
}




int main ()
{
int www;
int ss=0;
int ww=0;
double bi=0;
int water;
    cin>>a>>b>>c>>d>>e>>f;
    a*=100;b*=100;ee=e*1.0/100;
    //while(cin>>www){cout<<addsugar(www)<<endl; }







    for(int i=0;;i++)
    {
        water=i*a;
        if(water+addsugar(water)<=f)
        {
            if(addsugar(water)*1.0/water>=bi&&water!=0){ss=addsugar(water);ww=water;bi=addsugar(water)*1.0/water;}
        }
        else break;
        while(true)
        {
            water+=b;
            if(water+addsugar(water)<=f)
            {
                if(addsugar(water)*1.0/water>=bi&&water!=0){ss=addsugar(water);ww=water;bi=addsugar(water)*1.0/water;}
            }
            else break;
        }

    }
    cout<<ss+ww<<" "<<ss<<endl;






  return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String s = sc.next();
        System.out.println(answer(n, s));
        sc.close();
    }

    private static String answer(int n, String s) {
        if ((n % 2) != 0) {
            return "No";
        }
        String first = s.substring(0, n / 2);
        String last = s.substring((n / 2));
        if (first.equals(last)) {
            return "Yes";
        }
        return "No";
    }
}


Measured memory_bytes: 35324
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int length = Integer.parseInt(sc.nextLine());
		int count = 0;
		for(int i = 0; i < length; i++) {
			if(primeCheck(Integer.parseInt(sc.nextLine()))) count++;
		}
		sc.close();
		System.out.println(count);
	}
	
	public static boolean primeCheck(int x) {
		double h = Math.sqrt(x);
		for(int i = 2; i <= h; i++) {
			if(x%i == 0) {
				return false;
			}
		}
		return true;
	}
}


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

using namespace std;
using ll = long long;

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

  int n, m;
  cin >> n >> m;
  vector<vector<char>> a(n, vector<char>(n));
  vector<vector<char>> b(m, vector<char>(m));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      cin >> b[i][j];
    }
  }

  auto contains = [&](int x, int y) {
    for (int i = y; i < y + m; i++) {
      for (int j = x; j < x + m; j++) {
        if (a[i][j] != b[i-y][j-x])
          return false;
      }
    }
    return true;
  };

  for (int i = 0; i <= n - m; i++) {
    for (int j = 0; j <= n - m; j++) {
      if (contains(i, j)) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;

  return 0;
}


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

#define int long long
using P = pair<int, int>;

struct query {
  int u, d, c;  
};

int N, M;
vector<vector<int> > G;
int Q;
vector<query> queries;
vector<int> color;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin >> N >> M;
  G.resize(N);
  color.resize(N, 0);
  
  for ( int i = 0; i < M; i++ ) {
    int a, b;
    cin >> a >> b;    
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);   
  }

  cin >> Q;
  queries.resize(Q);
  for ( int i = 0; i < Q; i++ ) {
    cin >> queries[i].u >> queries[i].d >> queries[i].c;
    queries[i].u--;
  }

  int now = Q-1;
  int dp[N][11];
  fill_n(*dp, N*11, 0);  
  while ( now >= 0 ) {    
    int u = queries[now].u, d = queries[now].d, c = queries[now].c;
    queue<P> que;
    que.push(P(u, d));
    while ( !que.empty() ) {
      P q = que.front(); que.pop();
      int v = q.first, dist = q.second;

      if ( dist >= 0 && dp[v][dist] == 0 ) {
	dp[v][dist] = c;	
      } else {
	continue;
      }

      que.push(P(v, dist-1));	
      for ( int i: G[v] ) {
	que.push(P(i, dist-1));	
      }      
    }
    now--;
  }

  for ( int i = 0; i < N; i++ ) {
    cout << dp[i][0] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 26536