akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,x,n;
    cin>>n>>k;
    set<int>s1;
    for(int i=1;i<=k;i++){
        cin>>x;
        s1.insert(x);
    }
    int s[10],r=0;
    while(n!=0){
        int t=n%10;
        s[r++]=t;
        n=n/10;
    }
    reverse(s,s+r);
    int y=0,i;
    //r=s.size();
    for(i=0;i<r;i++){
        //d=s[i]-'0';
        if(!s1.count(s[i]))
            y++;
        else
            break;
    }
    int h=s[0];
    while(1){
        if(!s1.count(h)){
            break;
        }
        else
            h++;
    }
    if(y==r){
        for(int i=0;i<r;i++)
            cout<<s[i];
    }
    else if(h>9){
        for(int i=1;i<10;i++){
            if(!s1.count(i)){
                cout<<i;
                break;
            }
        }
        for(int i=1;i<=r;i++){
            for(int j=0;j<10;j++){
                if(!s1.count(j)){
                    cout<<j;
                    break;
                }
            }
        }
    }
    else{
        //cout<<i;
        for(int j=i;j>=0;j--){
            //d=s[j]-'0';
            //cout<<d<<endl;
            for(int l=s[j]+1;l<10;l++){
                if(!s1.count(l)){
                    for(int i=0;i<j;i++)
                        cout<<s[i];

                    cout<<l;
                    for(int i=j+1;i<r;i++){
                        //int d=s[i]-'0';
                        for(int p=0;p<10;p++){
                            if(!s1.count(p)){
                                cout<<p;
                                break;
                            }
                        }
                    }
                    return 0;
                }
            }
        }
        for(int i=1;i<10;i++){
            if(!s1.count(i)){
                cout<<i;
                break;
            }
        }
        for(int i=1;i<=r;i++){
            for(int j=0;j<10;j++){
                if(!s1.count(j)){
                    cout<<j;
                    break;
                }
            }
        }
    }

}


Measured memory_bytes: 3568
#include<bits/stdc++.h>
//#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long int
#define mkp make_pair
#define maxN 10000007
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,a,b) for(int i=a;i<b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define ump unordered_map<int,int>
#define  vi vector<int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define in cin>>
#define out cout<<
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
void printArray(int arr[],int n)
{
   for(int i=0;i<n;i++)cout<<arr[i]<<' ';
}
void printMp(mp m)
{
  mp ::iterator it;
  for(it=m.begin();it!=m.end();it++)cout<<it->first<<' '<<it->second<<endl;
}
void printUmp(ump m)
{
  ump ::iterator it;
  for(it=m.begin();it!=m.end();it++)cout<<it->first<<' '<<it->second<<endl;
}
void printSt(st s)
{
  st ::iterator it;
  for(it=s.begin();it!=s.end();it++)cout<<*it<<' ';
}
void printMst(mst s)
{
  mst ::iterator it;
  for(it=s.begin();it!=s.end();it++)cout<<*it<<' ';
}
void printVec(vector<int>v)
{
for(int i=0;i<v.size();i++)cout<<v[i]<<' ';
}
void printVec2(vector<int>v[],int n)
{
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<v[i].size();j++)
            cout<<v[i][j]<<' ';
        cout<<endl;
    }
}
 set<pair<int,int>> primeset;
void SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
        for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          primeset.insert(mkp(p,1));
}

int32_t main()
{
fastio;
string s;in s;
if(s=="Sunny")
out "Cloudy";
else if (s=="Cloudy")
out "Rainy";
else
out "Sunny";

return 0;
}


Measured memory_bytes: 256
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right
from heapq import heapify,heappush,heappop
n,m=n1()
A=n1()
h=[-i for i in A]
heapify(h)

for _ in range(m):
    a=heappop(h)
    heappush(h,a/2)

B=[int(-i) for i in h]
print(sum(B))

Measured memory_bytes: 99352
/*************************************************************************
 > File Name: F.cpp
 > Author: codecode
 > Mail: 2466734364@qq.com
 > Created Time: 2020.1.26.20:42
 ************************************************************************/
#include<bits/stdc++.h>
#define int long long
using namespace std;
int const nax=2e5+10;
struct pa{
    int x,h;
    bool operator <(const pa & a) const{
        return x<a.x;
    }
    void read(){
        cin>>x>>h;
    }
}a[nax];
int n,A,d,sum[nax];
int cdiv(int x,int y){
    return (x-1)/y+1;
}
signed main(){
    cin>>n>>d>>A;
    for(int i=1;i<=n;i++)
        a[i].read();
    sort(a+1,a+1+n);
    int ans=0;
    for(int i=1;i<=n;i++){
        sum[i]+=sum[i-1];
        int now=sum[i]+a[i].h;
        if(now<=0)continue;
        ans+=cdiv(now, A);
        int tosub=cdiv(now,A);
        int to=d*2+a[i].x;
        to=min(to,(int)a[n].x);
        int l=i,r=n,mid,ans1=-1;
        while(l<=r){
            mid=l+r>>1;
            if(a[mid].x<=to){
                ans1=mid;
                l=mid+1;
            }
            else r=mid-1;
        }
        sum[i]-=tosub*A;
        sum[ans1+1]+=tosub*A;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;

const ll MOD = 1e9+7;
ll a[500];
ll b[500];

vector<ll> divisor(ll n)
{
	vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
	reverse(ret.begin(),ret.end());
  return (ret);
}

int main()
{
	int n;
	ll k;
	ll ss=0;
	ll ans=0;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		ss+=a[i];
	}
	vector<ll> yaku=divisor(ss);
	for(int j=0;j<yaku.size();j++)
	{
		//cerr<<yaku[j]<<endl;
		fill(b,b+500,0);
		//順番にyaku[j]の倍数にするのにかかる手数を調べる
		for(int i=0;i<n;i++)
		{
			b[i]=(a[i]+yaku[j])%yaku[j];
			if(b[i]!=0)
				b[i]=yaku[j]-b[i];//加算でかかる回数
		}
		//検証する
		sort(b,b+n);
		reverse(b,b+n);
		for(int i=0;i<n+1;i++)
		{
			ll sum=0;
			ll psum=0;
			//マイナスを加える
			for(int k=0;k<i;k++)
			{
				if(b[k]!=0)
					sum+=(b[k]-yaku[j]);
			}
			for(int k=i;k<n;k++)
			{
				sum+=b[k];
				psum+=b[k];
			}
			//cerr<<yaku[j]<<" "<<sum<<" "<<absum<<endl;
			if(sum==0 && psum<=k)
			{
				ans=yaku[j];
				break;
			}
		}
		if(ans>0)
			break;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  int ans=0;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    ans+=min(a*2,abs(a-k)*2);
  }
  cout<<ans<<endl;
  return 0;
}


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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

int main(void){
    int N;
    scanf("%d",&N);

    int* ans;
    NEW(ans,N+1);
    //初期値(1円ずつ引き出し)
    for(int i=0;i<=N;i++) ans[i]=i;

    for(int i=1;i<=N;i*=6){
        for(int k=0;k<=N-i;k++) ans[k+i]=MIN(ans[k+i],ans[k]+1);
    }
    for(int j=1;j<=N;j*=9){
        for(int k=0;k<=N-j;k++) ans[k+j]=MIN(ans[k+j],ans[k]+1);
    }

    printf("%d\n",ans[N]);

    return 0;
}

Measured memory_bytes: 512
n,m,c = list(map(int,input().split()))
b = list(map(int,input().split()))

ans = 0
for i in range(n):
	a = list(map(int,input().split()))
	val = c
	for j in range(m):
		val += a[j]*b[j]
	if val > 0:
		ans += 1

print(ans)

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>
#include <cstdint>
#include <cctype>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vll = vector<vector<ll> >;
using Vs = vector<string>;
using Vb = vector<bool>;
using the = pair<int, int>;
using lthe = pair<ll, ll>;

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; }

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };


int main()
{
	int h, w;
	cin >> h >> w;
	Vs G(h);
	rep(i, h) cin >> G[i];

	Vll dp(h, Vl(w, 0));

	//初期値
	rep(i, w) {
		if (G[0][i] == '#')  break;
		else  dp[0][i] = 1;
	}
	rep(i, h) {
		if (G[i][0] == '#')  break;
		else  dp[i][0] = 1;
	}
	
	//dp
	for (int i = 1; i < h; i++) {
		for (int j = 1; j < w; j++) {
			if (G[i][j] == '#')  continue;
			dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % Mod;
		}
	}
	cout << dp[h - 1][w - 1] << endl;
}


Measured memory_bytes: 9600
using System;

namespace A___Buttons
{
    class Program
    {
        static void Main (string[] args)
        {
            var input = Console.ReadLine ().Split (' ');
            var a = int.Parse (input[0]);
            var b = int.Parse (input[1]);
            var ans = 0;
            ans += Math.Max (a, b);
            ans += Math.Max (Math.Max (a, b) - 1, Math.Min (a, b));
            Console.WriteLine (ans);
        }
    }
}

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

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

  int cnt1 = 99999;

  	for (int i = 0; i < N; i ++ ) {
      bool isExec = true;
      int cnt2 = 0;
      int A;
      cin >> A;
      while (isExec) {
        if (A % 2 == 0) {
          cnt2 ++;
          A /= 2;
        } else {
          // 割り切れなくなったらループを抜ける
          isExec = false;
        }
      }
      // 最小更新
      if (cnt1 > cnt2) {
        cnt1 = cnt2;
      }
  	}
  cout << cnt1 << endl;
}


Measured memory_bytes: 256
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
ans = 0
a = rl()
tmp = 0
for i in a:
  ans += max(0,tmp-i)
  tmp = max(tmp, i)
print(ans)











Measured memory_bytes: 51136
#include<iostream>
#include<string>
#include<string.h>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<cstdlib>
#include<vector>
#include<set>
#include<deque>
#include<queue>
#include<math.h>
#include<chrono>
#include<list>
#include<random>
#include<bitset>
#include<assert.h>
#include<ctime>
#include<cstdio>
#include <unordered_map>
using namespace std;
ifstream fi("input.txt");
ofstream fo("output.txt");
#define fast_input() {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
#define ll long long
#define For(i,n) for (int(i) = 0; (i)<(n); (i)++)
#define For1(i,n) for (int(i) = 1; (i) <= (n); (i)++)
#define Forlr(i,l,r) for (int(i) = (l); (i) <= (r); (i)++)
#define Forrl(i,r,l) for (int(i) = (r); (i) >= (l); (i)--)
#define all(a) a.begin(), a.end() 
#define pb push_back
#define pp pop_back
#define mp make_pair
#define PI 3.14159265
#define putno return cout <<"NO", 0;
#define putyes return cout <<"YES", 0;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef map<int, int> mii;
//const ll MOD = 1e9 + 7;
const int N = 1e5 + 5;
//DSU
/*
int p[ N], r[N];
void init(int n) {
	For(i, n) {
		p[i] = i;
	}
}
int get(int x) {
	if (p[x] != x) {
		p[x] = get(p[x]);
	}
	return p[x];
}
bool uni(int x, int y) {
	x = get(x); y = get(y);
	if (x == y) {
		return false;
	}
	if (r[x] >= r[y]) {
		p[y] = x;
	}
	else {
		p[x] = y;
	}
	if (r[x] == r[y]) {
		r[x]++;
	}
	return true;
}
*/

// So mu
/*
int power(int x, unsigned int y, int p)
{
	int res = 1; // Initialize result

	x = x % p; // Update x if it is more than or
	// equal to p

	while (y > 0)
	{
		// If y is odd, multiply x with result
		if (y & 1)
			res = (res*x) % p;

		// y must be even now
		y = y >> 1; // y = y/2
		x = (x*x) % p;
	}
	return res;
}
*/

// ReadHexa
/*
bitset<16400> b[4101];
void readHexa()
{
	For(i, n)
	{
		string st;
		cin>> st;
		For(j, m/4)
		{
			int x;
			if (st[j] >= 'A' && st[j] <= 'F')
				x = st[j] - 'A' + 10;
			else x = st[j] - '0';
			for (int k = 4; k; --k, x >>= 1)
				b[i][j * 4 + k] = x & 1;
		}
	}
}
*/

// nChoosek
/*
ll nChoosek(ll n, ll k)
{
	if (k > n) return 0;
	if (k * 2 > n) k = n - k;
	if (k == 0) return 1;

	ll result = n;
	for (ll i = 2; i <= k; ++i) {
		result *= (n - i + 1);
		result /= i;
	}
	return result;
}
*/

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/*
MIKUNO - 15/02/1999
*/
int n, m, k, cnt, rs1;
//	priority_queue <ll, vector<ll>, greater<ll> > q;
//ll n, m, q, k, pos, t, cnt, rs1, check;
ll maxx = -1e9, minn = 1e9;
const int maxn = 1005;
const ll MOD = 1e9 + 7;
int rs;
string t = "ACGT";
int main()
{
	fast_input();
	string s;
	cin >> s;
	For(i, s.length())
	{
		int temp = 0;
		For(j, 4)
		{
			if (s[i] == t[j])
			{
				cnt++;
				temp = 1;
				break;
			}
		}
		if (!temp) rs = max(rs, cnt), cnt = 0;
	}
	rs = max(rs, cnt);
	cout << rs;
}

Measured memory_bytes: 256
import sys
import os

n = input()
n = n[-1]

if n == "2" or n == "4" or n == "5" or n == "7" or n == "9":
    print("hon")
elif n == "0" or n == "1" or n == "6" or n == "8":
    print("pon")
elif n == "3":
    print("bon")

sys.exit()


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

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

int main(){
  int N;
  cin>>N;
  int a,b;
  cin>>a;
  for(int i=0;i<N;i++){
    b=a;
    cin>>a;
    a=gcd(a,b);
  }
  cout<<a<<endl;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

printList [a] = print a
printList (a:as) = putStr ( show a ) >> putChar ' ' >> printList as

main = do
	[ r, g, b ] <- readInts
	k <- readInt
	putStrLn $ which "Yes" "No" $ solve r g b <= k

solve r g b
	| g <= r = 1 + solve r ( g * 2 ) b
	| b <= g = 1 + solve r g ( b * 2 )
	| otherwise = 0

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
//const int c=0;
double PI = 4*atan(1);


int triple (ll A[], ll arr_size)
{
    int  c= 0;


    for (int i = 0; i < arr_size - 2; i++)
    {


        for (int j = i + 1; j < arr_size - 1; j++)
        {

            for (int k = j + 1; k < arr_size; k++)
            {

                if (  (A[k] <  A[i] + A[j] )&& (A[i]< A[j] && A[j] < A[k]) )
                    c++;
            }
        }
    }

    return c;
}

int main()
{
    optimize();

    int n;
    cin>> n;

    ll A[n];

    for(int i=0; i<n; i++)
        cin>> A[i];

    sort(A, A+n);

    cout<< triple( A, n);
    nl;


    return 0;
}




Measured memory_bytes: 3584
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <tuple>
#include <numeric>

using namespace std;

typedef long long ll;

int main(void){
    ll n,a,b;
    cin >> n >> a >> b;
    cout << min(n * a,b) << endl;
    return 0;
}


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

using namespace std;

int main() {
	int H, W, K;
	cin >> H >> W >> K;
	vector<vector<char>>S(H, vector<char>(W));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> S[i][j];
		}
	}
	int min = 9999999;
	for (int i = 0; i < (1 << (H - 1)); i++) {
		vector<int>id(H);
		int g = 0;//グループ数
		for (int j = 0; j < H; j ++) {
			id[j] = g;
			if ((i >> j) & 1) {
				g++;
			}
		}
		g++;
		vector<vector<int>>c(g, vector<int>(W, 0));//グループごとの列のホワイトの個数
		for (int j = 0; j < H; j++) {
			for (int k = 0; k < W; k++) {
				if(S[j][k]=='1')c[id[j]][k] += 1;
			}
		}
		int ans = g - 1;
		vector<int>white(g);//各グループが今何個のホワイトを持っているか
		for (int j = 0; j < W; j++) {
			for (int k = 0; k < g; k++) {
				white[k] += c[k][j];
			}
			bool ok = true;
			for (int k = 0; k < g; k++) {
				if (white[k] > K) {
					ok = false;
					break;
				}
			}
			if (!ok) {
				ans++;
				white = vector<int>(g, 0);
				for (int k = 0; k < g; k++)white[k] += c[k][j];
				bool cheack = true;
				for (int k = 0; k < g; k++) {
					if (white[k] > K) {
						cheack = false;
						break;
					}
				}
				if (!cheack) {
					ans = 9999999;
					break;
				}
			}
		}
		if (ans < min)min = ans;
	}
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 384
using System;

public class SimpleCalc{
    public static void Main(){
        // Here your code !
        string[] args = Console.ReadLine().Split(' ');
        int x = int.Parse(args[0]);
        int y = int.Parse(args[1]);
        
        if(x >= 0)
        {
            if(y >= 0)
            {
                if(x <= y)
                {
                    Console.WriteLine(y-x);
                }
                else
                {
                    if(y == 0)
                        Console.WriteLine(x-y+1);
                    else
                        Console.WriteLine(x-y+2);
                }
            }
            else
            {
                Console.WriteLine(Math.Abs(Math.Abs(x) - Math.Abs(y)) + 1);
            }
        }
        else
        {
            if(y < 0)
            {
                if(x <= y)
                {
                    Console.WriteLine(Math.Abs(x) - Math.Abs(y));
                }
                else
                {
                    Console.WriteLine(Math.Abs(y) - Math.Abs(x) + 2);
                }
            }
            else
            {
                if(y == 0)
                    Console.WriteLine(Math.Abs(Math.Abs(x) - Math.Abs(y)));
                else
                    Console.WriteLine(Math.Abs(Math.Abs(x) - Math.Abs(y)) + 1);
            }
            
        }
    }
}


Measured memory_bytes: 2648
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		if (a < b && b < c) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 26096
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;

lint A, B, X;
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> A >> B >> X;
	if (A == 0) {
		cout << B / X + 1 << endl;
	}
	else {
		cout << (B / X) - (A - 1) / X << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
std::string s;
std::vector<int> rem;
int main()
{
    std::cin >> s;
    s = "0" + s;
    int len = s.length();
    if(s[1] == '0' || s[len-1] == '1')
    {
        std::cout << "-1\n";
        return 0;
    }
    for(int i=1;i<=(len+1)/2;i++)
    {
        if(s[i] != s[len-i-1])
        {
            std::cout << "-1\n";
            return 0;
        }
    }
    int pos = 1;
    for(int i=2;i<=len/2;i++)
    {
        if(s[i] == '1')
        {
            while(pos != i)
            {
                std::cout << pos << " " << i << '\n';
                pos++;
            }
        }
    }
    std::cout << pos << " " << pos+1 << '\n';
    pos++;
    for(int i=pos+1;i<len;i++)
    {
        std::cout << pos << " " << i << '\n';
    }
}

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

int main(){
  int X;
  cin>>X;
  switch(X%7){
    case 0:
      cout<<"thu";
      break;
    case 1:
      cout<<"fri";
      break;
    case 2:
      cout<<"sat";
      break;
    case 3:
      cout<<"sun";
      break;
    case 4:
      cout<<"mon";
      break;
    case 5:
      cout<<"tue";
      break;
    case 6:
      cout<<"wed";
      break;
  }
  cout<<endl;
  return 0;
}



Measured memory_bytes: 3128
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        double pi = Math.PI;
        double area = pi * r * r;
        double length = 2 * pi * r;
        System.out.printf("%f %f",area, length);
    }
}


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

using namespace std;

int main(){
  string s; cin >> s;
  int n=s.length();
  int ans=0;
  bool c=false;
  int d=0;
  for(int i=0;i<n;i++){
    if(c){
      if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T'){
        c=true;
        ans++;
        d=max(d,ans);
      }
      else{
        c=false;
      }
    }
    else{
      if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T'){
        c=true;
        ans=1;
        d=max(d,ans);
      }
      else{
        c=false;
      }
    }
  }
  cout << d << endl;
}


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

using namespace std;

// 文字列一つ受け取る場合
// string s;
// 整数(max 2^31-1 or 10^9)一つ受け取る場合
int x;


int main(){
    cin >> x;
    int y = x/500;
    int r = x % 500;
    int z = y*1000 + (r/5)*5;
    cout << z;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

	int n,m,k,ca[201],a[201],b[201],i,j;

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

	scanf("%d",&m);

	for(i=0;i<m;i++){
		scanf("%d",&k);
		if(k==0){
			for(j=0;j<2*n;j++){
				a[j]=ca[j];
			}
			for(j=0;j<2*n;j++){
				if(j%2==0){
					ca[j]=a[j/2];
				}
				else if(j%2!=0){
					ca[j]=a[(j-1)/2+n];
				}
			}
		}
		else{
			for(j=0;j<k;j++){
				a[j]=ca[j];
			}
			for(j=0;j<n*2-k;j++){
				b[j]=ca[j+k];
			}
			for(j=0;j<n*2-k;j++){
				ca[j]=b[j];
			}
			for(j=n*2-k;j<2*n;j++){
				ca[j]=a[j-n*2+k];
			}
		}
	}

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

	return 0;
}

Measured memory_bytes: 604
S = [input() for _ in range(3)]
i = [0, 0, 0]
t = 0
while len(S[t]) > i[t]:
    tmp = t
    if S[t][i[t]] == "a":
        t = 0
    elif S[t][i[t]] == "b":
        t = 1
    elif S[t][i[t]] == "c":
        t = 2
    i[tmp] += 1
print("A" if t == 0 else "B" if t == 1 else "C")


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c<'0' || c>'9'));
	if(c=='-') c=getchar(),f=-1;
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	ll f=1;
	while((c=getchar())!='-' && (c<'0' || c>'9'));
	if(c=='-') c=getchar(),f=-1;
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int maxn=1e5+10;
int main(){
	int n=read(),ans=0;
	REP(i,1,n){
		int x=read(),y=read();
		while(x%y!=0){
			int r=(x/y)*y;
			x-=(x/y+1)*max((x-r)/(x/y+1),1);
			if(x<y) break;
		}
		ans^=x/y;
	}
	if(ans) printf("Takahashi\n");
	else printf("Aoki\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <functional>

#define MAX 300005
typedef long long ll;

using namespace std;

int main(){
	int N, x;
	vector<int> A(MAX);
	vector<ll> sum1(MAX), sum2(MAX);
	priority_queue<int, vector<int>, greater<int> > Q1;
	priority_queue<int> Q2;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> x;
		Q1.push(x);
		sum1[0] += x;
	}
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> x;
		Q2.push(x);
		sum2[N] += x;
	}
	
	for (int i = 0; i < N; i++) {
		Q1.push(A[i]);
		sum1[i+1] = sum1[i] + A[i] - Q1.top();
		Q1.pop();
		Q2.push(A[N-i-1]);
		sum2[N-i-1] = sum2[N-i] + A[N-i-1] - Q2.top();
		Q2.pop();
	}
	ll maxv = sum1[0] - sum2[0];

	for (int i = 1; i <= N; i++) {
		maxv = max(maxv, sum1[i] - sum2[i]);
	}
	cout << maxv << endl;

	return 0;
}


Measured memory_bytes: 7288
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define mp make_pair
#define maxn 100005
using namespace std;
const int inf = 0x3f3f3f3f;
const int neginf = 0xc0c0c0c0;
typedef long long ll;
typedef pair<int,int> P;
int n;
char s[maxn];
bool havsiz[maxn];
vector <int> adj[maxn];
int main(){
	scanf("%s",s + 1);
	n = strlen(s + 1);
	if(s[n] == '1'){
		puts("-1");
		return 0;
	}
	for(int i=1;i<n / 2;i++){
		if(s[i] != s[n - i]){
			puts("-1");
			return 0;
		}
	}
	if(s[1] == '0'){
		puts("-1");
		return 0;
	}
	for(int i=n / 2 + 1;i<=n;i++) s[i] = '0';
	int he = 1;
	for(int i=1;i<n;i++){
		if(s[i] == '0'){
			adj[he].push_back(i + 1);
		}else{
			adj[i + 1].push_back(he);
			he = i + 1;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=0;j<(int)adj[i].size();j++){
			printf("%d %d\n",i,adj[i][j]);
		}
	}
	return 0;
}


Measured memory_bytes: 5756
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define db(x) cout<<#x<<"="<<x<<endl
#define deb(x) each(x.begin(),x.end(),(int& y){cout << y <<" ";})
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define j1 j1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;


void Main(){

  int N,Q; cin>>N>>Q;

  ll ans[Q];

  rep(i,Q){
    ans[i]=-1;
  }

  vector<tuple<ll,ll,ll>> tp;
  map<ll,ll> mp;

  rep(i,N){
    ll s,t,x; cin>>s>>t>>x;
    tp.emplace_back(x,x-t,x-s);
  }
  rep(i,Q){
    ll d; cin>>d;
    mp.emplace(-d,i);
  }

  SORT(tp);

  rep(i,N){
    auto minitr = mp.upper_bound(get<1>(tp[i]));
    auto maxitr = mp.upper_bound(get<2>(tp[i]));

    for(auto itr=minitr; itr!=maxitr; ++itr){
      /*
      db(i);
      db(itr->second);
      db(get<0>(tp[i]));
      db(itr->first);
      */
      ans[itr->second]=get<0>(tp[i]);
    }

    mp.erase(minitr,maxitr);
    //db(mp.size());
  }

  rep(i,Q){
    cout<< ans[i]<<"\n";
  }
}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 21996
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <map>
using namespace std;

int main(){
  int n;
  cin >> n;
  map<long,int> mp;
  int j = 1;
  int cnt[n+1] = {};
  long a[n] = {};
  for(int i = 0; i < n; i++){
    cin >> a[i];
    if(mp[a[i]]==0){
      mp[a[i]] = j;
      j++;
    }
    cnt[mp[a[i]]]++;
  }
  long ans = 0;
  for(int i = 0; i < n; i++){
    if(cnt[mp[a[i]]]>=a[i]){
      ans += cnt[mp[a[i]]]-a[i];
      cnt[mp[a[i]]] = a[i];
    }else{
      ans += cnt[mp[a[i]]];
      cnt[mp[a[i]]] = a[i];
    }
  }
  cout << ans << endl;
}


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

int main() {
  int N, K;
  string S;
  cin >> N >> S >> K;
  char moji = S.at(K - 1);
  
  for (int i = 0; i < N; i++) {
    if (moji != S.at(i)) {
      S.at(i) = '*';
    }
  }
  cout << S;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>
#define rep(i,a,b) for(int i = a; i <= b; i++)
using namespace std;
const int N = 200010;
struct uf{ 
	int fa[N];
	int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
	void init() { rep(i,1,N - 10) fa[i] = i; }
}f, g;
map<pair<int,int>, int> cnt;
#define mp(a,b) make_pair(a,b)
int main() {
	f.init(); g.init();
	int n; scanf("%d",&n);
	int k, L; cin >>k>>L;
	rep(i,1,k) {
		int a, b; scanf("%d%d",&a,&b);
		a = f.find(a), b = f.find(b);
		if (a != b) f.fa[a] = b;
	}
	rep(i,1,L) {
		int a, b; scanf("%d%d",&a,&b);
		a = g.find(a), b = g.find(b);
		if (a != b) g.fa[a] = b;
	}
	rep(i,1,n) cnt[mp(f.find(i), g.find(i))]++;
	rep(i,1,n) cout <<cnt[mp(f.find(i), g.find(i))]<<' '; cout <<endl;
}

Measured memory_bytes: 13696
//二分答案+线段树优化建图+2_SAT
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 200010
#define top 1000000000
using namespace std;

struct edge{int x, y, next;}a[10000010];
struct bb{int x, y;}b[N];
struct cc{int x, id;}c[N];
struct pos1{int l, r;}pos[N];
struct tt{int l, r;}t[N];
int n, L, R, mid, l, p[N], root[2], flag[N], dfn[N], low[N], ss, cl, d[N], l1, P[N], sum;

inline bool cmp(cc a, cc b){return a.x<b.x;}

inline void add(int x, int y){a[++l1].x=x; a[l1].y=y; a[l1].next=p[x]; p[x]=l1;}

inline void maketree(int L, int R, int temp){
	t[l].l=t[l].r=0;
	if(L<R){
		int mid=(L+R)>>1, l1=l;
		l++; t[l1].l=l; if(!temp)add(l1, l); else add(l, l1);
		maketree(L, mid, temp);
		l++; t[l1].r=l; if(!temp)add(l1, l); else add(l, l1);
		maketree(mid+1, R, temp);
	}else{
		if(!temp){
			int x=c[L].id&1?pos[(c[L].id+1)/2].r:pos[c[L].id/2].l;
			add(l, x);
		}else add(L, l);
	}
}

inline void ins(int i, int a, int b, int x, int temp, int L, int R){
	if(a<=L&&R<=b){if(!temp)add(x, i); else add(i, x); return;}
	int mid=(L+R)>>1;
	if(a<=mid)ins(t[i].l, a, b, x, temp, L, mid);
	if(mid<b)ins(t[i].r, a, b, x, temp, mid+1, R);
}

inline void tarjan(int x){
	dfn[x]=low[x]=++ss;
	flag[x]=1; d[++cl]=x;
	for(int i=p[x]; i; i=a[i].next){
		if(!flag[a[i].y])tarjan(a[i].y);
		if(flag[a[i].y]==1)low[x]=min(low[x], low[a[i].y]);
	}
	if(dfn[x]==low[x]){
		sum++;
		while(d[cl]!=x){flag[d[cl]]=2; P[d[cl]]=sum; cl--;}
		flag[x]=2; P[x]=sum; cl--;
	}
}

inline int check(int mid){
	l1=0; memset(p, 0, sizeof(p)); l=n*2;
	l++; root[0]=l; maketree(1, n*2, 0);
	l++; root[1]=l; maketree(1, n*2, 1);
	int L=1, R=1, x;
	for(int i=1; i<=n*2; i++){
		while(L<i&&c[i].x-c[L].x>=mid)L++;
		while(R<n*2&&c[R+1].x-c[i].x<mid)R++;
		x=c[i].id&1?pos[(c[i].id+1)/2].r:pos[c[i].id/2].l;
		if(L<i){
			ins(root[0], L, i-1, i, 0, 1, n*2);
			ins(root[1], L, i-1, x, 1, 1, n*2);
		}
		if(i<R){
			ins(root[0], i+1, R, i, 0, 1, n*2);
			ins(root[1], i+1, R, x, 1, 1, n*2);
		}
	}
	cl=ss=sum=0; memset(flag, 0, sizeof(flag));
	for(int i=1; i<=l; i++)if(!flag[i])tarjan(i);
	for(int i=1; i<=n; i++)if(P[pos[i].l]==P[pos[i].r])return 0;
	return 1;
}

int main(){
	scanf("%d", &n);
	for(int i=1; i<=n; i++)scanf("%d%d", &b[i].x, &b[i].y);
	for(int i=1; i<=n; i++){
		c[i*2-1].x=b[i].x; c[i*2-1].id=i*2-1;
		c[i*2].x=b[i].y; c[i*2].id=i*2;
	}
	sort(c+1, c+1+n*2, cmp);
	for(int i=1; i<=n*2; i++)
		if(c[i].id&1)pos[(c[i].id+1)/2].l=i; else pos[c[i].id/2].r=i;
	L=0; R=top/(n-1);
	while(L<R){
		mid=(L+R)>>1; if(L==R-1)mid++;
		if(check(mid))L=mid; else R=mid-1;
	}
	printf("%d", L);
	return 0;
}

Measured memory_bytes: 31488
#include <iostream>

using namespace std;

int main(){
  
  int a,b,c,d;
  while(1){

    cin>>a>>b;
    if(a==0 && b==0)break;
    for(c=1;c<=a;c++){
      
      for(d=1;d<=b;d++){
	if((c+d)%2==0){
	
	cout<<"#";
	}
	else cout<<".";
	
      }
      
      cout<<"\n";
      
    }
    cout<<"\n";
  }
  
  
  
  
  return 0;
}

Measured memory_bytes: 1120
N, a = map(int,input().split())
s = 0
t = 0
u = 0

for i in range(N+1):
    for j in range(N+1-i):
        k = N - i - j
        if i * 10000 + j * 5000 + k * 1000 == a:
            s = i
            t = j
            u = k
            break
if s == t == u == 0:
    print("-1" + " " + "-1" + " " + "-1")
else:
    print(str(s) + " " + str(t) + " " + str(u))

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

void solveA(){
  int a,b,c;
  cin >> a >> b >> c;

  if (a==b && b == c){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}
void solveB(){
  int n;
  string s;
  int r=0,b=0;
  cin >> n >> s;

  for(int i = 0; i< n ; i++){
    if(s[i]=='R'){
      r++;
    }
    else{
      b++;
    }
  }

  if (r>b){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
}
int n,q;
string s;
vector<char> t(1000000);
vector<char> d(1000000);

int fun(int k){
  for(int i=0;i<q;i++){
    if (k==-1 || k==n){
      break;
    }
    if(t[i]==s[k]){
      if(d[i]=='L'){
	k--;
      }
      else{
	k++;
      }
    }
  }
  return k;
}

void solveC(){
  cin >> n >> q >> s;

  for(int i=0;i<q;i++){
    cin >> t[i];
    cin >> d[i];
  }

  int left = -1;
  int right = n;
  while(right-left > 1){
    int center = (left+right)/2;
    if(fun(center)==-1){
      left = center;
    }
    else{
      right = center;
    }
  }
  int aleft = right;

  left = -1;
  right = n;
  while(right-left > 1){
    int center = (left+right)/2;
    if(fun(center)==n){
      right = center;
    }
    else{
      left = center;
    }
  }
  int aright = left;

  int ans = aright - aleft + 1;
  cout << ans << endl;
  
}

int main(){
  solveC();
}


Measured memory_bytes: 2564
#include <stdio.h>
int main(void){
  int a, b, c;

  scanf("%d %d %d", &a, &b, &c);

  if(a>=0 && a<=100 && b>=0 && b<=100 && c>=0 && c<=100){
    if(a<b && b<c){
      printf("Yes\n");
    }
    else{
      printf("No\n");
    }
  }
  else{
    return 1;
  }
  return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MAX 2000005
#define MOD 1000000007
#define MOD2 998244353
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define vi vector<ll>
#define vp vector<pii>
#define all(v) v.begin(),v.end()
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
#define trace(x) cerr<<#x<<": "<<x<<'\n';
typedef long long ll;
using namespace std;
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

ll mexp(ll a, ll b){
    ll ans=1;
    a%=MOD;
    while(b){
        if(b&1) ans=ans*a%MOD;
        b>>=1;
        a=a*a%MOD;
    }
    return ans;
}

ll fac[2005],invfac[2005];

ll nCr(int n, int r){
    return (fac[n]*invfac[r]%MOD)*invfac[n-r]%MOD;
}

int main(){
    IOS

    fac[0]=1;
    FOR(i,1,2005){
        fac[i]=fac[i-1]*i%MOD;
    }
    FOR(i,0,2005){
        invfac[i]=mexp(fac[i],MOD-2);
    }
    int n,k;
    cin>>n>>k;
    int red=n-k,blue=k;
    FOR(i,1,k+1){
        if(red+1<i){
            cout<<0<<endl;
        }
        else{
            cout<<nCr(red+1,i)*nCr(blue-1,i-1)%MOD<<endl;
        }
    }

    cerr<<"Time: "<<1.0/CLOCKS_PER_SEC<<" ms"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(A) A.begin(),A.end()
const long long mod=1000000007;
int a,b,c,d,e,f;
int main(){
    cin>>a>>b>>c>>d>>e>>f;
    int ans1,ans2;double maxper=-1;
    for(int i=0;a*i<=f;i++)
    {
        for(int j=0;a*i+b*j<=f;j++)
        {
            for(int k=0;100*(a*i+b*j)+k*c<=f;k++)
            {
                for(int l=0;100*(a*i+b*j)+k*c+l*d<=f;l++)
                {
                    int m=e*(a*i+b*j);
                    int s=k*c+l*d;
                    if(s<=m)
                    {
                        double per=(double)s/(100*(a*i+b*j)+s);
                        if(maxper<per)
                        {
                            maxper=per;
                            ans1=100*(a*i+b*j)+s;ans2=s;
                        }
                    }
                }
            }
        }
    }
    cout<<ans1<<' '<<ans2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    ll n, m; scanf("%lld%lld", &n, &m);
    ll a[100000];
    for (int i = 0; i < n; i++) scanf("%lld", a + i);
    ll sum[100008];
    sum[0] = 0;
    for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i - 1];
    ll rem[100008];
    for (int i = 0; i <= n; i++) rem[i] = sum[i] % m;
    map<ll, ll> rem_cnt;
    rem_cnt[rem[n]] = 1;
    for (int i = n - 1; i >= 0; i--) {
        rem_cnt[rem[i]]++;
    }
    ll ans = 0;
    for (int i = 0; i <= n; i++) {
        if (rem_cnt[rem[i]] >= 2) {
            ans += (rem_cnt[rem[i]] - 1) * rem_cnt[rem[i]] / 2;
            rem_cnt[rem[i]] = 0;
        }
    }
    printf("%lld\n", ans);
}


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

#define IOS cin.tie(0);ios::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template <class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?' ':'\n'); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);}//最小公倍数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//void print(){}

//----------------------library------------------------//

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

const int NMAX = 200;
bool flag;

bool comp(int x,int y){
    return abs(0-x)<abs(0-y);
}

int make_num(char a,char b,char c){
    int num=(a-'0')*100+(b-'0')*10+(c-'0');
    return num;
}

double temp(int t,int h){
    return (double)t-h*0.006;
}

signed main(){
//    IOS;
    CIN(N);
    int cls=N/111;
    if(N%111!=0)cls++;
    printf("%d\n",cls*111);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;



int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    int a, b, c, d; cin >> a >> b >> c >> d;
    cout << ((abs(a-c) <= d || (abs(a-b) <= d && abs(b-c) <= d)) ? "Yes" : "No") << '\n';


    return 0;
}


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

int main() {
    ll H, W;
    cin >> H >> W;
    vector<string> S(H);
    for (ll i = 0; i < H; i++) {
        cin >> S[i];
    }

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

    vector<vector<ll>> ans(H, vector<ll>(W, 0));
    for (ll i = 0; i < H; i++) {
        for (ll j = 0; j < W; j++) {
            for (ll k = 0; k < 8; k++) {
                ll ni = i + dy[k];
                ll nj = j + dx[k];
                if (0 <= ni && ni < H && 0 <= nj && nj < W) {
                    ans[i][j] += S[ni][nj] == '#';
                }
            }
        }
    }

    for (ll i = 0; i < H; i++) {
        for (ll j = 0; j < W; j++) {
            if (S[i][j] == '#') {
                cout << "#";
            } else {
                cout << ans[i][j];
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let n: usize = read!();
    let x: usize = read!();
    let t: usize = read!();

    let mut ans = n / x;
    if n % x != 0 {
        ans += 1;
    }

    println!("{}", ans * t);
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  int count=0;
  int num=1;
  cin>>N;
  vector<int> a(N);
  for(int i=0; i<N; i++){
    cin>>a.at(i);
  }
  for(int i=0; i<N; i++){
    if(a.at(i)==num){
      count++;
      num++;
    }
  }
  if(count==0){
    cout<<"-1"<<endl;
  }else{
    cout<<N-count<<endl;
  }
  return 0;
}

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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 107;

int n;
char s[MAXN];
int K;



void init ();
void input ();
void work ();



int main ()
{
	init ();
	input ();
	work ();
}



void init ()
{
	// Init Everything Here

	ios::sync_with_stdio ( false );
}

void input ()
{
	// input method

	scanf ( "%s%d", s, &K );
}

void work ()
{
	// main work

	int n = strlen ( s );

	char cc = 0;
	int nc = 0;
	char beg = 0;
	int begc = 0;
	LL ans = 0;
	lp ( i, 0, n ) {
		if ( s[i] == cc ) ++nc;
		else {
			if ( i == nc ) {
				ans += nc >> 1;
				beg = cc;
				begc = nc;
			} else {
				ans += SC ( LL, nc >> 1 ) * K;
			}
			cc = s[i];
			nc = 1;
		}
	}

	if ( beg == 0 ) {
		cout << ( ( SC ( LL, n ) * K ) >> 1 ) << endl;
		return;
	}

	ans += nc >> 1;
	if ( beg == cc ) {
		ans += SC ( LL, ( nc + begc ) >> 1 ) * ( K - 1 );
	} else {
		ans += SC ( LL, ( nc >> 1 ) + ( begc >> 1 ) ) * ( K - 1 );
	}
	cout << ans << endl;
}

Measured memory_bytes: 256