akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll; 
 
using namespace std;
using ull = unsigned long long int;

ull f(ull b, ull n) {
	if (n < b) { return n; }
	else { return f(b, floor(n / b)) + (n % b); }
}

int main() {
	ull n, s;
	cin >> n >> s;

	if (n == s) {
		cout << n + 1 << endl;
		return 0;
	}

	for (ull b = 2; b * b <= n; ++b) {
		if (f(b, n) == s) {
			cout << b << endl;
			return 0;
		}
	}

	ull res = 1;
	for (ull p = 1; p * p < n; ++p) {
		ull x = (n - s) / p + 1;
		if ((x * x <= n) || (x > n)) { continue; }

		if (f(x, n) == s) {
			if (res < 2) { res = x; }
			res = min(res, x);
		}
	}

	if (res < 2) { cout << -1 << endl; }
	else { cout << res << endl; }

	return 0;
}


Measured memory_bytes: 256
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};
bool use[100010];


vector<edge> te[100010];
vector<edge> fe[100010];
int t[64];
int d[100100];
ll rec(int num) {
	if (num == 0) return 0;
	return rec(num - 1) + num;
}

void Solve() {
	int n;
	cin >> n;
	ll a[105];
	ll sum = 0;
	for (size_t i = 0; i < n; i++)
	{
		cin >> a[i];
		sum += a[i];
	}
	double ave = sum / (double)n;
	double best = 10000;
	int res = 0;
	for (size_t i = 0; i < n; i++)
	{
		if (abs(ave - a[i]) < best) {
			best = abs(ave - a[i]);
			res = i;
		}
	}
	cout << res << endl;
}


int main() {
	Solve();
	return 0;
}



Measured memory_bytes: 6016
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef set<int> si;
typedef string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
int N,L;
int a[210];
int main(){
  cin>>N>>L;
  int sum=0;
  rep(i,N){
    a[i]=L+i;
    sum+=a[i];
  }
  int m=INF,x;
  rep(i,N){
    if(abs(a[i])<m){
      x=a[i];
      m=abs(a[i]);
    }
  }
  prin(sum-x);
  
  return 0;
}


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

using namespace std;

#define int long long
map < int , int > me;


#define mod 1000000007
#define N 100005
#define MOD 1000000007


int fact[N], invfact[N];

int pow(int a, int b, int m)
{
    int ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%m;
        b/=2;
        a=(a*a)%m;
    }
    return ans;
}

int modinv(int k)
{
    return pow(k, MOD-2, MOD);
}

void precompute()
{
    fact[0]=fact[1]=1;
    for(int i=2;i<N;i++)
    {
        fact[i]=fact[i-1]*i;
        fact[i]%=MOD;
    }
    invfact[N-1]=modinv(fact[N-1]);
    for(int i=N-2;i>=0;i--)
    {
        invfact[i]=invfact[i+1]*(i+1);
        invfact[i]%=MOD;
    }
}

int nCr(int x, int y)
{
    if(y>x)
        return 0;
    int num=fact[x];
    num*=invfact[y];
    num%=MOD;
    num*=invfact[x-y];
    num%=MOD;
    return num;
}

int32_t main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
    
    int n;
    cin>>n;

    vector < int > a(n+2);
    int ending =0;
    for(int i=1;i<=n+1;i++)
    {
        cin>>a[i];
        if(me.find(a[i])==me.end())
            me[a[i]]=i;
        else 
            ending = i;
    }
    int x=n+1-ending;
    int starting = me[a[ending]];
    int other = n+1-ending;
    other += starting-1;
    precompute();

    cout<<n<<endl;
    for(int i=2;i<=n+1;i++)
    {
        int find=nCr(n+1,i);
        int find2=nCr(other,i-1);
        find-=find2;
        //find--;
        find%=mod;
        find+=mod;
        find%=mod;
        cout<<find<<endl;
    }



    return 0;
}


Measured memory_bytes: 9856
#include<cstdio>
#include<algorithm>

using namespace std;

int A[100100];
int B[100100];
int C[100100];

int N;

void input(){
	scanf("%d", &N);
	for(int i = 0; i < N; ++i){
		scanf("%d", A + i);
	}
	for(int i = 0; i < N; ++i){
		scanf("%d", B + i);
	}
	for(int i = 0; i < N; ++i){
		scanf("%d", C + i);
	}
}

long long solve(){
	int cle = 0;
	int ari = 0;
	long long ans = 0;
	sort(A, A + N);
	sort(B, B + N);
	sort(C, C + N);
	for(int i = 0; i < N; ++i){
		while(ari < N && A[ari] < B[i]){
			ari++;
		}
		while(cle < N && B[i] >= C[cle]){
			cle++;
		}
		long long x = ari;
		long long y = N - cle;
		ans += x * y;
	}
	return ans;
}

int main(){
	input();
	long long ans = solve();
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 1280
N = gets.to_i
A = gets.split.map(&:to_i)

F = A.inject(Hash.new(0)) {|h, x| h[x] += 1; h}.sort.reverse

E2 = F.select{|x| x[1] >= 2}.map{|x| x[0]}
E4 = F.select{|x| x[1] >= 4}.map{|x| x[0]}

a2 = E2.size >= 2 ? E2[0] * E2[1] : 0
a4 = E4.size >= 1 ? E4[0] **2 : 0

puts [a2, a4].max



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

using namespace std;
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

const int maxn = 1e6;
const int MOD = 1e9 + 7;

vector<long long> fact(maxn + 1, 1);
vector<long long> inv(maxn + 1, 1);

long long mod_pow(long long a, long long b, long long p = MOD) { // = (a^b) % p //((a^-1) % p) = (a^(p-2)) % p;
	long long res = 1;
	a %= p;

	while (b > 0) {
		if ((b & 1) == 1) res = ((res % p) * (a % p)) % p;
		a = ((a % p) * (a % p)) % p;
		b >>= 1;
	}
	return res;
}

void pre_fact() {
	for (long long i = 1; i <= maxn; i++) fact[i] = (i * fact[i - 1]) % MOD;
}

void pre_inv() {
	for (long long i = 1; i <= maxn; i++) inv[i] = (mod_pow(i, MOD - 2) * inv[i - 1]) % MOD;
}

long long C(long long n, long long r) { // nCr % MOD
	return (fact[n] * ((inv[r] * inv[n - r]) % MOD)) % MOD;
}


int main() {
	pre_fact(), pre_inv();

	int x, y; cin >> x >> y;

	if ((x + y) % 3 != 0) {
		cout << 0;
		return 0;
	}

	int n = (2 * y - x) / 3, m = (2 * x - y) / 3;

	if (n < 0 or m < 0) {
		cout << 0;
		return 0;
	}

	cout << C(n + m, n);

	return 0;
}

Measured memory_bytes: 18644
#include <unordered_set>
#include <string>
#include <iostream>

using namespace std;

int main(){
    int n; cin >> n;
    string operation, target;
    typedef unordered_set<string> set_t;
    set_t dict;
    for(int i=0;i<n;i++){
        cin >> operation >> target;
        if(operation == "insert"){
            dict.insert(target);
        }
        else{
            if(dict.count(target)==0)
                cout << "no" << endl;
            else
                cout << "yes" << endl;
        }
    }
}

Measured memory_bytes: 30568
#include<stdio.h>
#include<math.h>
int main(){

	int x,y;

	scanf("%d%d",&x,&y);

	// 2c + 4t = y and 2c + 2t = 2x, (y - 2x) / 2  = t, x - t
	if(y == 2*x) printf("Yes\n");
	else{
		if(y > 2*x && (y-2*x) % 2 == 0 ){
			int t = (y-2*x) / 2;
			int c = x - t;
			if(c >= 0) {
				printf("Yes\n");
			}else{
				printf("No\n");
			}
		}else{
				printf("No\n");
		}
	}



}


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

bool isPrime(int p)
{
    if (p <= 1)
        return false;
    if (p<= 3)
     return true;
    if (p%2 == 0 || p%3 == 0)
         return false;

    for (int i=5; i*i<=p; i=i+2)
        if (p%i == 0 || p%(i+2) == 0)
           return false;

    return true;
}
int nextPrime(int P)
{
    if (P <= 1)
        return 2;

    int prime = P;
    bool rslt = false;
    while (!rslt) {
        prime++;

        if (isPrime(prime))
            rslt = true;

    }

    return prime;
}
int main()
{
    int P;
    cin>>P;

           if(isPrime(P))
             cout<<P;
           else
              cout << nextPrime(P);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
#define MAXCH(a, b) a = max(a, b);
#define INF (1LL << 30)
using namespace std;
typedef long long ll;

ll N, M[100], D[100], V[100], S[100];

int main(void) {
  cin >> N;
  REP(i, 0, N) cin >> M[i] >> D[i] >> V[i] >> S[i];

  vector<ll> crowd(360, 0);
  REP(i, 0, N) {
    ll t = (M[i] - 1) * 30 + (D[i] - 1);
    REP(j, 0, V[i]) MAXCH(crowd[(t + j) % 360], S[i]);
    REP(j, 0, S[i]) MAXCH(crowd[(t + V[i] + j) % 360], S[i] - j - 1);
    REP(j, 0, S[i]) MAXCH(crowd[(t + 360 - j - 1) % 360], S[i] - j - 1);
  }

  // REP(i, 0, 360) cout << crowd[i] << " ";
  // cout << endl;

  cout << *min_element(crowd.begin(), crowd.end()) << endl;
}

Measured memory_bytes: 3104
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){
    return b?gcd(b,a%b):a;
}
int main(){
    int T;
    ll a,b,c,d,x,k;
    scanf("%d",&T);
    while(T--){
        scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
        if(d<b||a<b){printf("No\n");continue;}
        if(c>=b){printf("Yes\n");continue;}
        a%=b;
        if(a>c){printf("No\n");continue;}
        x=gcd(b,d);
        k=(a+b-c)/x;
        if((a+b-c)%x==0) k--;
        if(a>=k*x){printf("Yes\n");continue;}
        else{printf("No\n");continue;}
    }
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def main():
    N, M = map(int, input().split())

    ac_list = [False] * N
    wa_counts = [0] * N
    total_wa = 0

    for _ in range(M):
        p, s = input().split()
        p = int(p) - 1
        if ac_list[p]:
            continue
        if s == "AC":
            ac_list[p] = True
            total_wa += wa_counts[p]
            continue
        else:
            wa_counts[p] += 1

    print(sum(ac_list), total_wa)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4596
N,Q=gets.split.map &:to_i
A=[0,c=1,1,*[0]*N]
Q.times{
	a,b=gets.split.map &:to_i
	A[a],A[b]=A[b],A[a]
	c = c==a ? b : c==b ? a : c
	A[c-1]=1 if c-1>0 && A[c-1]==0
	A[c+1]=1 if c+1<=N && A[c+1]==0
}
p A.reduce :+

Measured memory_bytes: 3324
use proconio::marker::Chars;
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        s: Chars,
    };

    let s: Vec<char> = s;

    let mut base1 = vec!['0'; s.len()];

    for i in 0..s.len() {
        if i % 2 == 1 {
            base1[i] = '1';
        }
    }

    let mut count1 = 0;
    let mut count2 = 0;

    for (si, base1_i) in s.iter().zip(base1.iter()) {
        if si != base1_i {
            count1 += 1;
        } else {
            count2 += 1;
        }
    }

    if count1 < count2 {
        println!("{}", count1);
    } else {
        println!("{}", count2);
    }
}


Measured memory_bytes: 3104
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <bitset>
using namespace std;

#define X first
#define Y second
#define N 200020
#define M 
#define maxn 1000

typedef long long ll;
const ll INF = 1ll << 60;
const int Mod = 1000000007;

pair<int, int> p[N];

int main()
{
	//freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
	
	int n; scanf("%d", &n);
	for (int i = 0; i < n; ++i) 
	{
		scanf("%d %d", &p[i].X, &p[i].Y);
		if (p[i].X > p[i].Y) swap(p[i].X, p[i].Y);
	}
	sort(p, p + n);
	if (n == 1) puts("0");
	else
	{
		int mi = 1 << 30, ma = 0, mx;
		for (int i = 0; i < n; ++i) 
		{
			mi = min(mi, p[i].Y);
			ma = max(ma, p[i].Y);
		}
		ll res = 1ll * (p[n - 1].X - p[0].X) * (ma - mi);
		mx = ma;
		mi = p[0].Y;
		ma = max(p[n - 1].X, p[0].Y); 
		for (int i = 1; i < n; ++i)
		{
			res = min(res, 1ll * (mx - p[0].X) * (ma - min(p[i].X, mi)));
			ma = max(ma, p[i].Y);
			mi = min(mi, p[i].Y);
		}
		printf("%lld\n", res);
	}
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string.h>

using namespace std;

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch){
  if(ch == 'A') return 1;
  else if(ch == 'C') return 2;
  else if(ch == 'G') return 3;
  else if(ch == 'T') return 4;
  else return 0;
}

long long getKey(char str[]) {
  long long sum = 0, p = 1;
  for(int i=0; i<strlen(str); ++i){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M - 1)); }

int find(char str[]){
  long long key, h;
  key = getKey(str);
  for(int i=0; ; ++i){
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0) return 0;
  }

  return 0;
}

int insert(char str[]){
  long long key, h;
  key = getKey(str);
  for(int i=0; ; ++i){
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0){
      strcpy(H[h],str);
      return 0;
    }
  }

  return 0;
}



int main(){
  int n, h;
  char str[L], com[9];
  for(int i=0; i<M; ++i) H[i][0] = '\0';
  cin >> n;
  for(int i=0; i<n; ++i){
    cin >> com >> str;

    if(com[0] == 'i'){
      insert(str);
    }else{
      if(find(str)){
	cout << "yes" << endl;
      }else{
	cout << "no" << endl;
      }
    }
  }



  return 0;
}



Measured memory_bytes: 17416
/* package codechef; // don't place package name! */

import javax.swing.*;
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here
        Scanner s = new Scanner(System.in);
        int H = s.nextInt();
        int A = s.nextInt();
        int ans;
        if(H%A==0)
            ans=H/A;
        else 
             ans = H/A + 1;
        System.out.println(ans);
    }
}


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

int main() {
  string s;
  cin >> s;
  bool flg = true;
  if (s[0] != 'A') flg = false;
  // cerr << flg << endl;
  int cnt = 0, cur = 0;
  for (int i = 2; i < s.size() - 1; i++) {
    if (s[i] == 'C') {
      cnt++;
      cur = i;
    }
  }
  if (cnt != 1) flg = false;
  // cerr << flg << endl;
  for (int i = 1; i < s.size(); i++) {
    if (i == cur) continue;
    if (s[i] < 'a') flg = false;
  }
  cout << (flg ? "AC" : "WA") << endl;
}

Measured memory_bytes: 256
def main():
    N, Q = map(int, input().split())
    S = input()
    lr = [list(map(int, input().split())) for i in range(Q)]
    Cumsum = [0] * (N + 1)
    for i in range(1, N):
        if S[i - 1] == 'A' and S[i] == 'C':
            Cumsum[i + 1] = Cumsum[i] + 1
        else:
            Cumsum[i + 1] = Cumsum[i]

    for q in range(Q):
        ans = Cumsum[lr[q][1]] - Cumsum[lr[q][0]]
        print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 29908
package main

import (
	"fmt"
	"io"
	"math"
	"os"
	"sort"
)

func run(input io.Reader, output io.Writer) int {
	var n int
	fmt.Fscanf(input, "%d\n", &n)
	xi := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(input, "%d", &xi[i])
	}

	sort.Ints(xi)
	min := math.MaxInt32
	for p := xi[0]; p <= xi[len(xi)-1]; p++ {
		sum := 0
		for _, x := range xi {
			sum += (x - p) * (x - p)
		}
		if sum < min {
			min = sum
		}
	}
	fmt.Println(min)

	return 0
}

func main() {
	os.Exit(run(os.Stdin, os.Stdout))
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int px = 0; int py = 0; int pt = 0;

		for (int i = 0; i < N; i++) {
			int t = sc.nextInt();
			int x = sc.nextInt();
			int y = sc.nextInt();
			int dt = t - pt;
			int dist = Math.abs(px - x) + Math.abs(py - y);

			if (dt >= dist && dt % 2 == dist % 2) {
				px = x;
				py = y;
				pt = t;
				continue;
			} else {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
}

Measured memory_bytes: 85208
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	N = II()
	S = IS()
	ls = [S[0]]
	for s in S[1:]:
		if(ls[-1]!=s):
			ls.append(s)
	print(len(ls))

main()

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



int main() {
  string S,T;
  cin>>S>>T;
  T.pop_back();
  if(S==T)
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }  
  return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

int dx[]={1, 0, -1, 0};
int dy[]={0, -1, 0, 1};

const int MAX_N = 110;

int par[MAX_N];
int ranks[MAX_N];
int ufSize;

void init(int n){
    ufSize = n;
    for(int i=0; i<n; i++){
        par[i] = i;
        ranks[i] = 0;
    }
}

int find(int x){
    if(par[x] == x){
        return x;
    }
    else{
        return par[x] = find(par[x]);
    }
}

bool same(int x, int y){
    return find(x) == find(y);
}

void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;
    ufSize--;

    if(ranks[x] < ranks[y]){
        par[x] = y;
    }
    else{
        par[y] = x;
    }
    
    if(ranks[x] == ranks[y]){
        ranks[x]++;
    }
}

int kruskal(int n, vector<T> &edge){
    sort(edge.begin(), edge.end());
    init(n);
    int res = 0;
    for(int i=0; i<edge.size(); i++){
        int cost, cv, nv;
        tie(cost, cv, nv) = edge[i];
        if(!same(cv, nv)){
            unite(cv, nv);
            res += cost;
        }
    }

    return res;
}

int main(){
    while(1){
        int n, m; cin>>n>>m;
        if(n == 0) return 0;
        vector<T> edge;
        for(int i=0; i<m; i++){
            int a, b, c; cin>>a>>b>>c;
            edge.eb(T(c, a, b));
        }

        cout << kruskal(n, edge) << endl;
    }
}


Measured memory_bytes: 3092
#include<iostream>

using namespace std;

int main() {
    int a;
	int b;
    cin >> a >> b;
    if (a < b) {
        cout << "a < b" << endl;
	}
	if (a > b) {
        cout << "a > b" << endl;
	}
	if (a == b) {
        cout << "a == b" << endl;
    }
    return 0;
}


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

#define MOD 1000000007
#define INF (1<<30)
#define INFL (1<<62)
#define pe(str) return cout<<(str)<<endl,0
#define px(str) cout<<(str)<<endl,exit(0)
#define accu(ac,v) cout<<setprecision(ac)<<v<<endl
#define bpc(a) __builtin_popcount(a)
#define pr(str) cout<<(str)<<endl
#define prpr(str) cout<<str<<endl
#define db(str) cerr<<"debug:"<<(str)<<endl
#define dbdb(str) cerr<<"debugs:"<<str<<endl
#define re(i,n) for(int i=0;i<(n);i++)
#define rre(i,n) for(int i=(n);i>=0;i--)
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b);i>=(a);i--)
#define bw(a,b,c) (((a)<=(b))&&((b)<=(c)))
#define hello cout<<"hello"<<endl
#define spre(a) setprecision(a)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define s3(C,T,F) ((C)?(T):(F))
#define max3(a,b,c) max((a),max((b),(c)))
#define min3(a,b,c) min((a),min((b),(c)))
#define max4(a,b,c,d) max((a),max((b),max((c),(d))))
#define min4(a,b,c,d) min((a),min((b),min((c),(d))))
#define enl cout<<endl
#define declare(t,n) t n;cin>>n

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef complex<int> point;

template<class InputIterator>
void dump(InputIterator first,InputIterator last,char delim=' '){
	for(InputIterator it=first;it!=last;it++){
		if(it!=first)cout<<delim;
		cout<<*it;
	}
}

ull p(ull x,ull y){
	if(y==0) return 1;
	ull A=p(x,y/2)%MOD;
	return (y&1?((A*A)%MOD*x)%MOD: (A*A)%MOD);
	// return (y&1?((A*A)*x):(A*A));
}

template<class T>
void swp(T &a,T &b){
	T t=a; a=b; b=t;
}

int main(void){
	int dp[1001][1001];
	string a,b;
	int n;
	cin>>n;

	while (n--) {
		cin>>a>>b;
		re(i,a.size()) re(j,b.size()) dp[i][j]=0;
		rep(i,1,a.size()+1) rep(j,1,b.size()+1) dp[i][j]=max3(dp[i-1][j-1]+(a[i-1]==b[j-1]),dp[i-1][j],dp[i][j-1]);
		cout<<dp[a.size()][b.size()]<<endl;
	}
	return 0;
}

Measured memory_bytes: 7104
void main() {
	auto n = ri;
	auto a = readAs!(int[]);
	writefln("%(%d %)", rng(n).map!(i => a[i]));
}

auto rng(int n) {
	int[] tmp;
	if(n%2 == 0) {
		tmp ~= iota(n, 0, -2).array;
		tmp ~= iota(1, n, 2).array;
	} else {
		tmp ~= iota(n, 0, -2).array;
		tmp ~= iota(2, n, 2).array;
	}
	return tmp.map!(i => --i);
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 13552
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値

using namespace std;
using ll = long long int;

int main(void){
    long W,H,x,y;cin>>W>>H>>x>>y;
    cout << W*H/2.0 << " ";
    if(W%2==0&&H%2==0&&x==W/2&&y==H/2){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  int D;
  int G;
  cin >> D >> G;
  vector<int> p(D);
  vector<int> c(D);

  int max_count = 0;

  for(int i=0;i<D;i++){
    cin >> p.at(i) >> c.at(i);
    max_count += p.at(i);
  }

  int answer_count = max_count;

  for(int bit=0;bit<(1<<D);bit++){
    bitset<10> s(bit);
    int sum = 0;
    int count = 0;
    for(int i=D-1;i>=0;--i){
      if((bit>>i)&1){
        for(int j=0;j<p.at(i);++j){
          sum+=100*(i+1);
          count++;
          if(j+1==p.at(i)) sum += c.at(i);
          if((sum>=G)&&(count<=answer_count)){
              answer_count = count;
              break;
          }
        }
      }
    }
  }

  cout << answer_count << endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3616
n, k = map(int, input().split())
rem0 = n // k
remhalf = (n // k + 1 if (n // k) * k + k // 2 <= n else n // k)
ans = rem0 ** 3 + (remhalf ** 3 if k % 2 == 0 else 0)
print(ans)

Measured memory_bytes: 9112
def main():
    """
    1 <= A,B,C<=5*10^3
    1 <= X,Y<=10^5
    """
    A, B, C, X, Y = map(int, input().split())

    # A,B片方をを愚直に用意
    # A,BをABから愚直に用意
    a4 = A * X + min(B * Y, 2 * C * Y)
    a5 = B * Y + min(A * X, 2 * C * X)
    a6 = 2 * C * max(X, Y)

    a1 = 2 * C * min(X, Y)
    d = abs(X - Y)
    price = A if X >= Y else B
    a1 += min(price * d, 2 * C * d)

    # ABからAを作る
    a2 = float("inf")
    if 2 * C < A:
        d = max(Y - X, 0)
        a2 = 2 * C * X + min(B * d, 2 * C * d)

    # ABからBを作る
    a3 = float("inf")
    if 2 * C < B:
        d = max(X - Y, 0)
        a3 = 2 * C * Y + min(A * d, 2 * C * d)

    ans = min([a1, a2, a3, a4, a5, a6])
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep(i,n) FOR(i,0,n-1)
#define int long long

int a[200005];

signed main() {

	int a, b; cin >> a >> b;
	int ans = max(a + b, a - b);
	ans = max(ans, a*b);
	rep(i, 100000000) a = 1;
	cout << ans << endl;

}

//cout << ans << endl;

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include<bitset>
#include <utility>
using namespace std;
#define rank rankk
#define mp make_pair
#define pb push_back
#define xo(a,b) ((b)&1?(a):0)
//#define LL ll
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef long long ll;
const int INF=0x3f3f3f3f;
const ll INFF=0x3f3f3f3f3f3f3f3fll;
//const ll M=1e9+7;
//const ll maxn=2e5+7;
//const int MAXN=1005;
const int MAX=1e5+5;
const int MAX_N=MAX;
//const int N=55;
const ll MOD=1000000007;
//const double eps=0.00000001;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<class T> inline
void read(T& num) {
    bool start=false,neg=false;
    char c;
    num=0;
    while((c=getchar())!=EOF) {
        if(c=='-') start=neg=true;
        else if(c>='0' && c<='9') {
            start=true;
            num=num*10+c-'0';
        } else if(start) break;
    }
    if(neg) num=-num;
}
inline ll powMM(ll a,ll b,ll M){
    ll ret=1;
    a%=M;
//    b%=M;
    while (b){
        if (b&1) ret=ret*a%M;
        b>>=1;
        a=a*a%M;
    }
    return ret;
}
void open()
{
    freopen("1004.in","r",stdin);
    freopen("out.txt","w",stdout);
}
char a[125],b[125];
ll an;
int n;
ll dp1[55],dp2[55];
int main()
{
    scanf("%d",&n);
    scanf("%s",a);
    scanf("%s",b);
    dp1[1]=6;dp2[1]=2;
    for(int i=2;i<=52;i++)
        dp1[i]=dp1[i-1]*3LL%MOD,dp2[i]=dp2[i-1]*3LL%MOD;
    int st=0;
    bool ok=false;
    if(a[0]==b[0])
        an=3,st=1;
    else
        an=1,ok=true;;
    int cnt=0;
    for(int i=st;i<n;i++)
    {
        if(a[i]==b[i])
        {
            if(cnt)
            {
                if(ok)
                    an=an*dp1[cnt]%MOD;
                else
                    an=an*dp2[cnt]%MOD;
                ok=false;cnt=0;
            }
            if(a[i-1]==b[i-1])
                an=an*2%MOD;
        }
        else
        {
            ++cnt,++i;
        }
    }
    if(cnt)
    {
        if(ok)
            an=an*dp1[cnt]%MOD;
        else
                    an=an*dp2[cnt]%MOD;
        ok=false;cnt=0;
    }
    printf("%lld\n",an);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main()
{
  char A[11],B[11],C[11];
  int a,b,i;
  
  scanf("%s%s%s",A,B,C);
  
  for(i=1;i<11;i++){
	if(A[i]=='\0'){
      a=i-1;
      break;
    }
  }
    
  for(i=1;i<11;i++){
    if(B[i]=='\0'){
      b=i-1;
      break;
    }
  }
  
  /*printf("%d\n%d\n",a,b);*/
  
  if(A[a]==B[0]&&B[b]==C[0]){
      printf("YES");
  }else{
    printf("NO");
  }
  
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    while (n--)
        cout << "ACL";

}


Measured memory_bytes: 3612
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, V = MAP()
B, W = MAP()
T = INT()

if A < B:
    if A + V * T < B + W * T:
        print("NO")
    else:
        print("YES")
else:
    if B - W * T < A - V * T:
        print("NO")
    else:
        print("YES")

Measured memory_bytes: 10624
// A - Range Product

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int main() {
	int a, b;
	cin >> a >> b;

	string ans;

	if (a > 0) {
		ans = "Positive";
	} else if (b < 0) {
		if ((b - a) % 2 == 1) ans = "Positive";
		else ans = "Negative";
	} else {
		ans = "Zero";
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <functional>
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int n;
int waru=1;
long double counter=0;
int x[10];
int y[10];
// nPnの順列に対して処理を実行する
void foreach_permutation(int n, std::function<void(int *)> f) {
  int indexes[n];
  for (int i = 0; i < n; i++) indexes[i] = i;
  do {
    f(indexes);
  } while (next_permutation(indexes, indexes + n));
}

int main() {
  cin>>n;
  for(int i=0;i<n;i++)
  {
    cin>>x[i]>>y[i];
  }
  for(int i=1;i<=n;i++)
  {
    waru*=i;
  }
  foreach_permutation(n, [](int *indexes) {
	for(int i=0;i<n-1;i++)
    {
      counter+=sqrt(pow((x[indexes[i]]-x[indexes[i+1]]),2.0)+pow((y[indexes[i]]-y[indexes[i+1]]),2.0));
    }
  });
  cout<<fixed<<setprecision(10)<<counter/waru;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int num,num1,num2,tmp;
  scanf("%d%d",&num1,&num2);
  if(num1 < num2){
    tmp = num1;
    num1 = num2;
    num2 = tmp;
  }

  num = num1%num2;
  while(num != 0){
    num1 = num2;
    num2 = num;
    num = num1%num2;
  }
  printf("%d\n",num2);
  return 0;
}



Measured memory_bytes: 2144
import java.util.Scanner;

public class Main {

	static int ans = -2001001001;
	static int[] a = new int[10];
	static int[][] f, p;
	static int n;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		f = new int[n][10];
		p = new int[n][11];
		for(int i = 0 ; i < n ; i++) {
			for(int j = 0 ; j < 10 ; j++) {
				f[i][j] = sc.nextInt();
			}
		}
		for(int i = 0 ; i < n ; i++) {
			for(int j = 0 ; j < 11 ; j++) {
				p[i][j] = sc.nextInt();
			}
		}
		dfs(0);
		System.out.println(ans);
	}

	// 0000000000~1111111111の配列aを生成
	public static void dfs(int pos) {
		if(pos == 10) {
			func();
			return;
		}
		a[pos] = 0; dfs(pos + 1);
		a[pos] = 1; dfs(pos + 1);
	}

	// 0000000000~1111111111のそれぞれを全部試して計算する関数
	public static void func() {
		if(check()) return;
		int score = 0;
		for(int i = 0 ; i < n ; i++) {
			int cnt = 0;
			for(int j = 0 ; j < 10 ; j++) {
				if((a[j]&f[i][j]) == 1) cnt++;
			}
			score += p[i][cnt];
		}
		ans = Math.max(ans, score);
	}

	// a[i]が全て0かどうかのチェック
	public static boolean check() {
		boolean ok = true;
		for(int i = 0 ; i < 10 ; i++) {
			if(a[i] == 1) ok = false;
		}
		return ok ? true : false;
	}

}

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

#define fst first
#define snd second
#define mkp make_pair
typedef long long ll;
typedef pair<ll, int> pli;
const int MAXN = 100010;
const ll MOD = 1000000007; 
const ll INF = 1LL<<50;

inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	for(; !isdigit(ch); ch = getchar()) if(ch=='-') f=-1;
	for(; isdigit(ch); ch = getchar()) x = (x*10)+(ch^48);
	return x * f;
}

int st[MAXN], to[MAXN<<2];
int nxt[MAXN<<2], d[MAXN<<2], e;
inline void Add(int u, int v, int D) {
	to[++e] = v, nxt[e] = st[u];
	st[u] = e, d[e] = D;
	to[++e] = u, nxt[e] = st[v];
	st[v] = e, d[e] = D;
}

struct Edge {
	int u, v, d;
}E[MAXN<<1];

int n, m;
ll dis[2][MAXN], dp[2][MAXN], ans;
bool done[MAXN];

inline void update(ll &cur, ll val) {
	cur += val;
	if(cur >= MOD) cur -= MOD;
}

priority_queue<pli, vector<pli>, greater<pli> > q;

inline void Dijkstra(int S, int t) {
	int i;
	for(i = 1; i <= n; i++) dis[t][i] = INF;
	dis[t][S] = 0, dp[t][S] = 1;
	memset(done, 0, sizeof(done));
	q.push(mkp(0LL, S));
	while(!q.empty()) {
		int u = q.top().snd;
		q.pop();
		if(done[u]) continue;
		done[u] = true;
		for(i = st[u]; i; i = nxt[i]) {
			int v = to[i];
			if(dis[t][v] > dis[t][u]+d[i]) {
				dis[t][v] = dis[t][u]+d[i];
				dp[t][v] = dp[t][u];
				q.push(mkp(dis[t][v], v));
			}
			else if(dis[t][v] == dis[t][u]+d[i]) 
				update(dp[t][v], dp[t][u]);
		}
	}
	/*for(i = 1; i <= n; i++) printf("%lld ", dp[t][i]);
	printf("\n");*/
}

int main() {

	int i, S, T;
	n = read(), m = read();
	S = read(), T = read();
	for(i = 1; i <= m; i++) {
		int u = read(), v = read();
		Add(u, v, E[i].d = read());
		E[i].u = u, E[i].v = v;
	}

	Dijkstra(S, 0);
	Dijkstra(T, 1);

	ll C;
	//printf("%lld %lld\n", dp[0][T], dis[0][T]);
	ans = dp[0][T]*dp[0][T]%MOD;
	//printf("%lld\n", ans);
	//printf(":%lld\n", dis[0][2]);
	for(i = 1; i <= n; i++) 
		if(dis[0][i]*2 == dis[0][T]) {
			//printf(":%d %lld %lld\n", i, dp[0][i], dp[1][i]);
			C = dp[0][i]*dp[1][i]%MOD;
			ans = (ans-C*C%MOD+MOD)%MOD;
		}
	for(i = 1; i <= m; i++) {
		int u = E[i].u, v = E[i].v;
		if(dis[0][u] > dis[0][v]) swap(u, v);
		//if(dis[0][u]+E[i].d != dis[0][v]) continue;
		if(dis[0][u]+E[i].d+dis[1][v] != dis[0][T]) continue;
		if(dis[0][u]*2 < dis[0][T] && dis[0][v]*2 > dis[0][T]) {
			//printf("%d %d %lld %lld\n", u, v, dp[0][u], dp[1][v]);
			C = dp[0][u]*dp[1][v]%MOD;
			ans = (ans-C*C%MOD+MOD)%MOD;
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 12528
#include<cstring>
#include<iostream>
using namespace std;
int main () {
	int n;
	cin >> n;
	int points[3][n];
	int results[n];
	memset(results, 0, sizeof(results));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> points[j][i];
		}
	}
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < n; j++) {
			bool hasSame = false;
			for (int k = 0; k < n; k++) {
				if (j == k) continue;
				if (points[i][j] == points[i][k]) {
					hasSame = true;
					break;
				}
			}
			if (!hasSame) {
				results[j] += points[i][j];
			}
		}
	}
	for (int i = 0; i < n; i++) {
		cout << results[i] << endl;
	}
	return 0;
}

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

res = 0
for k in range(1 << N):
    bits = [(k >> i) & 1 for i in range(N)]
    flag = True
    for i in range(N):
        if (k >> i) & 1 == 0:
            continue
        for x, y in XY[i]:
            if bits[x - 1] == y:
                continue
            flag = False
    if flag:
        res = max(res, sum(bits))
print(res)


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 255;

char s[MAXN][MAXN];

char ans[MAXN];
int ans_len;

int cnt[MAXN][MAXN];

void solve(){
	int n;
	scanf("%d", &n);
	REP(i, 0, n){
		scanf("%s", &s[i][0]);
		for(int j = 0; s[i][j]; j++){
			cnt[i][s[i][j]]++;
		}
	}
	REPN(i, 'a', 'z'){
		int cur_cnt = INF;
		REP(j, 0, n){
			cur_cnt = min(cur_cnt, cnt[j][i]);
		}
		REP(j, 0, cur_cnt){
			ans[ans_len++] = i;
		}
	}
	printf("%s\n", ans);
	/*for(int i = 0; s[0][i]; i++){
		for(int j = i; s[0][j]; j++){
			int is_good_substr = 1;
			REP(k, 1, n){
				int is_good_cur_substr = 0;
				for(int l = 0; s[k][l]; l++){
					int is_good_cur_cur_substr = 1;
					for(int m = 0; m <= j - i; m++){
						if (!s[k][l + m] || s[0][i + m] != s[k][l + m]){
							is_good_cur_cur_substr = 0;
							break;
						}
					}
					if (is_good_cur_cur_substr){
						is_good_cur_substr = 1;
						break;
					}
				}
				if (!is_good_cur_substr){
					is_good_substr = 0;
					break;
				}
			}
			printf("%d %d %d\n", i, j, is_good_substr);
			if (is_good_substr){
				if (j - i + 1 > ans_len || j - i + 1 == ans_len && strcmp(ans, &s[0][i]) == 1){
					ans_len = j - i + 1;
					REP(k, 0, ans_len){
						ans[k] = s[0][i + k];
					}
					ans[ans_len] = 0;
				}
			}
		}
	}
	printf("%s\n", ans);*/
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int i,n,c=0;
	char a,dammy;
	scanf("%d%c",&n,&dammy);
	for(i=0;i<n;i++){
		scanf("%c%c",&a,&dammy);
		if(a=='Y')
			c=1;
	}
	if(c==1)
		printf("Four");
	else
		printf("Three");
	return 0;
}

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

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

int H[100005];
vector<int> elist[100005];

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int N, M; gi(N), gi(M);
	int a = 0;
	rep1(i, N) gi(H[i]);
	while(M--) {
		int u, v; gi(u), gi(v);
		elist[u].pb(v); elist[v].pb(u);
	}
	rep1(i, N) {
		bool g = 1;
		for(int& k:elist[i]) if(H[k] >= H[i]) { g = 0; break; }
		a += g;
	}
	print(a);
}


Measured memory_bytes: 11168
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
char ss[310][310];
int id[310];
int main()
{
    //freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	int n=read(),m=read(),cnt=read();
	int now=0;
	for(int i=1;i<=n;i++)scanf("%s",ss[i]+1);
	int p;
	for(int i=1;i<=n;i++)
	{
		bool bk=false;
		for(int j=1;j<=m;j++)if(ss[i][j]=='#'){bk=true;break;}
		if(bk==true){p=i;break;}
	}
	for(int i=p;i<=n;i++)
	{
		bool bk=false;
		for(int j=1;j<=m;j++)if(ss[i][j]=='#'){bk=true;break;}
		if(bk==false)
		{
			for(int j=1;j<m;j++)pr1(id[j]);
			pr2(id[m]);
		}
		else
		{
			id[1]=++now;bool bk=false;
			if(ss[i][1]=='#')bk=true;
			for(int j=2;j<=m;j++)
			{
				if(ss[i][j]=='#' && bk==true)id[j]=++now;
				else 
				{
					id[j]=now;
					if(ss[i][j]=='#')bk=true;
				}
			}
			for(int j=1;j<m;j++)pr1(id[j]);
			pr2(id[m]);
			if(i==p)
			{
				for(int k=p-1;k>=1;k--)
				{
					for(int j=1;j<m;j++)pr1(id[j]);
					pr2(id[m]);
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 768
import sys
n, m = map(int, sys.stdin.readline().split())
set1, setn = set(), set()
for _ in range(m):
  i, j = map(int, sys.stdin.readline().split())
  if i in [1, n] or j in [1, n]:
    if i == 1:
      set1.add(j)
    if i == n:
      setn.add(j)
    if j == 1:
      set1.add(i)
    if j == n:
      setn.add(i)
if set1 & setn:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')


Measured memory_bytes: 19024
n = int(input())
S = input()
s = [0 for i in range(n)]

for i in range(n):
    if S[i] == "E":
        s[i] = 1
min = n

count = 0
for j in range(n):
    i = 0
    if i < j and s[j] == 1:
        count += 1
    elif i > j and s[j] == 0:
        count += 1
if count < min:
    min = count

for i in range(1, n):
    if s[i-1] == 0:
        count += 1
    if s[i] == 1:
        count -= 1
    if count < min:
        min = count
print(min)


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

#define all(x) (x).begin(),(x).end()

typedef long long LL;
typedef long double LD;

int main()
{
    string s;
    cin >> s;
    int r, w, ans;
    r = 0; w = 0; ans = 0;

    for (int i = 0; i < s.length(); i++) {
        if (s[i] == '0') r++;
        else w++;
    }

    ans = 2*min(r, w);

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


Measured memory_bytes: 512
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

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

int main() {
    ll n, k; cin >> n >> k;
    vector<ll> a(n, 0);
    REP(i, n) {
        cin >> a[i];
    }
    sort(ALL(a));
    ll mx = *max_element(ALL(a));
    ll g = -1;
    REP(i, a.size()) {
        if (g == -1) {
            g = a[i];
        } else {
            g = gcd(g, a[i]);
        }
    }
    if (k % g == 0 && k <= mx) {
        cout << "POSSIBLE" << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 3888
#!/usr/bin/env python3

import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)

def max_index(lst):
	index = -1
	value = -float("inf")
	for i, vi in enumerate(lst):
		if value < vi:
			value = vi
			index = i
	return index


def main():
	log = Logger(0)
	day_length = int(sys.stdin.readline())
	down_happy = list(map(int, sys.stdin.readline().split()))
	daily_happy = [[] for i in range(day_length)]
	contests_kind = 26
	for i in range(day_length):
		si = list(map(int, sys.stdin.readline().split()))
		for j in range(contests_kind):
			daily_happy[i].append(si[j])
	happy = 0
	last_contest_days = [0]*contests_kind
	for day in range(day_length):
		best_contest = 0
		max_add_happy = -float("inf")
		for contest in range(contests_kind):
			add_happy = 0
			add_happy += daily_happy[day][contest]
			for contest_kind in range(contests_kind):
				if contest_kind != contest:
					add_happy -= down_happy[contest_kind] * (day + 1 - last_contest_days[contest_kind])
			if max_add_happy < add_happy:
				max_add_happy = add_happy
				best_contest = contest
		last_contest_days[best_contest] = day + 1
		print(best_contest + 1)
		happy += max_add_happy
	log.print(happy)





main()

Measured memory_bytes: 71328