akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

const int INVALID = INT_MAX / 2;

vector<vector<int> > edges;
vector<pair<int, int> > node;

bool solve(int curr, int prev)
{
    if(node[curr].first == INVALID){
        node[curr].first = node[prev].first - 1;
        node[curr].second = node[prev].second + 1;
    }

    for(int next : edges[curr]){
        if(next == prev)
            continue;

        if(!solve(next, curr))
            return false;
        if(!((node[curr].first % 2) ^ (node[next].first % 2)))
            return false;

        node[curr].first = max(node[curr].first, node[next].first - 1);
        node[curr].second = min(node[curr].second, node[next].second + 1);
        if(node[curr].second < node[curr].first)
            return false;
    }

    return true;
}

bool solve2(int curr, int prev)
{
    if(prev != -1){
        if(node[curr].first <= node[prev].first - 1 && node[prev].first - 1 <= node[curr].second)
            node[curr].first = node[prev].first - 1;
        else if(node[curr].first <= node[prev].first + 1 && node[prev].first + 1 <= node[curr].second)
            node[curr].first = node[prev].first + 1;
        else
            return false;
    }

    for(int next : edges[curr]){
        if(next == prev)
            continue;
        if(!solve2(next, curr))
            return false;
    }

    return true;
}

int main()
{
    int n;
    cin >> n;
    edges.assign(n, vector<int>());
    for(int i=0; i<n-1; ++i){
        int a, b;
        cin >> a >> b;
        -- a;
        -- b;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    int k;
    cin >> k;
    node.assign(n, make_pair(INVALID, INVALID));
    int curr;
    for(int i=0; i<k; ++i){
        int v, p;
        cin >> v >> p;
        -- v;
        node[v] = make_pair(p, p);
        curr = v;
    }

    if(!solve(curr, -1)){
        cout << "No" << endl;
    }
    else if(!solve2(curr, -1)){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
        for(int i=0; i<n; ++i)
            cout << node[i].first << endl;
    }

    return 0;
}

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

int main(){
  int n;
  cin >> n;
  while(n!=0){
    vector<int> a(n);
    for(int i=0;i<n;i++) cin >> a.at(i);

    vector<int> s(n+1);
    s.at(0) = 0;
    for(int i=1;i<n+1;i++) s.at(i) = s.at(i-1)+a.at(i-1);

    int ans= -1000000000;
    for(int i=1;i<n+1;i++){
      for(int j=0;j<i;j++){
        ans = max(s.at(i)-s.at(j),ans);
      }
    }

    cout << ans << endl;

    cin >> n;
  }
}




Measured memory_bytes: 3132
#include<cstdio>
#include<set>
#include<vector>
using namespace std;
#define M(x,y)make_pair(x,y)
typedef set<pair<int,int> >S;
int n,i,x,y,X,Y;main(){for(;scanf("%d",&n),n;){
vector<pair<int,int> >v;
for(scanf("%d%d",&X,&Y);--n;)scanf("%d%d",&x,&y),v.push_back(M(x-X,y-Y));
S s;S::iterator I;
for(scanf("%d",&n);n;n--)scanf("%d%d",&x,&y),s.insert(M(x,y));
for(I=s.begin();I!=s.end();I++){
	for(x=I->first,y=I->second,i=0;i<v.size();i++)
		if(s.find(M(x+v[i].first,y+v[i].second))==s.end())break;
	if(i==v.size()){
		printf("%d %d\n",x-X,y-Y);
		I=s.end();
		break;
	}
}
}}

Measured memory_bytes: 1084
#define DEBUG 0

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

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

char S[200000];
int main() {
    int i;
    int N,A,B,C,D;
    scanf("%d %d %d %d %d",&N,&A,&B,&C,&D);
    A--,B--,C--,D--;
    for (i = 0; i < N; i++) scanf(" %c",&S[i]);

    for (i = B; i < D; i++) {
        if ((S[i] == '#') && (S[i+1] == '#')) {
            printf("No\n");
            return 0;
        }
    }
    for (i = A; i < C; i++) {
        if ((S[i] == '#') && (S[i+1] == '#')) {
            printf("No\n");
            return 0;
        }
    }

    if (C < D) printf("Yes\n");
    else {
        for (i = B; i <= D; i++) {
            if ((i > 0) && (i < N-1) && (S[i-1] == '.') && (S[i] == '.') && (S[i+1] == '.')) {
                printf("Yes\n");
                return 0;
            }
        }
        printf("No\n");
    }

    return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
int gcd(int a,int b){
    if(b > a){
        swap(a,b);
    }
    bool flag = true;
    int gcdl;
    while(flag){
        if(a%b == 0){
            flag = false;
            gcdl = b;
        }
        else{
            swap(a,b);
            b = b % a;
        }
    }
    return gcdl;
}
int main(){
    int a,b,k;
    cin >> a >> b >> k;
    int m = gcd(a,b);
    int p = 0;
    int ans;
    for(int i = m;i>0;i--){
        if(m%i == 0){
            p = p + 1;
        }
        if(p == k){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 888
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
#define LL long long
#define mp make_pair
#define fr first
#define sc second
#define pb push_back
#define lc (x<<1)
#define rc ((x<<1)|1)
const int N=100005;
const LL two=2ll;
LL a[N],sum[N];
int main(){
  //  freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
    int i,n,ans=0;
    scanf("%d",&n);
    for (i=1;i<=n;i++) scanf("%lld",&a[i]);
    sort(a+1,a+n+1);
    for (i=1;i<=n;i++) sum[i]=sum[i-1]+a[i];
    for (i=1;i<=n;i++){
        int j=i,tp=upper_bound(a+1,a+n+1,sum[j]*two)-a-1;
        while (tp<n){
            tp=upper_bound(a+1,a+n+1,sum[j]*two)-a-1;
            if (j==tp) break; else j=tp;
        }
        if (tp==n) ans++;
    }
    printf("%d\n",ans);
    
  //  system("pause");
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ii pair<int,int>
#define iii pair<int,ii>

using namespace std;

void file(){
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}

int n,e,r;
long long dist[1000006],inf=1000000009;
vector<ii>graph[500005];


void init(){
    cin>>n>>e>>r;
    for(int i=0; i<e; i++){
        int u,v,w;
        cin>>u>>v>>w;
        graph[u].push_back(ii(v,w));
        //graph[v].push_back(ii(u,w));
    }
}

void dijkstra(int source){
    queue<int>q;
    q.push(source);
    dist[source]=0;

    while(!q.empty()){
        int u=q.front();
        q.pop();
        int len=graph[u].size();
        for(int i=0 ;i<len; i++){
            int v=graph[u][i].first,
                w=graph[u][i].second;
            if(dist[u]+w<dist[v]){
                dist[v]=dist[u]+w;
                q.push(v);
            }
        }
    }
}

void Back(){
    for(int i=0; i<n+7; i++)dist[i]=inf;
}

int main(){
    //file();
    init();
    Back();
    dijkstra(r);
    for(int i=0; i<n; i++){
        if(dist[i]<inf)cout<<dist[i]<<endl;
        else cout<<"INF"<<endl;
    }

return 0;
}



Measured memory_bytes: 22152
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct qq {
  char name[100];
  int time;
};

qq data[1000005];
int head, tail;

void enqueue(qq val) {
  data[tail++] = val;
}

qq dequeue() {
  return data[head++];
}

int main() {

  int n, q;
  scanf("%d %d", &n, &q);
  int i;
  for (i = 0; i < n; i++) {
    scanf("%s %d", data[i].name, &(data[i].time));
  }
  int current_time = 0;
  head = 0;
  tail = n;
  while (head != tail) {
    qq val = dequeue();
    if (val.time <= q) {
      printf("%s %d\n", val.name, current_time + val.time);
      current_time += val.time;
    } else {
      current_time += q;
      val.time -= q;
      enqueue(val);
    }
  }
  return 0;
}



Measured memory_bytes: 21912
def main():
    nm = [int(i) for i in input().split()]

    nm.sort()
    # 自身と周辺のカードの枚数を数えて、偶数なら表、奇数なら裏
    if nm[0] == 1 and nm[1] == 1:
        # 1枚の時
        print(1)
    elif nm[0] == 1 and nm[1] == 2:
        # 2枚の時
        print(2)
    elif nm[0] == 1 and nm[1] > 2:
        # 1列の時、両端は自身と隣接2枚、途中は3枚なので、途中が裏
        print(nm[1] - 2)
    elif nm[0] == 2:
        # 2列の時、4隅が自身と隣接4枚、他は6枚
        print(0)
    elif nm[0] > 2 and nm[1] > 2:
        # 3行3列以上の時、4隅が4枚、端は6枚、真ん中は9枚
        print((nm[0]-2) * (nm[1]-2))
    else:
        raise ValueError


if __name__ == '__main__':
    main()


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

MAX_V = N * (10 ** 3)
w, v = [], []
for _ in range(N):
    a, b = map(int, input().split())
    w.append(a)
    v.append(b)

# dp[in_n_items][above_v_value] = min_weight
dp = [[float('inf') for _ in range(MAX_V + 1)] for _ in range(N + 1)]
dp[0][0] = 0

for i in range(N):
    for j in range(MAX_V + 1):
        if j - v[i] >= 0:
            if dp[i][j - v[i]] + w[i] < dp[i][j]:
                dp[i + 1][j] = dp[i][j - v[i]] + w[i]
            else:
                dp[i + 1][j] = dp[i][j]
        else:
            dp[i + 1][j] = dp[i][j]

mv = 0
for i in range(MAX_V + 1):
    if dp[N][i] <= W:
        mv = i
print(mv)


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


int main() {
      string S; cin >> S; bool can = false;
      if(S.at(0) == S.at(1))
      {
            if(S.at(2) == S.at(3))can = true;
            if(S.at(0) == S.at(2))can = false;
      }
     else if(S.at(0) == S.at(2))
      {
            if(S.at(1) == S.at(3))can = true;
            if(S.at(0) == S.at(1))can = false;
      }
      else if(S.at(0) == S.at(3))
      {
            if(S.at(1) == S.at(2))can = true;
            if(S.at(0) == S.at(1))can = false;
      }
      

      if(can) cout << "Yes" << endl;
      else cout << "No" << endl;
      

      return 0;
}


Measured memory_bytes: 256
def main():
    n = input()
    F = [0]*(n+1)
    number = fibonacci(n,F)
    print number

def fibonacci(n,F):
    if n == 0 or n == 1:
        F[n] = 1
        return 1
    if F[n] != 0:
        return F[n]
    else:
        F[n] = fibonacci(n-2,F)+fibonacci(n-1,F)
        return F[n]

if __name__ == "__main__":
    main()

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

#define max 200000
#define sentinel 2000000000
typedef long long llong;

int l[max / 2 + 2], r[max / 2 + 2];

llong merge(int a[], int n, int left, int mid, int right) {
	int i, j, k;
	llong cnt = 0;
	int n1 = mid - left;
	int n2 = right - mid;
	for (i = 0; i < n1; i++) l[i] = a[left + i];
	for (j = 0; j < n2; j++) r[j] = a[mid + j];
	l[n1] = r[n2] = sentinel;
	i = 0;
	j = 0;
	for (k = left; k < right; k++) {
		if (l[i] <= r[j]) {
			a[k] = l[i++]; 
		}
		else {
			a[k] = r[j++];
			cnt += n1 - i;
		}
	}
	return cnt;
}

llong mergesort(int a[], int n, int left, int right) {
	int mid;
	llong v1, v2, v3;
	if (left + 1 < right) {
		mid = (left + right) / 2;
		v1 = mergesort(a, n, left, mid);
		v2 = mergesort(a, n, mid, right);
		v3 = merge(a, n, left, mid, right);
		return v1 + v2 + v3;
	}
	else return 0;
}

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

	llong ans = mergesort(a, n, 0, n);
	cout << ans << endl;

	return 0;
}


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

unsigned long long gcd(unsigned long long a, unsigned long long b)
{
	if(a<b)
	{
		unsigned long long int tmp = a;
		a = b;
		b = tmp;
	}
	unsigned long long r = a % b;
	while(r!=0)
	{
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}

int main()
{
	int T;
	cin >> T;
	bool is_ok[T];
	unsigned long long int A,B,C,D,R;
	for(int i=0;i<T;i++)
	{
		is_ok[i] = false;
		cin >> A >> B >> C >> D;
		if(A<B) 	continue;
		if(D<B)		continue;
		if(C<A%B)	continue;
		if(C<B-gcd(B,D))	continue;
		is_ok[i] = true;
	}
	for(int i=0;i<T;i++)
		if(is_ok[i]) 	cout << "Yes" << std::endl;
		else			cout << "No" << std::endl;
	return 0;
}

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

int main()
{
    string s;
    stack<char> S;
    cin >> s;
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i]=='B' and !S.empty()) S.pop();
        else if(s[i]!='B')S.push(s[i]);
    }
    vector<char> v;
    while(!S.empty())
    {
        v.push_back(S.top());
        S.pop();
    }
    reverse(v.begin(), v.end());
    for(auto u : v) cout << u;
}



Measured memory_bytes: 3604
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


# --------------------------------------------

dp = None


def main():
    N = int(input())
    P = li_input()

    ans = 0

    for i in range(len(P) - 1):
        if i + 1 != P[i]:
            continue

        P[i], P[i + 1] = P[i + 1], P[i]
        ans += 1

    if P[len(P) - 1] == len(P):
        ans += 1

    print(ans)


main()


Measured memory_bytes: 15380
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{
    public static void Main()
    {
        int[] ks = SpIntRead(' ');
        int c = 0;
        for (int x = 0; x <= ks[0]; x++) {
            for (int y = 0; y <= ks[0]; y++) {
                int z = ks[1] - x - y;
                if (0 <= z && z <= ks[0]) c++;
            }
        }
        Console.WriteLine(c);
    }
}

public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static long LCM(long a, long b)
    {
        long c = a * b;
        if (a < b) Swap(ref a, ref b);
        long d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string StrReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int IntRead()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
    public static int[] SpIntRead(char c)
    {
        return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    }
    public static string ToConvertBit(int N, int e)
    {
        string ret = "";
        int r = 0;
        while (N != 0)
        {
            r = N % e;
            ret += r.ToString();
            N -= r;
            N /= e;
        }
        ret = StrReverce(ret);
        return ret;
    }
}


Measured memory_bytes: 13268
#![doc = " # Bundled libraries"]
#![doc = ""]
#![doc = " ## `kyopro_lib` (private)"]
#![doc = ""]
#![doc = " ### Modules"]
#![doc = ""]
#![doc = " - `::__kyopro_lib::math` → `$crate::math`"]
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
fn main() {
    input! { t : usize , nmab : [(i64 , i64 , i64 , i64) ; t] , }
    for (n, m, a, b) in nmab {
        println!("{}", math::floor_sum(n, m, a, b));
    }
}
pub mod math {
    pub fn floor_sum(n: i64, m: i64, mut a: i64, mut b: i64) -> i64 {
        let mut res = 0;
        res += b / m * n;
        b %= m;
        res += a / m * n * (n - 1) / 2;
        a %= m;
        let y_max = (n * a + b) / m;
        if y_max == 0 {
            return res;
        }
        let x_max = y_max * m - b;
        res + (n - (x_max + a - 1) / a) * y_max + floor_sum(y_max, a, m, (a - x_max % a) % a)
    }
}


Measured memory_bytes: 6868
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
int main()
{
	ios::sync_with_stdio(false);
	ll n,flag=1;
	cin>>n;
	for(ll i=0;i<n;i++)
    {
        ll x;
        cin>>x;
        if(x%2==0)
        {
            if(x%3&&x%5) flag=0;
        }
    }
    if(flag) cout<<"APPROVED";
    else cout<<"DENIED";
	return 0;
}


Measured memory_bytes: 884
#include <bits/stdc++.h>  
using namespace std;  
typedef unsigned long long ll; 
typedef long double ld;
const double eps = 1e-10;
const int INF = 0x3f3f3f3f;  
const int N = 100000 + 5;

int main()
{
	int a,b;
	cin >> a >> b;
	if(a <= b)
		cout << "unsafe" << endl;
	else
		 cout << "safe" << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
#include <cassert>
//#include <numeric>
#pragma warning(disable:4996) 
 
typedef long long ll;
typedef unsigned long long ull;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

char str[8005];

int dp0[4005][8005];
int dp1[4005][8005];

void solve()
{
    scanf("%s", str);
    int n = strlen(str);
    int x, y;
    scanf("%d%d", &x, &y);

    vector<int> v;
    int cnt = 0;
    int i;
    for (i = 0; i < n; i++) {
        if (str[i] == 'F') {
            cnt++;
        }
        else {
            v.push_back(cnt);
            cnt = 0;
        }
    }
    v.push_back(cnt);
    int siz = (int)v.size();
    
    vector<int> v0, v1;
    int sum0 = 0, sum1 = 0;
    for (i = 0; i < siz; i++) {
        if (i%2==0) {
            if(i!=0) v0.push_back(v[i]);
            sum0 += v[i];
        }
        else {
            v1.push_back(v[i]);
            sum1 += v[i];
        }
    }
    int tmp0=sum0 - x;
    if (tmp0 % 2 || tmp0<0) {
        printf("No\n"); return;
    }
    x = tmp0 / 2;

    int tmp1 = sum1 - y;
    if (tmp1 % 2 || tmp1<0) {
        printf("No\n"); return;
    }
    y = tmp1 / 2;

    int siz0 = (int)v0.size();
    int j;
    dp0[0][0] = 1;
    for (i = 0; i <siz0; i++) {
        for (j = 0; j <= n; j++) {
            if (dp0[i][j]) {
                {
                    int j2 = j;
                    if(j2<=n) dp0[i + 1][j2] = 1;
                }
                {
                    int j2 = j + v0[i];
                    if(j2<=n) dp0[i + 1][j2] = 1;
                }
            }
        }
    }
    if (dp0[siz0][x] == 0) {
        printf("No\n"); return;
    }

    int siz1 = (int)v1.size();
    dp1[0][0] = 1;
    for (i = 0; i < siz1; i++) {
        for (j = 0; j <= n; j++) {
            if (dp1[i][j]) {
                {
                    int j2 = j;
                    if(j2<=n) dp1[i + 1][j2] = 1;
                }
                {
                    int j2 = j + v1[i];
                    if(j2<=n) dp1[i + 1][j2] = 1;
                }
            }
        }
    }
    if (dp1[siz1][y] == 0) {
        printf("No\n"); return;
    }
    printf("Yes\n");


    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        //printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}



Measured memory_bytes: 244352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll Mod = 1000000007;
int main() {
  int n;
  cin >> n;
  int v[n];
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  vector<pair<int,int>> P1(100001);
  vector<pair<int,int>> P2(100001);
  for (int i = 0; i < 100001; i++) {
    P1[i].first = 0;
    P1[i].second = i;
    P2[i].first = 0;
    P2[i].second = i;
  }
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      P1[v[i]].first++;
    } else {
      P2[v[i]].first++;
    }
  }
  sort(P1.begin(),P1.end());
  reverse(P1.begin(),P1.end());
  sort(P2.begin(),P2.end());
  reverse(P2.begin(),P2.end());
  int ans = 0;
  if (P1[0].second != P2[0].second) {
    ans = n - P1[0].first - P2[0].first;
  } else {
    ans = min(n - P1[1].first - P2[0].first,n - P1[0].first - P2[1].first);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2176
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner stdIn = new Scanner(System.in);
		
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		int c = stdIn.nextInt();
		int d = stdIn.nextInt();
		int e = stdIn.nextInt();
		int k = stdIn.nextInt();
		
		if(e-a > k) System.out.println(":(");
		else System.out.println("Yay!");

	}
}	


Measured memory_bytes: 22868
#include<stdio.h>
#define min(a,b) ((a)<(b)?(a):(b))

long long d[10][10];

void warshall_floyd(){
		for(int k=0;k<=9;k++){
				for(int i=0;i<=9;i++){
						for(int j=0;j<=9;j++){
								d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
						}
				}
		}
}

int main(){
		int h,w,i,j,a[200][200];
		scanf("%d%d",&h,&w);
		for(i=0;i<10;i++){
				for(j=0;j<10;j++){
						scanf("%lld",&d[i][j]);
				}
		}
		for(i=0;i<h;i++){
				for(j=0;j<w;j++){
						scanf("%d",&a[i][j]);
				}
		}
		warshall_floyd();
		long long ans=0;
		for(i=0;i<h;i++){
				for(j=0;j<w;j++){
						if(a[i][j]!=-1)ans+=d[a[i][j]][1];
				}
		}
		printf("%lld\n",ans);
		return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;

namespace c
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            foreach(var i in GetPrimeNumber(1000000)){
                if(i >= n){
                    Console.WriteLine(i);
                    break;
                }
            }
        }

        static IEnumerable<long> GetPrimeNumber(long n){
            if(n < 2){
               yield return 0;
            }

            if(n >= 2){
                yield return 2;
            }

            for(var i = 3; i <= n; i += 2){
                var flag = true;
                var sqrtnum = Math.Sqrt(i);
                for(var j = 3; j <= sqrtnum; j += 2){
                    if(i % j == 0){
                        flag = false;
                        break;
                    }
                }
                if(flag){
                    yield return i;
                }
            }
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 n, x;
  cin >> n >> x;
  vector<i64> l(n);
  for (i64 i = 0; i < n; i++)
    cin >> l[i];
  i64 d = 0;
  for (i64 i = 0; i < n; i++)
  {
    d += l[i];
    if (x < d)
    {
      cout << i + 1 << endl;
      return 0;
    }
  }
  cout << n + 1 << endl;
  return 0;
}


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

typedef long long LL;

template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar.size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}


int main(int argc, char const* argv[])
{
    int n,a,b;
    cin >> n >> a >> b;
    if (a*n > b) {
        cout << b << endl;
    }else{
        cout << a*n << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include<set>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
llfor;///////////////////////////////////////////////////////////
int main(){
 ll n;
 sc(n);
 string t;
 ll a=0,b=0,c=0,d=0;
 rep(i,0,n){
  sc(t);
  if(t=="AC")a++;
  if(t=="WA")b++;
  if(t=="TLE")c++;
  if(t=="RE")d++; 
 }
  cout<<"AC x "<<a<<endl;
  cout<<"WA x "<<b<<endl;
  cout<<"TLE x "<<c<<endl;
  cout<<"RE x "<<d<<endl;
return 0;}

Measured memory_bytes: 3624
/*
 * atcoder/abc130/a.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>

using namespace std;

#define ll long long

#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

char b;

void input() {
  cin >> b;
}

void solve() {
  if (b == 'A') cout << 'T';
  if (b == 'T') cout << 'A';
  if (b == 'C') cout << 'G';
  if (b == 'G') cout << 'C';
  cout << endl;
}

int main() {
  // cout.precision(15);
  input();
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n;
	while(scanf("%d", &n) != EOF){
		int a, b, c, d, count = 0;
		for(a = 0; a <= 9; a++){
			for(b = 0; b <= 9; b++){
				for(c = 0; c <= 9; c++){
					for(d = 0; d <= 9; d++){
						if((a + b + c + d) == n) count++;
					}
				}
			}
		}
		printf("%d\n", count);
	}
	return 0;
}

Measured memory_bytes: 596
N, D = map(int, input().split())
x = []
tmp_d = 0
counter = 0

for i in range(N):
    tmp = list(map(int, input().split()))
    x.append(tmp)

for n in range(N-1):
    for s in range(n+1, N):

        for d in range(D):
            tmp_d += (x[n][d] - x[s][d])**2

        if tmp_d**(1/2) == int(tmp_d**(1/2)):
            counter += 1
        
        tmp_d = 0

print(counter)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

void find_divisor(ll N, vector<ll>& divisor) {
  for(int i=1; i<=sqrt(N); i++) {
    if(N % i == 0)
      divisor.push_back(i);
  }
  int n = divisor.size();
  for(int i=n-1; i>=0; i--) {
    if(N != (ll)pow(divisor[i], 2))
      divisor.push_back(N / divisor[i]);
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; ll m; cin >> n >> m;
  vector<ll> div;
  find_divisor(m, div);
  ll ans = 1;
  for(ll d: div) {
    if(m/d >= n) chmax(ans, d);
  }
  cout << ans << endk;
  return 0;
}


Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int siz = 131072;
int BIT[2][siz+1];
void add(int ki,int x,int diff) {
	while (x <= siz) {
		BIT[ki][x] += diff;
		x = x + (x&(-x));
	}
}
int sum(int ki,int x) {
	int ans = 0;
	while (0 < x) {
		ans += BIT[ki][x];
		x -=(x&(-x));
	}
	return ans;
}
signed main() {
	int n, q;
	scanf("%lld %lld", &n,&q);
	for (int i = 0; i < q; i++) {
		int che, s, t;
		scanf("%lld %lld %lld",&che,&s,&t);
		if (che == 0) {
			t++;
			int diff; cin >> diff;
			add(0, s, diff); add(0, t, -diff);
			add(1, s, diff*(siz - s)); add(1, t, -diff * (siz - t));
		}
		else {
			s--;
			int ans = sum(1,t) - sum(1,s);
			ans += sum(0, t)*(t + 1 - siz) + sum(0, s)*(-s - 1 + siz);
			cout << ans << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 4744
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>


#define rep(p,q) for(int i = p;i < q;i++)
#define ll long long

using namespace std;

/*
//126 D

int main(void) {
	vector<vector<pair<int,ll>>> graph = vector<vector<pair<int,ll>>>(100000);
	vector<int> vColor = vector<int>(100000);
	int n;
	cin >> n;
	rep(0, n)vColor[i] = 2;
	rep(0, n - 1) {
		int u, v, w;
		cin >> u >> v >> w;
		graph[u - 1].push_back(make_pair(v - 1, w));
		graph[v - 1].push_back(make_pair(u - 1, w));
	}
	stack<pair<int, ll>>stk = stack<pair<int, ll>>();
	rep(0, graph[0].size())stk.push(graph[0][i]);
	vColor[0] = 0;
	while (stk.size() > 0) {
		pair<int, ll> p = stk.top();
		stk.pop();
		int v = p.first;
		if (p.second % 2 == 0)vColor[v] = 0;
		else vColor[v] = 1;
		vector<pair<int, ll>> nbr = graph[v];
		rep(0, nbr.size()) {
			if (vColor[nbr[i].first] == 2)stk.push(make_pair(nbr[i].first,nbr[i].second + p.second));
		}
	}
	rep(0, n) {
		cout << vColor[i] << endl;
	}
}
*/


//126 C
int main(void) {
	double n;
	double k;
	
	cin >> n >> k;
	
	double ans = 0;
	rep(1, n+1) {
		if (i >= k)ans += 1 / n;
		else {
			double div = k;
			double count = 0;
			while (i < div) {
				div /= 2;
				count++;
			}
			ans += (1 / n) / pow(2, count);
		}
	}
	cout << fixed << setprecision(10) << ans << endl;

}

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

using namespace std;

int a[3][101];
int p[3][101];

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}
	p[1][1] = a[0][0];
	for (int i = 1; i <= 2; i++) {
		for (int j = 1; j <= n; j++) {
			p[i][j] = max(p[i - 1][j], p[i][j - 1]) + a[i - 1][j - 1];
		}
	}
	cout << p[2][n] << endl;
	return 0;
}

Measured memory_bytes: 256
import queue

N = int(input())

S = list(map(int, input().split()))

S.sort(reverse = True)

#print(S)

q = queue.Queue()
q.put(S[0])

ans = 0

for i in range(1, N):
    ans += q.get()
    #print(ans)
    q.put(S[i])
    q.put(S[i])

print(ans)

Measured memory_bytes: 31924
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>

using namespace std;

long long N,M,a,b,i,j,k,K,p[200001],ans,temp;

double x;



int main()
{
  cin>>N>>K;
  for(i=0;i<N;i++)
  {
    cin>>p[i];
    
  }
  ans=0;
  
  for(i=0;i<K;i++)
  {
    ans+=p[i]+1;
  }
  
  temp=ans;
  
  for(i=0;i<N-K;i++)
  {
    temp-=p[i];
    temp+=p[i+K];
    
    if(ans<temp)
    {
      ans=temp;
    }
  }
  
  x=ans/2.;
  
  printf("%f",x);
  
 
}



Measured memory_bytes: 1792
function Main(input) {
  input = input.split('\n');
  let tmp = input[0].split(' ');

  let N = Number(tmp[0]);
  let A = Number(tmp[1]);

  let x = [0];
  x = x.concat(input[1].split(' ').map(Number));

  let dp = new Array(N + 1);
  for (let i = 0; i <= N; ++i) {
    dp[i] = new Array(N + 1);
    for (let j = 0; j <= N; ++j) {
      dp[i][j] = new Array(A * N + 1).fill(0);
    }
  }

  for (let i = 0; i < N; ++i) dp[i][0][0] = 1;

  for (let i = 1; i <= N; ++i) {
    for (let j = 1; j <= i; ++j) {
      for (let k = 1; k <= A * N; ++k) {
        if (k < x[i]) {
          dp[i][j][k] = dp[i - 1][j][k];
        } else {
          dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i]];
        }
      }
    }
  }

  let ans = 0;
  for (let j = 1; j <= N; ++j) {
    ans += dp[N][j][j * A];
  }

  console.log(ans);
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 98352
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

int main() {
	int n, k;
	cin >> n >> k;

	vector<bool> sunuke(n, false);

	int d, a;
	for (int i = 0; i < k; i++) {
		cin >> d;
		for (int j = 0; j < d; j++) {
			cin >> a;
			sunuke[a-1] = true;
		}
	}

	int ans = 0;
	for (bool b: sunuke) {
		if (!b) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3196
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	n := nextInt()
	x := nextInt()
	t := nextInt()

	count := n / x
	div := n % x
	if div != 0 {
		count++
	}
	fmt.Fprintf(out, "%d\n", count*t)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func quickSort(val []int) []int {
	if len(val) < 2 {
		return val
	}

	pivot := val[0]

	left := []int{}
	right := []int{}

	for _, v := range val[1:] {
		if pivot > v {
			left = append(left, v)
		} else {
			right = append(right, v)
		}
	}

	left = quickSort(left)
	right = quickSort(right)

	ret := append(left, pivot)
	ret = append(ret, right...)

	return ret
}


Measured memory_bytes: 1812
a,b,c,d= list(input())
op = ['+','-']
for i in op:
    for j in op:
        for k in op:
            if eval(a+i+b+j+c+k+d) == 7:
                print(str(a+i+b+j+c+k+d)+'=7')
                exit()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define For(i , j , k) for (int i = (j) , _##end_ = (k) ; i <= _##end_ ; ++ i)
#define Fordown(i , j , k) for (int i = (j) , _##end_ = (k) ; i >= _##end_ ; -- i)
#define Set(a , b) memset(a , b , sizeof(a))
#define pb push_back
#define INF (0x3f3f3f3f)
#define Mod (1000000007)
using namespace std;
typedef long long LL;

template <typename T> inline bool chkmax(T &a , T b) { return a < b ? (a = b , 1) : 0; }
template <typename T> inline bool chkmin(T &a , T b) { return b < a ? (a = b , 1) : 0; }

int _ , __;
char c_;
inline int read()
{
	for (_ = 0 , __ = 1 , c_ = getchar() ; !isdigit(c_) ; c_ = getchar()) if (c_ == '-') __ = -1;
	for ( ; isdigit(c_) ; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
	return _ * __;
}

inline void file()
{
#ifdef hany01
	freopen("a.in" , "r" , stdin);
	freopen("a.out" , "w" , stdout);
#endif
}

const int maxn = 200010;

int ai , bi , n , m;

map<int , int> hs;

int main()
{
	file();
	n = read();
	For(i , 1 , n)
	{
		ai = read();
		++ hs[ai];
	}
	m = read();
	For(i , 1 , m)
	{
		bi = read();
		if (!hs[bi])
		{
			puts("NO");
			return 0;
		}
		else
			-- hs[bi];
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;

int main(){
	int A,B;
	cin>>A>>B;
	
	if(A%3==0||B%3==0||(A+B)%3==0) cout<<"Possible";
	else cout<<"Impossible";
}

Measured memory_bytes: 256
#include <atcoder/maxflow>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using namespace atcoder;

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

int main() {
	int h, w;
	cin >> h >> w;
	
	vector<string> grid(h);
	for (int i = 0; i < h; i++) {
		cin >> grid[i];
	}
	
	mf_graph<int> g(h * w + 2);
	int s = h * w;
	int t = h * w + 1;
	
	//s -> even / odd -> t
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (grid[i][j] == '#') continue;
			int v = i * w + j;
			if ((i + j) % 2 == 0) {
				g.add_edge(s, v, 1);
			}
			else {
				g.add_edge(v, t, 1);
			}
		}
	}
	
	//even -> odd
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if ((i + j) % 2 || grid[i][j] == '#') continue;
			int v0 = i * w + j;
			for (int dir = 0; dir < 4; dir++) {
				int y = i + dy[dir];
				int x = j + dx[dir];
				if (0 <= y && y < h && 0 <= x && x < w && grid[y][x] == '.') {
					int v1 = y * w + x;
					g.add_edge(v0, v1, 1);
				}
			}
		}
	}
	
	cout << g.flow(s, t) << endl;
	
	auto edges = g.edges();
	for (auto e : edges) {
		if (e.from == s || e.to == t || e.flow == 0) continue;
		int i0 = e.from / w, j0 = e.from % w;
		int i1 = e.to / w, j1 = e.to % w;
		
		if (i0 == i1 + 1) {
			grid[i1][j1] = 'v';
			grid[i0][j0] = '^';
		}
		else if (j0 == j1 + 1) {
			grid[i1][j1] = '>'; grid[i0][j0] = '<';
		}
		else if (i0 == i1 - 1) {
			grid[i0][j0] = 'v';
			grid[i1][j1] = '^';
		}
		else {
			grid[i0][j0] = '>'; grid[i1][j1] = '<';
		}
	}
	
	for (int i = 0; i < h; i++) {
		cout << grid[i] << endl;
	}
	return 0;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    char a, b;
    cin >> a >> b;
    if (a == b) {
        cout << "=" << endl;
    } else if (a < b) {
        cout << "<" << endl;
    } else {
        cout << ">" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

    int main(){
        int A,B;
        scanf("%d", &A);
        scanf("%d", &B);
        if (A <=23 && A + B <= 23) {
            printf("%d", A + B);
        } else if (A <=23 && A + B >= 23) {
            printf("%d", A + B - 24);
        }
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>

char a[20], b[20];

int main() {
    int aa, bb;
    scanf("%d%d", &aa, &bb);
    for (int i = 0; i < bb; i++) a[i] = '0' + aa;
    for (int i = 0; i < aa; i++) b[i] = '0' + bb;
    printf("%s\n", strcmp(a, b) < 0 ? a : b);
}

Measured memory_bytes: 128
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;
  for(int i = b; i <= c; i++) {
    if(i % a == 0) {cout << "OK" << endl; return 0;}
  }
  cout << "NG" << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 3652
#include <stdio.h>

/*A[i]をmから引いていき0を作れるか全検索する*/
int Solve(int i , int m , int A[] , int n) {
    int respond;
    /*配列Aいくつかの組み合わせで引いていって、mを0にすることができたら*/
    if(m == 0)
        return 1;
    /*iを増やしていった結果、配列Aの要素数よりも大きくなってしまった ＝ 足した結果、それでもmに届かなかった*/
    /*C言語で偽は0それ以外は真*/
    if(i >= n)
        return 0;
    
    /*ここからが再帰(再帰をするときは必ず無限ループしないようにすることに注意)*/
    /*||はorなので「右が偽かつ左も偽なら偽」「右か左のどちらか一方が真ならばもう片方の真偽によらず真」*/
    /*ここではSolve(i ＋ 1 , m）と(i + 1 , m - A[i])の両方が常に実行されるので2^n回行われる*/
    /*mからA[i]を引かない場合と、引く場合の二通りがある*/
    respond = Solve(i + 1 , m , A , n) || Solve(i + 1 , m - A[i] , A , n);
    
    /*res = ~は再帰なので、resが真か偽かの判定を出すまで終わらない*/
    /*結果としてresが返した答えを返す(真or偽の二択)*/
    return respond;
}

int main(void)
{
    int n , q , m;
    int i , j;
    int count = 0;
    
    scanf("%d" , &n);
    
    int A[n];
    for(i = 0 ; i < n ; i++)
        scanf("%d" , &A[i]);
    
    scanf("%d" , &q);
    
    for(j = 0 ; j < q ; j ++) {
        scanf("%d" , &m);
        /*再帰なので0から始めて全て調べる*/
        if(Solve(0 , m , A , n) == 1)
            puts("yes");
        else
            puts("no");
    }

    return 0;
}



Measured memory_bytes: 2136
#coding:utf-8
n = int(input())
h_ent = list(map(int, input().split()))

count = 0

while True:
    if len(h_ent)  == 0:
        break
    elif h_ent[0] == 0:
        del h_ent[0]   #リストの先頭が0なら消す
    elif not 0 in h_ent:
        h_ent = list(map(lambda x:x-1, h_ent))
        count += 1
    else:
        for i in range(0, h_ent.index(0)):
            h_ent[i] -= 1
        count += 1

def out(x):
    print(x)

out(count)

Measured memory_bytes: 3064
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int count2 = 0;
        for(int i = a; a <= b; a++) {
            if(c%a == 0) {
                count2++;
            }
        }
        System.out.println(count2);
    }
}



Measured memory_bytes: 26332
from math import sqrt
 
N = int(input())
 
search_max = int(sqrt(N))
 
min_number = 10**12
for x in range(1, search_max + 1):
    if N % x == 0:
        y = N // x
        if x + y < min_number:
            min_number = x + y
print(min_number-2)

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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template <class T> ostream& operator<<(ostream& os, const V<T>& v) {
    os << "[";
    for (auto d : v) os << d << ", ";
    return os << "]";
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    return os << "P(" << p.first << ", " << p.second << ")";
}

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

    int n;
    cin >> n;
    int sa = 0, sb = 0, sc = 0;
    for (int i = 0; i < n; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        int na = a + max(sb, sc);
        int nb = b + max(sa, sc);
        int nc = c + max(sa, sb);
        sa = na; sb = nb; sc = nc;
    }
    cout << max({sa, sb, sc}) << endl;

    return 0;
}


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

#define dbg(x) cerr<<#x": "<<x<<"\n"
#define dbg_p(x) cerr<<#x": "<<x.first<<","<<x.second<<"\n"
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define st first
#define nd second

using namespace std;

long long n, k, a, b, c, d, t;

template<class T>
ostream& operator<<(ostream& out, vector<T> v) {
	out << v.size() << '\n';
	for(auto e : v) out << e << ' ';
	return out;
}

string solve() {
	cin >> a >> b >> c >> d;
	if(b > d)
		return "No\n";
	if(b > a) 
		return "No\n";
	// dbg(a);
	// dbg(b);
	// dbg(c);
	// dbg(d);
	long long cat = c / b;
	cat++;
	long long r = b * cat + a % b;
	// dbg(r);
	while(r > c) 
		r -= b;
	if(r < 0)
		return "No\n";
	r += d;
	if(c >= b)
		return "Yes\n";

	long long dif = d % b;
	if(dif == 0)
		return "Yes\n";
	// dbg(dif);
	// dbg(c);
	// dbg(d);
	// dbg(b);
	if(__gcd(dif, b) < b - c)
		return "No\n";
	// dbg_ok;
	return "Yes\n";
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> t;
	for(int i = 1; i <= t; i++) {
		cout << solve();
	}
}	

Measured memory_bytes: 256