akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <fstream>
#include <iterator>

#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v){
    if(!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &p) {
    out << "[" << p.first << ", " << p.second << "]";
    return out;
}
//---------


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //CLion Standard Input
    //--------------------------------------------------------------------------
//    ifstream in("/Users/ryo/Dropbox/competition/CompetitiveProgramming/in.txt");
//    cin.rdbuf(in.rdbuf());
    //--------------------------------------------------------------------------

    string s;
    cin >> s;

    int left = 0;
    while(s[left] != 'A'){
        left++;
    }

    int right = s.size();
    while(s[right] != 'Z'){
        right--;
    }


    cout << right - left + 1 << endl;

}

Measured memory_bytes: 720
#include <array>
#include <iostream>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

long long N;
const array<char, 3> letters = {'7', '5', '3'};

long long solvereq(const string& s) {
    if (!s.empty()) {
        if (stoll(s) > N)
            return 0;
    }

    bool flg = true;
    for (const char& c: letters) {
        flg &= s.find(c) != string::npos;
    }

    long long res = flg ? 1 : 0;
    for (const char& c: letters) {
        res += solvereq(s + c);
    }

    return res;
}

void solvestk(const array<char, 3>& letters) {
    stack<string> stk;
    vector<string> res;

    stk.push("");

    while (!stk.empty()) {
        string s = stk.top();
        if ((long long)s.length() == N) {
            res.push_back(s);
            stk.pop();
        } else {
            stk.pop();
            for (const char& c: letters) {
                stk.push(s + c);
            }
        }
    }

    std::for_each(res.crbegin(), res.crend(), [](const string& s) {
        cout << s << endl;
    });
}

int main() {
    cin >> N;
    cout << solvereq("") << endl;
    //cout << endl;

    //solvestk(letters);

    return 0;
}


Measured memory_bytes: 256
a,b,m = map(int,input().split())
As = list(map(int,input().split()))
Bs = list(map(int,input().split()))
amin = min(As)
bmin = min(Bs)

xycs = []
comb = []
for i in range(m):
    x, y, c = map(int, input().split())
    comb.append(As[x-1] + Bs[y-1] - c)

print(min(amin+bmin, min(comb)))




Measured memory_bytes: 71356
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	int b=n/2;
	if(n%2!=0)
		cout<<b*(b+1)<<endl;
	else
		cout<<b*b<<endl;
	return 0;
}

Measured memory_bytes: 256
<?php
    $N = intval(trim(fgets(STDIN)));
    
    $H = array_map('intval',explode(" ",trim(fgets(STDIN))));
    $count=0;
    for($i=1;$i<$N;$i++){
        $stand = $H[$i];
        for($j=0;$j<$i;$j++){
            if($stand < $H[$j]){
                $count++;
                break;
            }
            
        }
    }
    echo $N-$count;
?>

Measured memory_bytes: 16144
/* 実行時間1s制限の場合
  10^6 1,000,000   : 余裕をもって間に合う
  10^7 10,000,000  : おそらく間に合う
  10^8 100,000,000 : 非常にシンプルな処理でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}          // Least Commont Multiple オーバーフローしないように先に割る

const ll INF = LONG_MAX;
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; }

int main()
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    std::ifstream in("b.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    string s;
    cin >> s;

    int i = 1;
    bool ans = true;
    for (char& c :s)
    {
        if (i%2)
        {
            if (!(c=='R' || c=='U' || c=='D'))
            {
                ans = false;
            }
        }
        else
        {
            if (!(c=='L' || c=='U' || c=='D'))
            {
                ans = false;
            }
        }
        i++;
    }

    if(ans) cout << "Yes";
    else cout << "No";

    return 0;
}

/*
  - 1e9 : 10^9
  - vector
    vector<int> A(N);
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - string
    - loop
      for (char& c : s) {}
 */



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int a[51];
    rep(i, N) cin >> a[i];
    int ans = 0;
    while(true) {
        int idx = 0;
        rep(i, N) {
            if(a[idx] < a[i]) {
                idx = i;
            }
        }
        if (a[idx] < N) break;
        int cnt = a[idx] / N;
        a[idx] -= N * cnt + cnt;
        rep(i, N) {
            a[i] += cnt;
        }
        // rep(i, N) cout << a[i] <<  " ";
        // cout << endl;
        ans += cnt;
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
/*
 * ARC085_C.cpp
 *
 *  Created on: May 31, 2018
 *      Author: 13743
 */
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;

#define pb push_back
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end()
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

lng power(lng b, lng e) {lng sol=1; while(e>0) {if(e&1) {sol=sol*b;} e>>=1; b*= b;} return sol;}



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

	int N, M;
	cin >> N >> M;

	int tm = 1900*M + 100*(N-M);

	cout << tm*power(2, M) << endl;
}






Measured memory_bytes: 256
n = int(input())
l = list(input())

def che(k):
    if l[k] == "o":
        if ans[k] == 1:
            if ans[k-1]*ans[(k+1)%n] == 1:
                return True
            else:
                return False
        else:
            if ans[k-1]*ans[(k+1)%n] == -1:
                return True
            else:
                return False

    else:
        if ans[k] == 1:
            if ans[k-1]*ans[(k+1)%n] == -1:
                return True
            else:
                return False
        else:
            if ans[k-1]*ans[(k+1)%n] == 1:
                return True
            else:
                return False


check = [[1,1],[1,-1],[-1,1],[-1,-1]]
for j,k in check:
    ans = [0]*n
    ans[0] = j
    ans[1] = k
    
    for i in range(1,n):
        if ans[i] == 1:
            if l[i] == "o":
                ans[(i+1)%n] = ans[i-1]
            else:
                ans[(i+1)%n] = -ans[i-1]

        else:
            if l[i] == "o":
                ans[(i+1)%n] = -ans[i-1]
            else:
                ans[(i+1)%n] = ans[i-1]
    d = True
    
    for m in range(n):
        if che(m) == False:
            d = False
            
    if d:
        for i in ans:
            if i == 1:
                print("S",end="")
            else:
                print("W",end="")
        exit()  
            
print(-1)

Measured memory_bytes: 6788
#include <iostream>
#include <cstdio>
#include <string>
#include <queue>
#include <algorithm>

using namespace std;

int n, ans;
string s, t;
queue<int> q;

int main()
{
    cin >> n >> s >> t;

    if (s == t)
    {
        puts("0");
        return 0;
    }

    int up = n - 1, down = n - 1;

    while (down >= 0)
    {
        while (down && t[down - 1] == t[down]) --down;
        while (up >= 0 && (up > down || s[up] != t[down])) --up;
        if (up < 0)
        {
            puts("-1");
            return 0;
        }
        while (!q.empty() && q.front() - q.size() >= down) q.pop();
        if (up != down) q.push(up);
        ans = max(ans, (int)q.size());
        --down;
    }

    cout << ans + 1;

    return 0;
}

Measured memory_bytes: 6280
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<queue>
#include<set>
#include<map>

using namespace std;

#define ll long long
#define inf  1e15+7
#define MAXN 110
#define exp 1e-4

ll gcd(ll a,ll b)
{
    return b?gcd(b,a%b):a;
}

int main()
{
    ll a,b;
    while(scanf("%lld%lld",&a,&b)!=EOF)
    {
        ll d=gcd(a,b);
        ll l=a*b/d;
        printf("%lld %lld\n",d,l);
    }
    return 0;
}

Measured memory_bytes: 2572
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
ld squareRoot(int number, int precision) 
{ 
    int start = 0, end = number; 
    int mid; 
  
    ld ans; 
  
    while (start <= end) { 
        mid = (start + end) / 2; 
        if (mid * mid == number) { 
            ans = mid; 
            break; 
        } 
  
        if (mid * mid < number) { 
            start = mid + 1; 
            ans = mid; 
        } 
  
        else { 
            end = mid - 1; 
        } 
    } 
  
    ld increment = 0.1; 
    for (int i = 0; i < precision; i++) { 
        while (ans * ans <= number) { 
            ans += increment; 
        } 
  
        ans = ans - increment; 
        increment = increment / 10; 
    } 
    return ans; 
} 
int main()
{
 ios_base::sync_with_stdio(0);
 cin.tie(0);
 cout.tie(0);
 int t=1;
 //cin>>t;
 while(t--) {
  
  int arr[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
   cin>>k;
   cout<<arr[k-1];
  }
}

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

int main() {
    int N;
    string S;
    cin >> N >> S;
    
    int counter = 1;
    for (int i=0; i<N-1; i++) {
        if (S.at(i)==S.at(i+1)) continue;
        else counter++;
    }
    cout << counter << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   long long int n,k;
   int count=1;
   cin>>n;
   k=7;
   long long int sum=7;
   if(n%2==0||n%5==0){
   	cout<<"-1\n";
   	return 0;
   }
   while(sum%n!=0){
   	  sum=sum+((k%n)*(10%n))%n;
   	  k=((k%n)*(10%n));
   	  count++;
   }
   cout<<count<<"\n";
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main()
{

    long long n,i,s=1;
    cin>>n;
    i=floor(log2(n));
    i++;
    while(i--)
    {
        s*=2;
    }
    s--;
    cout<<s<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;
 
int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   string s,t;
   cin >> s >> t;
   vector<int> pos[26];
   f(i,0,s.length()){
      pos[s[i]-'a'].pb(i);
   }
   int prv = -1;
   int ans = 0;
   f(i,0,t.length()){
      if(pos[t[i]-'a'].empty()){
         cout << "-1\n";
         return 0;
      }
      auto k = upper_bound(all(pos[t[i]-'a']),prv);
      if(k==pos[t[i]-'a'].end()){
         ans++;
         prv = pos[t[i]-'a'][0];
      }else{
         prv = *k;
      }
   }
   // cout << ans << '\n' ;
   int res = ans*(int)s.length() + prv+1;
   cout << res << '\n';
   return 0;
}


Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll n;
vl a;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	a=vl(n);
	for(int i=0;i<n;i++) cin>>a[i];
	ll res=0;
	vi b(n,1),c;
	for(int i=1;i<n;i++){
		ll tmp=0;
		b[0]=b[n-1]=0;
		for(int j=1;;j++){
			int I=j*i,J=n-I-1;
			if(I>=n||J<0||!b[I]||!b[J]||i>=J||I==J) break;
			tmp+=a[I]+a[J];
			b[I]=b[J]=0;
			c.push_back(I);
			c.push_back(J);
			res=max(res,tmp);
		}
		for(auto j:c) b[j]++;
		c.clear();
	}
	cout<<res<<endl;
}

Measured memory_bytes: 2044
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		int c = parseInt(sc.next());
		sc.close();
		int ans = b + Math.min(c,a+b+1);
		out.println(ans);
	}
}


Measured memory_bytes: 20948
#include<stdio.h>


int main(){
	
	int N;
	int R;
	scanf("%d %d",&N,&R);
	int x;
	x = 10 - N;
	int inner;
	inner = 100 * x;
	
	if(N>100 || N<1 || R<0 || R>4111){
		printf("eror");
	}
	else if(N<10){
		printf("%d",inner + R);
	}
	else if(N>=10){
		printf("%d",R);
	}
	
	
	
	
	return 0;
}

Measured memory_bytes: 1676
while gets
  x1,y1,x2,y2,xq,yq=$_.split(",").map(&:to_f)
  a=y2-y1
  b=x1-x2
  c=y1*x2-x1*y2
  k=2*(a*xq+b*yq+c)/(a**2+b**2)
  xr=(xq-a*k).round(6)
  yr=(yq-b*k).round(6)
  puts "#{xr} #{yr}"
end

Measured memory_bytes: 8728
n = int(input())
b = list(map(int, input().split()))
ans = []
for i in range(n-1, -1, -1):
    for j in range(i, -1, -1):
        if b[j]-1 == j:
            ans.append(b[j])
            b = b[:j]+b[j+1:]
            break
        if j == 0:
            print(-1)
            exit()
for i in range(n-1, -1, -1):
    print(ans[i])



Measured memory_bytes: 3064
func main() {
    var abc = readLine()!.split(separator: " ").map{Int($0)!}
    var k = Int(readLine()!)!
    while abc[1] <= abc[0] {
        abc[1] *= 2
        k -= 1
    }
    while abc[2] <= abc[1] {
        abc[2] *= 2
        k -= 1
    }
    print(k>=0 ? "Yes" : "No")
}

main()

Measured memory_bytes: 8316
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
H, W = list(map(int, input().split()))
A = [input() + '.' for _ in range(H)]
A.append('.' * (W + 1))

cnt = 0
for i in range(H):
    for j in range(W):
        if A[i][j] == '#':
            cnt += 1
if cnt == H + W - 1:
    print("Possible")
else:
    print("Impossible")

# cur = (0, 0)
# while True:
#     x, y = cur
#     if x == W - 1 and y == H - 1:
#         print("Possible")
#         break
#     nx1, ny1 = x + 1, y
#     nx2, ny2 = x, y + 1
#     if A[ny1][nx1] == '#' and A[ny2][nx2] == '#':
#         print("Impossible")
#         break
#     if A[ny1][nx1] == '#':
#         cur = (nx1, ny1)
#     elif A[ny2][nx2] == '#':
#         cur = (nx2, ny2)
#     else:
#         print("Impossible")
#         break




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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    string s; cin >> s;
    set<int> st[26];
    for (int i = 0; i < 26; i++) {
        st[i].emplace(n+2);
    }
    for (int i = 0; i < n; i++) {
        st[s[i]-'a'].emplace(i);
    }
    int q; cin >> q;
    for (int qi = 0; qi < q; qi++) {
        int t; cin >> t;
        if (t == 1) {
            int i; char c; cin >> i >> c;
            i--;
            st[s[i]-'a'].erase(i);
            s[i] = c;
            st[c-'a'].emplace(i);
        } else {
            int l, r; cin >> l >> r; l--;
            int cnt = 0;
            for (int i = 0; i < 26; i++) {
                int x = *st[i].lower_bound(l);
                if (x < r) cnt++;
            }
            cout << cnt << "\n";
        }
    }
    return 0;
}

Measured memory_bytes: 24348
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	int N; cin >> N;
	ll A[200010];
	ll sum1 = 0, sum2 = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		sum2 += A[i];
	}
	ll ans = INF;
	for (int i = 0; i < N; i++) {
		sum1 += A[i];
		sum2 -= A[i];
		//cout << sum1 << " " << sum2 << endl;
		ans = min(ans, abs(sum1 - sum2));
	}
	cout << ans << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <cmath>
#include <algorithm>
#include <map>
#include <list>

using namespace std;

#define FOR( i, k, n ) for ( int i = ( k ); i < ( int )( n ); ++i )
#define REP( i, n ) FOR( i, 0, n )

typedef long long ll;
typedef pair< int, int > P;

#define MAX_W 100
#define MAX_H 100
#define MAX_N 500

bool Init( void );

int N, W, H, S, T;
int X[ MAX_N ], Y[ MAX_N ];
int Count[ MAX_W + 1 ][ MAX_H + 1 ];

int main()
{
	while( Init() ) {
		REP( i, N ) {
			int x = X[ i ], y = Y[ i ];
			REP( dx, S ) REP( dy, T ) {
				int xx = x - dx, yy = y - dy;
				if( xx < 0 || yy < 0 ) continue;
				++Count[ xx ][ yy ];
			}
		}
		int ans = 0;
		REP( x, W ) REP( y, H ) ans = max( ans, Count[ x ][ y ] );
		cout << ans << endl;
	}
	return 0;
}

bool Init() {
	// init
	REP( i, MAX_W + 1 ) REP( j, MAX_H + 1 ) Count[ i ][ j ] = 0;
	// input
	cin >> N;
	if( !N ) return false;
	cin >> W >> H;
	REP( i, N ) {
		int x, y;
		cin >> x >> y;
		X[ i ] = x - 1;  Y[ i ] = y - 1;
	}
	cin >> S >> T;
	return true;
}

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

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

  int ans = 0;
  for (int i=0; i<N-1; i++){
    for (int j=i+1; j<N; j++){
      if (S[i] == S[j]){
        if (i != 0){
          if (S[i-1] == S[j-1]) continue;
        }
        int equal = 1;
        int end = min(j-i, N-j);
        for (int k=1; k<end; k++){
          if (S[i+k] == S[j+k]) equal++;
          else break;
        }
        ans = max(ans, equal);
      }
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<math.h>
#include <iostream>
using namespace std;

void Factorization(int v){
	int k = 2;
	while ( k <= (int)sqrt((double) v)){
		if (v % k == 0){
			v = v / k;
			cout<<" "<<k;
			k = 2;
		}
		else
			k++;
	}
	cout<<" "<<v;
}

int main(){
	int n;
	cin>>n;
	cout<<n<<":";
	Factorization(n);
	cout<<endl;
	return 0;
}

Measured memory_bytes: 3092
#include<stdio.h>

int min(long n,long m){
    if(n<m) return n;
    else    return m;
}

int main(){
    long n,a[100],i,j,ans=1000000;
    scanf("%ld",&n);
    for(i=0;i<n;i++)    scanf("%ld",&a[i]);
    for(i=0;i<100;i++){
        long g=0;
        for(j=0;j<n;j++)    g+=(a[j]-i)*(a[j]-i);
        ans=min(ans,g);
    }
    printf("%ld",ans);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

signed main(){
   
    int n;
    cin >> n;

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

    int ans = 0;
    bool watched[100] = {};
    for(int t = 1; t <= 31; ++t){
        int idx = -1, mx = INF;
        for(int i = 0; i < n; ++i){
            if(!watched[i] && t >= a[i] && t <= b[i]){
                if(mx > b[i] - t){
                    mx = b[i] - t;
                    idx = i;
                }
            }
        }
        //cout << idx << endl;
        if(idx != -1){
            watched[idx] = true;
            ans += 100;
        }else{
            for(int i = 0; i < n; ++i){
                if(t >= a[i] && t <= b[i]){
                    ans += 50;
                    break;
                }
            }
        }
    }

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



Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    ll N, K; cin >> N >> K;
    vector<int> A(N);
    REP(i, 0, N) cin >> A[i];

    if (K == 0) {
        int ans = 0;
        REP(i, 0, N) ans = max(ans, A[i]);
        cout << ans << endl;
        return 0;
    }

    double ng = 0, ok = 1e9, mid;
    while (ok - ng > 1e-6) {
        mid = ng + (ok - ng) / 2;
        // cout << "# mid : " << mid << endl;
        ll cnt = 0;
        REP(i, 0, N) {
            cnt += (ll)ceil(A[i] / mid) - 1;
        }
        // cout << "--> cnt : " << cnt << endl;

        if (cnt <= K) ok = mid;
        else ng = mid;
    }
    if ((ll)ceil(ok - 1e-6) > 0) cout << (ll)ceil(ok - 1e-6) << endl;
    else cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 3928
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<ll> >;

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MX = 0; //最大値

#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define PB push_back
#define F first
#define S second

int main(){
    string s, s1, s2; ll n, res = 1;
    ll t1; char t2;
    cin >> s >> n;
    vector<ll> A(n);
    
    rep(i, n){
        cin >> A[i];
        if(A[i] == 2){
            cin >> t1 >> t2;
            if(res == 1){
                if(t1 == 1) s1.PB(t2);
                else s2.PB(t2);
            }
            else{
                if(t1 == 1) s2.PB(t2);
                else s1.PB(t2);
            }
        }
        else res *= -1;
    }

    if(res == -1) {
        reverse(ALL(s)); reverse(ALL(s2));
        cout << s2 << s << s1;
    }
    else{
        reverse(ALL(s1));
        cout << s1 << s << s2;
    }
    return 0;
}

Measured memory_bytes: 5364
#!/usr/bin/env python3
R, G, B, N = map(int, input().split())

cnt = 0
for r in range(N // R + 1):
    for g in range((N - r * R) // G + 1):
        b = N - r * R - G * g
        if b >= 0 and b % B == 0:
            cnt += 1
print(cnt)


Measured memory_bytes: 2940
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int X = sc.nextInt();
    if (X >= A && X <= A + B) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    } 
  }
}

Measured memory_bytes: 22740
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef unsigned long long ll;



int main(){
  int N;
  vector<ll> A;

  cin >> N;

  for(int i=0; i < N; i++){
    ll a;
    cin >> a;
    A.push_back(a);
  }

  sort(A.begin(), A.end());
  ll a =A[0];
  ll sum = 0;
  ll cnt = 0;
  for(auto it = A.begin(); it < A.end(); ++it){
    if(a != *it){
      a=*it;
      if(cnt % 2){
        ++sum;
      }
      cnt=1;
    }
    else{
      ++cnt;
    }
  }
  if(cnt % 2)
    ++sum;
  cout << sum << endl;

  return 0;
}



Measured memory_bytes: 1400
N,M = map(int,input().split())
x,y,z = [0] * N,[0] * N,[0] * N
for i in range(N):
    x[i],y[i],z[i] = map(str,input().split())
ans = 0
for i in range(2**3):
    d = ['+','+','+']
    for j in range(3):
        if (i>>j) & 1:
            d[j] = '-'
    val = []
    for j in range(N):
        val.append(eval( d[0]+x[j] + d[1]+y[j] + d[2]+z[j] ))
    val.sort(reverse=True)
    ans = max(ans,sum(val[:M]))
print(ans)

    
    

Measured memory_bytes: 76420
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
    int n,k;
    cin >> n >> k;

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

    int ans=0;
    for(int i=0;i<n;i++){
        if(h[i] >= k) ans++;
    }
    cout << ans;
    return (0);
}

Measured memory_bytes: 640
import java.util.*;
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt(), B = sc.nextInt(), X = sc.nextInt();
		if (X-A>=0 && X-A<=B) System.out.println("YES");
		else System.out.println("NO");
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

}

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

int main()
{
    int a,b,c;
    int maxc,mid,minc;
    cin >> a >> b >> c;
    minc = min({a,b,c});
    maxc = max({a,b,c});
    mid = a + b + c - minc - maxc;
    cout << (maxc - mid) + (mid - minc) << endl;
}

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

const int maxn=200005;
int n,m,x,y,ans,fa[maxn],cnt[maxn];

int findfather(int pos)
{
	if(fa[pos]==-1) return pos;
	int father=findfather(fa[pos]);
	fa[pos]=father;
	return father;
}

int main()
{
	memset(fa,-1,sizeof(fa));
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		cnt[i]=1;
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&x,&y);
		int p1=findfather(x),p2=findfather(y);
		if(p1==p2) continue;
		fa[p1]=p2;
		cnt[p2]+=cnt[p1];
	}
	for(int i=1;i<=n;i++)
		if(fa[i]==-1)
			ans=max(ans,cnt[i]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 5324
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(ll i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=200010;
const ll mod=1e9+7;

vector<int> v[mx];
vector<int> depth(mx,0);

void dfs(int n, int p, int d){
  depth[n] = d;
  for(auto to:v[n]){
    if(to==p) continue;
    dfs(to, n, d+1);
  }
}

int main(){
  int n;
  cin >> n;
  rep(i,n-1){
    int x,y; cin >> x >> y; x--; y--;
    v[x].emplace_back(y);
    v[y].emplace_back(x);
  }
  dfs(0,-1,0);
  int tmp = max_element(depth.begin(),depth.end()) - depth.begin();
  dfs(tmp,-1,0);
  tmp = max_element(depth.begin(),depth.end()) - depth.begin();
  int sz = depth[tmp]+1;
  if(sz%3!=2){
    cout << "First" << ln;
  } else {
    cout << "Second" << ln;
  }
  return 0;
}

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

template<class T> T read() {
	T t;
	cin >> t;
	return t;
}

inline void write() {
}

template<class T> void write(T const& t) {
	cout << t;
}

template<class T, class... Args> void write(T const& t, Args const&... args) {
	cout << t << ' ';
	write(args...);
}

template<class... Args> void writeln(Args const&... args) {
	write(args...);
	cout << '\n';
}

int main() {
	ios_base::sync_with_stdio(false);
	cin .exceptions(ios_base::badbit | ios_base::failbit);
	cout.exceptions(ios_base::badbit | ios_base::failbit);
	cin .tie(nullptr);
	cout.tie(nullptr);
	cout.precision(16);
	void run();
	run();
	return 0;
}

void run() {
	auto const N = read<sint>();
	auto const S = read<string>();

	vector<vector<sint>> maxLens(N + 1, vector<sint>(N + 1, 0));
	for (sint i = N - 1; i >= 0; --i) {
		for (sint j = N - 1; j >= 0; --j) {
			if (S[i] == S[j]) {
				maxLens[i][j] = min(maxLens[i + 1][j + 1] + 1, max(j - i, sint(0)));
			}
		}
	}
	sint maxLen = 0;
	for (sint i = N - 1; i >= 0; --i) {
		for (sint j = N - 1; j >= 0; --j) {
			maxLen = max(maxLen, maxLens[i][j]);
		}
	}
	writeln(maxLen);
}

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

template <class T>
inline void read(T &res)
{
	res = 0; bool bo = 0; char c;
	while (((c = getchar()) < '0' || c > '9') && c != '-');
	if (c == '-') bo = 1; else res = c - 48;
	while ((c = getchar()) >= '0' && c <= '9')
		res = (res << 3) + (res << 1) + (c - 48);
	if (bo) res = ~res + 1;
}

template <class T>
inline T Min(const T &a, const T &b) {return a < b ? a : b;}

typedef long long ll;

const int N = 1e5 + 5;

int n, X, b[N], u[N], v[N], p[N];
ll ans = 1e18, f[N], I, sum[N];

inline bool comp(int x, int y) {return f[x] > f[y];}

int main()
{
	read(n); read(X);
	for (int i = 1; i <= n; i++) read(b[i]), read(u[i]), read(v[i]), p[i] = i,
		I += 1ll * b[i] * u[i], f[i] = 1ll * b[i] * u[i] + 1ll * (X - b[i]) * v[i];
	std::sort(p + 1, p + n + 1, comp);
	for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + f[p[i]];
	for (int i = 1; i <= n; i++)
	{
		int l = 0, r = n;
		while (l <= r)
		{
			int mid = l + r >> 1;
			if (sum[mid] + f[p[i]] * (mid < i) >= I) r = mid - 1;
			else l = mid + 1; 
		}
		int cnt = l - (l > i); ll rst = I - (sum[l] - f[p[i]] * (l > i));
		l = 0; r = X;
		while (l <= r)
		{
			int mid = l + r >> 1;
			if ((mid <= b[p[i]] ? 1ll * mid * u[p[i]] : 1ll * b[p[i]] * u[p[i]]
				+ 1ll * (mid - b[p[i]]) * v[p[i]]) >= rst) r = mid - 1;
			else l = mid + 1;
		}
		ans = Min(ans, 1ll * cnt * X + l);
	}
	return std::cout << ans << std::endl, 0;
}

Measured memory_bytes: 6720
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int ans[10001];

int f(int x, int y, int z) {
   int d = x*x + y*y + z*z + x*y + y*z + z*x;
   return d;
}

int main(){
    int n; cin >> n;
    for(int x = 1; x < 101; x++){
        for(int y = 1; y < 101; y++){
            for(int z = 1; z < 101; z++){
                if(f(x,y,z) < 10001 ) ans[f(x,y,z)-1]++;
            }
        }
    }
    rep(i,n) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 3656
def main():
    import sys
    input = sys.stdin.readline

    N, x = map(int, input().split())
    S = list(map(int, input().split()))
    S.sort(reverse=True)
    mod = 1000000007

    ans = [0] * (10**5+1)
    ans[x] = 1
    for i, s in enumerate(S):
        for j in range(10**5+1):
            aj = ans[j]
            ans[j%s] = (ans[j%s] + aj)%mod
            ans[j] = (ans[j] + aj * (N-i-2))%mod
    ret = 0
    for k, a in enumerate(ans):
        ret = (ret + (a*k)%mod)%mod
    print(ret)



if __name__ == '__main__':
    main()


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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long a, b, n;
    cin >> a >> b >> n;
    if (b > n) {
        cout << floor(a * n/b);
    } else {
        cout << floor(a * (b - 1)/ b);
    }
    return 0;
}


Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
//const ll mod=1000000007;
const int mod=1e9+7;
int main(){
	int h,w;
	cin>>h>>w;
	vector <vector <char> > arr(h,vector <char> (w,'a'));
	vector <vector <long long > > dp(h,vector <long long> (w,0));
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>arr[i][j];
		}
	}
	dp[0][0]=1;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(i==0 && j==0)
				continue;
			if(arr[i][j]=='.'){
				//dp[i][j]=(dp[max(0,i-1)][j]+dp[i][max(0,j-1)])%mod;
				dp[i][j]+=(i>0)?dp[i-1][j]:0;
				dp[i][j]%=mod;
				dp[i][j]+=(j>0)?dp[i][j-1]:0;
				dp[i][j]%=mod;
			}
		}
	}/*
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cout<<dp[i][j]<<" ";
		}
		cout<<endl;
	}*/
	cout<<dp[h-1][w-1]%mod<<endl;

}

Measured memory_bytes: 9088
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define PB push_back
#define MP make_pair
#define all(x) x.begin(),x.end()



int main(){
	int N;
	cin >> N;
	string S;
	cin >> S;
	int r=0;
	int b=0;
	for(int i=0; i<S.size(); i++){
		if(S[i] == 'R') r++;
		else b++;
	}
	if(r > b) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}



Measured memory_bytes: 256
function Main(input){
  input = input.split(" ");
  
  var k = parseInt(input[0],10);
  var x = parseInt(input[1],10);
  
  if(k * 500 >= x){
    console.log("Yes");
  }
  else{
    console.log("No");
  }
}

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


Measured memory_bytes: 7372
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> P;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[100000],dp[100][100];

int main(){
  cin >> s >> t;
  s += t;
  rep(i,0,s.sz){
    n += (s[i]-'0')*pow(10,s.sz-i-1);
  }
  m = 0;
  rep(i,1,n/2){
    if(n == pow(i,2))m++;
  }
  if(m != 0)puts("Yes");
  else puts("No");
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>
#include <random>

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
typedef long long int ll;
const ll INF = 10000000000;
const double PI = acos(-1);
const ll mod = 1000000007;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<int>> to(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    for (auto i : to[0]) {
        for (auto j : to[i]) {
            if (j == n - 1) {
                cout << "POSSIBLE" << endl;
                return 0;
            }
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}


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

//Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

//Type Definitions:
typedef long long ll;
typedef unsigned long long ull;

//Constants:
const int INF = 2e9;
const int MOD = 1e9 + 7;

//Global Variables:

//Prototype Declarations:
int gcd(int, int);

//================ Main Loop ================
int main() {
    int n;
    string s;
    int ans = 0;
    cin >> n >> s;
    rep(i, n) {
        if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') ans++;
    }
    cout << ans << endl;
    return 0;
}
//===========================================

//Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

Measured memory_bytes: 256
import bisect
# 三角形の条件: c < a+b 

N = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0
# a と b を固定
for a in range(N):
  for b in range((a+1), N):
    # c の動ける範囲の右端を求める
    c = L[a]+L[b]
    k = bisect.bisect_left(L, c)
    # c の動ける範囲は、[j+1, k)
    ans += k - b - 1
print(ans)    

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
const int N=100000+5;
int sum[N];
int main(){
	for(int i=1;i<=N;i++)
	   sum[i]=sum[i-1]+i;
	int x,l=1,r=N;
	cin>>x;
	int pos;
	while(l<=r){
		int mid=(l+r)/2;
		if(sum[mid]<x) l=mid+1;
		else {
			pos=mid;r=mid-1;
		}
	}
	//pos=lower_bound(sum+1,sum+N,x)-sum;
	cout<<pos;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007
//S.size()
//配列名.Length()
using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<bool> VB;
typedef unsigned long long ll;


int main(void){
	string S;cin>>S;
	int cnt = 0;
	for(char i = 'a'; i <= 'z'; i ++){
		cnt = 0;
		for(int t = 0; t < S.size(); t++){
			if(S[t] == i)cnt++;
		}
		if(i == 'z' && cnt != 0){
			cout<<"None";
			break;
		}
		if(cnt == 0){
			cout<<i;
			break;
		}
	}
}


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

int main() {
    int n,m;cin>>n>>m;
    int a[n+1]{};
    int b,c;
    for (int i=0;i<m;i++) {
        cin>>b>>c;
        if (b==1)
            a[c]++;
        else if (c==n)
            a[b]++;
    }
    for (int i=1;i<=n;i++)
        if (a[i]==2) {
            puts("POSSIBLE");
            return 0;
        }
    puts("IMPOSSIBLE");
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pb push_back
#define pf push_front
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";
#define INF 10000000000000000 //1e16
 
// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
 
 
// using namespace __gnu_pbds;
using namespace std;
 
using ll  = long long;
using vi  = vector<int>;
using pii = pair<int,int>;
using vii = vector<pii>;
using mi  = multiset<int>;
using mii = multiset<pii>;
 
int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}

int ans(int n)
{
    if(n==1) return 1;
    return 2*ans(n/2)+1;
}

void solve()
{
    int n,m,t,i,k,r,l,u,v,w,j,s,sum=0,flag=0,count=0;
    string S,T,U; 
    // int a,b,x,y,z,c;
    cin>>n;
    cout<<ans(n);
}

 

signed main()
{
    #ifndef ONLINE_JUDGE 
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        if(t)cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3616
#include <stdio.h>

int main(void)
{
	int W; int H; int x; int y; int r;
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

	if (r <= x && x <= W - r && r <= y && y <= H -r) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}

	return 0;
}

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

int main(void) {
	long N;
	cin >> N;
	string s="";
	if (N==0) s = "0";
	while(N!=0) {
		if (N%2) {
			s = "1"+s;
			N--;
		} else {
			s = "0"+s;
		}
		N /= -2;
	}
	cout << s << endl;
	return 0;
}

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

#define SIZE 300005
#define MOD 1000000007LL
#define INF INT_MAX / 3
#define LLINF 1LL << 60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define FORALL(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef valarray<int> Array;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cout<<a[i];if(i==a.size()-1)cout<<endl;else cout<<" ";}}
int gcd(int a,int b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
int lcm(int a,int b){return a==0||b==0?0:a*b/gcd(a,b);}

int a[10];

bool dfs(int l,int r, int num)
{
  if(num == 10) return true;
  bool ans = false;
  if(a[num] > l) ans = dfs(a[num],r,num+1);
  else if(a[num] > r) ans = dfs(l,a[num],num+1);
  return ans;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  REP(v,n)
  {
    REP(i,10) cin >> a[i];
    cout << (dfs(0,0,0)?"YES":"NO") << "\n";
  }
  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod

char c;
int h, w;
vector<string> g(105);
vector<string> ans;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> h  >> w;
    rep(i, h) cin >> g[i];
    rep(i, h) {
      ans.push_back(g[i]);
      ans.push_back(g[i]);
    }
    rep(i, 2 * h) cout << ans[i] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

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

	for(int i = 0; i < S.size(); i++) {
		S[i] = (char)((int)S[i] + N);
		if(S[i] > 'Z') S[i] = (char)((int)S[i] - 26);
	}
	cout << S << "\n";
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()

using namespace std;

int main(){

    int n,m,x,y;
    cin >> n >> m >> x >> y;

    vector<int> X,Y;

    rep(i,n){
        int tmp;
        cin >> tmp;
        X.pback(tmp);
    }

    X.pback(x);

    rep(i,m){
        int tmp;
        cin >> tmp;
        Y.pback(tmp);
    }

    Y.pback(y);

    sort(ALL(X));
    sort(ALL(Y));

    cout << (X[n] < Y[0] ? "No War" : "War") << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma comment (linker, "/STACK:256000000")
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 2000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144*2
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long a = 0;a < b;++a)
#define ALL(x) (x).begin(),(x).end()
void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}
unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
long long inv(long long now) {
    long long b = MAX_MOD - 2LL;
    long long ans = 1;
    while (b != 0) {
        if (b % 2) {
            ans *= now;
            ans %= MAX_MOD;
        }
        now *= now;
        now %= MAX_MOD;
        b /= 2;
    }
    return ans;
}
long long combination(long long a, long long b) {
    long long ans = 1;
    REP(i, b) {
        ans *= (a - i);
        ans %= MAX_MOD;
        ans *= inv(i + 1);
        ans %= MAX_MOD;
    }
    return ans;
}
#define int ll
void solve() {
    long long x, y;
    cin >> x >> y;
    if (x > y) swap(x, y);
    long long cnt = 0;
    while (x > 0 && y > 0&&x != y) {
        x -= 1;
        y -= 2;
        cnt++;
    }
    if ((x != y) || x % 3 != 0) {
        cout << 0 << endl;
        return;
    }
    ll ans = 1;
    cnt += x / 3;
    long long cnt_b = x / 3;
    cout << combination(cnt + cnt_b, cnt_b) << endl;
}
#undef int
int main() {
    init();
    solve();
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

int main(void){
    ll n, m;
    cin >> n >> m;

    ll a[m], b[m];
    ll c[m];

    ll dp[m + 1][int(pow(2, int(n)))];
    rep(i, 0, m + 1){
        rep(j, 0, pow(2, n)){
            if(i == 0 && j == 0){
                dp[i][j] = 0;
            }else{
                dp[i][j] = 1000000000;
            }
        }
    }

    rep(i, 0, m){
        cin >> a[i] >> b[i];
        c[i] = 0;
        rep(j, 0, b[i]){
            ll tmp;
            cin >> tmp;
            tmp--;
            c[i] |= 1LL << tmp;
        }
    }



    rep(i, 0, m){
        rep(j, 0, pow(2, n)){
            if(i == 0){
                dp[i + 1][j] = min(dp[i][j], dp[i + 1][j]);
            }else{
                ll tmp = j | c[i - 1];
                dp[i + 1][j] = min(dp[i][j], dp[i + 1][j]);
                dp[i + 1][tmp] = min(dp[i + 1][tmp], dp[i][j] + a[i - 1]);
            }
        }
    }

    cout << (dp[m][int(pow(2, int(n))) - 1] < 1000000000 ? dp[m][int(pow(2, int(n))) - 1] : -1) << endl;

}


Measured memory_bytes: 32256