akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
typedef long long ll;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
int n; char s[MAXN];
int main() {
	read(n), scanf("%s", s);
	bool found = false;
	for (int i = 0; i <= n - 1; i++)
		found |= s[i] == '2';
	if (found) {
		bool ans = false;
		for (int i = 0; i <= n - 1; i++)
			if ((i & (n - 1)) == i && s[i] == '2') ans ^= true;
		printf("%d\n", ans);
	} else {
		bool ans = false;
		for (int i = 0; i <= n - 1; i++)
			if ((i & (n - 1)) == i && s[i] == '3') ans ^= true;
		printf("%d\n", ans * 2);
	}
	return 0;
}


Measured memory_bytes: 1280
#############################
#
# じゃんけん説明
# r: グー
# s: チョキ
# p: パー
#
#############################
#
# 入力r -> 勝利時の グー の点数
# 入力s -> 勝利時の チョキ の点数
# 入力p -> 勝利時の パー の点数
#
#############################

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

MY_HAND = []
ANS = 0

def can_not_use_hand(after_k_hand):
  if after_k_hand == 'r':
    return 'p'
  if after_k_hand == 's':
    return 'r'
  if after_k_hand == 'p':
    return 's'

for battle_time in range(n):
  if battle_time < k:
    if t[battle_time] == "r":
      MY_HAND.append("p")
      ANS += p
    
    if t[battle_time] == "s":
      MY_HAND.append("r")
      ANS += r
    
    if t[battle_time] == "p":
      MY_HAND.append("s")
      ANS += s
  else:
    if t[battle_time] == "r": # 基本 -> [p]
      if MY_HAND[battle_time-k] == "p": # [p] を前に使ってる -> [r, s, -]
        try:
          if can_not_use_hand(t[battle_time+k]) == 'r':
            MY_HAND.append("s")
            ANS += 0
          else:
            MY_HAND.append("r")
            ANS += 0
        except IndexError:
          MY_HAND.append("r")
          ANS += 0
      else: # 基本通り
        MY_HAND.append("p")
        ANS += p

    if t[battle_time] == "s": # 基本 -> [r]
      if MY_HAND[battle_time-k] == "r": # [r] を前に使ってる -> [-, s, p]
        try:
          if can_not_use_hand(t[battle_time+k]) == 's':
            MY_HAND.append("p")
            ANS += 0
          else:
            MY_HAND.append("s")
            ANS += 0
        except IndexError:
          MY_HAND.append("s")
          ANS += 0
      else: # 基本通り
        MY_HAND.append("r")
        ANS += r
    
    if t[battle_time] == "p": # 基本 -> [s]
      if MY_HAND[battle_time-k] == "s": # [s] を前に使ってる -> [r, -, p]
        try:
          if can_not_use_hand(t[battle_time+k]) == 'p':
            MY_HAND.append("r")
            ANS += 0
          else:
            MY_HAND.append("p")
            ANS += 0
        except IndexError:
          MY_HAND.append("p")
          ANS += 0
      else: # 基本通り
        MY_HAND.append("s")
        ANS += s

print(ANS)


Measured memory_bytes: 51824
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds;
using namespace std;

typedef long long int lli;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<lli> vli;
typedef vector<pii> vii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> OrderedSet;

const int MOD	= 1e9 + 7;
const double PI = acos(-1.0);

#define fastio			ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto &i : c)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define fill(a)  memset(a, 0, sizeof (a))
#define error(x) cerr << #x << " = " << (x) << endl
#define errorp(p) cerr << #p << " = " << (p.first) << ", " << (p.second) << endl

template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template <typename T> T lcm(T a, T b){return (a*b)/gcd(a,b); }
int mul(int a, int b, int c){lli res=(lli)a*b;return (int)(res>=c?res%c:res);}
template<typename T>T power(T e, T n, T m){T x=1,p=e;while(n){if(n&1)x=mul(x,p,m);p=mul(p,p,m);n>>=1;}return x;}
int mod_neg(int a, int b, int c){int res;if(abs(a-b)<c)res=a-b;else res=(a-b)%c;return(res<0?res+c:res);}
template<typename T>T extended_euclid(T a, T b, T &x, T &y){T xx=0,yy=1;y=0;x=1;while(b){T q=a/b,t=b;b=a%b;a=t;\
t=xx;xx=x-q*xx;x=t;t=yy;yy=y-q*yy;y=t;}return a;}
template<typename T>T mod_inverse(T a, T n){T x,y,z=0;T d=extended_euclid(a,n,x,y);return(d>1?-1:mod_neg(x,z,n));}
template <class T>  inline void smax(T &x,T y){ x = max((x), (y));}
template <class T>  inline void smin(T &x,T y){ x = min((x), (y));}


int main(){

    fastio;
    
    lli N, K;
    cin >> N >> K;

    lli ans = N % K;
    ans = min(ans, (K - ans));

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <string.h>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
 
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;
 
 
int main(void) {
  int m, n;
  cin >> n >> m;
  int sum=0;
  for(int i=0;i<n;i++) {
    sum += i;
  }
  for(int i=0;i<m;i++) {
  	sum+= i;
  }

  cout << sum << endl;

}

Measured memory_bytes: 256
#include <cstdio>
#define mod 1000000007

int n,i,j,tot;
long long ans;
char s[2][60];

int main() {
	scanf("%d\n%s\n%s",&n,s[0],s[1]);
	if (s[0][0] == s[1][0]) {ans = 3;  i = 1;} else {ans = 6;  i = 2;}
	for (;i<n;i++) {
		if (s[0][i] == s[1][i] && s[0][i-1] == s[1][i-1]) ans = (ans * 2) % mod;
		else if (s[0][i] != s[1][i] && s[0][i-1] == s[1][i-1]) ans = (ans * 2) % mod, i++;
		else if (s[0][i] != s[1][i] && s[0][i-1] != s[1][i-1]) ans = (ans * 3) % mod, i++;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 256
#include <iostream>
#include<time.h>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
#include<cctype>
#include<iterator>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
#define MOD 1000000007
#define INF 1<<30
#define INFTY 1000000000000000001LL
#define MAX_INT INT_MAX
#define Endl '\n'
#define greater greater<int>()
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
// g++ -o a a.cpp -Wall -lm -std=c++14
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main(){
    ll n;cin>>n;
    vector<pair<long long, long long> > res=prime_factorize(n);
    ll ans=0;
    for(auto v:res){
        ll e=v.se;
        ll tmp=0,cur=1;
        while(e>=cur)e-=cur++,++tmp;
        ans+=tmp;
    }
    cout<<ans<<endl;
}

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

int main() {
  
  int n,p,saishou = 300000,cnt = 0;
  cin >> n;
  
  
  
  for ( int i = 0; i < n; i++){
    cin >> p;
    if ( saishou >= p ){
      cnt++;
    }
    saishou = min(saishou,p);
  }
  
  cout << cnt << endl;    

}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for(int i = 0; i < n; i++)
#define vv(T) vector<vector<T>>
#define coa cout << ans << endl; return 0;
using namespace std;
using namespace atcoder;
using ll = long long;
template<typename T>
using vec = vector<T>;
template<typename T>
using vvec = vector<vector<T>>;
using qint = queue<int>;
using sint = stack<int>;
using pii = pair<int, int>;

using mint = modint998244353;
const mint inv9 = mint(1) / 9;
// const long long MOD = 998244353;

struct S{
    mint x, w;
    S(mint x = 0, mint w = 1) : x(x), w(w){}
};

S op(S a, S b){
    return S(a.x * b.w + b.x, a.w * b.w);
}

S e(){
    return S();
}

S mapping(int f, S a){
    if(f == 0) return a;
    return S((a.w - 1) * inv9 * f, a.w); 
}

int composition(int f, int g){
    if(f == 0) return g;
    return f;
}

int id(){
    return 0;
}

int main(){
    int n, q;
    cin >> n >> q;
    lazy_segtree<S, op, e, int, mapping, composition, id> lt(n);
    rep(i, n) lt.set(i, S(1, 10));
    rep(i, q){
        int l, r, d;
        cin >> l >> r >> d;
        l--;
        lt.apply(l, r, d);
        S ans = lt.prod(0, n);
        cout << ans.x.val() << endl;
    }
    return 0;
}


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

int main(){
  vector<int> a;
  vector<int> b;
  int n, tmp;
  cin >> n;
  rep(i,n){
    cin >> tmp;
    a.push_back(tmp);
    b.push_back(tmp);
  }
  sort(a.begin(),a.end());
  int pre=0;
  rep(i,n){
    if(a[i]!=b[i])
      pre++;
  }
  if(pre==0||pre==2){
    cout << "YES" << endl;
  } else{
    cout << "NO" << endl;
  }
  
}

Measured memory_bytes: 3536
n,a,b = gets.split.map(&:to_i)

def rec(n,a,b)
    return [a,b] if n == 1
    x = 0
    n.times do |i|
        if (a[i]^b[i]) == 1
            x = i
            break
        end
    end
    p = 0
    x.times do |i|
        p |= 1<<i
    end
    q = 0
    for i in x+1..n-1
        q |= 1<<i
    end
    c = ((a&p)|((a&q)>>1))
    d = ((b&p)|((b&q)>>1))
    u = rec(n-1,c,c^1)
    v = rec(n-1,c^1,d)
    q >>= 1
    y = a[x]
    (1<<(n-1)).times do |i|
        u[i] = (u[i]&p)|((u[i]&q)<<1)|(y<<x)
        v[i] = (v[i]&p)|((v[i]&q)<<1)|((y^1)<<x)
    end
    return u+v
end
x = 0
n.times do |i|
    x ^= a[i]^b[i]
end
if x == 0
    puts "NO"
else
    puts "YES"
    puts rec(n,a,b).join(" ")
end

Measured memory_bytes: 9716
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {

	
	public static void main(String[] args) {
		String s = in.readString();
		
		int n = s.length();
		
		for(int i=0; i<n; i++) {
			if (s.charAt(i)!=s.charAt(n-i-1)) {
				System.out.println("No");
				return;
			}
		}
		int p = (n-1)/2-1;
		for(int i=0; i<=(n-1)/2-1; i++) {
			if (s.charAt(i)!=s.charAt(p-i)) {
				System.out.println("No");
				return;
			}
		}
		
		
		int j = n-1;
		for(int i=(n+3)/2-1; i<n; i++) {
			if (s.charAt(i)!=s.charAt(j)) {
				System.out.println("No");
				return;
			}
			j--;
		}
		System.out.println("Yes");
		
		out.flush();
		out.close();
		
	}
	
	

	//NONPROBLEM CODE
	
	private static InputReader in = new InputReader(System.in);
	private static PrintWriter out = new PrintWriter(System.out);
	
	private static class InputReader {
		 
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
 
		public InputReader(InputStream st) {
			this.stream = st;
		}
 
		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
 
		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}
 
		public String readString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
 
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
 
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
 
		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
 
	}
	
	private static void debug(Object... o) {
		for(Object x: o) {
			out.write(x+" ");
		}
		out.write("\n");
		out.flush();
	}
	
}


Measured memory_bytes: 22996
#include<cstdio>
#include<iostream>
using namespace std;
int main(){
	int a;
	int b;
	int c;
	scanf("%d %d %d",&a,&b,&c);
	int det = a*b*c;
	if(det==5*7*5){
    	printf("YES\n");
	} else{
    	printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL n,k;
    cin>>n>>k;
    LL cnt[105] = {0};
    REP(i,k){
        LL d;
        cin>>d;
        REP(j,d){
            LL a;
            cin>>a;
            cnt[a-1]++;
        }
    }

    LL ans = 0;
    REP(i,n){
        if(cnt[i] == 0)ans++;
    }
    PUTS(ans);
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;

int main() {
    ios_base::sync_with_stdio(false);
    string s;
    cin >> s;
    const int INF = 999999999;
    int n = s.length();
    vector<int> dp(n + 1, INF);
    dp[0] = 0;
    unordered_map<int, int> mp;
    mp.reserve(300000);
    vector<int> mask(n + 1, 0);
    int cur = 0;
    for(int i = 0; i < n; ++i){
        cur ^= (1 << (int)(s[i] - 'a'));
        mask[i + 1] = cur;
    }
    mp[0] = 0;
    for(int i = 1; i <= n; ++i){
        int ans = INF;
        if(mp.find(mask[i]) != mp.end()){
            ans = min(ans, mp[mask[i]] + 1);
        }
        for(int j = (1 << 25); j > 0; j >>= 1){
            if(mp.find(mask[i] ^ j) == mp.end()){
                continue;
            }
            ans = min(ans, mp[mask[i] ^ j] + 1);
        }
        if(mp.find(mask[i]) == mp.end()){
            mp[mask[i]] = ans;
        }else {
            mp[mask[i]] = min(mp[mask[i]], ans);
        }
        if(i == n){
            cout << ans << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 10772
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>

using namespace std;

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

long long int INF = 1e18;
long long int mod = 1000000007;
double Pi = 3.1415926535897932384626;
/*
vector<ll> G[500005];
vector<P> tree[500010];

//big priority queue
priority_queue <ll> pql;
priority_queue <P> pqp;

//small priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
*/
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "RULD";
//↓,→,↑,←

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1 , number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1 , number1);
    }
}


ll i,j,k,ii,jj,n,m;
ll a,b,c,d,e,g,h,r,l,num,ans;
ll x[500005],y[500005],z[500005];
bool dame;
char s[500005];
ll dp[4][100005];

int main(){
    
    cin >> n;  
	for(i=0;i<n;i++){
		cin >> x[i] >> y[i] >> z[i];
	}
	for(i=0;i<n;i++){
		dp[1][i+1] = max(dp[2][i],dp[3][i]) + x[i];
		dp[2][i+1] = max(dp[1][i],dp[3][i]) + y[i];
		dp[3][i+1] = max(dp[2][i],dp[1][i]) + z[i];
	}
	ans = -10;
	for(i=1;i<=3;i++)ans = max(ans,dp[i][n]);

	p(ans);
    return 0;
}

Measured memory_bytes: 11776
#include <bits/stdc++.h>
using namespace std;
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; }
using ll = long long;
using P = pair<int, int>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

int x, y, z, k;

int main() {
    cin >> x >> y >> z >> k;
    vector<ll> A(x, 0);
    for(int i = 0; i < x; ++i) cin >> A.at(i);
    vector<ll> B(y, 0);
    for(int i = 0; i < y; ++i) cin >> B.at(i);
    vector<ll> C(z, 0);
    for(int i = 0; i < z; ++i) cin >> C.at(i);
    sort(A.begin(), A.end(), greater<ll>());
    sort(B.begin(), B.end(), greater<ll>());
    sort(C.begin(), C.end(), greater<ll>());

    vector<ll> ABC;
    for(int a = 0; a < x; ++a) {
        for(int b = 0; b < y; ++b) {
            if((a+1)*(b+1) > k) break;
            for(int c = 0; c < z; ++c) {
                if((a+1)*(b+1)*(c+1) > k) break;
                ABC.emplace_back(A.at(a)+B.at(b)+C.at(c));
            }
        }
    }
    sort(ABC.begin(), ABC.end(), greater<ll>());

    for(int i = 0; i < k; ++i) {
        cout << ABC.at(i) << endl;
    }
}

Measured memory_bytes: 1404
#include <stdio.h>

int main(){
	long long int a, b;
	scanf("%lld %lld", &a, &b);
	if (a == b){		
		if (a == 0){
			printf("Zero\n");
			return 0;
		}
		else {
			printf("Positive\n");
			return 0;
		}
	}
	else{
		if (a > 0){
			printf("Positive\n");
			return 0;
		}
		else if (a < 0 && b > 0){
			printf("Zero\n");
			return 0;
		}
		else if (a == 0 || b == 0){
			printf("Zero\n");
			return 0;
		}
		else if ((b - a - 1) % 2 == 0){
			printf("Positive\n");
			return 0;
		}
		else if ((b - a - 1) % 2 == 1){
			printf("Negative\n");
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 128
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Yulian
 */

#include <iostream>
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <deque>
#include <string>
#include <algorithm>
#include <map>


#include <iostream>













int getTheAnswer() {
    return 42;
}

template< class InputIt>
void incAll(const InputIt &first, const InputIt &last){
  for(auto it = first; it != last; ++it){
    ++*it;
  }
}

template <class InputIt>
void printAll(const InputIt &first, const InputIt &last, std::ostream& out){
  for(InputIt it = first; it != last; ++it){
    out << *it << " ";
  }
}

// only for positive integers
int gcd(int a, int b){
  int tmp;
  if(a < b){
    tmp = a;
    a = b;
    b = tmp;
  }
  while(b != 0){
    tmp = a;
    a = b;
    b = tmp % b;
  }
  return a;
}

int lcm(int a, int b){
  return abs(a*b) / gcd(a, b);
}


using namespace std;
class TaskA {
public:
	void solve(std::istream& in, std::ostream& out) {
    ios::sync_with_stdio(false);
		vector<int> x(1);
    in >> x[0];
    if(x[0] < 1200){
      out << "ABC" << endl;
    }else{
      out << "ARC" << endl;
    }
	}
};


int main() {
	TaskA solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 384
n,k=gets.split.map(&:to_i)

arr=gets.split.map(&:to_i)

sum=0
i=k
(n-k).times{
    if arr[i]>0
        sum+=arr[i]
    end
    i+=1}

sum2=arr[0..k-1].inject(:+)
sum3=[sum2,0].max
ans=sum+sum3

j=0

(n-k).times{
    
    sum2+=arr[j+k]
    sum2-=arr[j]
    
    if arr[j]>0
        sum+=arr[j]
    end
    if arr[j+k]>0
        sum-=arr[j+k]
    end
    
    sum3=[sum2,0].max
    
    
    if  sum+sum3>ans
        ans=sum+sum3
    end
    j+=1
}

puts ans

Measured memory_bytes: 11276
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin>>n;
  vector<ll> v(n);
  ll x=0;
  for(int i=0;i<n;i++)
  {
    cin>>v[i];
    x^=v[i];
  }
  for(int i=0;i<n;i++)
  {
    ll ans=x^v[i];
    cout<<ans<<" ";
  }
  return 0;
}

Measured memory_bytes: 4716
#include <iostream>

using namespace std;

void error(){
	cout << -1 << endl;
	return;
}

int main(){
	long long k;
	long long *a;
	cin >> k;
	a=new long long[k];
	for(long long i=0;i<k;i++){
		cin >> a[i];
	}

	long long max=2,min=2;
	if(a[k-1]!=2){
		error();
		return 0;
	}
	for(long long i=k-1;i>=0;i--){
		long long min_temp=0;
		long long max_temp=0;
		min_temp=(min/a[i])*a[i];
		if(min_temp<min){
			min_temp+=a[i];
		}
		if(min_temp>max){
			error();
			return 0;
		}

		max_temp=(max/a[i])*a[i];
		if(max_temp<min){
			error();
			return 0;
		}

		min=min_temp;
		max=max_temp+a[i]-1;
	}
	cout << min << " " << max << endl;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int *min_arr;
void updateMin(int i, int w)
{
   if(w < min_arr[i])
   {
      min_arr[i] = w;
   }
}
int main()
{
   int n;

   cin >> n;
   min_arr = new int[n];
   int weight[n];
   for(int i = 0; i < n; i++) {
      cin >> weight[i];
   } 
   
   for (int i = 0; i < n; i++) min_arr[i] = INT_MAX;

   //build 2d array
   for(int i = 0; i < n; i++)
   {
      if (i == 0)
      {
         min_arr[0] = 0;
         // mat[0][0] = 0;
      } 
      
      // frog jump first case
      if(i + 1 < n)
      {
         updateMin(i + 1, abs(weight[i] - weight[i + 1]) + min_arr[i]);
      }
      // frog jump second case
      if (i + 2 < n)
      {
         updateMin(i + 2, abs(weight[i] - weight[i + 2]) + min_arr[i]);
      }
   }
   cout << min_arr[n-1] << endl;
}

Measured memory_bytes: 4388
from sys import stdin, setrecursionlimit
#input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi, radians, sin, cos

MOD = 10 ** 9 + 7
INF = 10 ** 18

#N = int(input())
N, X, T = map(int, input().split())

#A = list(map(int, input().split()))
#A = [int(input()) for _ in range(N)]
#ABC = [list(map(int, input().split())) for _ in range(N)]

#S = input()
#S = [input() for _ in range(N)]

print(-(-N//X)*T)

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

int n, i;
long long x, y;

main(){
	cin >> n;
	for(i=0;i<n;i++){
		cin >> x >> y;
		if(x==y){
			cout << 2*(x-1) << endl;
			continue;
		}
		long long halve = sqrt(x*y);
		if(halve*halve==x*y) halve--;
		if(halve*(halve+1)<x*y) cout << 2*(halve-1)+1 << endl;
		else cout << 2*(halve-1) << endl;
	}
}

Measured memory_bytes: 256
MOD=[469762049,2281701377,2483027969]
D=dict()
def DFTm(A,proot,mod,s):
  n=1<<s
  m=n>>1
  if n==1:
    return 0
  X,Y=[],[]
  for i in range(0,n,2):
    X.append(A[i])
    Y.append(A[i+1])
  DFTm(X,proot,mod,s-1)
  DFTm(Y,proot,mod,s-1)
  a,b=1,0
  if D.get((proot,s),-1)==-1:
    b=pow(proot,(mod-1)>>s,mod)
    D[(proot,s)]=b
  else:
    b=D[(proot,s)]
  for i in range(n):
    A[i]=(X[i&(m-1)]+a*Y[i&(m-1)])%mod
    a=a*b%mod

def FFTm(X,Y,mod):
  n=1
  c=0
  while len(X)+len(Y)>n:
    n<<=1
    c+=1
  A=X[:]
  B=Y[:]
  while len(A)<n:
    A.append(0)
  while len(B)<n:
    B.append(0)
  DFTm(A,3,mod,c)
  DFTm(B,3,mod,c)
  for i in range(n):
    A[i]=A[i]*B[i]%mod
  DFTm(A,pow(3,mod-2,mod),mod,c)
  z=pow(n,mod-2,mod)
  for i in range(n):
    A[i]=A[i]*z%mod
  return A

N,M=map(int,input().split())
print(*FFTm(list(map(int,input().split())),list(map(int,input().split())),998244353)[:N+M-1])

Measured memory_bytes: 214424
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

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

	cin >> N >> K;
	vector<int>v;
	vector<int>w;
	for (int i = 1; i*i <= N; i++) {
		if (N%i == 0) {
			v.push_back(i);
			w.push_back(N / i);
		}
	}
	while (!w.empty()) {
		if (v.back() != w.back())v.push_back(w.back());
		w.pop_back();
	}
	vector<long long int>dp(v.size());
	dp[0] = K;
	for (int i = 1; i < v.size(); i++) {
		dp[i] = power(K, (v[i] + 1) / 2, MOD);
		for (int j = 0; j < i; j++) {
			if (v[i] % v[j])continue;
			dp[i] += MOD;
			dp[i] -= dp[j];
			dp[i] %= MOD;
		}
	}
	long long int ans = 0;
	for (int i = 0; i < v.size(); i++) {
		if (v[i] & 1) {
			ans += dp[i] * v[i];
			ans %= MOD;
		}
		else {
			ans += dp[i] * v[i] / 2;
			ans %= MOD;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }



int main()
{
	int h, w;
	cin >> h >> w;

	string s;
	vector<string> res;
	res.reserve(2 * h);
	REP(i, h)
	{
		cin >> s;
		res.PB(s);
		res.PB(s);
	}

	REP(i, 2 * h)
		cout << res[i] << endl;

}


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

int main() {
  int h,w;
  cin >> h >> w;
  vector<vector<char>>data(h,vector<char>(w));
  vector<vector<int>>plow(h,vector<int>(w,0));
  vector<vector<int>>pline(h,vector<int>(w,0));
  for(int i = 0;i < h;i++){
    for(int j = 0;j < w;j++){
      cin >> data.at(i).at(j);
    }
  }
  for(int i = 0;i < h;i++){
    for(int j = 0;j < w;j++){
      if(data.at(i).at(j) == '#'){
        for(int k = 0;k < w;k++){
          plow.at(i).at(k) = 1;
        }
        break;
      }
    }
  }
  for(int i =  0;i < w;i++){
    for(int j = 0;j < h;j++){
      if(data.at(j).at(i) == '#'){
        for(int k = 0;k < h;k++){
          pline.at(k).at(i) = 1;
        }
        break;
      }
    }
  }
  for(int i = 0;i < h;i++){
    for(int j = 0;j < w;j++){
      if(plow.at(i).at(j) == 1 && pline.at(i).at(j) == 1){
        cout << data.at(i).at(j);
      }
      if(j == w-1){
        for(int k = 0;k < w;k++){
          if(plow.at(i).at(k) == 1 && pline.at(i).at(k) == 1){
            break;
          }
          if(k == w-1){
            goto pass;
          }
        }
        cout << endl;
        pass:;
      }
    }
  }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N, M, K;
string S, T;
vector<vector<int>> A;
vector<int> B;
//=============================
void input()
{
    cin >> N >> M;
    A.resize(N);
    rep(i, M)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        A[a].push_back(b);
        A[b].push_back(a);
    }
}
//=============================
void dfs(int now, set<int> visited, int &ans)
{
    visited.insert(now);
    if (visited.size()==N)
    {
        ans++;
        return;
    }
    for (auto x : A[now])
    {
        if (visited.find(x)!=visited.end())
            continue;
        dfs(x, visited, ans);
    }
}
//=============================
void solve()
{
    int ans = 0;
    dfs(0, set<int>(), ans);
    cout << ans << endl;
}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
#print(h,n)

h_max = max(h)
ans = 0
for i in range(h_max):
    c = 0
    flag = 0
    for j in range(n):
        if h[j] != 0:
            h[j] -= 1
            flag = 1
            if j == n-1:
                c += 1
        else:
            if flag == 1:
                c += 1
                flag = 0
    ans += c
print(ans)

Measured memory_bytes: 38896
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<string>
#include<functional>
#include<utility>
using namespace std;
int main(){
	int n, v[20], c, sum = 0; cin >> n;
	for (int i = 0; i < n; ++i) cin >> v[i];
	for (int i = 0; i < n; ++i) {
		cin >> c;
		if (v[i] > c) sum += v[i] - c;
	}
	cout << sum << endl;
	return 0;
}

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

using namespace std;

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

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

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const lint MOD = (lint)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
//

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

  lint N, K;
  cin >> N >> K;
  vector<lint> A(N);
  rep(i, N) cin >> A[i];

  vector<pair<lint, lint>> B(N);
  lint res = 0;
  rep(i, N) {
    for (int r = i + 1; r < N; r++) {
      if (A[r] < A[i]) B[i].second += 1;
    }
    for (int l = 0; l < i; l++) {
      if (A[l] < A[i]) B[i].first += 1;
    }
  }

  // rep(i, N) { cout << B[i].first << " " << B[i].second << endl; }

  lint r = K * (1 + K) / 2LL;
  lint l = (K - 1) * (1 + K - 1) / 2LL;
  r %= MOD;
  l %= MOD;

  rep(i, N) {
    res += B[i].second * r % MOD;
    res %= MOD;
    res += B[i].first * l % MOD;
    res %= MOD;
  }

  cout << res << endl;

  return 0;
}

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

map< int64_t, int > prime_factor(int64_t n) {
	map< int64_t, int > ret;
	for (int64_t i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;

}

int main(void) {
	int N;
	cin >> N;
	map<int64_t, int> m;
	m = prime_factor(N);
	cout << N << ":";
	for (auto &d : m) {
		for (int i = 0; i < d.second; ++i) {
			cout << " " << d.first;
		}
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <random>
#include <algorithm>
#include <chrono>
#include <map>
#define tNow chrono::duration_cast<msec>(chrono::system_clock::now().time_since_epoch())
#define INF (1 << 30)
using namespace std;

typedef chrono::milliseconds msec;

int d, lastVal = -INF, bestVal = -INF, times = 0, groups = 0, updates = 0, positiveUpdates = 0;
vector<int> c(27), cur, ans;
vector< vector<int> > s, ss;

int calc() {
    int sum = 0;
    vector<int> last(27, 0);
    for (int i = 1; i <= d; ++i) {
        sum += s.at(i).at(cur.at(i));
        last.at(cur.at(i)) = i;
        for (int j = 1; j <= 26; ++j) sum -= c.at(j) * (i - last.at(j));
    }
    return sum;
}

void update(int curVal) {
    lastVal = curVal;
    if (bestVal < curVal) {
        bestVal = curVal;
        ans = cur;
        ++positiveUpdates;
    }
    ++updates;
}

int choose(int i, mt19937 m) {
    return lower_bound(ss.at(i).begin(), ss.at(i).end(), m() % ss.at(i).back() + 1) - ss.at(i).begin();
}

int main() {
    random_device r;
    msec st = tNow;
    msec lm = st + chrono::milliseconds(1980);
    cin >> d;
    ss = (s = vector< vector<int> >(d + 1, vector<int>(27)));
    cur.resize(d + 1);
    for (int i = 1; i <= 26; ++i) cin >> c.at(i);
    for (int i = 1; i <= d; ++i) for (int j = 1; j <= 26; ++j) cin >> s.at(i).at(j), ss.at(i).at(j) += ss.at(i).at(j - 1) + s.at(i).at(j);
    // for (int i = 1; i <= d; ++i) for (int j = 1; j <= 26; ++j) cin >> s.at(i).at(j), ss.at(i).at(j) += ss.at(i).at(j - 1) + s.at(i).at(j) + c.at(j);
    mt19937 m(r());
    for (int i = 1; i <= d; ++i) cur.at(i) = max_element(s.at(i).begin(), s.at(i).end()) - s.at(i).begin();;
    update(calc());
    // cur = {0, 1, 17, 13, 14, 13};
    // update(calc());
    // cout << bestVal << endl;
    // for (int i = 1; i <= d; ++i) cout << ans.at(i) << endl;

    while (tNow < lm) {
        ++groups;
        mt19937 m(r());
        for (int i = 0; i < 100; ++i) {
            int changeAt = m() % d + 1, changeTo = choose(changeAt, m), changedFrom = cur.at(changeAt);
            if (changedFrom == changeTo) continue;
            cur.at(changeAt) = changeTo;
            int curVal = calc();
            if (m() % max(1, (lastVal - curVal) / 10) == 0) update(curVal);
            else cur.at(changeAt) = changedFrom;
            ++times;
        }
    }

    for (int i = 1; i <= d; ++i) cout << ans.at(i) << endl;
    msec ed = tNow;
    #ifdef ___DEBUG
    cout << "Best Value: " << bestVal << endl;
    cout << "Best Score: " << max(bestVal + 1000000, 0) << endl;
    cout << "Tried: " << times << "times, " << groups << "groups\n";
    cout << "Updated: " << updates << "times\n";
    cout << (ed - st).count() << "ms\n";
    #endif
    return 0;
}


Measured memory_bytes: 3732
#include<cstdio>

int main(void){
int i,j,k,n,m,l,nm,ml,nl;
scanf("%d%d%d",&n,&m,&l);
nm=n*m;
ml=m*l;
nl=n*l;

int a[nm],b[ml];
long long c[nl]={0};
for (i=0;i<nm;i++){
	scanf("%d",&a[i]);
};
for(i=0;i<ml;i++){
	scanf("%d",&b[i]);
};

for(i=0;i<n;i++){
	for(j=0;j<l;j++){
		for(k=0;k<m;k++){
			c[i*l+j]=c[i*l+j]+a[i*m+k]*b[k*l+j];
		};
	};
};

for(i=0;i<n;i++){
	for(j=0;j<l-1;j++){
		printf("%lld ",c[i*l+j]);
	};
	printf("%lld\n",c[i*l+l-1]);
};

return 0;
}

Measured memory_bytes: 2744
#include<cstdio>
int main() {
	int a,b,c,t;
	scanf("%d%d%d",&a,&b,&c);
	if(b>a) {
		t = a;
		a = b;
		b = t;
	}
	if(c>a) {
		t = a;
		a = c;
		c = t;
	}
	if(b>c) {
		t = c;
		c = b;
		b = t;
	}
	printf("%d\n",a*10+b+c);
	return 0;
} 

Measured memory_bytes: 128
#include<stdio.h>
int main(){
	int a,b;
	char c;
	while(1){
	scanf("%d %c %d",&a,&c,&b);
	if(c=='?'){break;}
	switch(c){
		case '+':printf("%d\n",a+b);break;
		case '-':printf("%d\n",a-b);break;
		case '*':printf("%d\n",a*b);break;
		case '/':printf("%d\n",a/b);break;
	}
}
	return 0;
}

Measured memory_bytes: 600
mod = 10 ** 9 + 7

N, *X = map(int, open(0).read().split())

stack = []
ans = 1
for x in X:
    stack.append(x)
    if x < 2 * len(stack) - 1:
        ans = (ans * len(stack)) % mod
        stack.pop()
    else:
        ans = (ans * len(stack)) % mod

print(ans)


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

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	ll A,B,M;
	cin>>A>>B>>M;
    vector<ll> va(A),vb(B);
    ll min_a,min_b;
    rep(i,A){
        cin>>va[i];
        if(i==0) min_a = va[0];
        min_a = min(min_a,va[i]);
    }
    rep(j,B){
        cin>>vb[j];
        if(j==0) min_b = vb[0];
        min_b = min(min_b,vb[j]);
    }
    ll ans = min_a + min_b;
    ll x,y,c;
    rep(i,M){
        cin>>x>>y>>c;
        ans = min(ans,va[x-1]+vb[y-1]-c);
    }

    cout<<ans<<"\n";
	
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define mod 1000000007
int binarysearch(vector <int> &v, int info){
    int left = 0, right = v.size();
    while (left < right){
        int m = left + (right-left) / 2;
        if (v[m] >= info)
            right = m;
        else
            left = m + 1;
    }
    return left;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int i,j;
    vb prime(100001,true);
    for(i=2;i*i<=100001;i++){
        if(prime[i]){
            for(j=i*i;j<=100001;j+=i)prime[j]=false;
        }
    }
    vi v;
    for(i=2;i<=100001;i++){
        if(prime[i]){
            v.push_back(i);
        }
    }
    v.push_back(100003);
    int x;
    cin>>x;
    cout<<v[binarysearch(v,x)];
    return 0;
}

Measured memory_bytes: 512
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <deque>
#include <cstdio>
#include <cmath>
#include <complex>
#include <iostream>
#include <iterator>
 
using namespace std;
 
#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
 
char field[128][128];
int memo[128][128];
int w, h;
 
void fillup(int y, int x, int num, char c)
{
    memo[y][x] = num;
     
    const int dy[] = {-1, 0, 0, 1};
    const int dx[] = {0, 1, -1, 0};
     
    rep(i, 4){
        int py = y + dy[i];
        int px = x + dx[i];
        if(py<0 || h<=py || px<0 || w<=px || (memo[py][px] != -2 && memo[py][px] != -1))
            continue;
         
        if(field[py][px] != c)
            memo[py][px] = -2;
        else
            fillup(py, px, num, c);
    }
}
 
int main()
{
    while(scanf("%d%d", &w, &h), w){
        int y, x;
        rep(i, h){
            scanf("%s", field[i+1]+1);
            rep(j, w){
                if(field[i+1][j+1] == '&'){
                    y = i + 1;
                    x = j + 1;
                    field[y][x] = '.';
                }
            }
        }
         
        h += 2;
        w += 2;
        fill_n(field[0], w, '.');
        fill_n(field[h-1], w, '.');
        rep(i, h)
            field[i][0] = field[i][w-1] = '.';
         
        rep(i, h)
            fill_n(memo[i], w, -1);
         
        memo[y][x] = -2;
        for(int i=0;; ++i){
            const char chars[] = {'#', '.'};
            bool found = false;
            rep(l, 2){
                rep(j, h) rep(k, w){
                    if(field[j][k] == chars[l] && memo[j][k] == -2){
                        found = true;
                        fillup(j, k, i, chars[l]);
                    }
                }
            }
            if(!found)
                break;
        }
        printf("%d\n", memo[0][0]);
    }
 
    return 0;
}

Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  Int m;
  cin>>m;
  vector<Int> b(m);
  for(Int i=0;i<m;i++) cin>>b[i];
  cout<<includes(a.begin(),a.end(),b.begin(),b.end())<<endl;
  return 0;
}



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

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

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

}

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

int main() {
  int n;
  while ( cin >> n ) {
    int side[ n+5 ], sum = 0;
    for (int i = 0; i < n; ++i) {
      cin >> side[ i ];
      sum += side[ i ];
    }
    
    for (int i = 0; i < n; ++i)
    if ( side[ i ] >= sum - side[ i ] ) {
      cout << "No\n";
      return 0;
    }
    
    cout << "Yes\n";
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
   int k,a,b,i;

   scanf("%d %d %d",&k,&a,&b);
   for (i=a;i<=b;i++)
      if (i%k==0) {
         puts("OK");
         return 0;
      }
   puts("NG");
   return 0;
}


Measured memory_bytes: 1640
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
power=2
loop=0
ans=0
for i in range(1,(n*3)+1):
    if loop==n:
        print(ans)
        exit()
    elif power==i:
            ans+=a[i-1]
            power+=2
            loop+=1

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

#define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

int main(){
  vector<vector<double>> x(3,vector<double>(2));
  rep(i,3) rep(j,2) cin >> x[i][j] ;
  double ans = 0;
  rep(i,3){
    double a = hypot(x[0][0]-x[1][0],x[0][1]-x[1][1]);
    double b = hypot(x[0][0]-x[2][0],x[0][1]-x[2][1]);
    double c = hypot(x[1][0]-x[2][0],x[1][1]-x[2][1]);
    double S = abs((x[1][0]-x[0][0])*(x[2][1]-x[0][1])-(x[2][0]-x[0][0])*(x[1][1]-x[0][1]))/2;
    double h = 2*S/a;
    double r = 2*S/(a+b+c+2*h);
    chmax(ans,r);
    swap(x[0],x[2]);
    swap(x[1],x[2]);
  }
  printf("%.10f",ans);  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
#define rep(i, p, n) for(int i = p; i < n; i++) 

int main() {
    int n;
    cin >> n;
    rep(i, 0, n) {
        string s, t;
        cin >> s >> t;
        int lcs[s.size()+1][t.size()+1];
        rep(j, 0, s.size()+1) {
            rep(k, 0, t.size()+1) {
                lcs[j][k] = 0;
            }
        }
        rep(j, 1, s.size()+1) {
            rep(k, 1, t.size()+1) {
                if(s[j-1] == t[k-1]) {
                    lcs[j][k] = max(lcs[j-1][k], max(lcs[j][k-1], lcs[j-1][k-1]+1));
                }
                else {
                    lcs[j][k] = max(lcs[j-1][k], lcs[j][k-1]);
                }
            }
        }

        cout << lcs[s.size()][t.size()] << endl;
        
    }

    return 0;
}



Measured memory_bytes: 7056