akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-19;




signed main() {
    ll x, k, d;
    cin >> x >> k >> d;
    ll r = k % 2;
    x = abs(x);
    ll cnt = min(k, x / d);
    x -= d*cnt;
    if (r+(cnt%2) == 1) {
        mes(abs(x-d));
        re0;
    }
    mes(x);
    
    
}

Measured memory_bytes: 3632
import bisect
n = int(input())
*a, = map(int, input().split())
*b, = map(int, input().split())
*c, = map(int, input().split())

a.sort()
b.sort()
c.sort()

ans = 0
for _b in b:
    ans += bisect.bisect_left(a, _b)*(n - bisect.bisect_right(c, _b))

print(ans)


Measured memory_bytes: 23360
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  int mp[21][21];
  int x,y,n;
  char d;
  int nowx,nowy,ans;
  while(1){
    cin>>N;
    if(N==0) break;
    nowx=10;
    nowy=10;
    ans=0;
    for(int i=0;i<21;i++){
      for(int j=0;j<21;j++){
	mp[i][j]=0;
      }
    }
    for(int i=0;i<N;i++){
      cin>>x>>y;
      mp[x][y]=1;
    }
    /*for(int i=0;i<21;i++){
      for(int j=0;j<21;j++){
	cout<<mp[i][j]<<" ";
      }
      cout<<endl;
      }*/
    cin>>M;
    for(int i=0;i<M;i++){
      cin>>d>>n;
      if(d=='W'){
	for(int j=0;j<n;j++){
	  nowy--;
	  if(mp[nowy][nowx]==1){
	    mp[nowy][nowx]=0;
	    ans++;
	  }
	}
      }
	else if(d=='N'){
	  for(int j=0;j<n;j++){
	    nowx++;
	    if(mp[nowy][nowx]==1){
	      mp[nowy][nowx]=0;
	      ans++;
	    }
	  }
	}
	else if(d=='E'){
	  for(int j=0;j<n;j++){
	    nowy++;
	    if(mp[nowy][nowx]==1){
	      mp[nowy][nowx]=0;
	      ans++;
	    }
	  }
	}
	else if(d=='S'){
	  for(int j=0;j<n;j++){
	    nowx--;
	    if(mp[nowy][nowx]==1){
	      mp[nowy][nowx]=0;
	      ans++;
	    }
	  }
	}
    }
    if(ans==N) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}



Measured memory_bytes: 3084
#define NOMINMAX
#define TEST_MODE true

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a;             \
                                   c > 0 ? i < b : i > b; \
                                   i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long

#ifdef LOCAL_ENV

#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << " "
#define dumpl(x) dump(x) << endl
#else
const bool test = false;
#define dump(x) 
#define dumpl(x)
#endif

#else
const bool test = false;
#define dump(x) 
#define dumpl(x)
#endif

int dx[] = { 1, 0, -1, 0 };
int dy[] = { 0, 1, 0, -1 };
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }

//.....................
const int MAX = (int)2e5 + 5;

vector<string> split(const string &str, char sep)
{
	vector<string> v;
	stringstream ss(str);
	string buffer;
	while (getline(ss, buffer, sep))
	{
		v.push_back(buffer);
	}
	return v;
}

template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
	return accumulate(begin, end, 0ll);
}

template<typename T>
T gcd(T a, T b)
{
	T c;
	while (a != 0) {
		c = a; a = b%a;  b = c;
	}
	return b;
}

template<typename T>
T bit_count(T N) {
	T cnt = 0;
	while (N) {
		if (N & 1) cnt++;
		N >>= 1;
	}
	return cnt;
}

template<typename T>
void print_vec(ostream& ostream, vector<T> a) {
	rep(i, a.size() - 1) ostream << a[i] << " ";
	ostream << a.back() << endl;
}

template<class T>
T pow_n(T x, T n) {
	T res = 1;
	while (n > 0) {
		if (n & 1) res = res * x;
		x = x * x;
		n >>= 1;
	}
	return res;
}

class Solver {
public:
	int H, W;

	bool grid_ok(int y, int x) {
		return 0 <= y && y < H && 0 <= x && x < W;
	}

	int N;

	int ans() {
	}

	vector<bool> can;

	void solve() {
		cin >> N;
		can.resize(N + 1);
		can[0] = true;
		rep(loop, N) rrep(i, N) rep(j, 2) {
			int v = i + (j == 0 ? 4 : 7);
			try {can.at(v) = can[v] or can[i];}
			catch (exception& e) {}
		}
		cout << (can[N] ? "Yes" : "No") << endl;
	}

};

signed main()
{
	srand((unsigned int)time(NULL));
	cout << fixed << setprecision(20);
	auto ptr = new Solver();
	ptr->solve();
	delete ptr;
	//while (true) {
	//	if (cin.eof() == true) break;
	//	auto ptr = new Solver();
	//	ptr->solve();
	//	delete ptr;
	//}
	return 0;
}


Measured memory_bytes: 512
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
#import numpy as np
import bisect
import sys
#import sympy
sys.setrecursionlimit(10**6)


def bfs(s, n, node):
    # 頂点が探索済みかどうかのチェック配列
    check = [False for _ in range(n)]
    check[s] = True
    # 次見る頂点を格納するキュー
    queue = deque([s])
    visited_num = 1

    # 問題固有の配列
    #color_check=[[True for _ in range(l)] for _ in range(n)]
    color = [-1 for _ in range(n)]
    color[s] = 0

    while visited_num < n:
        # グラフが全連結ではない場合
        if len(queue) == 0:
            # 空配列を返す
            # 現状までの計算済み配列を返してもいいと思う
            return color

        now_vertex = queue.popleft()
        # インデックスがない場合は
        for next_vertex in node[now_vertex]:

            if check[next_vertex] == True:
                continue

            queue.append(next_vertex)
            check[next_vertex] = True

            # 問題固有の計算
            color[next_vertex] = color[now_vertex]+1
            visited_num += 1

    return color


mod = 10**9+7
# n=int(input())
# n,m=list(map(int,input().split()))
# a=list(map(int,input().split()))
def ceil(x, y): return (x+y-1)//y
def input_list(): return list(map(int, input().split()))


def buy(buy_cost, sell_cost, money):
    return money % buy_cost+(money//buy_cost)*sell_cost


n, k = input_list()
a = input_list()

for i in range(n-k):
    if a[i] < a[i+k]:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 32116
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max() / 2;
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourd; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<vector<LL>>g;
vector<edge>edges;
//vector<Pll>v;
map<Pll, Pll>ma;
set<LL>st;
double h, w, n, m, k, t, s, p, q, last, cnt, sum, ans, a[210000], b[210000];
string str, ss;
bool f[200][200];
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	sort(a, a + LL(n));
	rep(i, n) {
		if (i)
			ans = (ans + a[i]) / 2;
		else ans = a[i];
	}
	printf("%.15f\n", ans);
	return 0;
}


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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int ab, bc, ca;
    cin >> ab >> bc >> ca;
    int ans = ab * bc / 2;
    cout << ans << endl;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll modinv(ll a, ll m) {ll b = m, u = 1, v = 0;while (b) {ll t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}
const int INF = 1e9;
const ll LLINF = 1e16;

int main(void)
{
    ll n,m;
    cin >> n >> m;
    vector<bool> tenb(n,true);
    vector<ll> h(n);
    vector<pair<ll, ll>> miti(m);
    REP(i, n) { cin >> h[i]; }
    REP(i, m) { 
        cin >> miti[i].first >> miti[i].second;
        miti[i].first--;
        miti[i].second--;
    }

    REP(i, m) { 
        if(h[miti[i].first] < h[miti[i].second]){
            tenb[miti[i].first] = false; 
        }
        else if(h[miti[i].first] > h[miti[i].second]){
            tenb[miti[i].second] = false; 
        }
        else{
            tenb[miti[i].first] = false;
            tenb[miti[i].second] = false;
        }
    }

    ll cnt = 0;
    REP(i, n)
    {
        if(tenb[i]){
            cnt++;
        }
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 5636
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define ll long long
#define ull unsigned long long
#define dd double
#define oo 1001007000
#define ff float
#define ooo 4223352036854775007
#define iii pair<ll,ll>
#define vii vector<ll>
#define viii vector<iii>
#define sss pair<str,str>
#define str string
#define sii set<ll>
#define siii set<iii>
#define r0 return 0
#define pb push_back
#define sz size
using namespace std;

const char E='\n';
const int N=10005;
const int NN=2005;
const ll md=998244353;


int main(){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    n=n%10;
    if (n==3){
        cout << "bon" << E;
    }else
    if (n==2 || n==4 || n==5 || n==7 || n==9){
        cout << "hon" << E;
    }else{
        cout << "pon" << E;
    }


    r0;
}
/*








*/


Measured memory_bytes: 3648
#include <bits/stdc++.h>  
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(int)(n); i++)
using graph = vector<vector<char>>;

int main(){
  string  s;cin>>s;//cout<<s.size()<<endl;
  ll c=0,ans=0;
  rep(i,s.size()){
    if(s.at(i)=='B'){c++;}
    else{ans+=c;}
  }
  cout<<ans;
}



Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Text;

namespace atc
{
    class Program
    {
        static void Main(string[] args)
        {
            var bufs = Console.ReadLine().Split();
            var N = int.Parse(bufs[0]);
            var M = int.Parse(bufs[1]);
            var S = Console.ReadLine();
            var T = Console.ReadLine();

            var L = Lcm(N, M);
            var dic = new Dictionary<long, char>();

            //Sを格納
            for (int i = 0; i < N; i++)
            {
                var index = (i * L / N) + 1;
                dic.Add(index, S[i]);
            }

            //TがＳと被るか
            bool hasErr = false;
            for (int i = 0; i < M; i++)
            {
                var index = (i * L / M) + 1;
                if(dic.ContainsKey(index))
                {
                    if (T[i] != dic[index])
                    {
                        //矛盾あり！
                        hasErr = true;
                        break;
                    }
                }
            }

            if(hasErr)
            {
                Console.WriteLine(-1);
            }else
            {
                Console.WriteLine(L);
            }
        }

        static long Lcm(int a, int b)
        {
            return (long)a * b / Gcd(a, b);
        }

        static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }

            while(b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;

        }

    }
}


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

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; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;

int main(){
    long long N;
    cin >> N;
    vector<long long> H(N);
    for(int i = 0; i < N; ++i){
        cin >> H[i];
    }
    long long ans = 0LL;
    long long tmp = 0LL;
    long long ans1 = 0LL;
    bool flag = false;
    for(int i = N-1; i >= 1; i--){
        if(H[i] <= H[i-1]){
            ans++;
            if(i == 1){
                flag = true;
            }
        }else{
            if(ans >= tmp){
            tmp = ans;
            ans1 = ans;
            ans = 0LL;
            flag = true;
            } else {
                ans = 0LL;
                flag = true;
            }
        }
    }
    if(flag){
        if( ans1 >= ans){
    cout << ans1 << endl;
        } else {
            cout << ans << endl;
        }
    } else {
        cout << ans << endl;
    }

}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
using namespace std;
int main(void){
    int a, b;
    cin >> a >> b;
    cout << a/b << " " ;
    cout << a%b << " " << flush;
    cout << fixed << setprecision(6);
    cout << (double)a/(double)b << endl;
}



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

int s(int n){
  int sum=0;
  for(;n>0;n/=10){
    sum+=n%10;
  }
  return sum;
}

int main(){
  int n;
  cin>>n;
  if(n%s(n)==0){
    cout<<"Yes"<<endl;
  }
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
l = []
for i in range(H):
  l.append(str(input()))
ans = []
sharplist = '#' * (W+2)

ans.append(sharplist)
for i in range(H):
  ans.append('#' + l[i] + '#')
ans.append(sharplist)
      
for i in range(H+2):
  print(ans[i])

Measured memory_bytes: 3064
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int[][][] houses = new int[4][3][10];
		int n = Integer.parseInt(in.readLine());
		for (int i = 0; i < n; i += 1) {
			String[] info = in.readLine().split(" ");
			int b = Integer.parseInt(info[0]);
			int f = Integer.parseInt(info[1]);
			int r = Integer.parseInt(info[2]);
			int v = Integer.parseInt(info[3]);
			houses[b - 1][f - 1][r - 1] += v;
		}
		for (int x = 0; x < 4; x += 1) {
			for (int y = 0; y < 3; y += 1) {
				for (int z = 0; z < 10; z += 1) {
					sb.append(" ");
					sb.append(houses[x][y][z]);
				}
				sb.append(System.getProperty("line.separator"));
			}
			if (x != 3) {
				sb.append("####################"
						+ System.getProperty("line.separator"));
			}
		}
		System.out.print(sb);
	}
}

Measured memory_bytes: 17896
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#define rep(i,x) for(int i=0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
    if (a < b)swap(a, b);
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}

int main() {
    ll N;
    cin >> N;
    ll a = 0;
    ll b = 0;
    ll n = N;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            a = i;
            b = N / i;
        }
    }
    ll ans = 0;
    while (b) {
        b /= 10;
        ans++;
    }
    cout << ans << endl;
}

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

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

using ll = long long int;
const ll MOD = 1e9 + 7;

int main() {
    std::string S;  
    std::cin >> S;
    if(S == "ABC") {
        std::cout << "ARC" << std::endl;
    } else {
        std::cout << "ABC" << std::endl;
    }
}


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

using namespace std;

int main() {
    string cards[3];
    unsigned int idx[3] = {0};
    unsigned int who_turn = 0;

    cin >> cards[0] >> cards[1] >> cards[2];

    while (1) {
        if (cards[who_turn].size() > idx[who_turn]) {
            char card = cards[who_turn][ idx[who_turn]++ ];
            who_turn = card - 'a';
        } else {
            cout << (char)('A' + who_turn) << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

const int INF = 1e9;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int r;
	cin >> r;
	while(r--){
		string n;
		cin >> n;
		int ct = 0;
		int max_;
		bool ismultipled;
		do{
			ismultipled = false;
			max_ = 0;
			if(n.size() == 1)break;
			for(int digit = n.size() - 1;digit > 0;digit--){
				if(n[digit] == '0' && digit > 1)continue;
				ismultipled = true;
				max_ = max(max_,stoi(n.substr(0,digit)) * stoi(n.substr(digit,n.size() - digit)));

			}
			n = to_string(max_);
			if(ct > INF){
				ct = -1;
				break;
			}
		}while(ismultipled && ++ct);
		cout << ct << endl;
	}
  return 0;
}

Measured memory_bytes: 3320
import sys
import numpy as np

read = sys.stdin.read
readline = sys.stdin.readline

A, B, M = map(int, readline().split())
a = np.array(readline().split(), np.int64)
b = np.array(readline().split(), np.int64)
xyc = np.array(read().split(), np.int64)
x = xyc[::3]
y = xyc[1::3]
c = xyc[2::3]
answer = np.min(a) + np.min(b)
answer = min(answer, np.min(a[x - 1] + b[y - 1] - c))
print(answer)


Measured memory_bytes: 45496
#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define ff           first
#define ss           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

// Most important thing in CP - Have Fun :)

void solve(){
	//write here
   int k;
   cin>>k;
   unordered_set<int>seen;
   int val = 0;
   for (int i = 0 ; i <1e6+1 ; i++){
       val = (val*10 +7)%k;
       if (val == 0){
           cout<<i+1<<endl;
           return;
       }
       else if (seen.find(val)!=seen.end()){
           cout<<-1<<endl;
           return;
       }
       seen.insert(val);
   }
   cout<<-1<<endl;
}

int main(){
	cin.tie(NULL);
	ios::sync_with_stdio(false);
	//insert code
	
		solve();
	return 0;
}

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

long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
	long long g = gcd(a, b);
	return a / g * b; //オーバーフローに注意
}
int main() {
    long long A, B, C, D;
    cin >> A >> B >> C >> D;

    long long CD = lcm(C, D);
    long long countC = B / C - (A + C - 1) / C + 1;
    long long countD = B / D - (A + D - 1) / D + 1;
    long long countCD = B / CD - (A + CD - 1) / CD + 1;
    cout << (B - A + 1) - countC - countD + countCD << endl;
}

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

vector<int> G[100010];
int dp[100010];
int dfs(int v) {
    if (dp[v] != -1) return dp[v];
    for (auto to: G[v]) {
        dp[v] = max(dp[v], dfs(to) + 1);
    }
    return max(0, dp[v]);
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    rep(i, N) dp[i] = -1;
    rep(i, M) {
        int s, t;
        cin >> s >> t;
        s--; t--;
        G[s].push_back(t);
    }
    int ans = 0;
    rep(i, N) ans = max(ans, dfs(i));
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 7424
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

ll N, M;
string S[100];

int main(void) {
  cin >> N >> M;
  REP(i, 0, N) cin >> S[i];

  ll cnt[256];
  REP(i, 0, 256) cnt[i] = 0;
  REP(i, 0, N) REP(j, 0, M) cnt[S[i][j]]++;

  map<ll, ll> mp;
  REP(i, 0, 256) {
    if(cnt[i] % 4 == 0) mp[4] += cnt[i];
    if(cnt[i] % 4 == 1) mp[1] += 1;
    if(cnt[i] % 4 == 2) mp[2] += 2, mp[4] += (cnt[i] - 2);
    if(cnt[i] % 4 == 3) mp[1] += 1, mp[2] += 2, mp[4] += (cnt[i] - 3);
  }

  bool f;
  if(N % 2 == 1 && M % 2 == 1) {
    bool f1 = mp[1] == 1;
    bool f2 = mp[2] <= M + N - 1;
    f = f1 && f2;
  }
  if(N % 2 == 1 && M % 2 == 0) {
    bool f1 = mp[1] == 0;
    bool f2 = mp[2] <= M;
    f = f1 && f2;
  }
  if(N % 2 == 0 && M % 2 == 1) {
    bool f1 = mp[1] == 0;
    bool f2 = mp[2] <= N;
    f = f1 && f2;
  }
  if(N % 2 == 0 && M % 2 == 0) {
    bool f1 = mp[1] == 0;
    bool f2 = mp[2] == 0;
    f = f1 && f2;
  }

  cout << (f ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
using usize = ::std::size_t;
using u64 = ::std::int_least64_t;
//using u64 = int;
static constexpr u64 Inf = ::std::numeric_limits<u64>::max() / 2;
 
 #define MOD 1000000007

long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}

int main(int argc, char *argv[])
{
    
 
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin >> N;
    vector<u64> A(N + 1), S(N, 0);
    u64 sum = 0;
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
        sum += A[i];
        sum %= MOD;
    }
    S[0] = sum;
    u64 ans = 0;
    for (int i = 1; i < N; i++) {
        S[i] = mod((S[i - 1] % MOD) - (A[i] % MOD), MOD);
        ans += (S[i] * A[i]);
        ans %= MOD;
    }
    
    cout << ans << endl;

    
    return 0;
    
}


Measured memory_bytes: 6328
n,m,q=map(int,input().split())
con=[list(map(int,input().split())) for i in range(q)]
ans=0
from itertools import combinations_with_replacement
ten=[i for i in range(m)]

x=list(combinations_with_replacement(ten,n))
for i in range(len(x)):
  y=list(x[i])
  nowans=0
  for j in range(q):
    if y[con[j][1]-1]-y[con[j][0]-1]==con[j][2]:
      nowans+=con[j][3]
  ans=max(ans,nowans)
print(ans)

Measured memory_bytes: 21416
n, c, k = map(int, input().split())
t = []
for _ in range(n):
  t.append(int(input()))
  
st = sorted(t)

time = 0
limit = st[0]+k

d = {}
d[limit] = []
ans = 1
for i, p in enumerate(st):
  if p <= limit and len(d[limit]) < c:
    d[limit].append(p)
  else:
    limit = p + k
    ans += 1
    d[limit] = [p]

print(ans)

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

const int MOD = 1000000007;

// begin() end()
#define all(x) (x).begin(),(x).end()

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

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

//最小公倍数
int lcm(int number1,int number2){
	return number1 * number2 / gcd(number1,number2);	
}

int main(){
    int N;
    cin >> N;
    
    vector<int>A(N);
    REP(i, N) cin >> A[i];
    
    sort(all(A));
    int ans = abs(A[N - 1] - A[0]);
    cout << ans << endl; 
}

Measured memory_bytes: 256
N=int(input())
H=list(map(int,input().split()))
flag=[False for _ in range(N)]

def solver(x,y):
  global flag
  if x<0 or y>N:
    return
#  print(H[x],H[y])
  if H[x]>H[y] and flag[x]==False:
#    print(H)
    H[x]-=1
    flag[x]=True
    solver(x-1,y)

for i in range(N-1):
  solver(i,i+1)

#print(H)
shadow=H[:]
H.sort()
if shadow==H:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b;
  cin >> a >> b;
  int count = 1;
  if(b==1){
    cout<<0<<endl;
    return 0;
  }
  else{
    int c = a;
   while(b>c){
    c += a-1;
   count++;
  }
  cout << count << endl;
}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k,a,cnt[200001]={};
	cin>>n>>k;
	while(cin>>a)
		cnt[a]++;
	sort(cnt,cnt+200001,greater<>());
	int sum=0;
	for(int i=0;i<k;i++)
		sum+=cnt[i];
	cout<<n-sum<<endl;
}


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

int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
	cin>>arr[i];
set<int>found;
int i = 1;
int r=0;
while(i!=2)
{
	found.insert(i);
	i = arr[i-1];
	r++;
	if(found.find(i)!=found.end())
	{
		r=-1;
		break;
	}
}
cout<<r<<"\n";
}

Measured memory_bytes: 8556
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))
val = 0
for num in a:
    val = val ^ num
ans = [None]*n
for i,num in enumerate(a):
    ans[i] = val^num
write(" ".join(map(str, ans)))

Measured memory_bytes: 119176
#include <iostream>
#include <fstream>
#include <sstream>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <assert.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <set>

//#define DEBUG 1

#define for0(i,n) for (int i=0; i<n; i++)
#define forr(i,n) for (int i=n-1; i>=0; i--)
#define fori(i,a,b) for (int i=a; i<=b; i++)
#define iter(c,x) for(x::iterator it=c.begin(); it!=c.end(); it++)
#define vec(x) vector< x >
#define pb push_back
#define ms(a,z) memset(a,z,sizeof(a));
#define mp make_pair
#define X first
#define Y second
#define sqr(x) 1LL*(x)*(x)
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define all(a) a.begin(),a.end()
#define size(x) (int)(x).size()
#define read(x) int x; scanf("%d",&x);
#ifdef DEBUG
#define nl cout<<"\n";
#define pr(x) cout<<(x)<<" ";
#define prl(x) cout<<#x " = "<<x<<endl;
#define prp(x) cout<<"("<<(x).first<<" "<<(x).second<<") ";
#define printv(v) {for(int _=0; _<size(v); _++) cout<<v[_]<<" "; cout<<"\n";}
#define printa(a,s) {for (int _=0; _<s; _++) cout<<a[_]<<" "; cout<<"\n";}
#define print2D(a,m,n) {for (int _=0; _<m; _++) {for (int __=0; __<n; __++) cout<<a[_][__]<<" "; cout<<"\n";} cout<<"\n";}
#define debug cout<<"ok at line "<<__LINE__<<endl;
#else
#define nl
#define pr(x)
#define prl(x)
#define prp(x)
#define printv(v)
#define printa(a,s)
#define print2D(a,m,n)
#define debug
#endif

using namespace std;

typedef long long ll;

const int INF = 999999999;
const long long INFL = 99999999999999999LL;
const double EPSILON = 0.00000001;
const long long MOD = 1000000007;

int weights[105], values[105];
map<int,int> mem[105];
int N,W;

int solve(int i, int w_max)
{
    if (i == N)
        return 0;
    if (mem[i].find(w_max) != mem[i].end()) {
        return mem[i][w_max];
    }

    int v1=0,v2=0;
    if (w_max >= weights[i]) {
        v1 = solve(i+1, w_max-weights[i]) + values[i];
    }
    v2 = solve(i+1, w_max);
    int ans = max(v1,v2);
    //pr(i) pr(w_max) pr(ans) nl
    mem[i][w_max] = ans;
    return ans;
}

int main()
{
    #ifdef DEBUG
    freopen("B.txt","r",stdin);
    //freopen("","w",stdout);
    #endif

    scanf("%d %d",&N,&W);
    for0(i,N) {
        scanf("%d %d",&weights[i], &values[i]);
    }
    //printa(weights,N)
    //printa(values,N)

    int ans = solve(0,W);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4736
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 1010101;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[8] = { 1,-1,0,0,1,1,-1,-1 };
ll dy[8] = { 0,0,1,-1,1,-1,1,-1 };
ll d[110][2];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	string s;
	cin >> s;
	ll n = s.length();
	vector<ll>ans(n);
	ll res = 0;
	rep(i, n) {
		if (s[i] == 'R')res++;
		else {
			ans[i] += res / 2;
			ans[i - 1] += (res + 1) / 2;
			res = 0;
		}
	}
	for (ll i = n - 1;i >= 0;--i) {
		if (s[i] == 'L')res++;
		else {
			ans[i] += res / 2;
			ans[i + 1] += (res + 1) / 2;
			res = 0;
		}
	}
	rep(i, n) {
		cout << ans[i];
		cout << " ";
	}
	cout << endl;
	return 0;
}


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

int main(){
  int W, a, b;
  cin >> W >> a >> b;
  
  if(a<b){
   if(b - (a + W) <=0 ){
    cout << 0 << endl;
   }
   else{
  cout << b - (a + W) << endl;
   }
  }
  else if(a>=b){
    if(a - (b+W) <= 0){
      cout << 0 << endl;
    }
    else{
      cout << a - (b+W) << endl;
    }
  }
    
}

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

int main()
{
  string k;
  long long int n;
  vector<long long int> p;
  cin >> k;
  cin >> n;

  long long int t = 1;
  for (int i = 1; i < k.length(); i++)
  {
    if (k[i - 1] == k[i])
    {
      t++;
    }
    else
    {
      p.push_back(t);
      t = 1;
    }
  }
  p.push_back(t);

  long long int res = 0;
  if (k[0] == k[k.length() - 1])
  {
    if (p.size() == 1)
    {
      res += (p[0] * n) / 2;
    }
    else
    {
      res += p[0] / 2;
      for (int i = 1; i < p.size() - 1; i++)
      {
        res += (p[i] / 2) * n;
      }
      res += ((p[0] + p[p.size() - 1]) / 2) * (n - 1);
      res += p[p.size() - 1] / 2;
    }
  }
  else
  {
    for (int i = 0; i < p.size(); i++)
    {
      res += (p[i] / 2) * n;
    }
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int c = Integer.parseInt(sc.next());
		sc.close();

		System.out.println(a+b>=c?"Yes":"No");

	}

}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
 
 
int main() {
	int K = 38;
	
	int N = K * (K-1)  +1;
	
	
	cout << N << " " << K << endl;
	
	int cur = 2;
	for(int i=0; i<K; i++) {
		cout << 1 << " ";
		for(int j=0; j<K-1; j++) {
			cout << cur ;
			if(j == K-2) cout << endl;
			else cout << " ";
			cur++;
			
		}
		
	}
	
	for(int j=2; j<=K; j++) {
		int diff = j - 2 ;
		int base = K+1;
		for(int z=0; z<K-1; z++) {
		cout << j << " ";
			for(int k=0; k<K-1; k++) {
				cout << base + (K-1)*k + (diff * k  + z)% (K-1);
				if(k==K-2) cout << endl;
				else cout << " ";
				
			}
		}
		
	}
	
	
	
	
	
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define rep(i, j, k) for (auto i = j; i < k; i++)
#define rrep(i, j, k) for (auto i = j; i > k; i--)
using namespace std;

void solve(int &n) {
  vector<pair<int, int>> v[51];
  rep(i, 0, n + 1) {
    int m; cin >> m;
    rep(j, 0, m) {
      int x, y; cin >> x >> y;
      v[i].push_back({x, y});
    }
  }
  rep(i, 0, n + 1) {
    if (v[i][0] == make_pair(0, 0)) continue;
    int x = v[i][0].fi, y = v[i][0].se;
    rep(j, 0, (int)v[i].size()) {
      v[i][j].fi -= x;
      v[i][j].se -= y;
    }
  }
  vector<int> ans;
  rep(i, 1, n + 1) {
    rep(j, 0, 4) {
      bool ok = (v[0].size() == v[i].size() ? true : false);
      rep(k, 0, (int)v[i].size()) {
        if (v[i][k].fi != v[0][k].fi || v[i][k].se != v[0][k].se) ok = false;
      }
      if (ok) ans.push_back(i);
      rep(k, 0, (int)v[0].size()) {
        int x = v[0][k].fi, y = v[0][k].se;
        v[0][k].fi = y;
        v[0][k].se = -x;
      }
    }
  }
  if (v[0].back() != make_pair(0, 0)) {
    int x = v[0].back().fi, y = v[0].back().se;
    rep(j, 0, (int)v[0].size()) {
      v[0][j].fi -= x;
      v[0][j].se -= y;
    }
  }
  reverse(v[0].begin(), v[0].end());
  rep(i, 1, n + 1) {
    rep(j, 0, 4) {
      bool ok = (v[0].size() == v[i].size() ? true : false);
      rep(k, 0, (int)v[i].size()) {
        if (v[i][k].fi != v[0][k].fi || v[i][k].se != v[0][k].se) ok = false;
      }
      if (ok) ans.push_back(i);
      rep(k, 0, (int)v[0].size()) {
        int x = v[0][k].fi, y = v[0][k].se;
        v[0][k].fi = y;
        v[0][k].se = -x;
      }
    }
  }
  sort(ans.begin(), ans.end());
  bool past[51];
  fill(past, past + 51, false);
  rep(i, 0, (int)ans.size()) {
    if (past[ans[i]]) continue;
    cout << ans[i] << endl;
    past[ans[i]] = true;
  }
  cout << "+++++" << endl;
}

int main() {
  int n;
  while (cin >> n, n) solve(n);
}
///////////////////////////////////////////////////////////////////////////////////
//NOTE
///////////////////////////////////////////////////////////////////////////////////
//全部の座標が同じでも、そもそも折れ線を構成する頂点の個数が違ったら、その折れ線は
//同じ形状ではないというところがミスりやすい.(ミスした)



Measured memory_bytes: 3044
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;
#define rep(i,a,b) for(ll i=(a); i<(b); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define pai 3.14159265358979323846
ll gcd(ll a, ll b){if (a%b == 0)  return(b);else  return(gcd(b, a%b));}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
/* 辞書順 next_permutation(a.begin(),a.end()) */
 
int main() {
    int n;
    cin >> n;
    vector <int> a(n);
    rep(i,0,n) {
        cin >> a[i];
    }
    ll ans =0;
    rep(i,0,n) {
        ans += a[i]-1;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <cctype>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <set>
#include <deque>
#include <map>
#include <bitset>
#include <functional>
#include <cmath>

#define INF 1000000000
using namespace std;

int main() {
	long long a, b;
    long long v, w;
    long long t;
    cin >> a >> v >> b >> w >> t;

    long long dist = abs(a - b);

    long long x = v - w;

    if(x*t >= dist){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}


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

using namespace std;

int main(void) {
  for (int i = 1; i < 10; i++) {
    for (int j = 1; j < 10; j++) {
      printf("%dx%d=%d\n", i, j, i * j);
    }
  }

  return 0;
}


Measured memory_bytes: 3152
/**
 *      author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *      created : 2019-12-01 20:49:15
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>

using namespace std;

using int64 = long long;
#define debug(_) cerr << #_ << ": " << (_) << '\n'
template<typename T> inline void chmin(T &a, T b) { if (a > b) a = b; return; }
template<typename T> inline void chmax(T &a, T b) { if (a < b) a = b; return; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& vec) { os << '{'; for (size_t i = 0; i < vec.size(); ++i) { os << vec[i]; if (i != vec.size() - 1) os << ','; } os << '}'; return os; }
template<typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

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

  int m1, d1, m2, d2; cin >> m1 >> d1 >> m2 >> d2;

  if (m1 != m2) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;
}

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


typedef long long unsigned llu;
typedef long double ld;
#define ll long long
#define PI 3.14159265358979323846
#define For(i, a, b) for (int i = a, sz = (int)b; i < sz; i++)
#define rFor(i, a, b, c) for (int i = (a); i >= (b); i -= (c))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fill(a, b) memset(a, b, sizeof(a))
#define IO ios_base::sync_with_stdio(false), cin.tie(0),cout.tie(0)
const int mod = 1000000007;
const ll inf = 1000000000009;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);}

//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdoutn

int main()
{
	IO;
	ll a{},b{};
	cin>>a>>b;
	if(!a)cout<<"0\n";
	else if(a>b && b>1){
		if(!(a%b))cout<<"0"<<'\n';
		else cout<<b-(a%b)<<'\n';
	}
	else if((a>b && b==1)||(a==b))cout<<"0\n";
	else if(a<b){
			if(abs(a-b)>a)cout<<a<<'\n';
			else cout<<abs(a-b)<<'\n';
	}
	//system("pause");
	return 0;
}

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

#define fi first
#define se second
#define show(x) cerr << #x << "=" << "\n"
typedef long long ll;
typedef unsigned long long ull;

using namespace std;

string s;
int a[30];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1 = freopen("in.txt", "r", stdin);
  //stream2 = freopen("out.txt", "w", stdout);
  if (stream1 == NULL) return 0;
  //if (stream2 == NULL) return 0;:w
#endif
  cin >> s;
  int n = (int)s.size();
  for (int i = 0; i < n; i++) {
    a[s[i] - 'a']++;
  }
  string t = "";
  while (true) {
    bool zero = 1;
    for (int i = 0; i < 26; i++) {
      if (a[i] > 0) {
        t += (char)('a' + i);
        a[i]--;
        zero = 0;
      }
    }
    if (zero) {
      break;
    }
  }
  int now = 1;
  char pre = t[0];
  int m = (int)t.size();
  for (int i = 1; i < m; i++) {
    if (pre >= t[i]) {
      if (now > 2) {
        now = 1;
        pre = t[i];
      } else {
        cout << "NO" << endl;
        return 0;
      }
    } else {
      now++;
      pre = t[i];
    }
  }
  cout << "YES" << endl;
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}

Measured memory_bytes: 592
// https://atcoder.jp/contests/code-festival-2017-qualc/tasks/code_festival_2017_qualc_c

package main

import "fmt"

func main() {
	var s string
	fmt.Scanf("%s", &s)

	cnt := 0
	for l, r := 0, len(s)-1; l < r; l, r = l+1, r-1 {
		if s[l] == s[r] {
			continue
		}
		if s[l] == 'x' {
			r++
			cnt++
			continue
		}
		if s[r] == 'x' {
			l--
			cnt++
			continue
		}
		fmt.Println(-1)
		return
	}
	fmt.Println(cnt)
}


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

int main(){

  int n, cnt = 0, num = 0;
  string str, phone;

  cin >> n;

  for(int i = 0; i < n; i++){
    cin >> phone;
    for(int j = 0; j < (int)phone.size(); j++){
      if(phone[j] == '1'){
	cnt++;
	if(phone[j+1] == '0'){
	  switch (cnt % 5){
	  case 0: 
	    cout << " ";
	    break;
	  case 4: 
	    cout << '?';
	    break;
	  case 3: 
	    cout << '!';
	    break;
	  case 2: 
	    cout << ',';
	    break;
	  case 1: 
	    cout << '.';
	    break;
	  }
	  cnt = 0;
	}
      }else if(phone[j] == '2'){
	cnt++;
	if(phone[j+1] == '0'){
	  switch (cnt % 3){
	  case 0: 
	    cout << 'c';
	    break;
	  case 2: 
	    cout << 'b';
	    break;
	  case 1: 
	    cout << 'a';
	    break;
	  }
	  cnt = 0;
	}
      }else if(phone[j] == '3'){
	cnt++;
	if(phone[j+1] == '0'){
	  switch (cnt % 3){
	  case 0: 
	    cout << 'f';
	    break;
	  case 2: 
	    cout << 'e';
	    break;
	  case 1: 
	    cout << 'd';
	    break;
	  }
	  cnt = 0;
	}
      }else if(phone[j] == '4'){
	cnt++;
	if(phone[j+1] == '0'){
	  switch (cnt % 3){
	  case 0: 
	    cout << 'i';
	    break;
	  case 2: 
	    cout << 'h';
	    break;
	  case 1: 
	    cout << 'g';
	    break;
	  }
	  cnt = 0;
	}
      }else if(phone[j] == '5'){
	cnt++;
	if(phone[j+1] == '0'){
	  switch (cnt % 3){
	  case 0: 
	    cout << 'l';
	    break;
	  case 2: 
	    cout << 'k';
	    break;
	  case 1: 
	    cout << 'j';
	    break;
	  }
	  cnt = 0;
	}
      }else if(phone[j] == '6'){
	cnt++;
	if(phone[j+1] == '0'){
	  switch (cnt % 3){
	  case 0: 
	    cout << 'o';
	    break;
	  case 2: 
	    cout << 'n';
	    break;
	  case 1: 
	    cout << 'm';
	    break;
	  }
	  cnt = 0;
	}
      }else if(phone[j] == '7'){
	cnt++;
	if(phone[j+1] == '0'){
	  switch (cnt % 4){
	  case 0: 
	    cout << 's';
	    break;
	  case 3: 
	    cout << 'r';
	    break;
	  case 2: 
	    cout << 'q';
	    break;
	  case 1: 
	    cout << 'p';
	    break;
	  }
	  cnt = 0;
	}
      }else if(phone[j] == '8'){
	cnt++;
	if(phone[j+1] == '0'){
	  switch (cnt % 3){
	  case 0: 
	    cout << 'v';
	    break;
	  case 2: 
	    cout << 'u';
	    break;
	  case 1: 
	    cout << 't';
	    break;
	  }
	  cnt = 0;
	}
      }else if(phone[j] == '9'){
	cnt++;
	if(phone[j+1] == '0'){
	  switch (cnt % 4){
	  case 0: 
	    cout << 'z';
	    break;
	  case 3: 
	    cout << 'y';
	    break;
	  case 2: 
	    cout << 'x';
	    break;
	  case 1: 
	    cout << 'w';
	    break;
	  }
	  cnt = 0;
	}
      }
    }
    cout << endl;
  }









return 0;
}

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

typedef int keytype;

//quicksort(<#keytype *a#>, <#int first#>, <#int last#>)

void quicksort(keytype a[],keytype data[], int first, int last){
    int i, j;
    keytype x, t, at;
    
    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;  at = data[i];  data[i] = data[j];  data[j] = at;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, data ,first , i - 1);
    if (j + 1 < last) quicksort(a, data, j + 1, last);
}

int main(void){
    int n,data[100000],a[100000],i,j,tmp,k=0;
    scanf("%d",&n);
    for(k=0; k<n ; k++){
        scanf("%d", &a[k]);
        data[k]=k+1;
    }
    quicksort(a,data,0,n-1);
    for(j=0; j<n; j++){
        printf("%lld ", data[j]);
    }
    
    return 0;
}



Measured memory_bytes: 1536
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>
#include<utility>
#include<numeric>

#define pb push_back
#define mp make_pair
#define all(a)  (a).begin(),(a).end()
#define dwn(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;
const ll inf = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };
const long double EPS = 1e-10;

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	string s;
	cin >> s;
	int cnt = 0;
	int forigner = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'a') {
			if (cnt < a + b) {
				cout << "Yes" << endl;
				cnt++;
			}
			else {
				cout << "No" << endl;
			}
		}
		if (s[i] == 'b') {
			if (cnt < a + b && forigner < b) {
				cout << "Yes" << endl;
				cnt++;
				forigner++;
			}
			else {
				cout << "No" << endl;
			}
		}
		if (s[i] == 'c') {
			cout << "No" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 896