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 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 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 sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<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 vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int n, k;
    cin >> n >> k;
    int res = 0;
    while (n) {
        n /= k;
        res++;
    }
    cout << res << endl;
    return 0;
}


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

int main(){
    int n;  cin >> n;
    vector<ll>a(n);
    rep(i, n)   cin >> a[i];
    int q;  cin >> q;
    vector<ll[2]>Q(q);
    rep(i, q)   cin >> Q[i][0] >> Q[i][1];
    ll ans = 0;
    map<ll, ll>dic;
    rep(i, n){ dic[a[i]]++; }
    for(auto& x:dic){
        ans += x.first*x.second;
    }
    rep(i, q){
        ll b = Q[i][0], c = Q[i][1];
        ans = ans - b*dic[b] + c*dic[b];
        dic[c] += dic[b];
        dic[b] = 0;
        cout << ans << endl;
    }
}


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

vector<long long int> create_divisors_table(long long int n){
    vector<long long int> ret(n+1);

    for(int i=1; i<n+1; i++){
        for(int j=i; j<n+1; j+=i){
            ret[j]++;
        }
    }

    return ret;

}

int main() {
    long long int N, ans = 0;

    cin >> N;

    vector<long long int> table = create_divisors_table(N);

    for(int i=1; i<N; i++){

        ans += table[i];

    }
    
    cout << ans;

    return 0;
}

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

typedef long long int64;

int64 a, b, c, ans = LLONG_MAX;

void calc(int64 a, int64 b, int64 c) {
	int64 r = a / 2;

	for(int64 i = max(1LL, r - 5); i <= min(r + 5, a - 1); i++) {
		int64 v1 = i * b * c;
		int64 v2 = (a - i) * b * c;
		ans = min(ans, llabs(v1 - v2));
	}
}

int main() {
	scanf("%lld%lld%lld", &a, &b, &c);

	calc(a, b, c);
	calc(a, c, b);
	calc(b, a, c);
	calc(b, c, a);
	calc(c, a, b);
	calc(c, b, a);

	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b, ans;
    char op;
    cin >> a >> op >> b;
    if (op == '+') {
        ans = a + b;
    } else if (op == '-') {
        ans = a - b;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int dis[100000];
int gcd(int x, int y) {
	int r;
	while ((r = x % y) != 0) {
		x = y;
		y = r;
	}
	return y;
}
int main() {
	int n, X, x, d;
	scanf("%d%d", &n, &X);
	for (int i = 0; i < n; i++) {
		scanf("%d", &x);
		dis[i] = abs(X - x);
	}
	d = dis[0];
	for (int i = 1; i < n; i++) {
		d = gcd(d, dis[i]);
	}
	printf("%d", d);
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;

int main() {

	Int N;
	cin >> N;

	vector<Int> h(N);
	for (Int i = 0; i < N; i++) cin >> h[i];

	Int flag = 0;
	for (Int i = 0; i < N - 1; i++) {
		Int gap = h[i + 1] - h[i];
		if (gap >= 1)h[i + 1]--;
		if (gap <= -1) {
			flag = 1;
			break;
		}
	}

	if (flag)cout << "No" << endl;
	else cout << "Yes" << endl;

}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#include "math.h"
#include "string.h"
#include "algorithm"
 
using namespace std;
typedef int64_t ll;
typedef vector<int64_t> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define SIZE(a) int((a).size())


int h,w;
char maze[100][100];
int x,y;
int d[100][100];
int dx[2]={1,0}; int dy[2]={0,1};


int main(){
  cin >>h>>w;
  
  rep(i,h){
    rep(j,w){
      cin >> maze[i][j];
      d[i][j]=INT_MAX;
    }
  }
  
  d[0][0]=0;
  if(maze[0][0]=='#'){d[0][0]++;}
  
  rep(i,h){
    rep(j,w){
      rep(k,2){
        int ny=i+dy[k] ; int nx =j+dx[k];
          if(nx>=0 && nx<w && ny>=0 && ny<h){
            if(maze[i][j]=='.'&&maze[ny][nx]=='#'){
              d[ny][nx]=min(d[i][j]+1,d[ny][nx]);
            }
            else{
              d[ny][nx]=min(d[i][j],d[ny][nx]);
            }  
          }  
        
      }   
    }
  }
  cout << d[h-1][w-1]<<endl; 
}



Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>


typedef long long ll;

using namespace std;

int main() 
{ 
	int nums[3][3];
	bool results[3][3];

	for (int i = 0; i < 3; i++){
		for (int j = 0; j < 3; j++){
			cin >> nums[i][j];
		}
	}

	for (int i = 0; i < 3; i++){
		for (int j = 0; j < 3; j++){
			results[i][j] = false;
		}
	}

	int n;
	cin >> n;

	for (int k = 0; k < n; k++){

		int temp;
		cin >> temp; 

		for (int i = 0; i < 3; i++){
			for (int j = 0; j < 3; j++){
				if (nums[i][j] == temp){
					results[i][j] = true;
				}
			}
		}
	}

	bool res = false;

	if (results[0][0] && results[0][1] && results[0][2]) res = true;
	else if (results[1][0] && results[1][1] && results[1][2]) res = true;
	else if (results[2][0] && results[2][1] && results[2][2]) res = true;
	else if (results[0][0] && results[1][0] && results[2][0]) res = true;
	else if (results[0][1] && results[1][1] && results[2][1]) res = true;
	else if (results[0][2] && results[1][2] && results[2][2]) res = true;
	else if (results[0][0] && results[1][1] && results[2][2]) res = true;
	else if (results[0][2] && results[1][1] && results[2][0]) res = true;

	string ans = (res) ? "Yes" : "No";

	cout << ans << endl;

	return 0; 
} 


Measured memory_bytes: 256
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
const int inf = 1000000007;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % inf;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), inf - 2, inf) % inf * mod_pow(kai(y), inf - 2, inf) % inf;
}

signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << (a - b + 1) * (a - c + 1) << endl;
}


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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

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

  int a, b, c; cin >> a >> b >> c;

  int now = a;
  vector<bool> sel(b);
  while(!sel[now]) {
    sel[now] = true;
    now += a;
    now %= b;
  }

  cout << (sel[c] ? "YES" : "NO") << endl;

}








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

int main(){
  int N; cin >> N;
  string s;
  unordered_map <string, int> MAP;
  long long ans = 0;
  for(int i = 0; i < N; i++){
    cin >> s;
    sort(s.begin(), s.end());
    if(MAP.count(s)){
      MAP[s]++;
      ans += MAP[s];
    }
    else{
      MAP[s] = 0;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 10660
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define EPS (1e-7)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------
const ll INF = INT_MAX;

struct LazyRMQ
{
private:
    ll n;
    vector<ll> node, lazy;
    vector<bool> lazyFlag;

public:
    LazyRMQ(vector<ll> v)
    {
        ll sz = (ll)v.size();
        n = 1;
        while (n < sz)
        {
            n *= 2;
        }
        node.resize(2 * n - 1);
        lazy.resize(2 * n - 1, INF);
        lazyFlag.resize(2 * n - 1, false);
        for (ll i = 0; i < sz; i++)
        {
            node[i + n - 1] = v[i];
        }
        for (ll i = n - 2; i >= 0; i--)
        {
            node[i] = min(node[2 * i + 1], node[2 * i + 2]);
        }
    }

    void eval(ll now, ll l, ll r)
    {
        if (lazyFlag[now])
        {
            node[now] = lazy[now];
            if (r - l > 1)
            {
                lazy[2 * now + 1] = lazy[2 * now + 2] = lazy[now];
                lazyFlag[2 * now + 1] = lazyFlag[2 * now + 2] = true;
            }
            lazyFlag[now] = false;
        }
    }

    void update(ll a, ll b, ll x, ll now = 0, ll l = 0, ll r = -1)
    {
        if (r < 0)
        {
            r = n;
        }
        eval(now, l, r);
        if (b <= l || r <= a)
        {
            return;
        }
        if (a <= l && r <= b)
        {
            lazy[now] = x;
            lazyFlag[now] = true;
            eval(now, l, r);
        }
        else
        {
            update(a, b, x, 2 * now + 1, l, (l + r) / 2);
            update(a, b, x, 2 * now + 2, (l + r) / 2, r);
            node[now] = min(node[2 * now + 1], node[2 * now + 2]);
        }
    }

    ll getmin(ll a, ll b, ll now = 0, ll l = 0, ll r = -1)
    {
        if (r < 0)
        {
            r = n;
        }
        eval(now, l, r);
        if (b <= l || r <= a)
        {
            return INF;
        }
        if (a <= l && r <= b)
        {
            return node[now];
        }
        ll vl = getmin(a, b, 2 * now + 1, l, (l + r) / 2);
        ll vr = getmin(a, b, 2 * now + 2, (l + r) / 2, r);
        return min(vl, vr);
    }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, q;
    cin >> n >> q;
    vector<ll> a(n, INF);
    LazyRMQ lazyseg(a);
    for (ll i = 0; i < q; i++)
    {
        ll c;
        cin >> c;
        if (c == 0)
        {
            ll s, t, x;
            cin >> s >> t >> x;
            lazyseg.update(s, t + 1, x);
        }
        else
        {
            ll s, t;
            cin >> s >> t;
            cout << lazyseg.getmin(s, t + 1) << endl;
        }
    }
}


Measured memory_bytes: 8700
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>
#include <unordered_map>
#include <set>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

int main()
{
  ll N;
  cin >> N;
  vector<ll> as(N);
  ll res = 100 * 10000;
  for(auto i = 0; i < N; i++) cin >> as[i];
  for (auto a1 = -100; a1 <= 100; a1++) {
    ll cost = 0;
    for (auto a2 : as) {
      cost += (a1 - a2) * (a1 - a2);
    }
    res = min(res, cost);
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 888
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    int x = n * 100 / 108;
    for(int i=0; i<2; ++i){
        if(x * 108 / 100 == n){
            cout << x << endl;
            return 0;
        }
        ++ x;
    }

    cout << ":(" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] values = br.readLine().split(" ");
        int a = Integer.parseInt(values[0]);
        int b = Integer.parseInt(values[1]);
        double C = Integer.parseInt(values[2]) * Math.PI / 180;

        double S = 0.5 * a * b * Math.sin(C);
        double L = a + b + Math.sqrt(a*a + b*b - 2*a*b*Math.cos(C));
        double h = 2 * S / a;

        System.out.println(S +"\n"+ L +"\n"+ h);
    }
}

Measured memory_bytes: 24240
import itertools
N = int(input())
XY = [[int(i) for i in input().split()] for j in range(N)]

All = list(itertools.permutations(range(N)))

def euqlid(a1,a2,b1,b2):
    return pow((a1-a2)**2+(b1-b2)**2,0.5)
    
ans = 0
co = 0
for i in All:
    count = 0
    i = list(i)
    x,y = XY[i[0]]
    for j in i[1:]:
        s,t = XY[j]
        count += euqlid(x,s,y,t)
        x,y = s,t
    ans += count
    co += 1

print(ans/co)

Measured memory_bytes: 8052
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String []args)
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n<1200)
            System.out.println("ABC");
        else if(n>=1200 && n<2800)
            System.out.println("ARC");
        else if(n>=2800)
            System.out.println("AGC");

    }
}


Measured memory_bytes: 23124
#include<cstdio>
int n, K, Mod, D[310][310], Comb[310][310], S[310];
int main() {
	int i, j, k;
	scanf("%d%d%d", &n, &K, &Mod);
	for (i = 0; i < 310; i++) {
		Comb[i][0] = 1;
		for (j = 1; j <= i; j++)Comb[i][j] = (Comb[i - 1][j - 1] + Comb[i - 1][j]) % Mod;
	}
	D[0][0] = 1;
	for (i = 1; i <= 300; i++) {
		for (j = 0; j <= 300; j++) {
			S[j] = (S[j] + D[i - 1][j]) % Mod;
		}
		D[i][0] = 1;
		for (j = 1; j <= 300; j++) {
			for (k = 1; k <= j; k++) {
				D[i][j] = (D[i][j] + (long long)S[k - 1] * D[i][j - k] % Mod * Comb[j - 1][k - 1]) % Mod;
			}
		}
	}
	printf("%d\n", D[K][n]);
}

Measured memory_bytes: 896
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	static class Dice {
		// 回転方向と方向に対応する変更面の添え字配列
		enum Direction {
			Roll			(new int[] { 0, 1, 5, 4 }, 2),
			Pitch			(new int[] { 0, 3, 5, 2 }, 1),
			Yaw				(new int[] { 4, 2, 1, 3 },	5),
			ReverseRoll	(new int[] { 0, 4, 5, 1 }, 3),
			ReversePitch	(new int[] { 0, 2, 5, 3 }, 4),
			ReverseYaw		(new int[] { 4, 3, 1, 2 }, 0);

			private int[] nextRotat;
			private int rightNum;

			Direction(int[] nums, int num) {
				this.nextRotat = nums;
				this.rightNum = num;
			}
		}

		// ラベル
		int[] label;

		// コンストラクタ
		Dice(int[] label) {
			this.label = label;
		}

		public int DiceSearch(int num1, int num2) {
			int value1=0,value2=0;
			for(int i=0;i<label.length;i++) {
				if(label[i]==num1)value1=i;
				if(label[i]==num2)value2=i;
			}
			for (Direction dir : Direction.values()) {
				if (NumberSearch(value1, value2, dir.nextRotat)) {
					return dir.rightNum;
				}
			}
			return 0;
		}

		boolean NumberSearch(int num1, int num2, int[] array) {
			for (int i = 0; i < array.length - 1; i++) {
				if (array[i] == num1 && array[i + 1] == num2) {
					return true;
				}
			}
			if (array[array.length - 1] == num1 && array[0] == num2) {
				return true;
			}
			return false;
		}

	}

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

		// ラベル入力・ダイスの生成
		Dice dice = new Dice(CreateIntLabel(sc.nextLine().split("[\\s]+")));

		int questionCount = Integer.parseInt(sc.nextLine());
		ArrayList<Integer> ansList = new ArrayList<Integer>();
		for (int i = 0; i < questionCount; i++) {
			ansList.add(dice.DiceSearch(sc.nextInt(), sc.nextInt()));
		}

		// 出力
		for (int i : ansList) {
			System.out.println(dice.label[i]);
		}

	}

	// ラベル配列の生成
	public static int[] CreateIntLabel(String[] input) {
		int[] label = new int[input.length];
		for (int i = 0; i < input.length; i++) {
			label[i] = Integer.parseInt(input[i]);
		}
		return label;
	}

}



Measured memory_bytes: 26468
N = [int(i) for i in input().split()]
A = N[0]
B = N[1]
C = N[2]
K = N[3]

if K % 2 == 0:
    if abs(A - B) > 10 ** 18:
        print('Unfair')
    else:
        print(A - B)
else :
    if abs(A - B) > 10 ** 18:
        print('Unfair')
    else:
        print(B - A)

Measured memory_bytes: 3316
import java.util.Scanner;

class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a>b) {
            System.out.println("a > b");
        } else if (a<b) {
            System.out.println("a < b");
        } else {
            System.out.println("a == b");
        }
    }
}


Measured memory_bytes: 26132
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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; }

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 main () {
  int N;
  ll T;
  cin >> N >> T;
  vector<ll> t(N);
  rep(i,N) {
    cin >> t[i];
  }

  ll ans = 0;
  rep(i,N-1) {
    ans += min(t[i+1]-t[i],T);
  }
  ans += T;
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <tuple>
#include <cmath>
#include <algorithm>

using namespace std;


int main() {

    int N;

    cin >> N;

    vector<int> v;

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

    sort(v.rbegin(), v.rend());

    int alice = 0;
    int bob = 0;

    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) {
            alice += v[i];
        } else {
            bob += v[i];
        }
    }

    cout << (alice - bob) << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }

int main() {
    int n, d;
    cin >> n >> d;
    auto v = make_v(n, d, 0);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < d; ++j) {
            cin >> v[i][j];
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i+1; j < n; ++j) {
            int s = 0;
            for (int k = 0; k < d; ++k) {
                s += (v[i][k]-v[j][k])*(v[i][k]-v[j][k]);
            }
            int ok = 0;
            for (int l = 0; l < 5000; ++l) {
                if(l*l == s) ok++;
            }
            if(ok) ans++;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp(a, b) make_pair((a), (b))
#define pb(a) push_back((a))

using namespace std;
 
typedef long long lld;
typedef pair<int, int> pii;
typedef pair<lld, lld> pll;
typedef pair<lld, int> pli;
typedef pair<int, lld> pil;
typedef vector<vector<int>> Matrix;
typedef vector<vector<int>> Adj;
typedef vector<int> Row;
 
const int MOD = 1e9 + 7;
const int INF = 1e9;
const lld LINF = 1e18;
const double PI = 2.0 * acos(0.0);

int main() {
  int n;
  cin >> n;
  vector<pii> v(n);
  for (int i = 1; i <= n; ++i) {
    cin >> v[i-1].first;
    v[i-1].second = i;
  }
  sort(v.begin(), v.end());
  set<int> s;
  s.insert(0);
  s.insert(n+1);
  lld ans = 0;
  for (int i = 0; i < n; ++i) {
    auto l = s.upper_bound(v[i].second);
    auto r = s.lower_bound(v[i].second);
    if (l != s.begin()) --l;
    if (r == s.end()) --r;
    ans += 1ll * v[i].first * (v[i].second - *l) * (*r - v[i].second);
    s.insert(v[i].second);
  }
  cout << ans << endl;
}



Measured memory_bytes: 11136
#include<stdio.h>
#define MAX 1000000
 
int main(){
   
  int h;
  int i;
  int A[MAX+1];
 
 
  scanf("%d", &h);
 
  for ( i = 1; i <= h; i++ ){
    scanf("%d", &A[i]);
  }
 
  for ( i = 1; i <= h; i++ ) {
     
    printf("node %d: key = %d, ", i, A[i]);
     
    if ( i / 2 >= 1 )printf("parent key = %d, ", A[i/2]);
    if ( i*2 <= h ) printf("left key = %d, ", A[i*2]);
    if ( i*2+1 <= h ) printf("right key = %d, ", A[i*2+1]);
 
    printf("\n");
  }
   
  return 0;
}
/*
#include<stdio.h>
#define MAX 1000000
 
int parent(int i){ return i/2; }
int left(int i){ return i*2; }
int right(int i){ return i*2+1; }
 
int main(){
  int n,i,A[MAX+1];
 
  scanf("%d",&n);
  for(i=1;i<=n;i++) {
    scanf("%d",&A[i]);
  }
 
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ", i, A[i]);
     
    if(parent(i)>=1) printf("parent key = %d, ", A[parent(i)]);
    if(left(i)<=n) printf("left key = %d, ", A[left(i)]);
    if(right(i)<=n) printf("right key = %d, ", A[right(i)]);
 
    printf("\n");
  }
 
  return 0;
}
*/



Measured memory_bytes: 2044
#include <iostream>
#include <vector>

using namespace std;

int main(){
    long long N;
    while(cin >> N){
        vector<int> res;
        for(int i=1;(1LL<<i)-1<=N;i++) res.push_back(i);
        N -= (1LL << res.size()) - 1;
        int cur = res.size() + 1;
        for(int i=res.size();i>=0;i--){
            if(N&(1LL<<i)){
                auto it = res.begin();
                for(int j=0;j<i;j++) ++it;
                res.insert(it, cur);
                ++cur;
            }
        }
        for(int i=1;i<cur;i++) res.push_back(i);
        cout << res.size() << endl;
        cout << res[0];
        for(int i=1;i<res.size();i++) cout << " " << res[i];
        cout << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
#define pb push_back
#define fo(i, n) for(int i = 1; i <= n; ++i)
 
typedef long long ll;
 
const int N = 505000;
const int mod = 1e9 + 7;
const ll inf = 1e18;
 
int n, a[(1 << 18)];
int mx1[(1 << 18)], mx2[(1 << 18)];
int ans[(1 << 18)];
 
inline void upd(int mask, int x) {
    if(x >= mx1[mask]) mx2[mask] = mx1[mask], mx1[mask] = x;
    else if(x >= mx2[mask]) mx2[mask] = x;
}
 
int main() {
    ios::sync_with_stdio(0); cin.tie(0);
 
    cin >> n;
    for(int i = 0; i < (1 << n); ++i) {
        cin >> a[i];
        mx1[i] = a[i];
        mx2[i] = -2e9;
    }
    for(int i = 0; i < n; ++i) {
    	for(int mask = 0; mask < (1 << n); ++mask) {
    		if(mask & (1 << i)) continue;
    		upd(mask ^ (1 << i), mx1[mask]);
    		upd(mask ^ (1 << i), mx2[mask]);
    	}
    }
    int res = 0;
    for(int i = 1; i < (1 << n); ++i) {
    	res = max(res, mx1[i] + mx2[i]);
    	cout << res << '\n';
    }
 
    return 0;
}

Measured memory_bytes: 6144
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include <string>
using namespace std;
#define rep(i,n) for(long long i=0;i<(n);i++)
map<int, int> mp;
map<int, int>mm;
#define ll long long
#define ld long double
#define PI 3.14159265358979l
int main() {
    int a=0, b=0, c=0, d=0;
    rep(i, 4) {
        int n;
        cin >> n;
        if (n == 1)a = 1;
        else if(n == 9)b = 1;
        else if (n == 7)c = 1;
        else if (n == 4)d = 1;
    }
    if (a + b + c + d == 4)cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define MOD 1000000007
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
int main(){
    speed;
    ll N,x,max=0,res=0;
    cin>>N;
    ll A[N];
    map<ll,ll>ans;
    map<ll,ll>freq;
    for(ll i=0;i<N;i++) {cin>>A[i]; freq[A[i]]++; ans[A[i]]=1; if(max<A[i]) max=A[i];}
    sort(A,A+N);
    for(ll i=0;i<N;i++){
        if(ans[A[i]]==1){
            for(ll j=A[i]*2;j<=max;j+=A[i])
                ans[j]=0;
        }
        if(freq[A[i]]>1) ans[A[i]]=0;
    }
    for(auto i:ans)
        if(i.second==1) res++;
    cout<<res;
}


Measured memory_bytes: 76812
#include <cstdio>
 
int A, B;
 
int main() {
	scanf("%d%d", &A, &B);
	if (A <= 0 && B >= 0) puts("Zero");
	else if (A > 0 || (B - A) & 1) puts("Positive");
	else puts("Negative");
	return 0;
}

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

int P, Q, R;
const char *p;

int formula() {
  
  p++;

  switch( *p ) {
  case '-': return 2 - formula();
  case 'P': return P;
  case 'Q': return Q;
  case 'R': return R;
  case '0': return 0;
  case '1': return 1;
  case '2': return 2;
    
  case '(':
    int form1 = formula();
    int form2;
    p++;
    switch( *p ) {
    case '*':
      form2 = formula();
      p ++;
      if( form1 == 0 || form2 == 0 ) return 0;
      if( form1 == 1 || form2 == 1 ) return 1;
      else return 2;
    case '+':
      form2 = formula();
      p++;
      if( form1 == 2 || form2 == 2 ) return 2;
      if( form1 == 1 || form2 == 1 ) return 1;
      else return 0;
    }
  }
  
  return 0;
}

int main() {
  string str;
  
  while(getline(cin, str)) {
    int cnt = 0;
    if( str == "." ) break;
    for(int i=0; i<3; i++) {
      for(int j=0; j<3; j++) {
	for(int k=0; k<3; k++) {
	  P = i, Q = j, R = k;
	  p = &str[0]-1;
	  if( formula() == 2 ) cnt ++;
	}
      }
    }

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

Measured memory_bytes: 1184
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define x first
#define y second
const int N = 1e6+7;
vector<pii> qup,qdw;//qup : q > 0;qdw : q < 0
char s[N];
int main()
{
	int n;scanf("%d",&n);
    int tot = 0;
    for(int i = 1;i <= n;++i)
    {
    	scanf("%s",s);
    	int len = strlen(s);
    	int cur = 0;
    	int p = N;
    	for(int j = 0;j < len;++j)
    	{
    		if(s[j] == '(')	++cur;
    		else --cur;
    		p = min(p,cur);
    	}
    	//if(p == 0 && cur == 0)	continue;
    	if(cur > 0)	qup.push_back({p,cur});
    	else 		qdw.push_back({cur - p,-cur});
    	tot += cur;
    }
    if(tot != 0)
    {
    	puts("No");
    	return 0;
    }
    //qup : p from big to small
    sort(qup.begin(),qup.end());reverse(qup.begin(),qup.end());
    sort(qdw.begin(),qdw.end());reverse(qdw.begin(),qdw.end());
	bool ok = 1;
	int sum = 0;
	// for(int i = 0;i < qup.size();++i)
		// cout << qup[i].x << " " << qup[i].y << " ";
	// cout << endl;
	// for(int i = 0;i < qdw.size();++i)
		// cout << qdw[i].x << " " << qdw[i].y << " ";
	// cout << endl;
	for(int i = 0;i < qup.size();++i)
	{
		if(sum + qup[i].x < 0)
		{
			ok = 0;
			break;
		}
		sum += qup[i].y;
	}
	for(int i = 0;i < qdw.size();++i)
	{
		if(sum - qdw[i].x - qdw[i].y < 0)
		{
			ok = 0;
			break;
		}
		sum -= qdw[i].y;
	}
	if(!ok)	puts("No");
	else puts("Yes");
    return 0;
}


Measured memory_bytes: 10920
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define dfor(i,a,b) for(ll i=(a);i>=(b);i--)
#define mem(u, vis) memset(u, vis, sizeof(u))
#define ll long long
#define ull unsigned long long
#define MOD  1000000007
#define MAX  1e9
#define pb   push_back
#define F    first
#define S    second


int main() {
	ll t=1;
	//cin>>t;
	while(t--){
		ll n;
		cin>>n;
		ll v = n/500;
		ll sum = v*1000;
		v = n%500;
		sum += (v/5)*5;
		cout<<sum;
		
	}
	
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
using namespace std;
using vi = vector<int>;

int main(void){
    int n, k;
    cin >> n >> k;
    vi s(n, 1);
    for(int i=0; i<k; i++){
        int d;
        cin >> d;
        for(int j=0; j<d; j++){
            int a;
            cin >> a;
            s[a-1] = 0;
        }
    }
    int cnt = 0;
    for(int &x : s) cnt += x;
    cout << cnt << '\n';
    return 0;
}

Measured memory_bytes: 3504
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(x) x.begin(), x.end()
#define mod 1000000007
typedef long long ll;

int main() {
    int x;
    cin >> x;
    int glad = 0;
    while(x - 500 >= 0){
        x -= 500;
        glad += 1000;
    }
    while(x - 5 >=0){
        x -= 5;
        glad += 5;
    }
    cout << glad << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
typedef long long LL;
#define M(a,b) memset(a,b,sizeof(a))
#define pb push_back
const int maxn = 200000+5;
const LL mod = 1000000007;
LL dp[41][1<<17]={0};
int main()
{
    int n,x,y,z;
    scanf("%d%d%d%d",&n,&x,&y,&z);
    int state=(1<<x-1)|(1<<x+y-1)|(1<<x+y+z-1);
    int len=(1<<x+y+z)-1;
    LL ans=1;
    for (int i=1;i<=n;++i) {
        ans=ans*10LL%mod;
    }
    dp[0][0]=1;
    for (int i=1;i<=n;++i) {
        for (int j=0;j<=len;++j) {
            for (int k=1;k<=10;++k) {
                int now = (j<<k)|(1<<k-1);
                if ( (now&len&state) != state ) {
                    dp[i][now&len]=(dp[i][now&len]+dp[i-1][j])%mod;
                }
            }
        }
    }
    for (int i=0;i<=len;++i) {
        ans=(ans-dp[n][i]+mod)%mod;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 41216
/*
      author  : nishi5451
      created : 14.08.2020 15:44:28
*/

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


int main(){
    int n,k;
    cin >> n >> k;
    int now = 1;
    while(n--){
        if(now >= k){
            now+=k;
        }
        else now*=2;
    }
    cout << now << endl;
    return 0;
}

Measured memory_bytes: 3564
group_a=[1,3,5,7,8,10,12]
group_b=[4,6,9,11]
group_c=[2]
x,y=map(int,input().split())
for i in group_a:
    if x==i:
        x="a"
    if y==i:
        y="a"
for i in group_b:
    if x==i:
        x="b"
    if y==i:
        y="b"
for i in group_c:
    if x==i:
        x="c"
    if y==i:
        y="c"
if x==y:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<stdio.h>
int main(void){
  
char str[20];
int i;
int count = 0;

scanf("%s", str);

for (i = 0; str[i] != '\0'; i++){
count++;
}

for (i=count - 1; i>= 0; i--){
printf("%c", str[i]);
}

printf("\n");

    return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
map<long long,int> mp;
int main()
{
	int n;
	cin>>n;
	long long ret=0,sum=0;
	mp[0]++;
	for(int i=0;i<n;i++)
	{
		long long a;
		cin>>a;
		sum+=a;
		ret+=mp[sum];
		mp[sum]++;
	}
	cout<<ret<<endl;
	return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v)                                                            \
  do {                                                                         \
    x = max(x, v);                                                             \
  } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

const ll N = 1000000;
vector<bool> is_prime(N, true);

signed main() {
  is_prime[0] = false;
  is_prime[1] = false;
  for (ll i=2; i<N; i++) {
    if (!is_prime[i])
      continue;
    for (ll j=2*i; j<N; j+=i)
      is_prime[j] = false;
  }

  ll x;
  cin >> x;
  while(!is_prime[x])
    x++;
  cout<<x<<endl;
  return 0;
}


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

int main() {
  long long n;
  cin >> n;
  long long ans = 0;
  for (long long i = 1; i <= n; ++i) {
    long long y = n / i;
    ans += y * (y + 1) * i / 2;
  }
  cout << ans << endl;
}


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

int main(){
    vector<char> a(4);
    string ans = "";
    rep(i,4) cin >> a[i];
    ans += a[0];
    for(int bit = 0; bit<(1<<3); bit++){
        int sum = a[0] - '0';
        for(int i = 0; i < 3; i++){
            if(bit & (1<<i)) sum += (a[i+1] - '0');
            else sum -= (a[i+1] - '0'); 
        }
        if(sum == 7){
            for(int i = 0; i < 3; i++){
                if(bit & (1<<i)) ans += '+';
                else ans += '-';
                ans += a[i+1]; 
            } 
            break;
        }
    }
    ans += "=7";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long a[N], out[N];
vector<int> G[N];
int cnt[N];
bool v[N];
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; ++ i) {
		int a;
		scanf("%d", &a);
		::a[i] = a;
	}
	for (int i = 1; i < n; ++ i) {
		int u, v;
		scanf("%d%d", &u, &v);
		G[u].push_back(v);
		G[v].push_back(u);
		cnt[u] ++;
		cnt[v] ++;
	}
	if (n == 2 && a[1] != a[2]) return 0 * puts("NO");
	queue<int> q;
	for (int i = 1; i <= n; ++ i) {
		if (cnt[i] == 1) {
			q.push(i);
			out[i] = a[i];
		}
		else {
			out[i] = -1;
		}
	}
	int remain = n;
	while (!q.empty()) {
		int p = q.front(); q.pop();
		v[p] = 1;
		if (out[p] == -1) {
			long long tot = 0, big = 0;
			for (int u : G[p]) {
				if (!v[u]) continue;
				tot += out[u];
				big = max(big, out[u]);
			}
			/*for (int u : G[p]) {
				if (!v[u]) continue;
				if (low == -1) low = L[u], high = R[u]; else {
					int L = ::L[u], R = ::R[u];
					int nh = max(abs(high - L), abs(R - low));
					int nl;
					if (low > L) {
						swap(low, L);
						swap(high, R);
					}
					if (L <= high) {
						nl = 0;
						if ((L & 1) != (high & 1)) nl = 1;
					}
					else {
						nl = L - high;
					}
					low = nl;
					high = nh;
				}
			}*/
			if (remain == 1) {
				if ((tot & 1) || tot / 2 != a[p]) return 0 * puts("NO");
				break;
			}
			long long cut;
			if (big <= (tot - big)) {
				cut = tot - tot / 2;
			}
			else {
				cut = big;
			}
			if (a[p] > tot || a[p] < cut) return 0 * puts("NO");
			out[p] = tot - (tot - a[p]) * 2;
		}
		int par;
		for (int u : G[p]) {
			if (!v[u]) {
				par = u;
				break;
			}
		}
		cnt[par] --;
		if (cnt[par] == 1) q.push(par);
		remain --;
	}
	puts("YES");
}



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

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

vector<int> zAlgorithm(const string& S){
    int N = S.size();
    vector<int> A(N+1);

    int c = 0;  // 共通接頭字列の左端?
    FOR(i, 1, N){
        // i-c: 比べるべき先頭からの位置
        // i より前に共通接頭辞列があった場合
        if(A[i-c] < A[c]-(i-c)) A[i] = A[i-c];
        // 
        else{
            int j = max(0, A[c]-(i-c)); // 先頭から j 番目
            while (i+j < N && S[j] == S[i+j]) ++j;
            A[i] = j;
            c = i;
            //cout << i << " " << c << " " << A[i] << endl;
        }
    }
    A[0] = N;

    return A;
}

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

    int ans = 0;
    REP(i, N){
        auto prefix = zAlgorithm(S.substr(i));
        REP(j, N-i){
            int tmp = min(prefix[j], j);
            ans = max(ans, tmp);
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

int main(){

    int N,M;
    cin>>N>>M;
    vector<int> ship[N+1];
    REP(i,M){
        int a,b;
        cin>>a>>b;
        ship[a].push_back(b);
        ship[b].push_back(a);
    }

    REP(i,ship[1].size()){
        if(find(ship[ship[1][i]].begin(),ship[ship[1][i]].end(),N)!=ship[ship[1][i]].end()){
            cout<<"POSSIBLE"<<endl;
            return 0;
        }
    }
    cout<<"IMPOSSIBLE"<<endl;

    return 0;
}

Measured memory_bytes: 12016
N, M = list(map(int, input().split()))
sc = [list(map(int, input().split())) for i in range(M)]

answer = [None] * N
for si, ci in sc:
    digit = si - 1
    if answer[digit] is not None and answer[digit] != ci:
    # if answer[digit] != ci:
        print('-1')
        exit()
    
    answer[digit] = ci

if answer[0] == 0 and N != 1:
    print('-1')
    exit()

if answer[0] is None and N == 1:
    answer[0] = 0
elif answer[0] is None:
    answer[0] = 1

for i, value in enumerate(answer):
    if answer[i] is None:
        answer[i] = 0

answer = int(''.join(map(str, answer)))
print(answer)


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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

template <class T1, class T2>
inline void chmax(T1 &a, const T2 &b)
{
    if (a < b)
    {
        a = b;
    }
}
template <class T1, class T2>
inline void chmin(T1 &a, const T2 &b)
{
    if (a > b)
    {
        a = b;
    }
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;

int main()
{
    ll N;
    cin >> N;
    vl A(N);
    rep(i, N)
    {
        cin >> A[i];
    }
    sort(all(A), greater<ll>());

    ll ans = 0;
    rep(i, N)
    {
        ans += A[i / 2];
    }
    ans -= A[0];

    cout << ans << endl;
}

Measured memory_bytes: 4844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef string str;
static const long long INF = INT64_MAX;
static const long long MOD = (ll)1e9+7;

#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define REP(i, n) for(ll i=0;i<n;i++)
#define SZ(v) (ll)((v).size())
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse((v).begin(), (v).end())
#define FOLDL(src, dst, lambda) partial_sum((src).begin(), (src).end(), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum((src).begin(), (src).end(), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate((v).begin(), (v).end(), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())

template <typename T>void debug(T t) {cerr << t << endl;}
template <typename T, typename ...Args>void debug(T t, Args ...args) {cerr << t << " ";debug(args...);}
template <typename T>void out(T t) {cout << t << endl;}
template <typename T, typename ...Args>void out(T t, Args ...args) {cout << t << " ";out(args...);}

ll imos[510][510];

void solve() {
    ll N, M, Q;
    cin >> N >> M >> Q;
    REP(i, M) {
        ll l, r;
        cin >> l >> r;
        imos[r][l]++;
    }
    REP(i, N) REP(j, N) imos[i+1][j+1] += imos[i][j+1] + imos[i+1][j] - imos[i][j];
    REP(i, Q) {
        ll l, r;
        cin >> l >> r;
        out(imos[r][r] - imos[r][l-1] - imos[l-1][r] + imos[l-1][l-1]);
    }
}

int main() {
    fast_io;
    solve();
    return 0;
}



Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<ll, ll>
#define PP pair<P,P>
using namespace std;

int main(){
    string s; cin >> s;
    if((s[5]-'0')==0 && s[6]-'0'<=4) cout << "Heisei" << endl;
    else cout << "TBD" << endl;
return 0;
}



Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()

    val axy = Array(N) {
        val a = readLine()!!.toInt()
        Array(a) {
            readLine()!!.split(" ").map(String::toInt).let { it[0] to it[1] }
        }
    }

    var ans = 0

    for (bits in 0 until (1 shl N)) {

        var ok = true
        for ((i, xy) in axy.withIndex()) {
            if ((bits shr i and 1) == 0) {
                continue
            }

            for ((x, y) in xy) {
                if ((((bits shr (x - 1)) and 1) xor y) == 1) {
                    ok = false
                    break
                }
            }
        }
        if (ok) {
            ans = Math.max(ans, Integer.toBinaryString(bits).count { it == '1' })
        }
    }
    println(ans)

}

Measured memory_bytes: 40812
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int n,m;
main()
{
	cin>>n;
	vector<int>a(n);
	for(int i=0;i<n;i++)cin>>a[i];
	cin>>m;
	vector<int>b(m);
	for(int i=0;i<m;i++)cin>>b[i];
	int f=0;
	for(int i=0;i<m;i++)
	{
		while(f<a.size()&&a[f]!=b[i])f++;
		if(f==a.size())
		{
			cout<<0<<endl;
			return 0;
		}
	}
	cout<<1<<endl;
}



Measured memory_bytes: 4412
#include <bits/stdc++.h>
#define int long long
#define F first
#define S second
using namespace std;

int mod=1e9+7,  temp=0;


int32_t main() {
    int T;
    T=1;
    //cin>>T;
    while(T--){
        int h,w;
        cin>>h>>w;
        char a[h][w];
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                cin>>a[i][j];
            }
        }
        int ways[h+1][w+1];
        memset(ways,0,sizeof(ways));
        ways[0][1]=1;
        for(int i=1;i<=h;i++){
            for(int j=1;j<=w;j++){
                if(a[i-1][j-1]=='.'){
                    ways[i][j]=ways[i-1][j]+ways[i][j-1];
                    ways[i][j]%=mod;
                }
            }
        }
        // for(int i=0;i<=h;i++){
        //     for(int j=0;j<=w;j++){
        //         cout<<ways[i][j]<<" ";
        //     }cout<<endl;
        // }
        cout<<ways[h][w];
        cout<<'\n';
    }
	return 0;
}

Measured memory_bytes: 9088
N = int(input())
A = sorted(list(map(int, input().split())))

tmp = 0
sum_a = sum(A)
ind = N+1
for i in range(N-1):
    tmp += A[i]*2
    if tmp < A[i+1]:
        ind = i

if ind == N+1:
    print(N)
else:
    print(N-ind-1)


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

using namespace std;

#define ll long long

ll M = 1000000007;

ll bin_pow(ll a, ll pow) {
    if (pow == 0) return 1;
    if (pow == 1) return a;
    if (pow % 2 == 0) {
        ll tmp = bin_pow(a, pow / 2) % M;
        return tmp * tmp % M;
    }
    return a * bin_pow(a, pow - 1) % M;
}

ll inv(ll a) {
    return bin_pow(a, M - 2) % M;
}

ll fact(ll a) {
    ll ans = 1;
    for (int i = 1; i <= a; i++) {
        ans *= i;
        ans %= M;
    }
    return ans;
}

vector<vector<int>> d;
vector<pair<int, int>> a;

int ans(int n, int t) {
    if (t <= 0 || n == 0) return 0;
    if (d[n][t] == -1) {
        d[n][t] = max(ans(n - 1, t), ans(n - 1, t - a[n - 1].first) + a[n - 1].second);
    }

    return d[n][t];
}

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

    int n, m;
    cin >> n >> m;

    vector<int> a(n);
    a[0] = n == 1 ? 0 : 1;

    for (int i = 1; i < n; i++) a[i] = 0;

    set<int> was;

    bool ans = true;

    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        if ((was.count(x) == 1 && a[x - 1] != y) || (x == 1 && y == 0 && n != 1)) {
            ans = false;
        }

        was.insert(x);
        a[x - 1] = y;
    }

    if (ans) {
        for (auto aa : a) cout << aa;
    } else {
        cout << -1;
    }

    return 0;
}

Measured memory_bytes: 256