akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,t;
    int count1 = 0;
    int c[100];
    int t1[100];
    cin >> n >> t;
    int min = 1001;
    for(int i = 0;i < n;i++){
        cin >> c[i] >> t1[i];
        if(min >= c[i] && t1[i] <= t){
            min = c[i];
        }
        if(t < t1[i]){
            count1++;
        }
    }
    if(count1 != n){
        cout << min << endl;
    }else{
        cout << "TLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N, M = list(map(int, input().split(" ")))
a = []
for i in range(M):
    a.append(int(input()))

stairs = [1 for _ in range(N+1)]

for v in a:
    stairs[v] = 0

for i in list(range(0, N - 1))[::-1]:
    if stairs[i] == 0:
        continue
    stairs[i] = (stairs[i+1] + stairs[i+2]) % 1000000007

print(stairs[0])

Measured memory_bytes: 12568
#include <stdio.h>

int main(void) {
 
 
 int A ,B ,C ;
 scanf("%d%d%d",&A,&B,&C);
 if(A+B==C)
 printf("Yes");
 else if(C+A==B)
 printf("Yes");
 else if(B+C==A)
 printf("Yes");
 
 else
 printf("No");
 
 
 

  return 0;
}

Measured memory_bytes: 2096
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
#define __lcm(a,b) ((a)/__gcd(a,b)*(b))
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950288419716939937510582097;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
    int x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}

int main()
{
	puts(read()%read()?"1":"0");
	return 0;
}



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

#define ll long long

using namespace std;

//memset(dp, 0, sizeof(dp));

void work(int T) {
	
	ll n, k, res = 1, M = 1e9 + 7, nn = 0, nz = 0, np = 0;
	cin >> n >> k;
	vector<ll> a(n);
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		if(a[i] > 0) {
			np++;
		} else if(a[i] < 0) {
			nn++;	
		} else {
			nz++;
		}
	}
	sort(a.begin(), a.end());
	if(k % 2 == 1 && a[n - 1] == 0) {
		cout << 0 << endl;
		return;
	}
	if(k % 2 == 1 && a[n - 1] < 0) {
		while(k) {
			res = res * a[--n] % M;
			k--;
		}
		cout << (res + M) % M << endl;
		return;
	}
	int l = 0, t = n - 1, z = lower_bound(a.begin(), a.end(), 0) - a.begin(), r = upper_bound(a.begin(), a.end(), 0) - a.begin();
	while(k) {
		if(k >= 2 && n - l >= 2 && (n - l < 2 || a[n - 1] * a[n - 2] <= (a[l] * a[l + 1]))) {
			res = res * a[l] % M;
			res = res * a[l + 1] % M;
			l += 2;
			k -= 2;
		} else {
			res = res * a[n - 1] % M;
			k--;
			n--;
		}
	}

	cout << (res + M) % M << endl;
}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
	// int t;
	// for(cin >> t; t > 0; t--) {
		// work(t);
	// }
	work(0);
	return 0;
};

Measured memory_bytes: 4740
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};

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

    string k;
    int d;
    ll dp[10001][2][100];

    cin >> k >> d;

    memset(dp, 0, sizeof(dp));

    dp[0][1][(k[0] - '0') % d] = 1;
    for (int i = 0; i < (k[0] - '0'); i++)
    {
        dp[0][0][i % d] += 1;
    }

    for (int i = 0; i < k.size() - 1; i++)
    {
        for (int j = 0; j < 2; j++)
        {
            for (int l = 0; l < 100; l++)
            {

                if (dp[i][j][l] < 1)
                    continue;

                if (j == 1)
                {
                    (dp[i + 1][1][(l + (k[i + 1] - '0')) % d] += dp[i][j][l]) %= MOD;
                    for (int m = 0; m < (k[i + 1] - '0'); m++)
                    {
                        (dp[i + 1][0][(l + m) % d] += dp[i][j][l]) %= MOD;
                    }
                }
                else
                {
                    for (int m = 0; m < 10; m++)
                    {
                        (dp[i + 1][0][(l + m) % d] += dp[i][j][l]) %= MOD;
                    }
                }
            }
        }
    }

    cout << (dp[k.size() - 1][0][0] + dp[k.size() - 1][1][0] - 1 + MOD) % MOD << endl;

    return 0;
}

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

typedef long long ll;

using namespace std;

ll MAX = 1e9+1;

void solve() {
    int n;
    cin >> n;

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

    vector< vector<ll> > dp(n+1, vector<ll>(n+1, 0));
    // dp[i][j] ~ X-Y for a[i:j]
    // dp[i][j] = max(a[i] - dp[i+1][j], a[j-1] - dp[i][j-1])

    for (int layer = 0; layer < n; layer++) {
        for (int i = 0; i < n; i++) {
            if (layer == 0)
                dp[i][i+layer] = a[i];
            else if (i + layer < n) {
                dp[i][i+layer] = max(a[i] - dp[i+1][i+layer], a[i+layer] - dp[i][i+layer-1]);
            }
        }
    }

    cout.precision(20);
    cout << dp[0][n-1] << endl;
}


int main() {
    solve();
	return 0;
}




Measured memory_bytes: 70784
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner as = new Scanner(System.in);
		long n = as.nextLong();
		long m = as.nextLong();
		long l = 0;
		if(m>=2*n){
			l+=n;
			m-=2*n;
			l+=m/4;
		}else{
			l+=m/2;
		}
		System.out.println(l);
	}
}


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

int main() {
  int n;
  cin >> n;
  int x = 0;
  while (1) {
    n /= 2;
    if (n == 0) break;
    ++x;
  }
  cout << pow(2, x) << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner input =new Scanner(System.in);
		
		String str=input.next();
		char[] a = str.toCharArray();
		
		if((a[2]==a[3])&&(a[4]==a[5])) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}	
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
int main(){
    int n,kk;
    ll maxx,minn;
    ll sum=0;
    cin>>n>>kk;
    for(ll k=kk;k<=n+1;k++){
    /*
        maxx=(2*n-k+1)*k/2; //组成最大数
        minn=k*(k+1)/2; //组成最小数
        sum += maxx-minn+1;
        化简如下
    */
        sum += (k*(n-k+1)+1)%mod;
        sum%=mod;
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
const int dx[]={0,1,0,-1,1,-1,-1,1};
const int dy[]={-1,0,1,0,1,1,-1,-1};
const int INF = 1<<30;
const double EPS = 1e-15;
#define PB push_back
#define mk make_pair
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
	int N;
	scanf("%d",&N);
	while(N--){
		double a,b;
		int h,m;
		scanf("%d:%d",&h,&m);
		b = m*6.0;
		a = h*30.0+m/2.0;
		double d = min(360-fabs(a-b),fabs(a-b));
		if(d < 30.0){
			puts("alert");
		}
		else if(90.0 <= d && d <= 180.0){
			puts("safe");
		}
		else{
			puts("warning");
		}
	}

    return 0;
}

Measured memory_bytes: 1164
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int[] inputs = new int[3];
		inputs[0] = scanner.nextInt();
		inputs[1] = scanner.nextInt();
		inputs[2] = scanner.nextInt();
		scanner.close();
		
		int count5 = 0;
		int count7 = 0;
		for(int input: inputs) {
			if(input == 5) {
				count5++;
			} else if(input == 7) {
				count7++;
			} else {
				break;
			}
		}
		if(count5 == 2 && count7 == 1) {
			System.out.println("YES");
		} else {
			System.out.println("NO");			
		}
	}
}


Measured memory_bytes: 21844
//This is getting accepted!
// I HATE BUG
// God Of The Bugs
// 12/11/2016
#include<bits/stdc++.h>

using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FI first
#define SE second
#define pb push_back
#define mp make_pair
#define ll long long
#define sz(a) ((int)(a).size())
#define __builtin_popcount __builtin_popcounll
#define ld long double

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, pii> ppi;

const double PI = acos(0) * 2;
const double EPS = 1e-8;
const ll MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
const int oo = 1e9;
const double foo = 1e30;

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcounll(s);}
template<class T> T sqr(T x) { return x * x; }

inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}

int n;
int a[MAXN], vs[MAXN];;

int main() {
//#ifndef ONLINE_JUDGE
//    freopen("inp.txt", "r", stdin);
////    freopen("out.txt", "w", stdout);
//#endif

	cin >> n;
	for (int i=0; i<n; i++) cin >> a[i];
	
	vs[0] = 1;
	for (int i=0; i<n; i++) {
		for (int j=10000; j>=0; j--) {
			if (vs[j] && j + a[i] <= 10000) vs[j + a[i]] = 1;
		}
	}

	for (int j=10000; j>=0; j--) {
		if (vs[j] && j % 10) {
			cout << j;
			return 0;
		}
	}
	
	cout << 0;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pi = pair<int, int>;
const int MAXN = 200005;
int pos[MAXN];

int main(){
	int h, w, n; scanf("%d %d %d",&h,&w,&n);
	for(int i=1; i<=h; i++) pos[i] = w + 1;
	for(int i=0; i<n; i++){
		int x, y; scanf("%d %d",&x,&y);
		pos[x] = min(pos[x], y);
	}
	int rng = 1;
	for(int i=2; i<=h; i++){
		if(pos[i] <= rng){
			cout << i - 1 << endl;
			return 0;
		}
		if(pos[i] > rng + 1) rng++;
	}
	cout << h << endl;
}


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

#define ll long long
using namespace std;
const int N = 3e5 + 5;

int32_t main() {
    string s;
    cin >> s;
    int n = s.size();
    string a, b;
    for(int i = 0 ; i < (n - 1) / 2 ; i++)
        a += s[i];
    for(int i = (n + 3) / 2 - 1 ; i < n ; i++)
        b += s[i];
    string ss = s, aa = a, bb = b;
    reverse(ss.begin(), ss.end());
    reverse(aa.begin(), aa.end());
    reverse(bb.begin(), bb.end());
    if (ss == s && aa == a && bb == b) cout << "Yes";
    else cout << "No";
    return 0;
}

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

int main()
{
    map<int,bool> mp1;
    map<int,bool> mp2;

    int ans=0;

    for(int i=0;i<=100;i++){
        mp1[i]=false;
        mp2[i]=false;
    }

    int a,b,c,d;
    cin >> a>>b>>c>>d;

    for(int i=a;i<=b;i++){
        mp1[i] =true;
    }
    for(int i=c;i<=d;i++){
        mp2[i] =true;
    }

    for(int i=0;i<=100;i++){
        if(mp1[i] && mp2[i]){
            ans++;
        }
    }
    if(ans!=0) cout << ans-1 << endl;
    else       cout << 0 << endl;
}

Measured memory_bytes: 3656
from heapq import*
n,k=map(int,input().split())
*v,=map(int,input().split())
motimono=[]
ans=[]
v*=2
for j in range(1,min(n,k)+1):
    for i in range(n-j,n+1):
        motimono=v[i:i+j]
        ans.append(sum(motimono))
        heapify(motimono)
        for i in range(k-j):
            if len(motimono)>0:
                heappop(motimono)
            ans.append(sum(motimono))
print(max(ans))

Measured memory_bytes: 5356
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>

#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define vsort(v) sort(v.begin(),v.end())
#define asort(a,n) sort(a, a + n)
#define vi vector<int>
#define vd vector<double>

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    int N;
    int ans;
    int cnt;
    vi vec(100);
    while(true){
        vec.assign(100, -1);
        ans = 0;
        cnt = 0;
        cin >> N;
        if(N == 0) return 0;
        rep(i, N){
            cin >> vec[i];
        }
        vsort(vec);
        REP(i, 101 - N, 99){
            ans += vec[i];
            cnt++;
        }
        cout << (int)(ans / cnt) << endl;
    }


    return 0;
}

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


const long long MOD = 1000000007;

long long arr[100005];

long long fast(long long a,long long b)
{
	long long ans = 1;
	while(b!=0)
	{
		if(b%2==1) ans = (ans*a)%MOD;
		a=(a*a)%MOD;
		b/=2;
	}
	return ans;
}

int main()
{
	long long n,m;
	cin>>n>>m;
	long long xx = 0;
	long long yy = 0;
	for(int a=1;a<=n;a++)
	{
		cin>>arr[a];
		if(a!=1)
		{
			xx = (xx + (arr[a] - arr[a-1])*(a-1)*(n-a+1) )%MOD;
		}
	}
	for(int a=1;a<=m;a++)
	{
		cin>>arr[a];
		if(a!=1)
		{
			yy = (yy + (arr[a] - arr[a-1])*(a-1)*(m-a + 1) )%MOD;
		}
	}
	cout<<(xx*yy)%MOD<<endl;

}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main() {
  int n; cin >> n;
  int a = 0; int d = 0;
  for(int i= 1; i <= n; i++){
    a = i * 1.08;
    if(a == n){
      cout << i << endl;
      d = 1 ;
      break;
    }
  }
  if(d != 1)
    cout << ":(" << endl;
}

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

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

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


Measured memory_bytes: 3104
import java.util.*;

import java.lang.*;

import java.math.*;



public class Main {

	Scanner sc = new Scanner(System.in);

	



	boolean rec(int[] unused){

		int sum = 0;

		boolean is2 = false;

//		System.out.println(Arrays.toString(unused));

		for(int i=1;i<10;i++){

			sum+=unused[i];

			is2 |= (unused[i]==2);

		}

		if(sum==2){

//			System.out.println();

			return is2;

		}

		

		for(int i=1;i<10;i++){

			if(unused[i]>2){

				unused[i] -= 3;

				if(rec(unused)){

					unused[i] += 3;

					return true;

				}

				unused[i] += 3;

			}

		}

		for(int i=1;i<=7;i++){

			if(unused[i]*unused[i+1]*unused[i+2] > 0){

				unused[i] -= 1;

				unused[i+1] -= 1;

				unused[i+2] -= 1;

				if(rec(unused)){

					unused[i] += 1;

					unused[i+1] += 1;

					unused[i+2] += 1;

					return true;

				}

				unused[i] += 1;

				unused[i+1] += 1;

				unused[i+2] += 1;

			}

		}

		return false;

	}

	boolean check(int[] used){

		for(int i=1;i<10;i++){

			if(used[i] > 4)

				return false;

		}

		return rec(used);

	}

	

	void run(){

		for(;sc.hasNextLine();){

			String buffer = sc.nextLine();

			int[] used = new int[10];

			for(int i= 0; i < 13;i++){

				used[buffer.charAt(i)-'0']++;

			}

			String ret = "";

			for(int i = 1;i<10;i++){

				used[i]++;

//				System.out.println(i);

				ret += check(used)?i+" ":"";

				used[i]--;

			}

			ret = ret.trim();

			if(ret.length() < 1){

				System.out.println("0");

			}else{

				System.out.println(ret);	

			}			

		}

	}

	public static void main(String[] args){

		Main m = new Main();

		m.run();

		

	}

}

Measured memory_bytes: 12000
from sys import stdin
N=list(map(int,stdin.readline().strip().split()))[0]
eki=[list(map(int,input().split())) for _ in range(N-1)]

for i in range(len(eki)):
    x = eki[i][1]+eki[i][0]
    for j in range(i+1,len(eki)):
        if eki[j][1] >x:
            x=eki[j][1]
            x += eki[j][0]
        elif x%eki[j][2]==0:x+=eki[j][0]
        else:
            x+=eki[j][0]+eki[j][2]-x%eki[j][2]
    print(x)
print(0)

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


int main() {
    string s;
    cin >> s;
    string cnt;
    for (int i=0;i<s.size(); i++) {
       cnt+="x";
	}
  cout << cnt << endl;
}

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

#define repo(i,n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int main(){
    int N,M;
    cin >> N >> M;

    int g = 0;

    if(N > 1){
        g = N*(N-1)/2;
    }else{
        g = 0;
    }

    int k = 0;

    if(M > 1){
        k = M*(M-1)/2;
    }else{
        k = 0;
    }
    cout << g+k << endl;
    return 0;
}



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

int main() {
	int a, b;
	cin >> a >> b;
	if (a + b == 15) {
		puts("+");
	}
	else if (a * b == 15) {
		puts("*");
	}
	else {
		puts("x");
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <queue>
#include <iomanip>

using namespace std;
string A;

int main() {
  cin >> A;
  long N = A.size();
  long C[26] = {};
  for (int i=0; i<N; i++) {
    C[A.at(i) - 'a']++;
  }
  long ans = N*(N-1)/2 + 1;
  for (int i=0; i<26; i++) {
    if (C[i] >= 2) {
      ans -= C[i] * (C[i] - 1) / 2;
    }
  }
  cout << ans << endl;
}


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

int main() {
  int n;
  cin>>n;
  if(n%4==0)cout<<"Yes"<<endl;
  else if(n>=7&&n%4==3)cout<<"Yes"<<endl;
  else if(n>=14&&n%4==2)cout<<"Yes"<<endl;
  else if(n>=21&&n%4==1)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}



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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)              \
  cerr << #v ":[ ";          \
  for (auto macro_vi : v) {  \
    cerr << macro_vi << " "; \
  }                          \
  cerr << "]" << endl;
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
  int n, h;
  cin >> n >> h;
  vector<pair<lint, lint>> a(n);
  rep(i, n) { cin >> a[i].first >> a[i].second; }
  sort(all(a));
  reverse(all(a));
  // debug
  // for (int i = 0; i < a.size(); i++) {
  //   cout << a[i].first << " " << a[i].second << endl;
  // }
  // debug
  int s = a[0].first;
  vector<lint> sub(0);
  for (int i = 0; i < a.size(); i++) {
    if (s <= a[i].second) {
      sub.push_back(a[i].second);
    } else {
      continue;
    }
  }
  sort(all(sub));
  reverse(all(sub));

  lint times = 0;
  for (auto x : sub) {
    h -= x;
    times++;
    if (h <= 0) {
      h = 0;
      break;
    }
  }
  times += (h + s - 1) / s;
  cout << times << endl;
  return 0;
}

Measured memory_bytes: 2936
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    short a, b;

    cin >> a;
    cin >> b;

    long A = 0, B = 0;

    // aをb回並べる
    for(int i=0; i<b; i++){
        A += pow(10, i)*a;
    }

    // bをa回並べる
    for(int i=0; i<a; i++){
        B += pow(10, i)*b;
    }

    if(A >= B){
        cout << A << endl;
    }else{
        cout << B << endl;
    }

    return 0;
}

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

int main(){
    int m,h;
    string str;
    while(1){
        cin >> str;
        if(str[0] == '-') break;
        cin >> m;
        for(int i = 0; i < m; ++i){
            cin >> h;
            string right = str.substr(0, h);
            string left = str.substr(h, str.length() - h);
            str = left + right;
        }
        cout << str << endl;
    }
    return 0;
}

Measured memory_bytes: 3160
#include <iostream>

using namespace std;

int main(void)
{
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for (int i = 1; i <= n; i++)
    {
        cout << a[n - i];
        if (n - i != 0)
            cout << " ";
    }
    cout << endl;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const int INF=1e9;
int main(){
	int N;cin>>N;
	int sum=0;int res=0;int d;
	rep(i,0,N){
		cin>>d;
		res-=d*d;
		sum+=d;
	}cout<<(res+sum*sum)/2<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n,q,i,j,a,b,S=0;
	cin>>n;
	vector<ll>arr(n);
	unordered_map<ll,ll>mp;
	for(i=0;i<n;i++) 
	{
		cin>>arr[i];
		S += arr[i];
		mp[arr[i]]++;
	}
	cin>>q;
	while(q--)
	{
		cin>>a>>b;
		ll sub_1=mp[a]*a;
		ll sub_2=mp[b]*b;
		S -= sub_1;
		S -= sub_2;
		mp[b] += mp[a];
		mp[a]=0;
		S += mp[b]*b;
		cout<<S<<'\n';
	}
	return 0;
}

Measured memory_bytes: 7872
N, K = map(int, input().split())
X = list(map(int, input().split()))

pos = []
neg = []
for x in X:
  if x >= 0:
    pos.append(x)
  else:
    neg.append(-x)

plen = len(pos)
nlen = len(neg)
pos = [0] + sorted(pos)
neg = [0] + sorted(neg)
ans = float('inf')
for p in range(min(K + 1, plen + 1)): # pos方向にいくつ進むか
  if p + nlen < K:
    continue
  pcost = pos[p]
  ncost = neg[K - p]
  if pcost * ncost == 0:
    ans = ans if ans < pcost + ncost else pcost + ncost
  else:
    t1 = pcost * 2 + ncost
    t2 = ncost * 2 + pcost
    ans = ans if ans < t1 else t1
    ans = ans if ans < t2 else t2

print(ans)

Measured memory_bytes: 14480
/**
 * author:  virenkathiriya96
 * created: 2020.09.13 21:01:48 
**/

#include<bits/stdc++.h>

using namespace std;

#define int long long

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  bool x;
  cin >> x;
  x = !x;
  cout << x;
  return 0;
}

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

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

  if (k == 0) {
    cout<<n*n<<endl;
    return 0;
  }
  long long ans = 0;
  for (int b=k+1; b<=n; b++) {
    int c = n % b;
    if (c >= k) {
      ans += (n - c) / b * (c - k + 1) + ((n - c) / b - 1) * (b - 1 - c) + b - k;
    } else {
      ans += (n - k) / b * (b - k) + b - k;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
K, N = map(int, input().split())
a = list(map(int, input().split()))

a.sort()
a.append(a[0])

max_d = max([min(abs(a[i+1]-a[i]), K-a[i]+a[i+1]) for i in range(len(a)-1)])
result = K-max_d

print(result)


Measured memory_bytes: 32308
def main():
    h, n = map(int, input().split())
    arr = [list(map(int, input().split())) for _ in range(n)]
    dp = [[float("inf")]*(2*10**4+1) for _ in range(n+1)]
    dp[0][0] = 0
    for i in range(n):
        p, a, b = i+1, arr[i][0], arr[i][1]
        for j in range(2*10**4+1):
            if j < a:
                dp[p][j] = dp[p-1][j]
            else:
                if dp[p][j-a] + b < dp[p-1][j]:
                    dp[p][j] = dp[p][j-a] + b
                else:
                    dp[p][j] = dp[p-1][j]
    print(min(dp[-1][h:2*10**4+1]))

if __name__ == "__main__":
    main()


Measured memory_bytes: 331052
n = int(input())
a = list(map(int, input().split()))
money = 1000
stock = 0

if a[0] <= a[1]:
    stock = money // a[0]
    money -= stock * a[0]

for i in range(1, n-1):
    if a[i] <= a[i-1] and a[i] <= a[i+1] and stock == 0:
        stock = money // a[i]
        money -= stock * a[i]
    if a[i] >= a[i-1] and a[i] >= a[i+1] and stock != 0:
        money += stock * a[i]
        stock = 0
if stock > 0:
    money += stock * a[-1]
    stock = 0
print(money)

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

using namespace std;

bool vis[100005];
int now[100005];

struct Per {
  int *num,n;
  Per() {}
  Per(int a):n(a) {num=new int[n+1];}
  Per inv() {
  	Per b(n);
  	for(int i=1;i<=n;i++) b.num[num[i]]=i;
  	return b;
  }
  Per operator * (Per b) {
  	Per c(n);
  	for(int i=1;i<=n;i++) c.num[i]=num[b.num[i]];
  	return c;
  }
  Per operator ^ (int k) {
  	Per b(n);
  	for(int i=1;i<=n;i++) vis[i]=0;
  	for(int i=1;i<=n;i++)
  	  if (!vis[i]) {
  	  	  int x=i,cnt=0;
  	  	  do {
  	  	  	now[++cnt]=x;
  	  	  	vis[x]=1;
  	  	  	x=num[x];
		  } while (x!=i);
		  for(int j=1;j<=cnt;j++) b.num[now[j]]=now[(j+k-1)%cnt+1];
		}
	return b;
  }
};

Per fir[7];

int main() {
  int n,k;
  scanf("%d%d",&n,&k);
  fir[1]=Per(n);
  fir[2]=Per(n);
  for(int i=1;i<=n;i++) scanf("%d",&fir[1].num[i]);
  for(int i=1;i<=n;i++) scanf("%d",&fir[2].num[i]);
  for(int i=3;i<=6;i++) fir[i]=fir[i-1]*fir[i-2].inv();
  Per a=fir[2]*fir[1].inv()*fir[2].inv()*fir[1];
  Per ans=(a^((k-1)/6))*fir[(k-1)%6+1]*(a.inv()^((k-1)/6));
  for(int i=1;i<=n;i++) printf("%d ",ans.num[i]);
  printf("\n");
  return 0;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 25, M = 1e6 + 25, oo = 1e9+7, mxmsk = 1 << 16;
const long long OO = 1e18+25;
    
#define f first
#define s second
    
int n,m,l,r,d, dis[N], vis[N], v=1;
vector <pair<int, int>> g[N];
stack <int> st;
bool f;

void dfs(int from)
{
    vis[from] = v;
    for(auto pa : g[from])
    {
        if(vis[pa.f] != v)
        {
            dis[pa.f] = dis[from] + pa.s;
            dfs(pa.f);
        }else if(dis[pa.f] != dis[from] + pa.s)
        {
            f =1;
        }
    }
}

void dfs1(int from)
{
    vis[from] = v;
    for(auto pa: g[from])
    {
        if(vis[pa.f] != v)
        {
            dfs1(pa.f);
        }
    }
}

int main() {
    #   ifdef LOCAL_PROJECT
    freopen("in.txt", "r", stdin);
    #   endif
    cin >> n >> m;
    for(int i=0; i<m; i++)
    {
        cin >> l >> r >> d;
        g[l].push_back({r,d});
    }
    for(int i=1; i<=n ;i++)
    {
        if(vis[i] != v) 
        {
            st.push(i);
            dfs1(i);
        }
    }
    v++;
    while(!st.empty())
    {
        int i = st.top();
        if(vis[i] != v)
        {
            for(auto pa : g[i])
            {
                if(vis[pa.f] == v)
                {
                    dis[i] = dis[pa.f] - pa.s;
                    break;
                }
            }
            dfs(i);
        }
        st.pop();
    }
    if(f) cout << "No";
    else cout << "Yes";
    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int h, n;
    cin >> h >> n;
    int tai = h;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end(),std::greater<int>());
    for(int i = 0; i < n; i++){
        tai -= a[i];
    }
    if(tai > 0){
        cout << "No";
    }else{
        cout << "Yes";
    }
}


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

int lcompr(const void *a,const void *b){
    return *(long*)a == *(long*)b ? 0 : (*(long*)a < *(long*)b ? 1 : -1);
}

int main(void){
    register int i;
    long n;
    scanf("%ld",&n);
    long a[n];
    for(i = 0;i < n;i++)scanf("%ld",&a[i]);
    qsort(a,n,sizeof(long),lcompr);
    unsigned long long ans = 0;
    ans += a[0];
    n -= 2;
    long nid = 1,tmp = 0;
    while(n){
        if(tmp == 2){
            tmp = 0;
            nid++;
        }
        ans += a[nid];
        tmp++;
        n--;
    }
    printf("%llu",ans);
}

Measured memory_bytes: 4660
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


int main(void) {
    
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[0]==a[1]&&a[1]!=a[2])fin("Yes");
    else if(a[2]==a[1]&&a[1]!=a[0])fin("Yes");
    else fin("No");
}


Measured memory_bytes: 256
// デバッグ実行：Ctrl+F5

using System;

class Program
{
    static void Main(string[] args)
    {
        String line;
        line = Console.ReadLine();
        int N = int.Parse(line);
        line = Console.ReadLine();
        String[] words = line.Split(' ');
        int[] a = new int[N];
        double average = 0;
        for(int i = 0; i < N; i++)
        {
            a[i] = int.Parse(words[i]);
            average += a[i];
        }
        average /= (double)N;

        double distance = 101.0;
        int ans = -1;
        for(int i = 0; i < N; i++)
        {
            double j = Math.Abs(a[i] - average);
            if (distance > j)
            {
                distance = j;
                ans = i;
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13268
#080_D
n, c = map(int, input().split())
stc = [list(map(int, input().split())) for _ in range(n)]
stc.sort(key= lambda x: (x[2], x[0]))
imo = [0 for _ in range(10 ** 5 + 2)]

for i in range(n):
    if i < n-1:
        if stc[i][2] == stc[i+1][2] and stc[i][1] == stc[i+1][0]:
            stc[i+1][0] = stc[i][0]
            continue
    
    s, t, c = stc[i]
    imo[s] += 1
    imo[t+1] -= 1

for i in range(10 ** 5 + 1):
    imo[i+1] += imo[i]

print(max(imo))

Measured memory_bytes: 35460
def solve(n: int, values: list) -> int:
    min_cost = 10000 * n
    for target in range(-100, 100 + 1):
        cost = sum([(v - target) ** 2 for v in values])
        if cost < min_cost:
            min_cost = cost
    return min_cost


N = int(input())
values = list(map(int, input().split()))
print(solve(N, values))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    vector<int> v(3);
    cin >> v[0] >> v[1] >> v[2];
    auto it = max_element(v.begin(), v.end());
    int idx = it - v.begin();
    int add = 0;
    for (int i = 0; i < 3; ++i) {
        if (i == idx) continue;
        add += v[i];
    }

    if (add == v[idx]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef vector<int> V;
typedef pair<int,int> P;
typedef vector<vector<int>> Graph;


int main() {
    int n;
    cin >> n;
    V ans(10000000,0);
    for(int i=1;i<100;i++){
        for(int j=1;j<100;j++){
            for(int k=1;k<100;k++){
                ans[i*i+k*k+j*j+i*j+i*k+j*k-1]++;
            }
        }
    }
    rep(i,n){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 42260
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define int long long

signed main(){
    // cout << fixed << setprecision(10) << flush;

    int t;
    cin >> t;
    for(int i=0; i<t; i++){
        int n, m, a, b;
        cin >> n >> m >> a >> b;
        cout << floor_sum(n, m, a, b) << endl;
    }

    return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define int long long
int c[10000000];
signed main(){
  int a,b;
  cin>>a>>b;
  for(int i=1;i<1000;i++){
    c[i]=i+c[i-1];
    if(c[i]-c[i-1]==b-a){
      cout<<c[i-1]-a<<"\n";
      break;
    }
  }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int[] is = new int[s.length()];
        for(int i=0; i<s.length(); i++){
            is[i] = (int)(s.charAt(i)) - (int)('0');
        }
        int min = Integer.MAX_VALUE;
        for(int i=0; i<s.length()-2; i++){
            int tmp = is[i]*100 + is[i+1]*10 + is[i+2];
            min = Math.min(Math.abs(tmp - 753), min);
        }

        System.out.println(min);
    }
}

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

int n, m;
int field[51][51];

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

void dfs(int y, int x){
    field[y][x] = 0;
    rep(i,8){
        int ny = y + dy[i];
        int nx = x + dx[i];
        if(ny < 0 || n < ny || nx < 0 || m < nx) continue;
        if(field[ny][nx] == 0) continue;
        dfs(ny, nx);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(1){
        cin >> m >> n;
        if(m == 0 && n == 0) break;
        rep(i,n)rep(j,m) cin >> field[i][j];
        int ans = 0;
        rep(i,n)rep(j,m){
            if(field[i][j] == 0) continue;
            dfs(i, j);
            ans++;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3220
#include <iostream>

using namespace std;

int main(){
    string S;
    long long K;
    cin >> S;
    cin >> K;
    long long idx = -1;
    for(int i = 0; i < S.size(); i++){
        if(S[i] != '1') {
            idx = i+1;
            break;
        }
    }
    if(idx == -1 || idx > K){
        cout << 1 << endl;
    }else{
        cout << S[idx-1] << endl;
    }
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  rep(d, 1000) {
    int x = d / 100;
    int y = (d - x * 100) / 10;
    int z = d % 10;
    vi32 ds = {x, y, z};
    int now = 0;
    rep(i, n) {
      if (ds[now] == s[i] - '0') now++;
      if (now == 3) break;
    }
    if (now == 3) ans++;
  }
  cout << ans << endl;
}


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

int main(){
    int N;
    cin >> N;
    for(int i=1; i<=9; i++) for(int j=1; j<=9; j++) if(i*j == N){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
/*input
141421 35623
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k; cin >> n >> k;
    ll ans = 0;
    vector<ll> pre(n + 1);
    for(int i = 1; i < n + 1; i++) pre[i] = (pre[i - 1] + i) % MOD;
    for(int i = k; i < n + 2; i++)
    {
    	ll spe = (i == n + 1 ? 0 : pre[n - i]);
    	ans = ((((((((ans + pre[n]) % MOD) - spe) + MOD) % MOD) - pre[i - 1]) + MOD) % MOD + 1) % MOD;
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 4784
using System;
using System.Linq;

class Program
    {
        static void Main(string[] args)
        {
            //?????°??????
            int[,] tou = new int[12,10];//??¬????????±
            string[] data;
            int print_count = 0;//???????????????
            int data_num = int.Parse(Console.ReadLine());//?????±??°
            int x = 0,y=0;// tou???x??§?¨?y??§?¨?
            int[] room = new int[4];

            //??\?±????????????????
            for(int count = 0; count < data_num; count++)
            {
                data = Console.ReadLine().Split();
                //??\?????????
                foreach(var item in data.Select((v, i) => new { Value = v, Index = i }))
                {                  
                    room[item.Index] = int.Parse(item.Value);
                }
                //??§?¨???????
                x = ((room[0] - 1) *3)-1+room[1];                
                y = room[2] - 1;

                //??\?±??????????
                tou[x,y] += room[3];
                if (tou[x, y] < 0)
                {
                    tou[x, y] = 0;
                }
            }


            //????????????
            for(x=0;x<12; x++)
            {
                for(y = 0; y < 10; y++)
                {
                    Console.Write(" {0}",tou[x,y]);
                }
                Console.WriteLine();
                print_count++;
                if (print_count % 3 == 0&&print_count<12)
                {
                    Console.WriteLine("####################");
                }
            }
        }
    }

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

#define all(x) (x).begin(), (x).end()
#define make_unique(vec) sort(all(vec)); vec.resize(unique(all(vec)) - vec.begin());
#define dbg(x) cerr<<#x<<" = "<<x<<endl

using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

bool tests = false;

void solve(){
    int n, m; cin >> n >> m;
    vvi g(n+1);
    for (int i=0; i<m; i++){
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    queue<int> qu;
    vi par(n+1, -1);
    vector<bool> vis(n+1, false);
    qu.push(1);
    vis[1] = true;
    while (!qu.empty()){
        int v = qu.front(); qu.pop();
        for (int s : g[v]){
            if (!vis[s]){
                vis[s] = true;
                qu.push(s);
                par[s] = v;
            }
        }
    }
    bool ok = true;
    for (int i=1; i<=n; i++){
        if (vis[i] == false){
            ok = false;
            break;
        }
    }
    if (!ok){
        cout << "No" << endl;
        return;
    }cout << "Yes" << endl;
    for (int i=2; i<= n; i++){
        cout << par[i] << endl;
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    if (tests){
        cin >> t;
    }
    while (t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 10260
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int main(){
	string S;
	cin>>S;
	cout<<2018;
	REP(i,S.size()){
		if(i<4)continue;
		cout<<S[i];
	}
	cout<<endl;
	return(0);
}

Measured memory_bytes: 256
a,b,c,d,e,f = map(int,input().split())
x=[]
for i in range(int(f/100+0.9)):
    for j in range(int(f/100+0.9)):
        if (100*a*i+100*b*j)<= f:
            x.append(100*a*i+100*b*j)
y=[]
for i in range(int(f/c+0.9)):
    for j in range(int(f/d+0.9)):
        if (c*i+d*j)<= f:
            y.append(c*i+d*j)
p=e/(100+e)
maxp=0
mj=0
mi=0
for i in x:
    for j in y:
        if((i+j<=f) and (i+j)>0 and (j/(i+j)<=p)):
            if(j/(i+j)>=maxp):
                mj=j
                mi=i
                maxp=j/(i+j)
print(str(mj+mi)+" "+str(mj))

Measured memory_bytes: 14548
import java.util.Scanner;

public class Main {
	public static void main(String[] args)  {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		String a = sc.nextLine();
		String[] str = new String[H];
		for(int i = 0; i < H; i ++) {
			str[i] = sc.nextLine();
		}
		for(int i = 0; i < H; i ++) {
			System.out.println(str[i]);
			System.out.println(str[i]);
		}
		}
}

Measured memory_bytes: 24020
#include <bits/stdc++.h>
using namespace std;
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define sz(x)             (int)((x).size())
#define int               long long
#define M                 1000000007
#define MM                998244353
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount

template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}
template<typename T1,typename T2>std::istream& operator>>(std::istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>std::ostream& operator<<(std::ostream& out,pair<T1,T2> &a){out<<a.fr<<" "<<a.sc;return out;}

const int N=2e5 + 5;
int p[N];
double e[N];
void solve(){
	int n,k;
	cin>>n>>k;
	rep(i,0,n)cin>>p[i];
	int sum=0;
	rep(i,1,1500){
		sum+=i;
		e[i]=1.0*sum/i;
	}
	double ans=0,t=0;
	rep(i,0,k){
		t+=e[p[i]];
	}
	ans=t;
	rep(i,k,n){
		t+=e[p[i]];
		t-=e[p[i-k]];
		amax(ans,t);
	}
	cout<<ans;
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cout<<setprecision(9);
	cout<<fixed;
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SEIVE
		seive();
	#endif
	#ifdef NCR
		init();
	#endif
	#ifdef DSU
		cleardsu(MAXDSUSIZE);
	#endif
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main()
{
	int R, G, B, N;
	cin >> R >> G >> B >> N;
	int count = 0;
	for (int r = 0; r <= N; r++) {
		for (int g = 0; g <= N; g++) {
			int v = R * r + G * g;
			if (N >= v && (N - v) % B == 0) {
				count++;
			}
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include<cstdio>
int a[200005], n, now, r;
long long ans;
int main()
{
	scanf("%d", &n);
	for(int i=1;i<=n;++i) {
		scanf("%d", &a[i]);
	}
	for(int i = 1; i <= n; ++i) {
		now &= ~a[i-1];
		while(r <= n && (a[++r] & now) == 0) now |= a[r];
		--r;
		ans += r-i+1;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int main() {
  string s;
  cin >> s;
  int a = stoi(s.substr(0, 2));
  int b = stoi(s.substr(2, 2));
  if ((1 <= a && a <= 12) && (1 <= b && b <= 12)) cout << "AMBIGUOUS" << endl;
  else if (1 <= a && a <= 12) cout << "MMYY" << endl;
  else if (1 <= b && b <= 12) cout << "YYMM" << endl;
  else cout << "NA" << endl;
  return 0;
}

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

void cal(int x, int y, int z, string &t, vector<int> &vec){
  int result=t.at(0)-'0';
  bool flag=false;
  
  if(x>=2 || y>=2 || z>=2) kill;
  else if(flag) kill;
  else{
  
  if(x==1) result+=t.at(1)-'0';
  else result-=t.at(1)-'0';
  if(y==1) result+=t.at(2)-'0';
  else result-=t.at(2)-'0';
  if(z==1) result+=t.at(3)-'0';
  else result-=t.at(3)-'0';
  
  if(result==7){
    flag=true;
    vec.at(0)=x;
    vec.at(1)=y;
    vec.at(2)=z;
    return;
  }
  else{
    cal(x+1, y, z, t, vec);
    cal(x, y+1, z, t, vec);
    cal(x, y, z+1, t, vec);
  }
    
  }
}


int main(){
  string s;
  cin >> s;
  vector<int> vec(3,0);
  
  bool flag=false;
  cal(0, 0, 0, s, vec);
  
  for(int i=0; i<3; i++){
    cout << s.at(i);
    if(vec.at(i)==1) cout << '+';
    else cout << '-';
  }
  cout << s.at(3) << "=7";
}

Measured memory_bytes: 256