akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> 

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()


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


  int N;
  cin>>N;
  vector<set<int>>n(N+1);
  for(int i=1;i<=N;i++){
    for(int j=1;j*j<=N;j++){
      if(i%j==0)n[i].insert(j),n[i].insert(i/j);
    }
  }
  vector<int>A(N+1);
  for(int i=1;i<=N;i++)cin>>A[i];
  vector<bool>b(N+1,false);
  vector<int>ans;
  for(int i=N;i>=1;i--){
    if(b[i]==A[i])continue;
    else ans.push_back(i);
    for(auto it:n[i]){
      b[it]=!b[it];
    }
  }
  bool ok=true;
  /*
  for(auto it:b)cout<<it<<" ";
  cout<<endl;
  for(auto it:A)cout<<it<<" ";
  */
  for(int i=1;i<=N;i++)if(b[i]!=A[i])ok=false;
  if(ok){
    cout<<ans.size()<<endl;
    for(auto it:ans)cout<<it<<" ";
    cout<<endl;
  }
  else{
    cout<<-1<<endl;
  }
  return 0;
}


Measured memory_bytes: 127476
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  int64 ret = m;
  for (int i = 1; i < n; ++i) {
    ret += min(a[i] - a[i - 1], m);
  }
  printf("%lld\n", ret);
  return 0;
}


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

using namespace std;

int main(int argc,char* argv[]){
	int N;
	bool flag=true;
	cin >> N;
	long long int a[N],count=0;
	for(int i=0;i<N;i++) cin >> a[i];
	while(flag){
		flag = false;
		for(int i=0;i<N;i++){
			if(a[i]%64==0){
				flag = true;
				count += 6;
				a[i]/= 64;
			}else if(a[i]%32==0){
				flag = true;
				count += 5;
				a[i]/=32;
			}else if(a[i]%16==0){
				flag = true;
				count += 4;
				a[i]/=16;
			}else if(a[i]%2==0){
				flag = true;
				count++;
				a[i]/=2;
			}
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 384
scan :: Int -> Int
scan = iter 0 where
    iter c n = case divMod n 10 of
        (0, r) -> if r == 2 then c+1 else c
        (q, r) -> if r == 2 then iter (c+1) q else iter c q

main :: IO() 
main = do
    n  <- readLn :: IO Int
    let ans = scan n
    print ans

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

struct edge { int to, id; };

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

  vector<vector<edge>> edges(100010);

  for(int i=1; i<=N-1; i++){
    int a, b; cin >> a >> b;
    edges[a].push_back((edge){b, i});
    edges[b].push_back((edge){a, i});
  }

  int K = 0, max_id;
  for(int i=1; i<=N; i++){
    if(K < edges[i].size()){
      K = edges[i].size();
      max_id = i;
    }
  }

  cout << K << endl;

  // max_idから幅優先探索で色を塗っていく
  vector<int> color_e(100010), color_v(100010);
  vector<bool> visited(1000010, false);
  
  queue<int> Q; Q.push(max_id);
  color_v[max_id] = 0; visited[max_id] = true;

  while(!Q.empty()){
    int cur = Q.front(); Q.pop();

    int c = 1;
    for(int i=0; i<edges[cur].size(); i++){
      edge e = edges[cur][i];
      int next = e.to;

      if(!visited[next]){
        if(c == color_v[cur]) c++;
        
        color_e[e.id] = c;
        color_v[next] = c;
        c++;

        visited[next] = true;
        Q.push(next);
      }
    }  
  }

  for(int i=1; i<N; i++){
    cout << color_e[i] << endl;
  }
  
}

Measured memory_bytes: 7424
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1, (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

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

    vector<vector<int>> v(n, vector<int>(3));
    for(auto& i : v){
        for(auto& j : i){
            cin >> j;
        }
    }

    vector<vector<int>> dp(n, vector<int>(3,0));

    REP(i, 3){
        dp[0][i] = v[0][i];
    }

    for(int i=1; i<n; i++){
        dp[i][0] = v[i][0] + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = v[i][1] + max(dp[i-1][0], dp[i-1][2]);
        dp[i][2] = v[i][2] + max(dp[i-1][0], dp[i-1][1]);
    }

    cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]}) << endl;

    return 0;
}

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

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(ceil(1.0*c/b)<=ceil(1.0*a/d))
    cout << "Yes"<<endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3584
#include<stdio.h>
#include<string.h>
//言語は「C++14(GCC 5.4.1)」
//AtCoder Beginner Contest 61-A

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

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#define pb push_back
#define mk make_pair
#define fastio ios_base::sync_with_stdio(false); cout.tie(NULL);
using namespace std;

int main()
{
	fastio;
	
	int n,a,b,i,j,mn=-1;
	cin>>n;
	vector<int> ar[n+1];
	vector<pair<int,int>> v;
	
	for(i=0;i<n-1;i++)
		cin>>a>>b , ar[a].pb(b) , ar[b].pb(a) , v.pb({a,b});
	
	for(i=1;i<=n;i++)
	{
		int tmp=ar[i].size();
		mn=max(mn,tmp);
	}
	
	int vis[mn];
	map<pair<int,int>,int> mp,ans;
	
	for(i=1;i<=n;i++)
	{
		memset(vis,0,sizeof(int)*ar[i].size());
		
		for(auto el : ar[i])
		{
			if(ans.find({i,el})!=ans.end())
				vis[ans[{i,el}]-1]=1;
			else if(ans.find({el,i})!=ans.end())
				vis[ans[{el,i}]-1]=1;
		}
		
		for(auto el : ar[i])
		{
			if(mp.find({i,el})==mp.end() && mp.find({el,i})==mp.end())
			{
				for(j=0;j<ar[i].size();j++)
				{
					if(vis[j]==0)
					{
						ans[{i,el}]=ans[{el,i}]=j+1;
						vis[j]=1;
						mp[{el,i}]=mp[{i,el}]=1;
						break;
					}
				}
			}
		}
	}
	
	cout<<mn<<"\n";
	for(auto pair : v)
		cout<<ans[pair]<<"\n";
	return 0;
}


Measured memory_bytes: 34520
#include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<complex>
using namespace std;
typedef long long int llint;
int main(){
	char a[4];
	for (int i = 0; i < 4; i++){
		cin >> a[i];
	}
	int ans = 0;
	for (int i = 0; i < 4; i++){
		if (a[i] == '+'){
			ans++;
		}
		else{
			ans--;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define fordebug int hoge;cin>>hoge;
#define DEKAI 1000000007;
#define INF (1<<28)
#define int unsigned long long
#define double long double
#define floot10 cout<<fixed<<setprecision(10)
#define Int unsigned long long

int min(int a,int b){
  if(a<b) return a;
  return b;
}
int max(int a,int b){
  if(a>b) return a;
  return b;
}

int gcd(Int a, Int b) {
  return b != 0 ? gcd(b, a % b) : a;
}
int lcm(Int a, Int b) {
  return a / gcd(a, b)*b;
}
// a x + b y = gcd(a, b)
int extgcd(Int a, Int b, Int &x, Int &y) {
  Int g = a; x = 1; y = 0;
  if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
  return g;
}
 
signed main(){
  int n,k;
  cin>>n>>k;
  vector<int> v;
  lp(i,n){
    int a;
    cin>>a;
    v.push_back(a);
  }
  sort(v.begin(),v.end());
  reverse(v.begin(),v.end());
  int ans=0;
  lp(i,k){
    ans+=v[i];
  }
  cout<<ans<<endl;
  return 0;
}
 


Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.buffer.readline
    N = int(input())
    TXY = [[int(i) for i in input().split()] for j in range(N)]
    time, px, py = 0, 0, 0
    for t, x, y in TXY:
        move = abs(x-px) + abs(y-py)
        # print(move, t-time)
        if (t - time) % 2 != move % 2 or t - time < move:
            return print("No")
        time, px, py = t, x, y
    print("Yes")


if __name__ == '__main__':
    main()


Measured memory_bytes: 55644
//#include <fstream>

#include <iostream>
#include <algorithm>

using namespace std;

const int INF = (1 << 31) - 1;
const int NMAX = 105;
const int WMAX = 100005;
int w[NMAX], v[NMAX];
long long dp[2][WMAX];
long long n, wtot, smax;

int main()
{
	//ifstream cin("test.in");
	//ofstream cout("test.out");
	cin >> n >> wtot;
	for (int i = 1;i <= n;++i)
	{
		cin >> w[i] >> v[i];
		smax += v[i];
	}
	for (int j = 1;j <= smax;++j)
		dp[0][j] = INF;
	for (int i = 1;i <= n;++i)
	{
		for (int j = 0;j <= smax;++j)
		{
			dp[1][j] = dp[0][j];
			if (v[i] <= j && dp[0][j - v[i]] != INF && dp[1][j] > dp[0][j - v[i]] + w[i])
				dp[1][j] = dp[0][j - v[i]] + w[i];
		}
		for (int j = 0;j <= smax;++j)
			dp[0][j] = dp[1][j];
	}
	int ans = 0;
	for (int j = 0;j <= smax;++j)
		if (dp[1][j] <= wtot)
			ans = max(ans, j);
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 1792
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 1e5 + 10;
int n , L , T , x[N] , w[N] , ed[N] , ans[N];

int main(){
  scanf("%d%d%d",&n,&L,&T);
  int pos = 0;
  rep(i,0,n) {
    scanf("%d%d",x+i,w+i);
    if(w[i] == 1) {
      ed[i] = (x[i] + T) % L;
      pos += (x[i] + T) / L;
      pos %= n;
    } else {
      ed[i] = ((x[i] - T) % L + L) % L;
      pos += (x[i] - T) / L - (x[i] < T && (x[i] - T) % L != 0);
      pos = (pos % n + n) % n;
    }
  }
  sort(ed , ed + n);
  rep(i,0,n) printf("%d\n",ed[(pos+i)%n]);
  return 0;
}


Measured memory_bytes: 2432
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

// End of template.


int main(){
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m;
    int c[30];
    cin >> n >> m;
    rep(i, m) cin >> c[i];
    sort(begin(c), begin(c) + m);

    int dp[60100];
    fill(begin(dp), end(dp), INF);
    dp[0] = 0;

    rep(i, n) {
        rep(ci, m) {
            dp[i + c[ci]] = min(dp[i + c[ci]], dp[i] + 1);
        }
    }

    cout << dp[n] << '\n';

    return 0;
}




Measured memory_bytes: 3456
use std::io::*;
use std::str::FromStr;

fn main() {
    let cin = stdin();
    let mut sc = Scanner::new(cin.lock());

    let a: u32 = sc.next();
    let b: u32 = sc.next();

    println!("{} {} {:.5}", a / b, a % b, (a as f64) / (b as f64));
}

/* ========== Scanner ========== */

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn next<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.next()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect()
    }
}



Measured memory_bytes: 5052
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<string>
#include<map>
#include<set>
#include<functional>
#include<list>
#include<bitset>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
typedef long long ll;
typedef pair<int, int> p;

int gcdd(int m, int n)
{
	// 引数に０がある場合は０を返す
	if ((0 == m) || (0 == n))
		return 0;

	// ユークリッドの方法
	while (m != n)
	{
		if (m > n) m = m - n;
		else         n = n - m;
	}
	return m;
}
unsigned GCD(unsigned u, unsigned v) {
	while (v != 0) {
		unsigned r = u % v;
		u = v;
		v = r;
	}
	return u;
}

int main() {
	int n,x,y;
	cin >> n>>x>>y;
	int ans = abs(y - x);
//	cout << ans << endl;
	for (int i = 0; i < n - 1; i++) {
		cin >> y;
	//	cout << ans << endl;
		ans = GCD(ans, abs(y - x));
	}
	cout << ans;



	return 0;
}


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

int main(){
	int n;
	std::cin >> n;
	std::cin.ignore();
	
	while(n--){
		std::string Eng;
		getline(std::cin, Eng);
		std::string::size_type pos;
		while((pos = Eng.find("Hoshino")) != std::string::npos){
			Eng.replace(pos, 7, "Hoshina");
		}
		std::cout << Eng << std::endl;
	}
	
    return 0;
}

Measured memory_bytes: 1212
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    int N,K; cin >> N >> K;

    if(N == 1){
        if(K == 1){
            cout << "1 2 3" << endl;
        }else{
            cout << -1 << endl;
        }
        return 0;
    }

    vector<VI> ta(N,VI(3));
    int now = 0;
    FOR(i,1,N+1){
        ta[now][0] = i;
        now += 2;
        if(now >= N){
            now = 1;
        }
    }
    now = 1;
    FOR(i,N+1,2*N+1){
        ta[now][1] = i;
        now += 2;
        if(now >= N) now = 0;
    }
    now = 0;
    FOR(i,2*N+1,3*N+1){
        ta[now][2] = i;
        now++;
    }

    bool ok = true;
    REP(i,N){
        int a=ta[i][0],b=ta[i][1],c=ta[i][2];

        if(a+K+b+K-2 > c+K-1){
            ok = false;
        }
    }
    if(!ok){
        cout << -1 << endl;
    }else{
        REP(i,N){
            int a=ta[i][0],b=ta[i][1],c=ta[i][2];
            cout << a+K-1 << " " << b+K-1 << " " << c+K-1 << endl;
        }
    }

}


Measured memory_bytes: 7680
// D - Chat in a Circle
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(int)(s);i<(int)(e);++i)

int main(){
	int N; cin>>N;
	vector<int> A(N); rp(i, 0, N) cin>>A[i];
	sort(A.rbegin(), A.rend());
	int64_t ans = 0;
	queue<int> q;
	q.push(A[0]);
	rp(i, 1, N){
		ans += q.front(); q.pop();
		q.push(A[i]); q.push(A[i]);
	}
	cout<< ans <<endl;
}


Measured memory_bytes: 4816
def gcd(a,b):
    if a < b:
        a, b = b, a
    while b >= 1:
        a, b = b, a % b
    return a

a, b, c, d = [ int(v) for v in input().split() ]

if a == c:
    print(abs(b-d))
elif b == d:
    print(abs(a-c))
else:
    x, y = max(abs(a-c),abs(b-d)),  min(abs(a-c),abs(b-d))
    a = gcd(x,y)
    ux, uy = x // a, y // a

    print(a * (ux+uy-1))

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

using namespace std;

int main(){
    int x;
    cin>>x;
    bool flag[100010];
    for(int i=0;i<100010;i++){
        flag[i]=true;
    }
    flag[0]=false;flag[1]=false;
    for(int i=2;i<=sqrt(100010);i++){
        for(int j=i+i;j<=(100010);j+=i){
            flag[j]=false;
        }
    }
    for(int i=x;i<=100010;i++){
        if(flag[i]){
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

#define MAX_NAME_LENGTH 10+1
#define MAX_PROCESS 100000

typedef struct{
    char name[MAX_NAME_LENGTH];
    int time;
}Process;

Process Q[MAX_PROCESS];
int head=0,tail=0;

//?????\??????????´?x?????????????????¢??°
void enqueue(Process x){
    Q[tail]=x;
    if(tail+1 == MAX_PROCESS){//????????°?????????????????¨??????
        tail=0;
    }else{
        tail++;
    }
}

//?????\??????????????????????´??????????????????¢??°
Process dequeue(){
    Process x = Q[head];
    if(head+1 == MAX_PROCESS){//????????°?????????????????¨??????
        head=0;
    }else{
        head++;
    }
    return x;
}

int main(){
    int n,q,i,count=0;
    Process x;
    scanf("%d %d",&n,&q);   //??????????????°n??¨???????????????n?????\???
    
    for(i=0;i<n;i++){
        scanf("%s %d",x.name,&x.time);
        enqueue(x);         //?????\??????????´?x???????????????
    }
    
    while(1){
        x=dequeue();    //?????\????????????????´????????????????
        if(x.time<=q){  //???????????????????????????????????????????????\????????£?????´???
            count+=x.time;
            printf("%s %d\n",x.name,count);
        }else {         //?????????????????????????????????????????????????????§????????£?????´???
            count+=q;
            x.time-=q;
            enqueue(x); //???????????\?????´???
        }
        if(tail==head)break;//?????\??????head??¨tail????????´??????????????\??????????????????????????£????????´???break
    }
}

Measured memory_bytes: 3300
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vp;
set<char> st;
string s;
int main(int argc,char const* argv[])
{
  int a,b;
  cin >> a >> b;
  if(b<a)
    {
      cout << a-1 << endl;
    }
  else
    {
      cout << a << endl;
    }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
   int a, b, c, d;
   scanf("%d %d %d %d", &a, &b, &c, &d);
   if ( a + b == c + d && a * b == c * d ) printf("yes\n");
   else if ( a + c == b + d && a * c == b * d ) printf("yes\n");
   else if ( a + d == b + c && a * d == b * c ) printf("yes\n");
   else printf("no\n");
   return 0;
}

Measured memory_bytes: 1860
#include <cstdio>

int main()
{
	long long s, c; scanf("%lld%lld", &s, &c);
	if(c <= s * 2) printf("%lld\n", c >> 1);
	else printf("%lld\n", (c - s * 2) / 4 + s);

	return 0;
}

Measured memory_bytes: 128
fn main() {
    let s: String = read();
    if s == "ABC" {
        println!("{}", "ARC");
    } else {
        println!("{}", "ABC");
    }
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
int main(){
    
    int64_t N;
    cin >> N;
    int64_t sum = 0;
    vector<int64_t> vec(N);
    for(int i=0; i<N; i++){
        cin >> vec[i];
        sum += vec[i];
    }
    //回数の下限
    int64_t ans = sum - N*(N-1);
    int64_t cnt = 0;
    if(ans > 0){
      for(int i=0; i<N; i++){
        //全部+であればansだけ増える。結果として、N-1以下になればいい
        vec[i] += ans - (N-1);
        //その時に選ばないといけない回数。一回選ぶと+1がないのとN引かれるからN+1相当
        int64_t x = (vec[i] + N) / (N+1);
        vec[i] -= x*(N+1);
        cnt += x;
      }
    }
  
    if(cnt > ans && ans > 0){
      for(int i=0; i<N; i++){
         vec[i] += cnt - ans;
      }
    }
  
    ans = cnt;
   
   if(ans > 0){
     for(int i=0; i<N; i++){
       vec[i] += N-1;
     }
   }
  
    while(true){
      sort(vec.rbegin(),vec.rend());
      if(vec[0] < N){
        break;
      }
      vec[0] -= N;
      for(int i=1; i<N; i++){
        vec[i]++;
      }
      ans++;
    }
    
    cout << ans << endl;
    
}



Measured memory_bytes: 3576
program main
  implicit none
  integer :: n, k, i, j, p
  character(100000) :: s
  integer, allocatable :: jmax(:)
  read *, n, k
  read *, s

  allocate (jmax(n))
  j = 1
  p = 0
  if (s(1:1) == "0") p = 1
  do i = 1, n
    if (j < i) then
      j = i
      p = 0
      if (s(i:i) == "0") p = 1
    end if
    do while (j < n)
      if (s(j:j + 1) == "10" .and. p >= k) exit
      if (s(j:j + 1) == "10") p = p + 1
      j = j + 1
    end do

    jmax(i) = j
    if (i < n .and. s(i:i + 1) == "01") p = p - 1
  end do
  do i = 1, n
    jmax(i) = jmax(i) - i + 1
  end do
  print "(i0)", maxval(jmax)
end program main


Measured memory_bytes: 932
def search():
    for i in range(N - M + 1):
        for j in range(N - M + 1):
            if all(B[k] == A[i + k][j:j + M] for k in range(M)):
                return 'Yes'
    return 'No'


N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
print(search())


Measured memory_bytes: 2940
/**
*    author:  souzai32
*    created: 14.08.2020 17:06:40
**/

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

int main() {

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);
    sort(a.begin(),a.end());

    long long ans=1;
    if(n%2){
        if(a.at(0)!=0) ans=0;
        for(int i=1; i<n; i++){
            if(a.at(i)!=2*((i+1)/2)) ans=0;
            if(i%2==0) ans*=2;
            ans%=long(1e9+7);
        }
    }
    else{
        for(int i=0; i<n; i++){
            if(a.at(i)!=2*(i/2)+1) ans=0;
            if(i%2) ans*=2;
            ans%=long(1e9+7);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3732
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8');

_b(input);

function _b(input: string) {
  const [s, t] = input.split('\n');

  console.log(
    s
      .split('')
      .reduce((num, charS, index) => (charS !== t[index] ? num + 1 : num), 0)
  );
}


Measured memory_bytes: 34668
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
typedef pair<int,int> pii;
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/4
#define INTINF INT_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T &a, T b){if(a < b){a = b;return true;}return false;}
template<class T> inline bool chmin(T &a, T b){if(a > b){a = b;return true;}return false;}
/*----------------------------------------------------------------*/
const int MOD = 998244353;
// const int MOD = 1000000007;

/*----------------------------------------------------------------*/
signed main(){

	int n,a,b;
	cin >> n >> a >> b;
	string s;
	cin >> s;

	int cnt_a = 0;
	int cnt_b = 0;

	for(auto c:s){
		int x = cnt_a + cnt_b;
		if(c == 'a' && x < a+b){
			cnt_a++;
			cout << "Yes" << endl;
		}
		else if(c == 'b' && x < a+b && cnt_b < b){
			cnt_b++;
			cout << "Yes" << endl;
		}
		else cout << "No" << endl;
	}


	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=gnu++17 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://code-festival-2016-qualb.contest.atcoder.jp/tasks/codefestival_2016_qualB_b
// rm -r -f test;oj dl https://atcoder.jp/contests/code-festival-2016-qualb/tasks/codefestival_2016_qualB_b

Measured memory_bytes: 3748
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
void print(int A[], int n)
{
    for(int i = 0; i < n; i++)
    {
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int A[n + 1];
    for(int i = 0; i < n; i++) cin >> A[i];
    print(A, n);
    for(int i = 1; i < n; i++)
    {
        int a = i;
        int b = i - 1;
        while(A[a] < A[b] && b >= 0)
        {
            swap(A[a], A[b]);
            a--;
            b--;
        }
        print(A, n);
    }
    return 0;
}



Measured memory_bytes: 3172
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
MOD = 1000000007
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N=II()
S=input()
if (N%2):
    print("No")
    exit()

if S[:N//2] == S[N//2:]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <ctime>
#include <vector>
#include <queue>
#include <bitset>
#include <cmath>
#include <time.h>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>
#include <deque>
#include <iomanip>
#include <complex>
//#include <ext/rope>

using namespace std;
//using namespace __gnu_cxx;

//defines
typedef long long ll;
typedef long double ld;
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define fast_read cin.sync_with_stdio(0)
#define PREX(number) cout << fixed << setprecision(number)
#define nul point(0, 0)
#define random srand(time(NULL))
#define rand_int abs((rand() << 15) | rand())
#define str_to_int(stroka) atoi(stroka.c_str())
#define str_to_ll(stroka) atoll(stroka.c_str())
#define str_to_double(stroka) atof(stroka.c_str())
#define what_is(x) cerr << #x << " is " << x << endl
#define solve_system int number; cin >> number; forn(i, 0, number) solve()
#define solve_system_scanf int number; scanf("%d", &number); forn(i, 0, number) solve()

//easy functions
template< typename T >
T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template< typename T >
T lcm(T a, T b) { return (a / gcd(a, b)) * b; }
bool is_down(char x) { return ('a' <= x && x <= 'z'); }
bool is_upper(char x) { return ('A' <= x && x <= 'Z'); }
bool is_digit(char x) { return ('0' <= x && x <= '9'); }

//constants
const ld pi = 3.141592653589793238462643383279;
const ld log23 = 1.58496250072115618145373894394781;
const ld eps = 1e-8;
const ld zero = 0;
const ll INF = 1e18;
const int COUT = 30;
const int prost = 239;
const ll prost64 = 239;
const int two = 2;
const ll sr = 31;
const int MOD = 1e9 + 7;
const int BIG = 2 * 1e9 + 1;
const int alf = 26;
const int MAX_N = 1e5 + 10;
const int MAX_M = (1 << 20);
const int MAX_T = (1 << 22);
const int BLOCK = trunc(sqrt(MAX_N)) + 1;
const int MAX_LOG = 18;
const int km = (1 << 18);
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, 1, 0, -1};
const int dxo[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dyo[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int bit_max = 32;
const int dig = 10;
const string str_alf = "abcdefghijklmnopqrstuvwxyz";
const string str_alf_big = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int bt = 31;

// Code starts here

ll n, a[MAX_N];

int main()
{   /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif /**/
    fast_read;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    ll l = 2;
    ll r = 2;
    for (int i = n - 1; i >= 0; i--)
    {
        if (l % a[i] != 0)
            l = ((l + a[i] - 1) / a[i]) * a[i];
        r = (r / a[i]) * a[i];
        if (l > r)
        {
            cout << -1;
            return 0;
        }
        r += a[i] - 1;
    }
    cout << l << " " << r;
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
import java.lang.*;
import java.io.*;

class Main{
	public static void main(String[] args) {
	  Scanner sc=new Scanner(System.in);
      int n=sc.nextInt();
      if(n==0){
        System.out.println("1");
      }
      if(n==1){
        System.out.println("0");
      }
        
	}
}

Measured memory_bytes: 27012
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "NO" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ld,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N,m; cin>>N>>m;
    vector<ll> A(N);
    rep(i,N) {cin>>A[i]; --A[i];}
    ll sum=0;
    rep(i,N-1) {
        if(A[i]<A[i+1]) sum+=A[i+1]-A[i];
        else sum+=A[i+1]+m-A[i];
    }
    //(a->b]で 0,1,2,3... 0,0
    vector<ll> pot(m*2+2,0);
    vector<ll> hole(m*2+2,0);
    rep(i,N-1){
        if(A[i]<A[i+1]){
            ++pot[A[i]+2];
            --pot[A[i+1]+1];
            hole[A[i+1]+1]-=A[i+1]-A[i]-1;
        }
        else{
            ++pot[A[i]+2];
            --pot[A[i+1]+m+1];
            hole[A[i+1]+m+1]-=A[i+1]+m-A[i]-1;
        }
    }
    vector<ll> ans(m*2,0);
    ll poten=0;
    ll now=0;
    rep(i,m*2){
        poten+=pot[i];
        now+=poten;
        now+=hole[i];
        ans[i]=now;
    }
    rep(i,m) ans[i]+=ans[i+m];
    ll saidai=*(max_element(ALL(ans)));
    cout<< sum-saidai <<"\n";
    
}
 
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------

Measured memory_bytes: 5760
package main

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

func main() {
	sc := NewScanner()
	N := sc.NextInt()
	mn := N + 2
	for i := 1; i*i <= N; i++ {
		if N%i == 0 {
			mn = min(mn, i+N/i)
		}
	}
	fmt.Println(mn - 2)
}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define show(x) cout<<x<<'\n'
#define showh(x) cout<<x<<' '
#define go(i,a,n) for(ll i=a;i<n;i++)
#define gor(i,a,n) for(ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define mod 1000000007
bool prime[100001];
bool ispoweroftwo(ll x)
{
    return x && !(x & (x-1));
}
ll xorcal(ll n)
{
    if(n%4==0)
        return n;
    if(n%4==1)
        return 1;
    if(n%4==2)
        return n+1;
    if(n%4==3)
        return 0;
}
void sieve(ll n)
{
    memset(prime,true,sizeof(prime));
    prime[0]=false;
    prime[1]=false;
    for(ll i=2;i*i<=n;i++)
    {
        if(prime[i]==true)
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                prime[j]=false;
            }
        }
    }
    show(prime[89]);
}
bool isprime(ll n)
{
    if (n<=1) return false;
    if (n<=3) return true;

    if(n%2==0 or n%3==0) return false;

    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0 or n%(i+2)==0) return false;
    }
    return true;
}

ll modinverse(ll a,ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
      return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;

        m = a % m; a = t;
        t = y;

        y = x - q * y;
        x = t;
    }

    if (x < 0)
       x += m0;

    return x;
}

ll gcd(ll a,ll b)
{
    if(a==0)
    {
        return b;
    }
    return(b%a,a);
}

ll power(ll A, ll B)
{
    if (A == 0)
        return 0;
    if (B == 0)
        return 1;

    ll y;
    if (B % 2 == 0) {
        y = power(A, B / 2);
        y = (y * y) % mod;
    }

    else {
        y = A % mod;
        y = (y * power(A, B - 1) % mod) % mod;
    }

    return (ll)((y + mod) % mod);
}
int main()
{
    ios_base::sync_with_stdio(false);
    ll a,b,mul=2;
    cin>>a>>b;
    if(b==1)
    {
        show("0");
        exit(0);
    }
    if(a>=b)
    {
        show("1");
        exit(0);
    }
    ll cnt=a;
    cnt--;
    while(1)
    {
        cnt += a;
        if(cnt>=b)
        {
            break;
        }
        mul++;
        cnt--;
    }
    show(mul);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <list>
#include <queue>
using namespace std;

int inf = (1 << 30);
int mod = 1e9 + 7;
int64_t inf64 = (1LL << 60);

template <typename T>
T gcd(T a, T b) {
    if(b == 0) return a;
    else return gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
    T g = gcd(a, b);
    return a / g * b;
}

bool check(vector<int> a, int index, int key){
    if(a[index] >= key) return true;
    else return false;
}

int lower_bound(vector<int> a, int key){
    int left = -1, right = a.size();
    while(right - left > 1){
        int mid = left + (left + right) / 2;
        if(check(a, mid, key)) right = mid;
        else left = mid;
    }
    return right;
}

int main(){

    int N, M;
    cin >> N >> M;
    vector<string> A(N), B(M);
    for(int i = 0; i < N; i++) cin >> A[i];
    for(int i = 0; i < M; i++) cin >> B[i];

    string ans = "No";
    for(int i = 0; i <= N - M; i++){
        for(int j = 0; j <= N - M; j++){
            bool flag = true;
            for(int x = 0; x < M; x++){
                for(int y = 0; y < M; y++){
                    if(A[i + x][j + y] != B[x][y]) flag = false;
                }
            }
            if(flag) ans = "Yes";
        }
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main(){

	int n;
	long long int ans=0;
	vector<long long int> a, b;

	cin>> n;
	a.resize(n+1);
	b.resize(n);

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

	for(int i=n-1;i>=0;i--){
		if(a[i]+a[i+1]<=b[i]){
			ans+=a[i]+a[i+1];
			a[i]=0;
			a[i+1]=0;
		}else if(a[i+1]<=b[i]){
			ans+=a[i+1];
			b[i]-=a[i+1];
			a[i+1]=0;
			ans+=min(a[i], b[i]);
			a[i]-=min(a[i], b[i]);
		}else{
			ans+=min(a[i+1], b[i]);
			a[i+1]-=min(a[i+1], b[i]);
		}
	}

	cout<< ans << endl;

}

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

int n;
long long d[100][100];
const long long INF=1LL<<32;

void floyd(){
    REP(k,n){
        REP(i,n){
            if(d[i][k]==INF)continue;
            REP(j,n){
                if(d[k][j]==INF)continue;
                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }
}

int main(){
    int e,u,v,c;
    scanf("%d%d",&n,&e);
    REP(i,n){
        REP(j,n){
            d[i][j]=(i==j?0:INF);
        }
    }
    REP(i,e){
        scanf("%d%d%d",&u,&v,&c);
        d[u][v]=c;
    }
    floyd();
    bool flag=false;
    REP(i,n) if(d[i][i]<0) flag=true;
    if(flag){
        printf("NEGATIVE CYCLE\n");
    }else{
        REP(i,n){
            REP(j,n){
                if(j) printf(" ");
                if(d[i][j]==INF) printf("INF");
                else printf("%d",d[i][j]);
            }
            puts("");
        }
    }
    return 0;
}




Measured memory_bytes: 3300
#include <iostream>

using namespace std;

#define ROUNDUP(n) ((n + 2 - 1) / 2 * 2)

int main(int argc, char* argv[])
{
  unsigned long A, B; cin >> A >> B;

  unsigned long cnt_pair;
  if (A % 2 == 0) {
    cnt_pair = (ROUNDUP(B) - A) / 2;
  } else {
    cnt_pair = (B - A) / 2;
  }

  unsigned long ans;
  if (cnt_pair < 2) {
    ans = A;
    for (int i = A + 1; i <= B; i++) {
      ans ^= i;
    }
  } else {
    ans = (cnt_pair % 2 == 1) ? 1 : 0;
    if (A % 2 == 0) {
      if (B % 2 == 0) {
	ans ^= B;
      }
    } else {
      ans ^= A;
      if (B % 2 == 0) {
	ans ^= B;
      }
    }
    
  }
  cout << ans << endl;
  return 0;
}
  


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[3];
int read()
{
	char c=getchar();int x=0,f=1;
	while(c>'9'||c<'0'){if(c='-'){f=-1;}c=getchar();}
	
	while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return x*f;
}
int main()
{
	for(int i=1;i<=3;i++)cin>>a[i];
	sort(a+1,a+4);
	cout<<a[1]+a[2]<<endl;
	return 0;
	
}

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

int main(){
    
    cout << fixed << setprecision(12);
    
    double PI = acos(-1);
    double r;
    
    cin >> r;
    
    cout << r * r * PI <<  " ";
    cout << r * 2 * PI << endl;
    
    
    return 0;
}


Measured memory_bytes: 3212
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

using ll = long long;
using ld = long double;
using ull = unsigned long long;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

const int N = 512000;

int ans[N];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cout.setf(ios::fixed), cout.precision(20);
    string s;
    cin >> s;
    int n = s.size() + 1;
    int cur = 0;
    for (int i = 0; i < n - 1; ++i) {
        if (s[i] == '<') {
            ++cur;
        } else {
            cur = 0;
        }
        ans[i + 1] = max(ans[i + 1], cur);
    }
    cur = 0;
    for (int i = n - 2; i >= 0; --i) {
        if (s[i] == '>') {
            ++cur;
        } else {
            cur = 0;
        }
        ans[i] = max(ans[i], cur);
    }
    ll sum = 0;
    for (int i = 0; i < n; ++i) {
        sum += ans[i];
    }
    cout << sum << "\n";
	return 0;
}




Measured memory_bytes: 2844
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define nt _int128
#define mod 1000000007
int main()
{
// #ifndef ONLINE_JUDGE
//        freopen("input.txt","r",stdin);
//     freopen("output.txt","w",stdout);
// #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    // cin >> t;
    t  = 1;
    while(t--)
    {
        ll n,m;
        cin>>n>>m;
        char arr[n+1][m+1];
        for(ll i=1;i<=n;i++)
        {
            for(ll j=1;j<=m;j++)
                cin>>arr[i][j];
        }
        ll dp[n+1][m+1];
        memset(dp,0,sizeof(dp));
        dp[1][1]=1;
        for(ll i=2;i<=m;i++)
        {
            if(arr[1][i]=='.')
                dp[1][i]=dp[1][i-1];
        }
        for(ll i=2;i<=n;i++)
        {
            if(arr[i][1]=='.')
                dp[i][1]=dp[i-1][1];
        }
        for(ll i=2;i<=n;i++)
        {
            for(ll j=2;j<=m;j++)
            {
                if(arr[i][j]=='.')
                    dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
            }
        }
        cout<<dp[n][m];

    }
    return 0;
}

Measured memory_bytes: 9088
#include "bits/stdc++.h"

#define rep(i,n) for(int i = 0;i<n;i++)
#define vv(Type,Name, n,m,d)vector<vector<Type>> Name(n, vector<Type>(m, d))
#define P pair
using namespace std;
using ll = long long;


int main(void) {

	ios::sync_with_stdio(false);
	cin.tie(0);

	ll n;
	cin >> n;
	if (n % 2) {
		cout << 0 << endl;
		return 0;
	}

	ll ans = 0; 
	ll div = 2;
	while (div <= n) {
		ll tmp = n / (div *= 5);

		ans += tmp;

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


Measured memory_bytes: 3692
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<int> vi;

#define rep(i, n) for(int i = 0, i##_len=(n); i < i##_len; i++)
#define all(x) (x).begin(), (x).end()
#define SIZE(x) ((int)(x).size())

int main(void)
{
  // code begin

  int n, a;
  vi as;
  cin >> n;
  rep(i, n){
    cin >> a;
    as.push_back(a);
  }

  set<int> vset;
  for(const int i: as)
    vset.insert(i);

  vi vs(vset.begin(), vset.end());
  sort(all(vs));

  int ma1 = vs[vs.size() - 1];
  int ma2 = vs[vs.size() - 2];

  if(count(all(as), ma1) >= 2){
    rep(i, as.size()){
      cout << ma1 << endl;
    }
  }
  else{
    for(const int i: as){
      if(i == ma1){
        cout << ma2 << endl;
      }else{
        cout << ma1 << endl;
      }
    }
  }


  // code end
  return 0;
}


Measured memory_bytes: 9588