akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

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

      int n;

      int i = 0;

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

        if ( n == 0 )break;

          i++;

       System.out.println("Case "+i+": "+n);
     }
  }
}


Measured memory_bytes: 42832
#include <cstdio>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

using ll = long long;

ll A, B;

// 000 001 010 011 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111 10000
// 001 011 001 111 001 011 001 1111 001 011 001 111 001 011 001 11111
// 1 11 1 111 1 11 1 1111 1 11 1 111 1 11 1 11111
// 1 2  3 4   5 6  7 8    9 10 11 12 13 14 15 16 

// 1  2  3  4    5   6
//  11  1  111 1  11

int main()
{
  scanf( "%lld%lld", &A, &B );

  ll ans = 0;

  if( (B-A+1)&1 )
  {
    if( A % 2 == 0 )
      ans = B^(((B-A)/2)&1);
    else
      ans = A^(((B-A)/2)&1);
  }
  else
  {
    if( A % 2 == 0 )
      ans = ((B-A+1)/2)&1;
    else
      ans = A^B^(((B-A)/2)&1);
  }

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

Measured memory_bytes: 128
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,q = inpl()
g = [[]for i in range(n)]
c = [0 for i in range(n)]
seen = [False] * n
for i in range(n-1):
    a,b = inpl()
    g[a-1].append(b-1)
    g[b-1].append(a-1)
for i in range(q):
    a,b = inpl()
    c[a-1] += b
def dfs(node):
    for v in g[node]:
        if seen[v]:
            continue
        c[v] += c[node]
        seen[v] = True
        dfs(v) 
seen[0] = True
dfs(0)
print(*c)


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define N_CITY 6
#define MAX_CAP 1'000'000'000'000'000

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

    i64 min_cap = MAX_CAP;
    i64 cap;
    REP(i, 5) {
        cin >> cap;
        chmin(min_cap, cap);
    }

    i64 min_t = 4 + (N / min_cap + (N % min_cap > 0));
    cout << min_t << endl;

    return 0;
}

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

using namespace std;

int n, a, b;
char str[100100];

int main() {
	int i, ac = 0, bc = 0;

	scanf("%d%d%d",&n,&a,&b);
	scanf("%s",str);
	for (i=0;i<n;i++) {
		if (str[i]=='c') {
			printf("No\n");
			continue;
		}
		if (str[i]=='a') {
			if (ac+bc<a+b) {
				printf("Yes\n");
				ac++;
			}
			else printf("No\n");
		}
		else {
			if (ac+bc<a+b&&bc<b) {
				printf("Yes\n");
				bc++;
			}
			else printf("No\n");
		}
	}

    return 0;
}


Measured memory_bytes: 768
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    String s = sc.next();
    String s1[] = s.split("");
    s1[k-1] = s1[k-1].toLowerCase();
    for (int i = 0; i < n; i++){
      System.out.print(s1[i]);
    }
  }
}


Measured memory_bytes: 35844
import sys
input=sys.stdin.readline
'''
N=int(input())
H=map(int,input().split())
'''
N=list(map(int,input().split()))
s=0
for _ in range(2):
  if N[0]>N[1]:
    s+=N[0]
    N[0]-=1
  else:
    s+=N[1]
    N[1]-=1
print(s)

Measured memory_bytes: 3060
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int R = sc.nextInt();
		int G = sc.nextInt();
		int B = sc.nextInt();
		int N = sc.nextInt();
		
		int ans = 0;
		for(int i=0; i<=N/R; i++)
			for(int j=0; j<=(N-i*R)/G; j++)
				if((N-i*R-j*G)%B==0)
					ans++;
		
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

struct CumulativeSum{
    vector<int> data;
    CumulativeSum(int sz) : data(sz, 0) {};
    void add(int k, int x){
        data[k] += x;
    }
    void build(){
        for(int i = 1; i < data.size(); i++){
            data[i] += data[i - 1];
        }
    }
    //区間[0,k]の和
    int query(int k){
        if(k < 0) return 0;
        return (data[min(k, (int)data.size() - 1)]);
    }
    //区間[l.r)の和
    int query(int l, int r){
        return query(r - 1) - query(l - 1);
    }
    // 累積和が x 以上の値になる最小の index
    int lowerBound(int x){
        int res = lower_bound(data.begin(), data.end(), x) - data.begin();
        return res;
    }
};

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    CumulativeSum cs(n);
    rep(i, 0, n){
        cin >> a[i];
        cs.add(i, a[i]);
    }
    cs.build();
    int sum = cs.query(0, n);
    int ans = 1e18;
    // [0, i), [i, n)
    rep(i, 2, n - 1){
        int leftSum = cs.query(0, i);
        int rightSum = cs.query(i, n);
        int lmidx = cs.lowerBound(leftSum / 2);
        int rmidx = cs.lowerBound(sum - rightSum / 2);
        int llsum[2], rrsum[2];
        llsum[0] = cs.query(0, lmidx + 1);
        llsum[1] = cs.query(0, lmidx);
        rrsum[0] = cs.query(rmidx, n);
        rrsum[1] = cs.query(rmidx + 1, n);
        // cout << i << ' ' << leftSum << ' ' << rightSum << endl;
        // cout << lmidx << ' ' << rmidx << endl;
        // cout << llsum[0] << ' ' << rrsum[0] << endl;
        // cout << llsum[1] << ' ' << rrsum[1] << endl;
        rep(j, 0, 2){
            rep(k, 0, 2){
                int MAX = max({llsum[j], leftSum - llsum[j], rrsum[k], rightSum - rrsum[k]});
                int MIN = min({llsum[j], leftSum - llsum[j], rrsum[k], rightSum - rrsum[k]});
                chmin(ans, MAX - MIN);
            }
        }   
    }
    cout << ans << endl;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define in long long
using namespace std;
string s;
in ans=1;
in cnt[200011]={};
int main()
{
	cin >>s;
	for(in i=0;i<s.size();i++)
	{
		ans+=i-cnt[s[i]];
		cnt[s[i]]++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
int main(void)
{
	int x, a, b;
	cin >> x >> a >> b;
	if (x >= b-a  )
	{
		if (a - b >= 0)
		{
			cout << "delicious";
			return 0;
		}
		cout << "safe";
	}
	else if (x<b-a)
	{
		cout << "dangerous";
	}

	return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val in = new java.util.Scanner(System.in)
  val N = in.nextInt
  val primes: Stream[Int] = 2 #:: (Stream.from(3, 2) filter {n =>
    primes takeWhile {_ <= Math.sqrt(n).toInt} forall {n % _ != 0}
  })
  val ps = primes.takeWhile(_ <= N).toArray
  val pNums = new Array[Int](ps.size)

  def divide(i: Int, n: Int): Unit = {
    if (i < ps.size) {
      if (n % ps(i) == 0) {
        pNums(i) += 1
        divide(i, n / ps(i))
      } else divide(i + 1, n)
    }
  }

  (2 to N).foreach(divide(0, _))

  def n(i: Int) = pNums.count(_ >= i - 1)

  println(
    n(5) * (n(5) - 1) / 2 * (n(3) - 2) +
    n(15) * (n(5) - 1) +
    n(25) * (n(3) - 1) +
    n(75))
}

Measured memory_bytes: 25928
#include<cstdio>
#include<cstdlib>
#include<iostream>

using namespace std;

int main()
{
	int i_temp,i_a,i_b;
	cin>>i_temp;
	if(i_temp==1)  cout<<"Hello World";
	else
	{
		cin>>i_a>>i_b;
		cout<<i_a+i_b;
	}
	return 0;
 } 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <cmath>
#include <algorithm>
#include <string>


using namespace std;
using ll = long long;
using ull = unsigned long long;


#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)

auto sumdig(ll num) {
	ll dig, sum;
	sum = 0;
	while (num) {
		dig = num % 10;
		sum = sum + dig;
		num = num / 10;
	}
	return sum;
}
double calc_sunuke(ll num) {
	return (double)num / (double)sumdig(num);

}

int main() {

	string s;
	
	cin >> s;
	string ans = s.erase(s.length()-1);
	while (ans.length() != 2) {
		if (ans.length() % 2 == 0) {
			string subset1 = ans.substr(ans.length() / 2);
			string subset2 = ans.substr(0, ans.length() / 2);
			if ( subset1 == subset2) {
				break;
			}
			else {
				ans.erase(ans.length() - 2);
			}
		}
		else {
			ans.erase(ans.length() - 1);
		}


	}

	cout << ans.length() << endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool c[10][10];
int main(){
    int h,w;
    string ans = "Possible";
    cin >> h >> w;
    for(int i = 0;i < h;i ++){
        for(int j = 0;j < w;j ++){
            char a;
            cin >> a;
            if(a=='#') c[i][j] = 1;
        }
    }
    for(int i = 0;i < h-1;i ++){
        for(int j = 0;j < w-1;j ++){
            if(c[i+1][j]&&c[i][j+1]&&c[i+1][j+1]) ans = "Impossible";
            if(c[i][j]&&c[i][j+1]&&c[i+1][j]) ans = "Impossible";            
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from sys import stdin, stdout


def read():
    x0 = stdin.readline().rstrip()
    return x0


def __main__():
    n = int(read())
    x = 100
    res = 0

    while x < n:
        x += x // 100
        res += 1

    r = str(res) + '\n'
    stdout.write(r)

    #res = str(m) + '\n'


    #res = str(max(m1, m2)) + '\n'
    #stdout.write(res)

__main__()

#a = [int(i) for i in read().split()]

Measured memory_bytes: 9172
#include <bits/stdc++.h>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>

using namespace std;
// using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<double,double> pd;
typedef priority_queue<int, vector<int>, greater<int>> min_heap;

// template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const double PI = 4*atan(1);
const ll INF = 1e18;
const int MX = 100001;

string st;
int n;
const int maxn = 2e5 + 5;
int mods[maxn], freq[maxn];
const int mod = 2019;

ll binom(ll a) {
    // cout << "a: " << a << "\n";
    return (a) * (a - 1) / 2;
}

int poww[maxn];


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> st;
    n = st.size();
    poww[n - 1] = 1;
    for (int i = n - 2; i >= 0; i--) {
        poww[i] = (10 * poww[i + 1]) % mod;
    }
    freq[0]++;
    mods[n - 1] = st[n - 1] - '0';
    freq[mods[n - 1]]++;
    for (int i = n - 2; i >= 0; i--) {
        mods[i] = (mods[i + 1] + poww[i] * (st[i] - '0')) % mod;
        freq[mods[i]]++;
        // cout << "mod:" << mods[i] <<", next:  " << mods[i + 1] << "\n";
    }
    ll ans = 0;
    for (int i = 0; i < mod; i++) {
        ans += binom(freq[i]);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
#define LL long long
#define mem(i, j) memset(i, j, sizeof(i))
#define rep(i, j, k) for(int i = j; i <= k; i++)
#define dep(i, j, k) for(int i = k; i >= j; i--)
#define pb push_back
#define make make_pair
#define INF INT_MAX
#define inf LLONG_MAX
#define PI acos(-1)
#define fir first
#define sec second
using namespace std;

const int N = 1e6 + 5;

int a[N] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};


void solve() {
    int n;
    scanf("%d", &n);
    printf("%d\n", a[n - 1]);


}

int main() {
//    int _; scanf("%d", &_);
//    while(_--) solve();

    solve();

    return 0;
}


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

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// rep
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\n'


string s;

signed main()
{
    cin >> s;

    REP(i, 3){
        if(s[i+1] == s[i]) {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good"<< endl;
    return 0;

}

Measured memory_bytes: 256
def func(n, t, q, s):
    matchN = 0
    t.append(0)
    for x in s:
        t[n] = x
        i = 0
        while t[i] != x:
            i += 1
        if i != n:
            matchN += 1
    return matchN

n = int(input())
t = list(map(int, input().split(" ")))
q = int(input())
s = list(map(int, input().split(" ")))
print (func(n, t, q, s))


Measured memory_bytes: 6324
#include <stdio.h>

int main(void){
    int n;
    scanf("%d", &n);

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

    int count = 0;
    int a = n + 1;
    for(int i = 0; i < n; i++){
        if(a > p[i]){
            count++;
            a = p[i];
        }
    }

    printf("%d", count);
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
    using namespace std;
    #define int long long
     
    signed  main() {
    	int a, b; cin >> a >> b;
    	int c = __gcd(a, b);
    	int ans = 1;
      int d=c;
    	
    	for (int i = 2; i * i <= c; i++) {
        if(c%i!=0)
        continue;

       if(d%i==0 && d!=0 && d>=i){
         ans++;
         while(d%i==0)
         d/=i;
       }
   

    }

        if(d!=1 && (d%2)!=0 && c%d==0){
         ans++;
       }

       cout<<ans;
      }


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

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

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  Int ans=0,pos=-1;
  vector<Int> d(21,-1);
  for(Int i=0;i<n;i++){
    for(Int b=0;b<21;b++){
      if((~a[i]>>b)&1) continue;
      chmax(pos,d[b]);
      d[b]=i;
    }
    //cout<<i<<" "<<pos<<endl;
    ans+=i-pos;
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
    int N;
    cin >> N;
    ll ans = 0;
    for (int i = 1; i <= N; i++) {
        if (i%3 != 0 && i%5 != 0) ans += i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define printP(x) "(" << (x).first << ", " << (x).second << ")"
#define mod 1000000007
using namespace std;
typedef pair<llint, llint> P;

struct edge{
	llint to, cap, rev;
	edge(llint a, llint b, llint c){
		to = a, cap = b, rev = c;
	}
};


llint h, w;
char c[305][305];
llint dp[305][305];
llint cost[305][305];

int main(void)
{
	cin >> h >> w;
	for(int y = 1; y <= h; y++){
		for(int x = 1; x <= w; x++){
			cin >> c[x][h-y+1];
		}
	}
	
	llint ans = 0;
	for(int i = 1; i < w; i++){
		for(int j = h; j >= 1; j--){
			for(int k = h; k >= 1; k--){
				cost[j][k] = cost[j+1][k+1];
				if(c[i][j] == c[i+1][k]) cost[j][k]++;
			}
		}
		for(int j = 0; j <= h; j++){
			for(int k = 0; k <= h; k++){
				dp[j][k] = inf;
			}
		}
		dp[0][0] = 0;
		for(int j = 0; j <= h; j++){
			for(int k = 0; k <= h; k++){
				if(j == h && k == h) continue;
				if(j+1 <= h) chmin(dp[j+1][k], dp[j][k] + cost[j+1][k+1]);
				if(k+1 <= h) chmin(dp[j][k+1], dp[j][k] + cost[j+1][k+1]);
			}
		}
		ans += dp[h][h];
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1792
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using namespace std;

const ll INF = ll(1e18)+1;
 
int main() {
  int n; ll k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());
  ll l = -INF, r = INF;
  while (l+1 < r) {
    ll x = (l+r)/2;
    bool ok = [&]{
      ll tot = 0;
      rep(i,n) {
        if (a[i] < 0) {
          int l = -1, r = n;
          while (l+1<r) {
            int c = (l+r)/2;
            if (a[c]*a[i] < x) r = c; else l = c;
          }
          tot += n-r;
        } else {
          int l = -1, r = n;
          while (l+1<r) {
            int c = (l+r)/2;
            if (a[c]*a[i] < x) l = c; else r = c;
          }
          tot += r;
        }
        if (a[i]*a[i] < x) tot--;
      }
      tot /= 2;
      return tot < k;
    }();
    if (ok) l = x; else r = x;
  }
  cout << l << endl;
  return 0;
}

Measured memory_bytes: 1792
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define ff first
#define ss second
#define setbits(x) __builtin_popcount(x)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<db, db> pdd;
typedef vector<int> vi;
#define m1 make_pair
#define in insert
#define pb push_back
#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define endl "\n"
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
inline ll power(ll a, ll n, ll m)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2, m);
    p = (p * p) % m;
    if (n % 2)
        return (p * a) % m;
    else
        return p;
}
const ll MOD = 1000000007;
const int N = int(3e5) + 999;
#define int long long int

int32_t main(){
    IOS;

    int n;
    cin>>n;
    vector<pair<int,int>> v;
    for(int i=0;i<n;i++){
    	int x,l;
    	cin>>x>>l;
    	v.pb({x+l,x-l});
    }
    
    sort(v.begin(),v.end());
    int ans = 1;
    stack<pair<int,int>> st;

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

    	if(st.size()==0){
    		st.push(v[i]);
    	}
    	else{
    		if(st.top().ff<=v[i].ss)
    			st.push(v[i]);
    	}

    	int sz = st.size();
    	ans = max(ans,sz);

    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3440
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    string s ;
    int i , j , k , t;
    cin >> s ;
    i =s.size();
    i--;
    if(s[i]=='s')
        cout << s << "es";
    else
        cout << s << "s";
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD=1000000007;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
long long gcd(long long a,long long b){
    ll gcdmax=max(a,b);
    ll gcdmin=min(a,b);
    while(true){
        if(gcdmax%gcdmin==0)break;
        else gcdmax%=gcdmin;
        swap(gcdmin,gcdmax);
    }
    return gcdmin;
}
ll powerup(ll N,ll P,ll M){
    if(P==0)return 1;
    else if(P%2==0){
        ll t=powerup(N,P/2,M);
        return t*t%M;
    }
    else return N*powerup(N,P-1,M)%M;
}
int main()
{
  ll K,N;
  ll ans=0;
  cin>>K>>N;
  vector<ll> A(N);
  rep(i,N){
    cin>>A.at(i);
    if(i>=1)ans=max(ans,A.at(i)-A.at(i-1));
  }
  ans=max(ans,K-A.at(N-1)+A.at(0));
  cout<<K-ans<<endl;
}


Measured memory_bytes: 1792
using System;
using System.Linq;

namespace AizuOnlineJudge {
    class Program {
        static void Main() {
            var max = int.Parse(Console.ReadLine());
            var unique = true;
            var dice = new int[max][];

            for (var i = 0; i < max; ++i) {
                var line = Console.ReadLine();
                if (!unique) {
                    continue;
                }
                var die = line.Split().Select(int.Parse).ToArray();
                unique = dice.TakeWhile(q => q != null).All(d => !"RRRNRRRNRRRSRRRSRRRNRRR".SkipWhile(q => !die.Roll(q).SequenceEqual(d)).Any());
                dice[i] = die;
            }

            Console.WriteLine(unique ? "Yes" : "No");
        }
    }
    static class Ex {
        public static int[] Roll(this int[] dice, char c) {
            switch (c) {
                case 'N':
                    Move(dice, 0, 1, 5, 4);
                    break;

                case 'S':
                    Move(dice, 0, 4, 5, 1);
                    break;

                case 'E':
                    Move(dice, 0, 3, 5, 2);
                    break;

                case 'W':
                    Move(dice, 0, 2, 5, 3);
                    break;
                
                case 'R':
                    Move(dice, 1, 2, 4, 3);
                    break;

                case 'L':
                    Move(dice, 1, 3, 4, 2);
                    break;
            }

            return dice;
        }

        static void Move(int[] dice, int a, int b, int c, int d) {
            var tmp = dice[a];
            dice[a] = dice[b];
            dice[b] = dice[c];
            dice[c] = dice[d];
            dice[d] = tmp;
        }
    }
}



Measured memory_bytes: 20476
#include<cstdio>
int main()
{
	int a,b,c;
	scanf("%d %d",&a,&b);
	if(a>0)
		printf("Positive");
	if(a<=0&&b>=0)
		printf("Zero");
	if(a<0&&b<0)
	{
		if((b-a)%2==0)
			printf("Negative");
		else
			printf("Positive");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl
#define show2(a, n, m) rep(i, n) { rep(j, m) {cout << a[i][j] << ' ';} cout << endl;} 
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
//	cout << fixed << setprecision(15);
	int n;
	cin >> n;
	vi c(n+1);
	rep(i, n-1) {
		int a;
		cin >> a;
		c[a]++;
	}
	rep1(i, n) cout << c[i] << endl;
}


Measured memory_bytes: 4052
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>

using namespace std;

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

typedef long long ll;
const int Mod = static_cast<int>(1e9 + 7);

int main()
{	
	int k, s;
	cin >> k >> s;

	vector<int> sum(k + 1, s);
	for (int i = 1; i <= k; i++)  sum[i] -= i;
	sort(sum.begin(), sum.end());

	int ans = 0;
	for (int i = 0; i <= k; i++) {
		for (int j = 0; j <= k; j++) {
			if (binary_search(sum.begin(), sum.end(), i + j)) {
				ans++;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
h = {}
for v in a:
    if v not in h:
        h[v] = 0
    h[v] += 1

for i in range(1, n + 1):
    if i in h:
        print(h[i])
    else:
        print(0)


Measured memory_bytes: 33576
s = int(input())


def f(n):
    if n % 2 == 0:
        return n // 2
    else:
        return n * 3 + 1


def insert(sslist, x):
    if not sslist:
        sslist.append(x)
        return False

    start = 0
    end = len(sslist)

    while start < end - 1:
        y = sslist[(start + end) // 2]
        if x == y:
            return True
        if x < y:
            end = (start + end) // 2
        if x > y:
            start = (start + end) // 2

    if sslist[start] == x:
        return True
    if sslist[start] < x:
        sslist.insert(start + 1, x)
        return False
    if sslist[start] > x:
        sslist.insert(start, x)
        return False


slist = []
ss = s
for i in range(1, 2**32):
    ret = insert(slist, ss)
    ss = f(ss)
    if ret:
        print(i)
        break


Measured memory_bytes: 38256
n, m = map(int, input().split())
mi = None
ma = None
fail = False
for i in range(m):
    l, r = map(int, input().split())
    if mi is None:
        mi = r
    if ma is None:
        ma = l
    ma = max(l, ma)
    mi = min(r, mi)
    if mi < l:
        fail = True
    if r < ma:
        fail = True
if fail:
    print("0")
else:
    print(str(int(mi - ma) + 1))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

queue < int > q;
vector < int > v[100005], r[100005], NVL[100005], t[100005];
vector < int > :: iterator it, itt, ittt;
int nvl[100005];

int main()
{
    int n, m, i, j, x, y, nvl_max = 0;

    cin >> n >> m;
    for ( i = 1 ; i <= m ; i++ )
    {
        cin >> x >> y;
        v[x].push_back ( y );
        v[y].push_back ( x );
    }

    if ( m % 2 == 1 )
    {
        cout << -1;
        return 0;
    }

    q.push ( 1 );
    nvl[1] = 1;
    NVL[1].push_back ( 1 );
    while ( q.empty() == 0 )
    {
        x = q.front();
        q.pop();

        for ( i = 0 ; i < v[x].size() ; i++ )
            if ( nvl[v[x][i]] == 0 )
            {
                q.push ( v[x][i] );
                nvl[v[x][i]] = nvl[x] + 1;
                NVL[nvl[x]+1].push_back ( v[x][i] );
            }
    }

    for ( i = 1 ; i <= n ; i++ )
        for ( it = v[i].begin() ; it != v[i].end() ; it++ )
            if ( nvl[i] < nvl[*it] || ( nvl[i] == nvl[*it] && i < *it ) ) r[i].push_back ( *it ), t[*it].push_back ( i );

    for ( i = 1 ; i <= n ; i++ ) nvl_max = max ( nvl_max, nvl[i] );

    for ( i = nvl_max ; i >= 1 ; i-- )
        for ( it = NVL[i].begin() ; it != NVL[i].end() ; it++ )
            if ( r[*it].size() % 2 == 1 )
            {
                for ( itt = t[*it].begin() ; itt != t[*it].end() ; itt++ )
                    if ( nvl[*itt] == i - 1 )
                    {
                        r[*it].push_back ( *itt );
                        for ( ittt = r[*itt].begin() ; ittt != r[*itt].end() ; ittt++ )
                            if ( *ittt == *it )
                            {
                                r[*itt].erase ( ittt );
                                break;
                            }

                        break;
                    }
            }

    for ( i = 1 ; i <= n ; i++ )
        if ( r[i].empty() == 0 ) for ( j = 0 ; j < r[i].size() ; j++ ) cout << i << ' ' << r[i][j] << '\n';

    return 0;
}


Measured memory_bytes: 22144
import java.io.*;
import java.util.*;
class Main{
 public static void main(String args[]){
   Scanner in = new Scanner(System.in);
 	int N = in.nextInt();
   	int K = in.nextInt();
   	boolean check[]=new boolean[10];
   	Arrays.fill(check,true);
   int ans=0;
   	for(int i =0;i<K;i++){
    	check[in.nextInt()] = false;
    }
   
  	for(int i = N;true;i++){
    	int a = i;
      	boolean hello = true;	
      while(a>0){
   			int d = a%10;
          	if(!check[d]) {
              hello = false;
              break;
            }
        	a/=10;
        }
      	if(hello){
          	ans = i;
  			break;      	
        }
    }
  
   System.out.println(ans);
 }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v){stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n<<=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}
void YN(bool z){cout<<(z?"YES\n":"NO\n");}
void Yn(bool z){cout<<(z?"Yes\n":"No\n");}
void yn(bool z){cout<<(z?"yes\n":"no\n");}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
const int N = 0;
ll n, m;
string s, t;
map<ll, char> a;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m >> s >> t;
  ll nm = n * m / gcd(n, m);
  FOR(i, 0, n) a[nm / n * i] = s[i];
  FOR(i, 0, m) if(a.find(nm / m * i) != a.end() && a[nm / m * i] != t[i]){
    cout << -1 << endl;
    return 0;
  }
  cout << nm << endl;
  return 0;
}

Measured memory_bytes: 6144
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	a, b, c := nextInt(), nextInt(), nextInt()

	var counter int = 0

	for i := a; i <= b; i++ {
		if c%i == 0 {
			counter++
		}
	}
	fmt.Fprintln(out, counter)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}



Measured memory_bytes: 1192
// Example program
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int nodes, edges;
int vrijednost[100009];
vector<int> adj[100009];

int dfs(int node)
{
 //   cout<<node<<endl;
    if(vrijednost[node]!=0) return vrijednost[node];
    else{

    for(int i=0; i<adj[node].size(); i++)
    {
        vrijednost[node]=max(dfs(adj[node][i])+1, vrijednost[node]);   
    }
    return vrijednost[node];
    }
}

int main()
{

cin>>nodes>>edges;
for(int i=0; i<edges; i++)
{
    int a, b; cin>>a>>b;
    adj[a].push_back(b);
}

for(int i=0; i<=nodes; i++) vrijednost[i]=0;

for(int i=1; i<=nodes; i++)
{
    if(vrijednost[i]==0) dfs(i);
}

int maksi=0;
for(int i=1; i<=nodes; i++) maksi= max(maksi, vrijednost[i]);
cout<<maksi;
    
}


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

int main(){
    int a;
    string s;
    cin >> a >> s;
    if(a < 3200) cout << "red" << endl;
    else cout << s << endl;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  typedef long long ll;
  ll N;
  cin >> N;
  ll ans = 0;
  for(int i=1; i <= N;++i) {
    if(i % 3==0) continue;
    if(i % 5==0) continue;
    ans += i;
  }
  cout << ans << endl;
}


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

int main()
{	
	int i = 0;
	int A[100][3];
	for (;;) {
		cin >> A[i][0] >> A[i][1] >> A[i][2];
		if (A[i][0] == -1 && A[i][1] == -1 && A[i][2] == -1)break;

		i++;
	}
	int j = 0;
	for (j;j < i;j++) {
		if (A[j][0] == -1 || A[j][1] == -1)cout << "F" << endl;
		else if (A[j][0] + A[j][1] >= 80)cout << "A" << endl;
		else if (A[j][0] + A[j][1] >= 65)cout << "B" << endl;
		else if (A[j][0] + A[j][1] >= 50 || A[j][2] >= 50) cout << "C" << endl;
		else if (A[j][0] + A[j][1] >= 30)cout << "D" << endl;
		else cout << "F" << endl;
	}
	return 0;
}


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

using namespace std;
using int64 = long long;
//const int mod = 1e9 + 7;
const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


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

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

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

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

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

static constexpr uint32_t mul_inv(uint32_t n, int e = 5, uint32_t x = 1) {
  return e == 0 ? x : mul_inv(n, e - 1, x * (2 - x * n));
}


int main() {
  int K;
  cin >> K;
  int64 d = 7;
  int add = 1;
  set< int > used;
  while(d % K != 0) {
    d = d * 10 + 7;
    d %= K;
    if(used.count(d)) {
      cout << -1 << "\n";
      return 0;
    }
    used.emplace(d);
    ++add;
  }
  cout << add << "\n";
}



Measured memory_bytes: 50524
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using tiii = tuple<int,int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV int(1e9+7)
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
//const double PI = M_PI;  
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
 
/*Coding Space*/
ll used[100001] = {};
int main(){
  ll n; cin >> n;
  ll t = 0;
  rep(i,100001)if(1LL * (i+1)*i/2 == n) t = i+1;
  if(!t){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
    cout << t << endl;
    rep(i,t){
      cout << t-1 << " ";
      int cnt = 0;
      int index = 1;
      vt<int> v;
      rep(x,100001){
        if(cnt == t - 1) break;
        if(used[x+1] == index){
          v.pb(x+1); used[x+1] = LLINF; index++; cnt++;
        }else if(used[x+1] == 0){
          v.pb(x+1); used[x+1] = i+1; cnt++;
        }
      }
      rep(ii,t-1) cout << v[ii] << (ii == t-2?"\n":" ");
    }
  }
}

Measured memory_bytes: 2176
from operator import itemgetter

def main():
  N, M = map(int, input().split())
  ab = [tuple(map(int, input().split())) for _ in range(M)]
  ab.sort(key=itemgetter(1))
  east_island = ab[0][1]
  answer = 1

  for i, j in ab:
      if i >= east_island:
          answer += 1
          east_island = j

  print(answer)


if __name__ == '__main__':
    main()

Measured memory_bytes: 18212
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  long n,a,b;
  cin >> n >> a >> b;
  vector<long> x(n);
  rep(i,n) cin >> x.at(i);
  vector<long> dis(n-1);
  rep(i,n-1){
    dis.at(i) = x.at(i+1)-x.at(i);
  }
  long ans = 0;
  rep(i,n-1){
    if(dis.at(i)*a > b) ans += b;
    else ans += dis.at(i)*a;
  }
  cout << ans << endl;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    for(int i=0; i<m; i++) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<int> d(n, -1), pre(n, -1);
    queue<int> que;
    que.push(0);
    d[0] = 0;
    while(!que.empty()) {
        int v = que.front();
        que.pop();
        for(auto nv : g[v]) {
            if(d[nv] == -1) {
                d[nv] = d[v] + 1;
                pre[nv] = v;
                que.push(nv);
            }
        }
    }
    cout << "Yes" << endl;
    for(int i=1; i<n; i++) cout << pre[i] + 1 << "\n";
}

Measured memory_bytes: 10624
#include <iostream>
#define X 50000
using namespace std;

int gold(int n,bool p[X+1]){
	if(n%2==1){
		if(p[n-2]) return 1;
		else return 0;
	}
	else{
		int c = 0;
		for(int i=2;i<=X;i++){
			if(n-i<i) break;
			if(p[i] and p[n-i]) c++;
		}
		return c;
	}
}

int main(){
	int n;
	bool p[X+1];
	for(int i=0;i<=X;i++) p[i] = true;
	for(int i=2;i<=X;i++){
		if(not p[i]) continue;
		for(int j=2;j<=X/i;j++) p[i*j] = false;
	}
	while(1){
		cin >> n;
		if(n==0) break;
		cout << gold(n,p) << endl;
	}
}

Measured memory_bytes: 1204
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        String x = sc.next();
        String y = sc.next();

        if(x.charAt(0) < y.charAt(0))   System.out.println("<");
        else if(x.charAt(0) > y.charAt(0))  System.out.println(">");
        else System.out.println("=");
    }
}

Measured memory_bytes: 23636
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int n,m;
    cin>>n;
    string s[n];
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    cin>>m;
    string t[m];
    for(int i=0;i<m;i++){
        cin>>t[i];
    }
    int ans=0;
    int tmp=0;
    for(int i =0;i<n;i++){
        tmp=count(s,s+n,s[i])-count(t,t+m,s[i]);
        ans=max(ans,tmp);
    }
    
    cout<<ans;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, K, L;
  cin >> N >> K >> L;
  vector<vector<int>> E1(N);
  for (int i = 0; i < K; i++){
    int p, q;
    cin >> p >> q;
    p--;
    q--;
    E1[p].push_back(q);
    E1[q].push_back(p);
  }
  vector<vector<int>> E2(N);
  for (int i = 0; i < L; i++){
    int r, s;
    cin >> r >> s;
    r--;
    s--;
    E2[r].push_back(s);
    E2[s].push_back(r);
  }
  vector<int> C1(N, -1);
  int cnt1 = 0;
  for (int i = 0; i < N; i++){
    if (C1[i] == -1){
      C1[i] = cnt1;
      queue<int> Q;
      Q.push(i);
      while (!Q.empty()){
        int v = Q.front();
        Q.pop();
        for (int w : E1[v]){
          if (C1[w] == -1){
            C1[w] = cnt1;
            Q.push(w);
          }
        }
      }
      cnt1++;
    }
  }
  vector<int> C2(N, -1);
  int cnt2 = 0;
  for (int i = 0; i < N; i++){
    if (C2[i] == -1){
      C2[i] = cnt2;
      queue<int> Q;
      Q.push(i);
      while (!Q.empty()){
        int v = Q.front();
        Q.pop();
        for (int w : E2[v]){
          if (C2[w] == -1){
            C2[w] = cnt2;
            Q.push(w);
          }
        }
      }
      cnt2++;
    }
  }
  vector<tuple<int, int, int>> V(N);
  for (int i = 0; i < N; i++){
    V[i] = make_tuple(C1[i], C2[i], i);
  }
  sort(V.begin(), V.end());
  vector<int> left(cnt1, N), right(cnt1, 0);
  for (int i = 0; i < N; i++){
    int c = get<0>(V[i]);
    left[c] = min(left[c], i);
    right[c] = max(right[c], i + 1);
  }
  vector<int> cnt(cnt2, 0);
  int l = 0;
  int r = 0;
  vector<int> ans(N);
  for (int i = 0; i < N; i++){
    int c1 = get<0>(V[i]);
    int c2 = get<1>(V[i]);
    int id = get<2>(V[i]);
    while (l < left[c1]){
      cnt[get<1>(V[l])]--;
      l++;
    }
    while (r < right[c1]){
      cnt[get<1>(V[r])]++;
      r++;
    }
    ans[id] = cnt[c2];
  }
  for (int i = 0; i < N; i++){
    cout << ans[i];
    if (i < N - 1){
      cout << ' ';
    }
  }
  cout << endl;
}

Measured memory_bytes: 24568
from fractions import *

N = int(input())
A = list(map(int,input().split()))
lsum = [0]*(N+2)
rsum = [0]*(N+2)
lsum[1] = A[0]
rsum[N] = A[-1]
for i in range(1,N):
    lsum[i+1] = gcd(lsum[i],A[i])
for i in range(N-2,-1,-1):
    rsum[i+1] = gcd(rsum[i+2],A[i])
ans = 1
for i in range(1,N+1):
    if lsum[i-1] == 0:
        ans = max(ans, rsum[i+1])
    elif rsum[i+1] == 0:
        ans = max(ans, lsum[i-1])
    else:
        ans = max(ans, gcd(lsum[i-1],rsum[i+1]))
print(ans)





Measured memory_bytes: 16152
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

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













#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;

int main(){
    int n;
    char s[11];
    scanf("%d", &n);
    int128_t k[26];
    k[0] = 1;
    for(int i = 1; i < 26; i++){
        k[i] = k[i - 1] * 11;
    }
    map<int128_t, ll> mp;
    ll ans = 0;
    for(int i = 0; i < n; i++){
        scanf("%s", s);
        int128_t x = 0;
        for(int j = 0; j < 10; j++){
            x += k[s[j] - 'a'];
        }
        ans += mp[x]++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
    int n,m,k,ans=0;
    cin >> n >> m >> k;
    int a[n],b[m];
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];
    long Sa[n+1],Sb[m+1];
    Sa[0]=0;Sb[0]=0;
    rep(i,n) Sa[i+1] = Sa[i]+a[i];
    rep(i,m) Sb[i+1] = Sb[i]+b[i];
    rep(i,n+1){//Aを何番目まで読むか
        long cur = k-Sa[i];
        if(cur<0) continue;
        else{
            int ok = -1,ng = m+1;
            while(ng-ok>1){
                int mid = (ok+ng)/2;
                if(Sb[mid]<=cur) ok = mid;
                else ng = mid;
            }
            ans = max(ans,i+ok);
        }
    }
    cout << ans << endl;
}

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

int main()
{
    std::string str,str2;
    int k;
    std::cin >> k >> str ;
    
    if(str.size()<=k){
     std::cout << str << std::endl;
    }
    else{
        str2="...";
        std::cout << str.substr(0,k)+str2  << std::endl;
    }
    
}

Measured memory_bytes: 3600
public class Main {
	
	private static void daxpy(double a, double[] x, double[]y ) {
		for (int i = 0; i < x.length; ++i) {
			y[i] = a * x[i] + y[i];
		}
	}
	
	private static double dasum(double[] x) {
		double res = 0.;
		for (int i = 0; i < x.length; ++i) {
			res += Math.abs(x[i]);
		}
		return (res);
	}
	
	private static double dnrm2(double[] x) {
		double res = 0.;
		double scl = 1.;
		for (int i = 0; i < x.length; ++i) {
			final double abs = Math.abs(x[i]);
			if ( scl < abs ) {
				res = 1. + res * (scl / abs) * (scl / abs);
				scl = abs;
			} else {
				res += (abs / scl) * (abs / scl);
			}
		}
		return (scl * Math.sqrt(res));
	}

	private static int idamax(double[] x) {
		double max = Math.abs(x[0]);
		int res = 0;
		for (int i = 1; i < x.length; ++i) {
			if (max < Math.abs(x[i])) {
				max = Math.abs(x[i]);
				res = i;
			}
		}
		return (res);
	}
	
	private static double calcL3Norm(double[] x) {
		double res = 0.;
		for (int i = 0; i < x.length; ++i) {
			res += Math.pow(Math.abs(x[i]), 3);
		}
		return Math.pow(res, 1./3.);
	}
	
	public void run(java.io.InputStream in, java.io.PrintStream out) {
		final java.util.Scanner sc = new java.util.Scanner(in);
		final double[] x = new double[sc.nextInt()];
		final double[] y = new double[x.length];

		for (int i = 0; i < x.length; ++i) {
			x[i] = sc.nextDouble();
		}
		for (int i = 0; i < x.length; ++i) {
			y[i] = sc.nextDouble();
		}
		daxpy(-1., y, x);

		out.printf("%.6f\n", dasum(x));
		out.printf("%.6f\n", dnrm2(x));
		out.printf("%.6f\n", calcL3Norm(x));
		out.printf("%.6f\n", Math.abs(x[idamax(x)]));
		
		sc.close();
	}
	
	public static void main(String[] args) {
		(new Main()).run(System.in, System.out);
	}

}

Measured memory_bytes: 29120
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>


#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)

using namespace std;

int main()
{

  int a;
  cin >> a;
  if(81<a)
  {
    cout << "No";
  }
  else
  {
    FOR(i,1,10)
    {
      if(a%i == 0)
      {
        if(a/i <10)
        {
        cout << "Yes";
        	return 0;
        }
      }
    }
    cout <<"No";
  }
	return 0;
}


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

int main(){
  string s,ans="";
  cin >> s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='B'&&ans.size()!=0) ans.pop_back();
    else if(s[i]=='0') ans.push_back('0');
    else if(s[i]=='1') ans.push_back('1');
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256