akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	string s;
	cin >> s;

	int cnt = 0, cnt2 = 0;
	rep (i, n) {
		if (s[i] == 'a') {
			if (cnt < a + b) {
				cnt++;
				cout << "Yes" << endl;
			}
			else cout << "No" << endl;
		}
		else if (s[i] == 'b') {
			cnt2++;
			if (cnt < a + b && cnt2 <= b) {
				cnt++;
				cout << "Yes" << endl;
			}
			else cout << "No" << endl;
		}
		else cout << "No" << endl;
	}

	return 0;
}

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

int H;
int W;
int main()
{

	
	vector<vector<int>> map;


	cin >> H >> W;

	for(int i = 0; i < H; i++)
	{
		vector<int> line;
		for(int j = 0; j < W; j++)
		{
			int cleanState;
			cin >> cleanState;
			if(H == 1 && W == 1)
			{
				cout << (cleanState == 1 ? 0 : 1) << endl;
				return 0;
			}
			else if(H == 1 || W == 1)
			{
				if(cleanState == 1)
				{
					cout << 1 << endl;
					return 0;
				}
			}
			line.push_back(cleanState == 1 ? 0 : 1 );
		}
		map.push_back(line);
	}
	if(H == 1 || W == 1)
	{
		cout << 0 << endl;
		return 0;
	}
	int max = 0;
	for(int i = 1; i < H; i++)
	{
		for(int j = 1; j < W; j++)
		{
			if(map[i][j] == 0)
			{
				continue;
			}
			int min = 1500;
			min = min < map[i - 1][j] ? min : map[i - 1][j];
			min = min < map[i][j-1] ? min : map[i][j-1];
			min = min < map[i - 1][j-1] ? min : map[i - 1][j-1];
			map[i][j] = min + 1;
			max = max < min + 1 ? min + 1 : max;
		}
	}
	cout << max * max << endl;

}

Measured memory_bytes: 10476
N = int(input())
a = [int(input()) for _ in range(N)]

cnt, i = 0, 0
for j in range(len(a)):
    cnt += 1
    if a[i] == 2:
        print(cnt)
        #break
        quit()
    else:
        i = a[i] - 1
print(-1)

Measured memory_bytes: 7084
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int way = 0;

		while(true) {
			int n = scan.nextInt();
			int x = scan.nextInt();

			if(n == 0 && x == 0) {
				break;
			}

			way = 0;
			for(int i = 1; i <= n; i++) {
				for(int j = i + 1; j <= n; j++) {
					for(int k = j + 1; k <= n; k++) {
						if(i + j + k == x) {
							way++;
						}
					}
				}
			}
			System.out.println(way);
		}

		scan.close();
	}
}


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

  string result = "Three";
  
  string arare;
  
  for ( int i = 0; i< N; i++){
    cin >> arare;
    if(arare == "Y"){
      result = "Four";
      break;
    }
  }
  cout << result << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

vector<vi> g, row, col;

int r(int i, int j, int cnt) {
  int ni = i + 0;
  int nj = j + 1;
  if(row[ni][nj] == -1) {
    row[i][j] = cnt;
    return cnt;
  } else {
    row[i][j] = r(ni, nj, cnt + 1);
    return row[i][j];
  }
}

int c(int i, int j, int cnt) {
  int ni = i + 1;
  int nj = j + 0;
  if(col[ni][nj] == -1) {
    col[i][j] = cnt;
    return cnt;
  } else {
    col[i][j] = c(ni, nj, cnt + 1);
    return col[i][j];
  }
}

int main() {
  int h, w;
  cin >> h >> w;
  g = vector<vi>(h + 2, vi(w + 2, -1));
  rep2(i, 1, h + 1) rep2(j, 1, w + 1) {
    char c;
    cin >> c;
    if(c == '.') g[i][j] = 0;
  }
  row = g;
  col = g;
  rep2(i, 1, h + 1) rep2(j, 1, w + 1) if(row[i][j] == 0) r(i, j, 0);
  rep2(j, 1, w + 1) rep2(i, 1, h + 1) if(col[i][j] == 0) c(i, j, 0);
  int ans = 0;
  rep2(i, 1, h + 1) rep2(j, 1, w + 1) ans = max(ans, row[i][j] + col[i][j] + 1);
  cout << ans << endl;
}

Measured memory_bytes: 47488
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

s = int(sys.stdin.readline())
hist = {s}
i = 2
while True:
    if s % 2 == 0:
        s //= 2
    else:
        s = s * 3 + 1
    if s in hist:
        print(i)
        break
    hist.add(s)
    i += 1


Measured memory_bytes: 13560
#include <iostream>
#include<vector>
#include <math.h>
#include<stdio.h>
#include <climits>
#include<algorithm>
#include<string>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define LL  long long 
#define Pi 3.14159265358979;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string s;
	int i = 0, j = 0,k = 0;//ループ用配列
	int sa[101] = {};
	int ans = 0;

	cin >> s;

	cout << s[0] << s[1] << s[2] << "\n";

}


Measured memory_bytes: 3648
import java.util.*;
 
public class Main {
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] strs = new String[n];
		for(int i=0; i<n; i++){
			strs[i] = sc.next();
		}
		Map<String, Integer> map = new HashMap<>();
		for(String str: strs){
			char[] chs = new char[str.length()];
			for(int i=0; i<str.length(); i++){
				chs[i] = str.charAt(i);
			}
			Arrays.sort(chs);
			String sorted = new String(chs);
			Integer count = map.get(sorted);
			if(count == null) {
				map.put(sorted, 1);
			} else {
				map.put(sorted, count+1);
			}
		}
		long ans = 0;
		for (long i : map.values()) {
			if(i>1){
				ans += i*(i-1)/2;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 53596
#include<bits/stdc++.h>
using namespace std;
void fun(vector<int> g[],vector<vector<long long int>>& dp, int s,int* vis)
{
vis[s]=1;
for(auto x:g[s])
{
if(vis[x]==0)
{fun(g,dp,x,vis);
dp[s][0]*=(dp[x][0]+dp[x][1]);
dp[s][1]*=dp[x][0];
dp[s][0]%=1000000007;
dp[s][1]%=1000000007;
}
}
}
int main()
{
int n;cin>>n;
vector<int> g[n+1];
for(int i=0;i<n-1;++i)
{
int a,b;
cin>>a>>b;
g[a].push_back(b);
g[b].push_back(a);
}
int vis[n+1];
memset(vis,0,sizeof(vis));
vector<vector<long long int>> dp(n+1,vector<long long int> (2,1));
fun(g,dp,1,vis);
cout<<(dp[1][0]+dp[1][1])%1000000007<<endl;
}


Measured memory_bytes: 18560
N,M=map(int,input().split())
ab=[tuple(map(int,input().split())) for i in range(M)]

ab.sort()
l=1
r=N
ans=1
for a,b in ab:
  l=max(a,l)
  r=min(b,r)
  if l>=r:
    ans+=1
    l=a
    r=b
print(ans)
  


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

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int gcd(int a, int b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
int digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}



int main() {
	ll m, a, r, c, h;
	char unko[5] = { 'M','A','R','C','H' };
	ll cnt[5] = {};
	int n;
	cin >> n;
	REP(i, n) {
		string s;
		cin >> s;
		REP(j, 5) {
			if (s[0] == unko[j])cnt[j]++;
		}
	}
	ll ans = 0;
	REP(i, 3) {
		FOR(j, i + 1, 4) {
			FOR(k, j + 1, 5)ans += cnt[i] * cnt[j] * cnt[k];
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    ll N, M;
    cin >> N >> M;
    if (N > M) swap(N, M);
    if (N == 1 && M == 1) { cout << 1 << '\n'; }
    else if (N == 1) {
        cout << M - 2 << '\n';
    }
    else {
        cout << (N - 2) * (M - 2) << '\n';
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int M[101][101];

int main() {
  int h,w;
  cin >> h >> w;
  int n;
  cin >>n;
  
  
  vi a(n);
  rep(i,n)cin >> a[i];

  int now = 0;
  rep(i,h){
    rep(j,w){
      while(a[now]==0)now++;
      int c = now+1;
      if(i%2)M[i][w-1-j] = c;
      else 
      M[i][j] = c; 
      a[now]--;
    }
  }
  rep(i,h){
    rep(j,w)cout<<M[i][j]<<" ";
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define F first
#define S second
#define vi vector<int>
#define vl vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define abu ios_base::sync_with_stdio(0)
#define said cin.tie(0)
using namespace std;
ll const MOD = 1000000007;

void yes(){
    cout<<"YES"<<'\n';
}

void no(){
    cout<<"NO"<<'\n';
}

ll fact(int n){
    ll ans = 1;
    for(int i=2;i<=n;i++){
        ans = (ans*i)%MOD;
    }

    return ans;
}

ll powM(int n, int x){
    if(x==0){
        return 1;
    }
    if(x==1){
        return n%MOD;
    }

    if(x%2==0){
        ll a = powM(n,x/2);
        return (a*a)%MOD;
    }else{
        return (n*powM(n,x-1))%MOD;
    }
}

ll C(int n, int k){
    return (fact(n) * powM((fact(k)*fact(n-k))%MOD,MOD-2))%MOD;
}

ll A(int n, int k){
    return (fact(n) * powM(fact(n-k)%MOD,MOD-2))%MOD;
}

void add_self(int &a, int b){
    a += b;
    if(a>=MOD){
        a-=MOD;
    }
}

void sub_self(int &a, int b){
    a -= b;
    if(a<0){
        a+=MOD;
    }
}

ll const MAXN = 300100;
long long t[4*MAXN],a[MAXN+10];


void build(int v, int tl, int tr){
    if(tl==tr){
        t[v] = a[tl];
        return;
    }else{
        int tm = (tl+tr)/2;
        build(2*v,tl,tm);
        build(2*v+1,tm+1,tr);
        t[v] = max(t[2*v],t[2*v+1]);
        return;
    }
}

void change(int v, int tl, int tr, int pos, ll x){
    if(tr<pos || pos < tl){
        return;
    }
    if(tl==tr){
        a[tl]=x;
        t[v]=x;
        return; 
    }
    int tm = (tl+tr)/2;
    change(v*2,tl, tm,pos,x);
    change(v*2+1,tm+1,tr,pos,x);
    t[v] = max(t[v*2],t[v*2+1]);
}

long long sum(int v, int tl, int tr, int l, int r){
    if(tr<l || r<tl){
        return -999999999999;
    }
    if(l <= tl && tr <= r){
        return t[v];  
    }   
    //push(v,tl,tr);
    int tm = (tl+tr)/2;
    long long sl = sum(v*2,tl,tm,l,r);
    long long sr = sum(v*2+1,tm+1,tr,l,r);
    return max(sl,sr);
    
}





void solve(){
    int n;
    cin>>n;
    vl h(n+1);
    for(int i=1;i<=n;i++){
        cin>>h[i];
    }
    vl b(n+1);
    for(int i=1;i<=n;i++){
        cin>>b[i];
    }
    build(1,0,n);
    for(int i=1;i<=n;i++){
        ll best = sum(1,0,n,0,h[i]-1);
        change(1,0,n,h[i],best+b[i]);
        
    }
    cout<<sum(1,0,n,1,n)<<'\n';

}

int main(){
    abu;
    said;
    int t = 1;
    //cin>>t;
    while(t--){
        solve();
    }

    return 0;
}


Measured memory_bytes: 11136
#include <stdio.h>

int main(void)
{
    int n;
    int a, b, c;
    int i;

    scanf("%d", &n);
    for (i = 0; i < n; i++){
        scanf("%d %d %d", &a, &b, &c);

        if (a * a + b * b == c * c){
            printf("YES\n");
        }
        else if (b * b + c * c == a * a){
            printf("YES\n");
        }
        else if (c * c + a * a == b * b){
            printf("YES\n");
        }
        else {
            printf("NO\n");
        }
    }

    return (0);
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;

int n, m;
vector<int> a[N];

bool c[N];
int dp[N];

void dfs(int x)
{
    if (c[x])
        return;
    c[x] = true;
    for (int i = 0; i < a[x].size(); ++i)
    {
        int h = a[x][i];
        dfs(h);
        dp[x] = max(dp[x], dp[h] + 1);
    }
}

int main()
{
    cin >> n >> m;
    while (m--)
    {
        int x, y;
        cin >> x >> y;
        a[x].push_back(y);
    }
    for (int i = 1; i <= n; ++i)
    {
        dfs(i);
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i)
        ans = max(ans, dp[i]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8192
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int n = sc.nextInt();
			if(n==0) break;
			for(int i=0;i<n;i++){
				int[] a = new int[4];
				int[] b = new int[4];
				int[] c = new int[4];
				for(int j=0;j<4;j++) a[j] = sc.nextInt();
				for(int j=0;j<4;j++) b[j] = sc.nextInt();
				c[0] = a[0]*b[0] - a[1]*b[1] - a[2]*b[2] - a[3]*b[3];
				c[1] = a[0]*b[1] + a[1]*b[0] + a[2]*b[3] - a[3]*b[2];
				c[2] = a[0]*b[2] + a[2]*b[0] + a[3]*b[1] - a[1]*b[3];
				c[3] = a[0]*b[3] + a[3]*b[0] + a[1]*b[2] - a[2]*b[1];
				System.out.println(c[0] + " " + c[1] + " " + c[2] + " " + c[3]);
			}
		}
	}	
}

Measured memory_bytes: 23560
import java.util.*;
import java.math.*;
import java.lang.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		double t = sc.nextInt();
		double a = sc.nextInt();
		// List<Integer> list = new ArrayList<>();
		double minDiffT = 100000;
		int minI = 0;

		for(int i=0;i<n;i++){
			double currentH = sc.nextInt();
			// list.add(sc.nextInt());
			double currentDiff = Math.abs(t - currentH * 0.006-a);
			
			if(currentDiff<minDiffT){
				minDiffT  = currentDiff;
				minI = i+1;
			}
			
		}
			
		System.out.println(minI);

	}
}

Measured memory_bytes: 23124
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string.h>
using namespace std;
main()
{
    int i, j, k, m, n, ans, cnt = 0;
    vector<int> v;
    int x,a;
    cin >> x >> a;
    if( x < a ) puts("0");
    else puts("10");
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
		String str = String.valueOf(N);
      	for(int i=0; i<3;  i++){
			if(str.charAt(i)=='7'){
              	System.out.println("Yes");
              	return;
            }
        }
      
      	System.out.println("No");
        return;
	}
}


Measured memory_bytes: 35812
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <set>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


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

    // input
    int N;
    cin >> N;
    int sum = 0;
    
    REPN(i, N) {
        sum += i;
    }
    cout << sum << "\n";
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
    freopen("a.in","r",stdin);
    #endif
    string s,t;
    cin>>s>>t;
    cout<<t+s;



}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int ans=0;
    char s[5];
    scanf("%s",&s);

    for(int i=0;i<4;i++){
        if(s[i]=='+') ans++;
        if(s[i]=='-') ans--;
    }
    printf("%d\n",ans);
    return 0;
}


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

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

int main(){
	int a,b,g,l;
	while(cin>>a>>b){
		g=gcd((a>=b)?a:b,(a>=b)?b:a);
		l=(a/g)*b;
		cout<<g<<" "<<l<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main(void){
    
    
    static int A[7] = {1, 3, 5, 7, 8, 10, 12};
    static int B[4] = {4, 6, 9, 11};
    
    int x, y;
    bool b_X = false;
    bool b_Y = false;
    cin >> x >> y;
    
    if(x == 2 || y == 2){
        cout << "No" << endl;
        return 0;
    }
    
    for(int i = 0; i < 4; i++){
        if(x == B[i]) b_X = true;
        if(y == B[i]) b_Y = true;
    }
    
    if(b_X && b_Y){
        cout << "Yes" << endl;
        return 0;
    }
    
    b_X = false, b_Y = false;
    
    for(int i = 0; i < 7; i++){
        if(x == A[i]) b_X = true;
        if(y == A[i]) b_Y = true;
    }
    
    if(b_X && b_Y) cout << "Yes" << endl;
    else cout << "No" << endl;
    
} 


Measured memory_bytes: 256
#include<cstdio>
const int MAXN=2005;

int N,M,Q;
bool grid[MAXN][MAXN];

int V[MAXN][MAXN],E1[MAXN][MAXN],E2[MAXN][MAXN];

int main()
{
	scanf("%d%d%d",&N,&M,&Q);
	for(int i=1;i<=N;i++)
		for(int j=1,x;j<=M;j++)
		{
			scanf("%1d",&x);
			grid[i][j]=x;
		}
	for(int i=1;i<=N;i++)
		for(int j=1;j<=M;j++)
			V[i][j]=V[i-1][j]+V[i][j-1]-V[i-1][j-1]+grid[i][j];
	for(int i=1;i<=N;i++)
		for(int j=1;j<=M;j++)
			E1[i][j]=E1[i-1][j]+E1[i][j-1]-E1[i-1][j-1]+(grid[i][j]&&grid[i][j-1]);
	for(int i=1;i<=N;i++)
		for(int j=1;j<=M;j++)
			E2[i][j]=E2[i-1][j]+E2[i][j-1]-E2[i-1][j-1]+(grid[i][j]&&grid[i-1][j]);
	
	while(Q--)
	{
		int x1,y1,x2,y2;
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		printf("%d\n",
		(V[x2][y2]-V[x2][y1-1]-V[x1-1][y2]+V[x1-1][y1-1])
		-(E1[x2][y2]-E1[x2][y1]-E1[x1-1][y2]+E1[x1-1][y1])
		-(E2[x2][y2]-E2[x2][y1-1]-E2[x1][y2]+E2[x1][y1-1]));
	}
	
	return 0;
}


Measured memory_bytes: 52736
import java.util.*;
import java.io.*;

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        int x=fsc.nextInt(), y=fsc.nextInt();
        fsc.close();
        HashSet h1=new HashSet();
        h1.add(1);
        h1.add(3);
        h1.add(5);
        h1.add(7);
        h1.add(8);
        h1.add(10);
        h1.add(12);
        HashSet h2=new HashSet();
        h2.add(4);
        h2.add(6);
        h2.add(9);
        h2.add(11);
        HashSet h3=new HashSet();
        h3.add(2);
        if(h1.contains(x) && h1.contains(y)){
            System.out.println("Yes");
        }
        else if(h2.contains(x) && h2.contains(y)){
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


Measured memory_bytes: 19156
#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);
}

void test()
{
   long long a,b,x,res;
   cin>>a>>b>>x;

   res=b/x-a/x;
   
   if(a%x==0)
    res++;
   
   cout<<res;

}

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

    test();

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  priority_queue<int, vector<int>, greater<int>> q;
  vector<double> C(N);
  for (int i = 0; i < N; i++) {
    cin >> C.at(i);
    q.push(C.at(i));
  }
  int m1 = q.top();
  q.pop();
  int m2 = q.top();
  for (long long int i = m2; i > 0; i--) {
    int count = 0;
    for (int j = 0; j< N; j++) {
      double a = C.at(j) / i;
      int A = C.at(j) / i;
      if (A == a) {
        count++;
      }
    }
    if (count >= N - 1) {
      printf("%lld\n", i);
      break;
    }
  }
}

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

const int M = 105;


int dp[M][M][2];

int K;


int countInRangeUtil(int pos, int cnt, int tight,
					vector<int> num)
{
	
	if (pos == num.size()) {

		if (cnt <= K)
			return 1;
		return 0;
	}

	
	if (dp[pos][cnt][tight] != -1)
		return dp[pos][cnt][tight];

	int ans = 0;


	int limit = (tight ? 9 : num[pos]);

	for (int dig = 0; dig <= limit; dig++) {
		int currCnt = cnt;

		if (dig != 0)
			currCnt++;

		int currTight = tight;


		if (dig < num[pos])
			currTight = 1;


		ans += countInRangeUtil(pos + 1, currCnt,
								currTight, num);
	}
	return dp[pos][cnt][tight] = ans;
}

int countInRange(string& x)
{
	vector<int> num;
	for(int i=0; i<x.size(); ++i){
		num.push_back(x[i]-'0');
	}
	memset(dp, -1, sizeof(dp));
	return countInRangeUtil(0, 0, 0, num);
}


int main()
{
	string x;
	cin>>x;
	cin>>K;
	if( K == 1 ){
		cout<<countInRange(x)-1<<'\n';
	}else if( K == 2 ){
		int a1 = countInRange(x);
		K = 1;
		cout<<a1 - countInRange(x)<<'\n';
	}else if( K == 3 ){
		int a1 = countInRange(x);
		K = 2;
		int a2 = countInRange(x);
		cout<<a1 - a2 << '\n';
	}
	return 0;
}


Measured memory_bytes: 384
N = int(input())
data = []
for _ in range(N):
    x, y, h = map(int, input().split())
    data.append((x, y, h))

data = sorted(data, key=lambda x: x[2], reverse=True)
    
halt = False
for i in range(100+1):
    for j in range(100+1):
        x, y, h = data[0]
        H = h + abs(x - i) + abs(y - j)
        for x, y, h in data[1:]:
            if h != max(0, H - abs(x- i) - abs(y - j)):
                break
        else:
            print(i, j, H)
            halt = True
        if halt:
            break
    if halt:
        break

Measured memory_bytes: 3188
#include <stdio.h>
 
int main(void) {
  int H , W,i,j;
 
  while(1){
    scanf("%d %d",&H,&W);
    if(H == 0 && W == 0) {
      break;
    }
    for(j=0; j<H; j++) {
      for(i=0; i<W; i++) {
    printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
 
}


Measured memory_bytes: 2096
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <string.h>
#include <vector>

using namespace std;
int main() {
    int A,B;
    string ans;
    cin >> A >> B;
    cout << (max({A+B,A-B,A*B})) << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque
S = deque(input())
Q = int(input())
# queries = list(list(input().split()) for _ in range(Q))  # 後でroop回し直すのは2度手間

reverse = 0
# for query in queries:
for query in sys.stdin:
    if query[0] == '1':  # len(query)は改行記号の有無で変わるのでダメ
        reverse = 1 - reverse

    else:
        _, f, c = query.split()
        is_append_left = (reverse + int(f)) % 2
        if is_append_left:
            S.appendleft(c)  # listだとO(n)だが，dequeではO(1)
        else:
            S.append(c)

if reverse:  # reverse処理は重い．実際，最後の一回で良い．
    S.reverse()

print(''.join(S))

Measured memory_bytes: 8436
MOD = 10**9 + 7

fact = [1] * 2200000
invfact = [1] * 2200000

for i in range(1, 2200000):
    fact[i] = fact[i-1] * i % MOD

invfact[2200000 - 1] = pow(fact[2200000 - 1], MOD-2, MOD)

for i in range(2200000-1, 0, -1):
    invfact[i-1] = invfact[i] * i % MOD


def nCk(n, k):
    return fact[n] * invfact[k] * invfact[n-k] % MOD


k = int(input())
n = len(input())

ans = 0

for l in range(n, n+k+1):
    ans += pow(25, l - n, MOD) * nCk(l-1, n-1) * pow(26, n+k-l, MOD) % MOD
    ans %= MOD

print(ans)

Measured memory_bytes: 120304
S=input()
if S[0]=="A":
  c=0
  d=0
  for x in range(2,len(S)-1):
    if S[x].islower():
      d+=1
    if S[x]=="C":
      c+=1
  if c==1 and d==len(S)-4 and S[1].islower() and S[len(S)-1].islower():
    print("AC")
  else:
    print("WA")
else:
  print("WA")
  

Measured memory_bytes: 9028
# https://atcoder.jp/contests/abc098/tasks/abc098_a

if ARGV[0]=="LOCAL_DEV"
  define_method("debug") do |var|
    p var
  end
else
  define_method("debug") do |var|
  end
end

X=STDIN.gets.strip.to_i
a=X/11

a*=2
b=X%11
if b>6
  a+=2
elsif b>0
  a+=1
end
puts a




Measured memory_bytes: 1788
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())


for _ in range(N):
    B = int(input())
    for i in range(3):
      for j in range(3):
          if A[i][j] == B:
              A[i][j] = 0
        
bingo = False
for row in A:
  if sum(row) == 0:
    bingo = True
for col in zip(*A):
  if sum(col) == 0:
    bingo = True
if sum(A[i][i] for i in range(3)) == 0:
  bingo =True
if sum(A[i][3 - i - 1] for i in range(3)) == 0:
  bingo = True
  
print("Yes" if bingo == True else "No")

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

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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;
const int INF = 1e9;

struct Edge{
  int to, cap, cost, rev;
  Edge(int to_=0, int cap_ = 0, int cost_ = 0, int rev_ = 0)
	:to(to_), cap(cap_), cost(cost_), rev(rev_){}
};

const int MAX_V = 200*200*2;
int A, B, K;
int V;
vector<Edge> G[MAX_V];
int h[MAX_V]; // ??????????????£???
int dist[MAX_V];
int prevv[MAX_V], preve[MAX_V]; //??´??????????????¨???

void add_edge(int from, int to, int cap, int cost){
  G[from].push_back(Edge(to, cap, cost, G[to].size()));
  G[to].push_back(Edge(from, 0, -cost, G[from].size()-1));
}

int min_cost_flow(int s, int t){
  int res = 0, f = 0;
  fill(h, h+V, 0);
  for(;;){
	priority_queue<PII,vector<PII>,greater<PII>> pq;
	fill(dist, dist+V, INF);
	pq.push(PII(0,s));
	dist[s] = 0;
	while(!pq.empty()){
	  PII p = pq.top(); pq.pop();
	  int v = p.second;
	  if(dist[v] < p.first) continue;
	  for(int i=0;i<G[v].size();++i){
		Edge& e = G[v][i];
		if(e.cap > 0 && dist[v] + e.cost + h[v] - h[e.to] < dist[e.to]){
		  dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
		  prevv[e.to] = v;
		  preve[e.to] = i;
		  pq.push(PII(dist[e.to], e.to));
		}
	  }
	}
	if(dist[t] == INF) break;

	for(int v=0;v<V;++v) h[v] += dist[v];
	int d = INF;
	for(int v=t;v!=s;v=prevv[v])
	  d = min(d, G[prevv[v]][preve[v]].cap);

	res += d * h[t];
	for(int v=t;v!=s;v=prevv[v]){
	  Edge& e = G[prevv[v]][preve[v]];
	  e.cap -= d;
	  G[v][e.rev].cap += d;
	}
	if(res > K) break;
	f += d;
  }
  
  return f;
}

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

  cin >> A >> B >> K;
  int S = 0, T = A+B+A*B+1;
  V = A+B+A*B+2;
  int ans = 0;
  VS as(A), bs(B);
  REP(i,A) cin >> as[i];
  REP(i,B) cin >> bs[i];
  
	REP(i,MAX_V) G[i].clear();
	FOR(i,1,A+1) add_edge(S,i,1,0);
	FOR(i,1,B+1) add_edge(A+i,T,1,0);
	REP(i,A){
	  REP(j,B){
		int t = A+B+i*B+j+1;
		add_edge(1+i,t,1,as[i][j]-'0');
	  }
	}
	REP(j,B){
	  REP(i,A){
		int t = A+B+i*B+j+1;
		add_edge(t,A+1+j,1,bs[j][i]-'0');
	  }
	}
	int c = min_cost_flow(S,T);

  cout << c << endl;
  return 0;
}

Measured memory_bytes: 10144
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
#include <string.h>
#include <cstring>
#include <queue>
 

using namespace std;

int main() {
    int  x, y;
    cin >> x >> y;
        
    for(int i=0; i<100; i++){
        for(int j=0;j<100; j++){
            if(i+j==x){
                if(2*i+4*j==y){
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl;
    return 0;
 }


Measured memory_bytes: 3632
from collections import Counter
def main():
    S=input()
    remainders=[0]
    sub=0
    pow10=1
    for i in range(len(S)-1,-1,-1):
        remainders.append((remainders[-1]+pow10*int(S[i]))%2019)
        pow10=((pow10%2019)*(10%2019))%2019
    d=Counter(remainders)
    ans=0
    for key in d:
        ans+=(d[key]*(d[key]-1))//2
    print(ans)
if __name__=='__main__':
    main()

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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a[] =new int[5];
        for (int i =0;i<a.length;i++){
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        System.out.println(a[4]+" "+a[3]+" "+a[2]+" "+a[1]+" "+a[0]);
    }
}

Measured memory_bytes: 17308
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    char b;
    cin >> b;
    if (b == 'A')
        cout << 'T' << endl;
    if (b == 'T')
        cout << 'A' << endl;

    if (b == 'G')
        cout << 'C' << endl;
    if (b == 'C')
        cout << 'G' << endl;

    return 0;
}

Measured memory_bytes: 256
W, H, N = map(int, input().split())
array = [list(map(int, input().split())) for i in range(N)]

xmin = 0
xmax = W
ymin = 0
ymax = H
for i in range(N):

    if array[i][2] == 1:
        xmin = max(xmin, array[i][0])
    elif array[i][2] == 2:
        xmax = min(xmax, array[i][0])
    elif array[i][2] == 3:
        ymin = max(ymin, array[i][1])
    elif array[i][2] == 4:
        ymax = min(ymax, array[i][1])
area = (xmax-xmin)*(ymax-ymin)
if area <= 0 or xmax < xmin or ymax < ymin:
    print(0)
else:
    print(area)

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

int dp[1000005];

int main(void){
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    int l[q];
    int r[q];
    int ans[q];
    
    rep(i,q){
        int x,y;
        cin >> x >> y;
        l[i] = x;
        r[i] = y;
    }
    
    
    for(int i=1;i<n;i++){
        if(s[i-1] == 'A'){
            if(s[i] =='C'){
                dp[i] = dp[i-1] + 1;
            }
         	else{
              	dp[i] = dp[i-1];
            }
        }
      	else{
          dp[i] = dp[i-1];
        }
    }
  
    rep(i,q){
        ans[i] = dp[r[i]-1] -dp[l[i]-1];
    }
    
    rep(i,q){
        cout << ans[i] <<endl;
    }
    
    
    
    return 0;
}




































Measured memory_bytes: 2560
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<endl
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;


void solve() {
	int N, H; cin >> H >> N;
	int sum = 0;
	vector<int>v(N);
	REP(i, N) {
		cin >> v[i];
		sum += v[i];
	}
	if (sum >= H)print("Yes");
	else print("No");
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q;cin>>q;
	//while(q--)
	solve();
}




Measured memory_bytes: 1024
package main

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

func main() {
	n := readInt()
	q := readInt()

	results := make([]int, n)
	links := make([][]int, n)

	for i := 0; i < n-1; i++ {
		a := readInt() - 1
		b := readInt() - 1
		links[a] = append(links[a], b)
		links[b] = append(links[b], a)
	}

	for i := 0; i < q; i++ {
		p := readInt() - 1
		x := readInt()
		results[p] += x
	}

	processed := make([]bool, n)
	processed[0] = true
	queue := make([]int, 0)
	queue = append(queue, 0)
	for len(queue) != 0 {
		i := queue[0]
		queue = queue[1:]
		for _, j := range links[i] {
			if processed[j] {
				continue
			}
			results[j] += results[i]
			processed[j] = true
			queue = append(queue, j)
		}
	}

	writeIntln(results...)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, _ := strconv.Atoi(readString())
	return result
}

func writeIntln(v ...int) {
	b := make([]byte, 0, 4096)
	for i := 0; i < len(v) - 1; i ++ {
		b = append(b, strconv.Itoa(v[i])...)
		b = append(b, " "...)
	}
	b = append(b, strconv.Itoa(v[len(v) - 1])...)
	fmt.Println(string(b))
}

Measured memory_bytes: 28032
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

int n, a[500010], ca[500010];
ll czero[500010], dp[1 << 20][2], last[1 << 20], mod = 1e9+7;
void zero() {
	for (int i = 0; i < (1 << 20); i++)
		dp[i][0] = 1, last[i] = 0;
	for (int i = 1; i <= n; i++) {
		czero[i] = czero[i - 1];
		if (ca[i] != 0) {
			dp[ca[i]][0] += dp[ca[i]][1] * (czero[i] - czero[last[ca[i]]]);
			dp[ca[i]][0] %= mod;

			dp[ca[i]][1] += dp[ca[i]][0];
			dp[ca[i]][1] %= mod;

			last[ca[i]] = i;
		}
		else
			czero[i]++;
	}
	ll sum = 0;
	for (int i = 1; i < (1 << 20); i++)
		sum += dp[i][1];
	ll pow2 = 1;
	for (int i = 0; i < czero[n] - 1; i++)
		pow2 = (pow2 * 2) % mod;
	sum += pow2;
	sum = ((sum % mod) + mod) % mod;
	printf("%lld\n", sum);
}
void nonzero() {
	for (int i = 0; i < (1 << 20); i++)
		dp[i][0] = 1, last[i] = 0;
	for (int i = 1; i <= n; i++) {
		czero[i] = czero[i - 1];
		if (ca[i] != 0) {
			dp[ca[i]][0] += dp[ca[i]][1] * (czero[i] - czero[last[ca[i]]]);
			dp[ca[i]][0] %= mod;

			dp[ca[i]][1] += dp[ca[i]][0];
			dp[ca[i]][1] %= mod;

			last[ca[i]] = i;
		}
		else
			czero[i]++;
	}
	printf("%lld\n", dp[ca[n]][0]);
}
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", a + i);
		ca[i] ^= ca[i - 1] ^ a[i];
	}

	if (ca[n] == 0)
		zero();
	else
		nonzero();
}

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

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

using namespace std;
using lint=long long;

const long long INF=1LL<<61;

int main(){
	int n; scanf("%d",&n);
	vector<lint> a(n);
	rep(i,n) scanf("%lld",&a[i]);

	static lint dp[200002][3];
	rep(i,n+2) rep(j,3) dp[i][j]=-INF;
	dp[0][0]=0;
	rep(i,n){
		dp[i+2][0]=dp[i][0]+a[i];
		dp[i+2][1]=dp[i][1]+a[i];
		if(i>=1) dp[i+2][1]=max(dp[i+2][1],dp[i-1][0]+a[i]);
		dp[i+2][2]=dp[i][2]+a[i];
		if(i>=1) dp[i+2][2]=max(dp[i+2][2],dp[i-1][1]+a[i]);
		if(i>=2) dp[i+2][2]=max(dp[i+2][2],dp[i-2][0]+a[i]);
	}

	lint ans;
	if(n%2==0) ans=max(dp[n][0],dp[n+1][1]);
	else       ans=max({dp[n-1][0],dp[n][1],dp[n+1][2]});
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 9616
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#include<cmath>
#define ll __int64
#define ll long long
const ll INF=10000000000000;
ll n,s;

ll f(ll b,ll n){
	ll ret=0;

	while(n){
		ret+=n%b;
		n/=b;
	}
	return ret;
}
int main(){
	cin>>n>>s;
	if(n==s){cout<<n+1<<endl; return 0;}
	if(n<s){cout<<-1<<endl;return 0;}
	for(ll i=2;i<=sqrt(n);i++){
		//cout<<f(i,n)<<endl;
		if(f(i,n)==s){
			cout<<i<<endl;
			return 0;
		}
	}

	ll ans=INF;
	for(ll i=1;i<sqrt(n);i++){
		if((n-s)%i==0)if(f((n-s)/i+1,n)==s)ans=min(ans,(n-s)/i+1);

	}
	if(ans==INF)ans=-1;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main
{
  public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    String S=in.nextLine();
    if(S.charAt(2)==S.charAt(3) && S.charAt(4)==S.charAt(5))
       System.out.println("Yes");
       else
       System.out.println("No");
       }
       }
       
  


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

int main() {
  int a;
  cin >> a;
  int ans = a + a * a + pow(a, 3);
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 4012
s = input()
count = 0
for i in range(len(s)):
    # 0番目の文字がA
    if i == 0:
        if s[i] != 'A':
            break
    # 大文字が出現したとき
    elif s[i].isupper():
        # Cの条件を満たせばcountを増やす
        if 2 <= i < len(s) - 1 and s[i] == 'C':
            count += 1
        # そうでなければcountを0にし、ループ終了
        else:
            count = 0
            break
# カウントが1なら
if count == 1:
    print('AC')
else:
    print('WA')

Measured memory_bytes: 38256
#include<cstdio>

int main(){
  auto N=0;
  auto result=0ll;
  
  scanf("%d",&N);
  for(auto i=1;i<=N;++i){
    if(i%3==0)continue;
    if(i%5==0)continue;
    result+=i;
  }
  printf("%lld\n",result);
}

Measured memory_bytes: 1736
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int cmp(const void *a, const void *b);

int main() {

    int n, k, i;
    scanf("%d %d", &n, &k);
    long long a[n], sum = 0;
    for (i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
    }

    qsort(a, n, sizeof(a[0]), cmp);
    for (i = 0; i < n - k; i++) {
        sum += a[i];
    }

    printf("%lld", sum);

    return 0;
}

int cmp(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}


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

int main()
{
    int N, K;
    cin >> N >> K;
    int sunuke[N];
    for(int i = 0; i < N; i++) {
        sunuke[i] = 1;
    }
    for(int i = 0; i < K; i++) {
        int d;
        cin >> d;
        for(int j = 0; j < d; j++) {
            int A;
            cin >> A;
            sunuke[A-1] = 0;
        }
    }

    int sum = 0;
    for(int i = 0; i < N; i++) {
        sum += sunuke[i];
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main() {

    fast

    int n;
    string s;
    cin>>n;
    cin>>s;
    int cnt=1;
    for(int i=0;i<n-1;i++){
        if(s[i]!=s[i+1])
            cnt++;
    }
    cout<<cnt;




	return 0;
}





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

#define YYDBG 0

#if YYDBG==1
#define PRINTF(...) printf(__VA_ARGS__);
#define FOR for
#define IF if
#define ELSE else
#else
#define PRINTF(...) 
#define FOR(...)
#define IF(...)
#define ELSE 
#endif

int inputs[200000];
int outputs[200000];
int N;

int main(void) {
    int result = 0;
    int i,j;
    int num;
    int counter;
    int ans;

    scanf("%d\n", &N);
    for(i=0;i<N;i++) { 
        scanf("%d ", &(inputs[i]));
    }

    PRINTF("in  : ");
    FOR(i=0;i<N;i++) {
        PRINTF("%d ", inputs[i]);
    }
    PRINTF("\n");
    PRINTF("\n");


    ans = 0;
    for(i=N;i>0;i--) {
        
        counter = 0;
        for(j=1;j<=N/i;j++) {
            PRINTF("-%d- ", j);
            counter += outputs[(j*i)-1];
        }
        if(counter%2 != inputs[i-1]) {
            outputs[i-1] = 1;
            ans++;
        }

        PRINTF("%d:%d(%d)[%d] ", i, inputs[i-1], N/i, counter);
    }
    PRINTF("\n");

    PRINTF("out : ");
    FOR(i=0;i<N;i++) {
        PRINTF("%d ", outputs[i]);
    }
    PRINTF("\n");
    PRINTF("\n");
    

    printf("%d\n", ans);
    for(i=0;i<N;i++) {
        if (outputs[i] == 1) {
            printf("%d ", i+1);
        }
    }
    printf("\n");

    return 0;
}



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

int main() {
  int a,b;
  cin >> a >> b;
  vector<int> vec(a);
  for (int i = 0; i < a; i++) {
    cin >> vec.at(i);
  }
  for (int i = 0; i < a - b; i++) {
    if (vec.at(i) < vec.at(i+b)) {
      cout << "Yes" <<endl;
    }
    else {
      cout << "No" <<endl;
    }
  }
  
}


Measured memory_bytes: 4048
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int max = -10000001;
    int min = 1000001;
    long long sum = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if(a > max) {
            max = a;
        }
        if(a < min) {
            min = a;
        }
        sum += a;
    }
    cout << min << " " << max << " " << sum << endl;
}


Measured memory_bytes: 3092
#include<stdio.h>
int main(void)
{
	int a, b, c, k, max,i;
	scanf("%d %d %d", &a, &b, &c);
	scanf("%d", &k);
	max = a;
	if (max < b) max = b;
	if (max < c) max = c;

	if (a == max)
	{
		for (i = 0; i < k; i++)
		{
			max = max * 2;
		}
		printf("%d\n", max + b + c);
	}
	else if(b==max)
	{
		for (i = 0; i < k; i++)
		{
			max = max * 2;
		}
		printf("%d\n", max + a+c);
	}
	else if(c==max)
	{
		for (i = 0; i < k; i++)
		{
			max = max * 2;
		}
		printf("%d\n", max + a+ b);
	}
	return 0;
	}

Measured memory_bytes: 128