akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int cnt=0;
int main(){
	int x,y;
	cin>>x>>y;
	for(int i=0;i<2;i++){
		cnt+=max(x,y);
		if(x==max(x,y)){
			x--;
			continue;
		}
		else if(y==max(x,y)){
			y--;
			continue;
		}
	}
	cout<<cnt<<endl;
	return 0;
}

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

vector<int> v;
int t[100005];

int main() {
  int n, k; cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> t[i];
  for (int i = 0; i < n - 1; i++) v.push_back(t[i + 1] - t[i] - 1);
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  int tt = t[n - 1] - t[0] + 1;
  for (int i = 0; i < k - 1; i++) tt -= v[i];
  cout << tt << endl;
}



Measured memory_bytes: 3904
#include<stdio.h>
#include<math.h>
int Sosu(int N){
  int i=3;
if(N==2)return 1;
if(N<2 || N%2==0)return 0;
while(i<=sqrt(N)){
  if(N%i==0)return 0;
  i=i+2;
}
return 1;
}
int main(void){
int N;
int n,i;
int S=0,c=0;
while(1){
scanf("%d",&n);
if(n>=1 && n<=10000)break;
}
for(i=0 ; i<n ; i++){
  while(1){
  scanf("%d",&N);
  if(N>=2 && N<=100000000)break;
  }
  S+=Sosu(N);
}
printf("%d\n",S);
return 0;
}


Measured memory_bytes: 2040
#include<stdio.h>
#define NMAX 200000
#define RMAX 1000000000
int main()
{
	int a[NMAX] = {0};
	int temp = 0;
	int n = 0;
	scanf("%d", &n);
	int maxv = 0;
	int minv = 0;
	for(int i = 0 ; i < n ; i++)
	{
		scanf("%d", &temp);
		if(i == 0)
		{
			minv = temp;
		}
		else if(i == 1)
		{
			maxv = temp - minv;
			minv = (minv < temp)?minv:temp;
		}
		else
		{
			maxv = (maxv > temp - minv)?maxv:(temp-minv);
			minv = (minv < temp)?minv:temp;
		}
	}
	printf("%d\n", maxv);
	return 0;
}


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

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

int main(){
	int H, W;
	cin>>H>>W;
	vector<string> vec(H);
	for(int i = 0; i < H; ++i){
		cin>>vec[i];
	}
	vector<bool> e(W, false);
	vector<vector<bool> >ok(H, e);
	for(int i = 0; i < H; ++i){
		for(int j = 0; j < W; ++j){
			if(vec[i][j] == '#'){
				for(int k = 0; k < 4; ++k){
					int x = i + dx[k];
					int y = j + dy[k];
					if(x >= 0 && x < H && y >= 0 && y < W){
							if(vec[x][y] == '#')ok[x][y]=true;
						}
				}
			}
		}
	}
		bool bad = false;
		for(int i = 0; i < H; ++i){
			for(int j = 0; j < W; ++j){
				if(vec[i][j] == '#' && !ok[i][j])bad = true;
			}
		}
		if(bad){
			cout<<"No"<<endl;
		}
		else{
			cout<<"Yes"<<endl;
		}

	return 0;
}

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


int main(){
	 int N;
	 cin >> N;
	 vector<int> v(N);
	 for(int i = 0; i < N; ++i) {
		 cin >> v[i];
	 }
	 sort(v.begin(),v.end());
	 double ans = v[0];
	 for (int i = 1; i < N; ++i) {
		 ans += v[i];
		 ans /= 2;
	 }
	 cout << ans << endl;



}














Measured memory_bytes: 3668
// ABC101C - Minimization

#include <bits/stdc++.h>
using namespace std;

int main() {
	int N, K;
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		int t;
		cin >> t;
	}

	int ans;
//	ans = ((N - K) + (K - 2))/ (K - 1) + 1;
	ans = (N - 2)/(K - 1) + 1;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""
Nが小さいので、Y座標でcandに入れておく
"""
N = ir()
AB = [lr() for _ in range(N)]
CD = [lr() for _ in range(N)]
cand = [0] * (2*N)
ABCD = [(a, b, 0) for a, b in AB] + [(c, d, 1) for c, d in CD]
ABCD.sort()
answer = 0
for X, Y, Z in ABCD:
    if Z == 0:
        cand[Y] += 1
    else:
        for y in range(Y-1, -1, -1):
            if cand[y] > 0:
                answer += 1
                cand[y] -= 1
                break

print(answer)


Measured memory_bytes: 9092
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 13 21:45:12 2019

@author: sofugo
"""
import numpy as np
N = (input())
x=np.array(list(N),dtype=np.int)
count=0
count2=0

now=0
for n,i in enumerate(x):
    if i==now:
        if n%2==0:
            now=1
        else:
            now=0
    else:
        count+=1
        if n%2==0:
            now=1
        else:
            now=0
    
now=1
for n,i in enumerate(x):
    if i==now:
        if n%2==0:
            now=0
        else:
            now=1
    else:
        count2+=1
        if n%2==0:
            now=0
        else:
            now=1
if(count>count2):
    print(count2)
else:
    print(count)
    

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  ll K; cin >> K;
  string S; cin >> S;
  ll l = S.size();

  c_fac(2*pow(10,6));
  ll p25[K+l+1] = {}; rep(i,K+l+1) p25[i] = i==0 ? 1 : p25[i-1]*25%MOD;
  ll prev[K+l+1] = {}; repr(i,l-1,K+l+1) prev[i] = p25[i-(l-1)]*nck(i,(l-1))%MOD;
  // debug(prev,prev+(K+l+1));  

  ll result = 0; rep(i,K+l) result = (result*26 + prev[i]) % MOD;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 51136
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		double[] nums = new double[n];
		String[] strs = new String[n];
		
		for(int i=0; i<n; i++) {
			nums[i] = sc.nextDouble();
			strs[i] = sc.next();
		}
		
		double sum = 0;
		
		for(int i=0; i<n; i++) {
			if(strs[i].equals("JPY")) {
				sum += nums[i];
			}else if(strs[i].equals("BTC")) {
				sum += nums[i]* (380000.0);
			}else {
				throw new RuntimeException("wrong input");
			}
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 23380
#include <stdio.h>

#define NMAX 101

int min(int,int);

int main(void){
  int n,i,j,k,l;
  int m[NMAX][NMAX],p[NMAX];

  scanf("%d",&n);

  for(i = 1;i <= n;i++){
    scanf("%d%d",&p[i - 1],&p[i]);
    m[i][i] = 0;
  }
  for(l = 2;l <= n;l++){
    for(i = 1;i <= n - l + 1;i++){
      j = i + l - 1;
      m[i][j] = (1<<21);
      for(k = i;k <= j - 1;k++){
	m[i][j] = min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
      }
    }
  }
  printf("%d\n",m[1][n]);

  return 0;
}

int min(int a,int b){
  if(a <= b){
    return a;
  }else{
    return b;
  }
}



Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define M 998244353


void sumSquare(int a[],int n) 
{ 
    long long int m;
    for(int i=1;i<=sqrt(n);i++)
    {
        for(int j=1;j<=sqrt(n);j++)
        {
            for(int k=1;k<=sqrt(n);k++)
            {
                m=(i*i)+(k*k)+(j*j)+(i*j)+(j*k)+(k*i);
                if(m>n)
                {
                    break;
                }
                else
                {
                    a[m-1]++;
                }
            }
        }
    }
}
	
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    int n,x=1,y=1,z=1,pos;
	cin>>n;
	int a[n]={0};
    sumSquare(a,n);
	for(int i=0;i<n;i++)
	{
	    cout<<a[i]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 3580
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
using namespace std;
#define INF 1000000007
#define ll long long
#define rep(i, start, end) for(ll i=(ll)start; i<(ll)end; i++)
#define print(a) cout << a << endl;
#define printarray(a, len) rep(i,0,len) cout << a[i] << " ";
 
int main(){
  ll n, l, total=0, m=INF;
  cin >> n >> l;
  rep(i, 0, n){
    total += l + i;
    if (l+i >= 0){
    	m = min(llabs(m), llabs(l+i));
    }else{
      m = -min(llabs(m), llabs(l+i));
    }
  }
  print(total - m);
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int gcd,x,y,tmp;
    
    scanf("%d %d",&x,&y);
    
    if(x<y){
        tmp=x;
        x=y;
        y=tmp;
    }
    
    while((gcd=x%y)!=0){
        x=y;
        y=gcd;
    }
    printf("%d\n",y);
    
    return 0;
}


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

int* mallocint(int si)
{
    return (int*) malloc(si * sizeof(int));
}

int main()
{
    int ti = clock();

    int n, m;
    cin >> n >> m;
    pair<int, int> *ans = new pair<int, int>[m];
    int c1 = ( m + 1 ) / 2;
    int c2 = m / 2;
    int l = 1;
    int r = 2 * c1;
    for( int k = c1 - 1; k >= 0; k-- )
    {
        ans[k].first = l++;
        ans[k].second = r--; 
    }
    l = 2 * c1 + 1;
    r = l + 2 * c2;
    for( int k = c2 - 1; k >= 0; k-- )
    {
        ans[k + c1].first = l++;
        ans[k + c1].second = r--; 
    }

    for( int i = 0; i < m; i++)
    {
        cout << ans[i].first << " " << ans[i].second << endl;
    }

    //printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
    return 0;    
}

Measured memory_bytes: 4252
# -*- coding: utf-8 -*-

N = int(input())
s = []
for i in range(0,N):
    data = input()
    s.append(data)

M = int(input())
t = []
for i in range(0,M):
    data = input()
    t.append(data)

st = s + t

plus  = []
minus = []
for i in st:
    p = 0
    m = 0
    for j in s:
        if i == j:
            p = p + 1
        else:
            pass
    for j in t:
        if i == j:
            m = m - 1
        else:
            pass
            
    plus.append(p)
    minus.append(m)

pmax=0
for i,j in zip(plus,minus):
    if 0 < (i + j) and pmax <(i + j):
        pmax = i + j
    else:
        pass

print(pmax)

Measured memory_bytes: 3064
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  LL N, K; std::cin >> N >> K;
  LL sum = 0;
  char pc = ' ';
  for (int n = 0; n < N; ++n) {
    char c; std::cin >> c;
    if (c == pc) ++sum;
    pc = c;
  }
  std::cout << std::min(sum + K*2, N-1) << std::endl;
}


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

int main() {

  string S;
  cin >> S;

  string even,odd;

  int n = S.size();
  for(int i = 0;i < n-1;i++) {
    if(S.at(i) == S.at(i+1)) {
      cout << i+1 << " " << i+2 << endl;
      return 0;
    }
    if(i % 2 == 0) even.push_back(S.at(i));
    else odd.push_back(S.at(i));
  }

  int e = even.size(),o = odd.size();
  for(int i = 0 ;i < e-1;i++) {
    if(even.at(i) == even.at(i+1)) {
      cout << 2*i + 1 << " " << 2*i + 3 << endl;
      return 0;
    }
  }

  for(int i = 0;i < o-1;i++) {
    if(odd.at(i) == odd.at(i+1)) {
      cout << 2*i + 2 << " " << 2*i + 4 << endl;
      return 0;
    }
  }

  cout << -1 << " " << -1 << endl;

  
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
using vb = vector<bool>;
using vb2 = vector<vector<bool>>;
using vc = vector<char>;
using vc2 = vector<vector<char>>;
using vs = vector<string>;
using si = set<int>;
using vs2 = vector<vector<string>>;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
const long double PI = acos(-1.0);
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)
#define sz(x) (int)(x).size()
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
 
#define ALL(x) (x).begin(),(x).end()
#define SORT(v) sort(ALL(v));
#define IN(type,a) type a;cin >> a;
#define VIN(type,a,n) vector<type> a(n);cin >> a;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
#define COUT(x) cout << (x) << endl;
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;
#define ENDL cout << endl;
#define DB(s,x) cout << (s) << " : " << x << endl;

#define HOGE COUT("HOGE")

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

template<typename T> bool chmax(T& a, const T& b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T& a, const T& b){if(a>b){a=b;return true;}return false;}
int main() {
    IN(ll, x);
    ll a = 100;
    ll counter = 0;
    while(a<x){
        a += a/100;
        counter++;
    }
    COUT(counter);
}


Measured memory_bytes: 3636
# 初期入力
import sys
input = sys.stdin.readline
S =input().strip()

#ACGTが連続しているか判定
count =0
count_list=[0]
for i in S:
    if i in "ACGT":
        count +=1
        count_list.append(count)
    else:
        count =0
print(max(count_list))

Measured memory_bytes: 3060
from itertools import product
N = int(input())
S = input()
S = [int(s) for s in S]
ans = 0
for q in product(range(10),repeat=3):
    i = 0
    for s in S:
        if s==q[i]:
            if i==2:
                ans += 1
                break
            else:
                i+=1
print (ans)
            


Measured memory_bytes: 41708
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[1000], b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> x;
  rep(i, 130) { a[i] = i * i * i * i * i; }
  rep(i, 130) {
    rep(j, 130) {
      ans = a[i] - a[j];
      if (ans == x) {
        b = i, c = j;
        break;
      }
    }
  }

  rep(i, 130) {
    rep(j, 130) {
      ans = a[i] + a[j];
      if (ans == x) {
        b = i, c = -j;
        break;
      }
    }
  }

  cout << b << " " << c << "\n";
  return 0;
}

Measured memory_bytes: 3616
abc=[int(x) for x in input().split()]
abc.sort()
a=abc[0]
b=abc[1]
c=abc[2]

ans=float('inf')
for i in range(a,100):
  for j in range(b,100):
    for k in range(c,100):
      now=0
      if i==j and j==k and i==k:
        now=i-a+j-b+k-c
        if now%2==0:
          ans=min(now//2,ans)
          break
        
print(ans)

Measured memory_bytes: 69492
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

#define MAX 1000000

int main() {

	for (int e; cin >> e&&e;) {
		int m = INF;
		int max_z = pow(e, 1. / 3)+1;
		for (int z = max_z; z >= 0; z--) {
			if (z*z*z > e)continue;
			//cout << "z " << z;
			int tmp = e;
			tmp -= z*z*z;
			int y = pow(tmp, 1. / 2);
			//cout << " y " << y;
			tmp -= y*y;
			int x = tmp;
			//cout << " x " << x;
			m = min(m, x + y + z);
			//cout << " m " << x + y + z;
			//cout << endl;
		}
		cout << m << endl;
	}
	return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

int N, M; 
int a[1050], b[1050];

int min(int a, int b) {
    if (a <= b) return a;
    return b;
}

const int INF = 1e9;
/*
i番目までの宝箱をj番目までのカギを使って空けるために必要な費用の最小値dp[i][j]とする

dp[i+1][j] = min(dp[i][j] if j番目までのカギにi+1番目も含まれている
                 dp[i][k] + a[j] | c[j]にi+1が含まれる
                 ) 


i番目までの鍵だけで状態をj(ビット表現)にするための費用の最小値dp[i][j]とする
i番目の鍵のビット表現をd[i]として

dp[i+1][j||d[i]] = min(dp[i][j||d[i]], dp[i][j]+a[i])
*/

int d[1050];
int dp[5000];

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        cin >> a[i] >> b[i];
        int k = 0;
        for (int j = 0; j < b[i]; j++) {
            int c;
            cin >> c;
            k += 1 << (c-1);
        }
        d[i] = k;
    }
        for (int j = 0; j < (1 << N); j++) {
            dp[j] = INF;
        }
    
    dp[0] = 0;

    for (int i = 0; i < M; i++) {
        for (int j = 0; j < (1 << N); j++) {
            dp[j|d[i]] = min(dp[j|d[i]],dp[j]+a[i]);
            
        }
    }
     
    if (dp[(1 << N) - 1] >= INF) {
        cout << -1 << endl;
    } else {
        cout << dp[(1 << N) - 1] << endl;
    }
}



Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]
ans = 1
if 0 in a:
  print(0)
else:
  for i in a:
    ans = ans * i
    if ans > 1000000000000000000:
  	  break
  if ans > 1000000000000000000:
    print('-1')
  else:
    print(ans)

Measured memory_bytes: 21588
#include <bits/stdc++.h>
// #include "ane.cpp"

const int INF  = 1e9;
const long long INFLL = 1e18;
const int NMAX = 100005;
const int MMAX = 100005;
const int KMAX = 1005;
const int MOD  = 1e9 + 7;
using namespace std;

// comment to disable debug functions
#define DEBUG

// frequently used macros

#if __cplusplus >= 201103L
#define ALL(v) begin(v),end(v)
#define SORT(v) sort(begin(v), end(v))
#define FIND(v,x) find(begin(v), end(v), (x))
#else
#define ALL(v) (v).begin(),(v).end()
#define SORT(v) sort(v.begin(), v.end())
#define FIND(v,x) find(v.begin(), v.end(), (x))
#endif

#define MEMNEXT(from, to) do{ memmove((to), (from), sizeof(from)); \
memset((from), 0, sizeof(from)); } while(0)
#ifdef DEBUG
#define DUMP(x) do{ std::cerr << (#x) << ": " << x << std::endl; }while(0)
#else
#define DUMP(x) do{}while(0)
#endif

// frequent used aliases
typedef long long ll;
typedef pair<int, int> p;
typedef pair<ll, int> lp;
typedef pair<ll, ll> llp;
typedef vector<int> vec;
typedef vector<ll> vecll;
typedef vector<vec> mat;
typedef vector<vecll> matll;

// frequently used constants
static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1};
static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1};

// frequently used structs
struct edge{
  int to,cost;
};

// printf for debug
#ifndef DEBUG
void debug(const char* format, ...){}
#else
void debug(const char* format, ...){
  va_list arg;
  va_start(arg, format);
  vprintf(format, arg);
  va_end(arg);
}
#endif

// dump vector
#ifdef DEBUG
#define DUMPV(v, c) do{       \
  printf("%s: ", #v);         \
  for (int i = 0; i < (c); ++i) \
  {                           \
  cout << (v)[i] << " ";      \
  }                           \
  cout << endl;               \
} while(0)
#else
#define DUMPV(v,c)
#endif

// std::fill of multi dimensions
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
  std::fill( (T*)array, (T*)(array+N), val );
}

// binary search
ll BSearch(ll _begin, ll _end, bool (*f)(int)){
  ll mid;
  while(_end - _begin > 1LL) {
  mid = (_begin + _end) / 2LL;
  if(f(mid)) {
    debug("BSearch: f(%d) == true\n", mid);
    _end = mid;
  }
  else
  {
    debug("BSearch: f(%d) == false\n", mid);
    _begin = mid;
  }
  }
  return _end;
}


ll N,M,K,A,B,C,D,E;
int dp[NMAX] = {};

string S[2];
vec v;

ll ans = 0;

void solve(){
  // main algorithm
  if(S[0].size() > S[1].size()) {
    cout << "GREATER\n";
  }
  else if(S[1].size() > S[0].size()){
    cout << "LESS\n";
  }else{
    for (int i = 0; i < S[0].size(); ++i)
    {
      if (S[0][i] > S[1][i])
      {
        cout << "GREATER\n";
        return;
      }else if(S[0][i] < S[1][i]){
        cout << "LESS\n";
        return;
      }
    }
    cout << "EQUAL\n";
  }
}
void debug(){
  // output debug information

}
void answer(){
  // output answer
}
int main(int argc, char const *argv[])
{
  // operate inputs

  // Fill(dp, -1);
  cin >> S[0] >> S[1];
  solve();
  #ifdef DEBUG
  debug();
  #endif
  answer();

  return 0;
}

Measured memory_bytes: 256
def NumberOfMultiples():

    num = list(map(int,input().split()))

    count = 0

    for i in range(num[0], num[1]+1):
        mod = i % num[2]
        
        if mod == 0:
            count = count + 1
    
    print(count)

if __name__ == '__main__':
    NumberOfMultiples()



Measured memory_bytes: 9032
import itertools
while True:
    data = input().split()
    if not sum(map(int, data)):
        break
    for num in itertools.permutations(data, 4):
        for oprs in itertools.product([' + ', ' - ', ' * '], repeat=3):
            if eval('('+num[0]+oprs[0]+num[1]+')'+oprs[1]+'('+num[2]+oprs[2]+num[3]+')') == 10:
                print('('+num[0]+oprs[0]+num[1]+')'+oprs[1]+'('+num[2]+oprs[2]+num[3]+')')
                break
            if eval('('+'('+num[0]+oprs[0]+num[1]+')'+oprs[1]+num[2]+')'+oprs[2]+num[3]) == 10:
                print('('+'('+num[0]+oprs[0]+num[1]+')'+oprs[1]+num[2]+')'+oprs[2]+num[3])
                break
            if eval('('+num[0]+oprs[0]+'('+num[1]+oprs[1]+num[2]+')'+')'+oprs[2]+num[3]) == 10:
                print('('+num[0]+oprs[0]+'('+num[1]+oprs[1]+num[2]+')'+')'+oprs[2]+num[3])
                break
            if eval(num[0]+oprs[0]+'('+'('+num[1]+oprs[1]+num[2]+')'+oprs[2]+num[3]+')') == 10:
                print(num[0]+oprs[0]+'('+'('+num[1]+oprs[1]+num[2]+')'+oprs[2]+num[3]+')')
                break
            if eval(num[0]+oprs[0]+'('+num[1]+oprs[1]+'('+num[2]+oprs[2]+num[3]+')'+')') == 10:
                print(num[0]+oprs[0]+'('+num[1]+oprs[1]+'('+num[2]+oprs[2]+num[3]+')'+')')
                break
        else:
            continue
        break
    else:
        print(0)

Measured memory_bytes: 7652
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define st(vvv) sort(vvv.begin(),vvv.end())
#define rvs(vvv) reverse(vvv.begin(),vvv.end())
int inf = 1000000007;
i64 giant = 4000000000000000000;

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if ((a - b) % 2 == 0) {
		cout << (a + b) / 2 << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import math

A, B = map(int, input().split())

def rangeOfPriceWithoutTax(price, rate):
    min_ = math.ceil(price / rate)
    max_ = int((price + 1) // rate)
    return set(range(min_, max_ + 1))

range_ = (rangeOfPriceWithoutTax(A, 0.08) & rangeOfPriceWithoutTax(B, 0.1)) - {0}

try:
    print(min(range_))
except ValueError:
    print(-1)


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

int f(int x, int y, int z){
  return x*x+y*y+z*z+x*y+y*z+z*x;
}

int main(){
  int n;  cin >> n;
  vector<int> ans(n+3, 0);
  bool xflag = false, yflag = false;

  for(int x=1; ; x++){
    for(int y=x; ; y++){
      for(int z=y; ; z++){
	int fr = f(x, y, z);
	if(fr <= n){
	  if(x==y && y==z && z==x)  ans[fr] += 1;
	  else if(x!=y && y!=z && z!=x)  ans[fr] += 6;
	  else  ans[fr] += 3;
	}else{
	  if(z == y)  yflag = true;
	  if(yflag && y==x)  xflag = true;
	  break;
	}
      }
      if(yflag){
	yflag = false;
	break;
      }
    }
    if(xflag)  break;
  }
  for(int i=1; i<=n; i++)
    cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 3500
import sys,math,collections
from collections import defaultdict

#from itertools import permutations,combinations
	
def file():
	sys.stdin = open('input.py', 'r')
	sys.stdout = open('output.py', 'w') 
def get_array():
	l=list(map(int, input().split()))
	return l
def get_2_ints():	
	a,b=map(int, input().split())
	return a,b
def get_3_ints():	
	a,b,c=map(int, input().split())
	return a,b,c	
def sod(n):
	n,c=str(n),0
	for i in n:	
		c+=int(i)
	return c	

def getFloor(A, x):

	(left, right) = (0, len(A) - 1)

	floor = -1
	while left <= right:
		mid = (left + right) // 2
		if A[mid] == x:
			return A[mid]
		elif x < A[mid]:
			right = mid - 1
		else:
			floor = A[mid]
			left = mid + 1
			
	return floor
#file()	
def main():
	n=int(input())
	l=get_array()
	c=0
	for i in range(0,n,2):
		if(l[i]&1):
			c+=1
	print(c)		



                       

















				

			







            
			
































		








if __name__ == '__main__':
    main()


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int N;
    cin >> N;
    rep1(h, 3500) for (int n=h; n<=3500; ++n) {
        ll num = (ll)N * h * n, den = (ll)4 * h * n - (ll)N * (h+n);
        if (den<=0) continue;
        if (num%den) continue;
        ll w = num / den;
        if (w > 0) {
            printf("%d %d %lld\n", h, n, w);
            return 0;
        } 
    }
    return 0;
}


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

bool Pru(int& c, int& a, int& n){
	if (c > 0 && a > 0 && n > 0){
		c -= 1;
		a -= 1;
		n -= 1;
		return true;
	}
	return false;
}

bool Bal(int& c, int& a){
	if (c >= 2 && a >= 1){
		c -= 2;
		a -= 1;
		return true;
	}
	return false;
}
bool Spe(int& c){
	if (c >= 3){
		c -= 3;
		return true;
	}
	return false;
}

int main(){
	int N;
	cin >> N;
	for (int i = 0; i < N; i++){
		int c, a, n, cnt = 0;
		cin >> c >> a >> n;
		while (Pru(c, a, n)) cnt++;
		while (Bal(c, a)) cnt++;
		while(Spe(c)) cnt++;
		cout << cnt << endl;
	}
	return 0;
}


Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn=2e5+10;
const int mod=998244353;
struct Point{
	int x,y;
	// Point (int x = 0,int y = 0)
};
Point p[maxn];
bool operator <(const Point &a,const Point &b){
	return  a.x < b.x;
}
LL sum[maxn];
int lowbit(int x){return x&(-x);}
int s[maxn],pre[maxn];
int x[maxn],y[maxn];
LL tree[maxn];
void Add(int x,int p){
	for(;x < maxn; x += lowbit(x))
		tree[x] += p;//,x += lowbit(x);
}
LL Sum(int x){
	LL sum = 0;
	for(;x > 0; x -= lowbit(x))
		sum += tree[x];
	return sum;
}
LL pow2[maxn];
int A[maxn],B[maxn];
inline void Add(LL &a,LL b){
	a += b;
	while(a >= mod)
		a -= mod;
	while(a < 0)
		a += mod;
}
int main(void)
{
	pow2[0] = 1;
	for(int i = 1;i < maxn; ++i)
		pow2[i] = pow2[i-1]*2%mod;
	// cout<<pow2[10]<<endl;
	int n;cin>>n;
	for(int i = 1;i <= n;++i)
		cin>>p[i].x>>p[i].y,x[i]= p[i].x,y[i] = p[i].y;
	sort(p+1,p+n+1);
	sort(y+1,y+n+1);
	int N = unique(y+1,y+n+1)-y-1;
	for(int i = 1;i <= n;++i)
		{
			p[i].x = i,p[i].y = lower_bound(y+1,y+N+1,p[i].y)-y;
		}
	LL ans = n*(pow2[n]-1)%mod;
	for(int i = 1;i <= n; ++i){
		A[i] = Sum(p[i].y);
		Add(p[i].y,1);
	}
	memset(tree,0,sizeof(tree));
	for(int i = n;i >= 1; --i){
		B[i] = Sum(p[i].y);
		Add(p[i].y,1);
	}
	for(int i = 1;i <= n; ++i){
		LL tmp = pow2[i-1]+pow2[n-i]+pow2[p[i].y-1]+pow2[n-p[i].y]-pow2[A[i]]-pow2[i-A[i]-1]-pow2[n-i-B[i]]-pow2[B[i]];
		tmp %= mod;
		Add(ans,-tmp);
	}
	cout<<(ans%mod+mod)%mod<<endl;

   return 0;
}


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

using namespace std;

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

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> v(n);
    int temp;
    rep(i, q){
        cin >> temp;
        v[temp-1]++;
    }
    rep(i, n){
        if(k - (q - v[i]) > 0) cout << "Yes\n";
            else cout << "No\n";
    }
}


Measured memory_bytes: 1024
open System

let Mod = Math.Pow (10.,9.) + 7. |> int64

let Ruisekiwa list = 

    let rec subRuisekiwa accum list2 temp = 
        match list2 with
        | [] -> accum
        | hd :: tl -> subRuisekiwa ((hd + temp) :: accum) tl (hd + temp)

    subRuisekiwa [] (List.rev list) 0L |> List.tail |> List.map (fun x -> x % Mod)

let N = Console.ReadLine() |> int64
let AList = Console.ReadLine().Split(' ') |> Array.map int64 |> Seq.toList

let result list =
    
    let ruisekiList = Ruisekiwa list

    let rec subR accum list2 (ruisekiL:list<int64>) =
        match list2 with
        | [] -> accum
        | hd :: tl when List.isEmpty tl -> accum
        | hd :: tl -> subR ((accum + ((hd * (ruisekiL.Head)) % Mod)) % Mod) tl ruisekiL.Tail

    subR 0L list ruisekiList

printfn "%i" (result AList)

Measured memory_bytes: 76056
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> vec_B(M); 
  rep(i, M) {
    cin >> vec_B.at(i);
  }
  vector<vector<int>> vec(N, vector<int>(M));
  rep(i, N) {
    rep(j, M) {
      cin >> vec.at(i).at(j);
    }
  }
  int c = 0;
  int AA = 0;
  rep(i, N) {
    rep(j, M) {
      AA += vec.at(i).at(j) * vec_B.at(j);
    }
    if(AA + C > 0) {
      c++;
    }
    AA = 0;
  }
  cout << c << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  ll a;
  cin>>a;
  vector<ll>vec(0);
  for(ll i=1;i*i<=a;i++){
    if(a%i==0){
      vec.push_back(i+a/i);
    }
  }
  sort(vec.begin(),vec.end());
  
  cout<<vec.at(0)-2<<endl;
  return 0;
  
      
                        
                        
}


Measured memory_bytes: 3640
/*input
1
1

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n;
  cin >> n;
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i % 3 == 0 || i % 5 == 0) continue;
    ans += i;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



// Mを全探索して、左x以内
// 距離k未満のDCのペアを全て見て間に挟まってるMの個数を足す → なかなかしんどそう
// クエリをソートしても良いことはあんまりなさそう
// 各Dから距離k未満のMの個数はO(1)にできる
// 逆にMの(左のD)*(右のC)をまず計算して、k以上離れたDMCを計算した方が楽？
// 各Dから必要なのは
// 「k以上離れたCについて、DとそのCの間のMの個数」
// Cを見る度にいままでのMの個数を足していったものを保持しとけばいい？

int n, Q, k, d[1001001], c[1001001], cnt[1001001], ml[1001001];
string s;

signed main() {
	cin >> n >> s >> Q;
	rep(i,n) {
		if (s[i]=='D') d[i]++;
		d[i+1] += d[i];
	}
	repr(i,n-1) {
		if (s[i]=='C') c[i]++;
		c[i] += c[i+1];
	}
	int m = 0;
	rep(i,n) {
		if (s[i]=='M') m++;
		if (s[i]=='C') cnt[i] += m;
		cnt[i+1] += cnt[i];
		ml[i] = m;
	}
	int tres = 0;
	rep(i,n) if (s[i]=='M') tres += d[i] * c[i];
	while (Q--) {
		cin >> k;
		int res = tres;
		rep(i,n) if (s[i]=='D') res -= cnt[n-1] - cnt[min(n-1,i+k-1)] - ml[i]*c[min(n,i+k)];
		cout << res << endl;
	}
}


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

int main(){
    int N;
    cin >> N;
    multiset<long long> s;
    long long a;
    rep(i, N){
        cin >> a;
        s.insert(a);
        multiset<long long>::iterator ite;;
        ite = s.find(a);
        while(ite != s.begin()){
            ite--;
            if(*ite < a){
                s.erase(ite);
                break;
            }
        }
    }
    cout << s.size() << endl;
}

Measured memory_bytes: 5500
# include<iostream>
# include<cstdio>
# include<cstring>
using namespace std;
const int MAX=101;
struct p{
	int x,y,dis;
}c[MAX];
int L,num,Num;
int h[MAX];
void add(int x,int y,int dis)
{
	c[++num]=(p){x,y,dis};
}
int main()
{
	scanf("%d",&L);
	int n=L;
	for(int i=20;i>=0;--i)
	  if((1<<i)<=L) L-=(1<<i),h[++Num]=i;
	for(int i=1;i<h[1];++i)
	  add(i,i+1,0),add(i,i+1,1<<i-1);
	add(h[1],20,0),add(h[1],20,1<<h[1]-1);
	int G=1<<h[1];
	while(G<n)
	{
		int tt=1;
		while((1<<tt)<=(n-G)) ++tt;
		add(tt,20,G),G|=(1<<tt-1);
	}
	printf("20 %d\n",num);
	for(int i=1;i<=num;++i)
	  printf("%d %d %d\n",c[i].x,c[i].y,c[i].dis);
	return 0;
}

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

int main(){
  
  map<char,char> mp;
  mp['A'] = 'T';
  mp['T'] = 'A';
  mp['G'] = 'C';
  mp['C'] = 'G';
  
  char c;
  cin>>c;
  cout<<mp[c];
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<queue>
#include<vector>
#include<algorithm>
#include<tuple>
#include<numeric>
#include<map>
#include<cmath>
#define ll long long
#define mod 1000000000+7
#define rep(i,n) for(int i=0;i<(int) (n);i++)
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int>p(n);
  rep(i,n)cin>>p[i];

  int m=p[0];
  int cnt=1;
  for(int i=1;i<n;i++){
    if(p[i]<m)cnt++;
    m=min(m,p[i]);
  }

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


Measured memory_bytes: 1024
// by Balloons
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

typedef long long LL;

const int inf = 1e9;

int main(){
	int n,ans=0;scanf("%d",&n);
	while(n--){
		int x,k;scanf("%d%d",&x,&k);
		while(x%k > 0)x -= ((x%k-1) / (x/k+1) + 1)*(x/k+1);
		ans ^= x/k;
	}
	if(ans)puts("Takahashi");else puts("Aoki");

	return 0;
}


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

int main() {
    int N; cin >> N;
    vector<vector<char>> S(N, vector<char>(N));
    for (int i = 0; i < N; i++) {
        string t; cin >> t;
        for (int j = 0; j < N; j++) {
            S[i][j] = t[j];
        }
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        bool f = true;
        for (int j = 0; j < N; j++) {
            for (int k = 0; k < N; k++) {
                if (S[j][(k+N-i)%N] != S[k][(j+N-i)%N]) {
                    f = false;
                    break;
                }
            }
        }
        if (f) ans += N;
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')

def main():
  s = input()
  if len(set(s)) == 2:
    print('Yes')
  else:
    print('No')
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 5076
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);
   ll int n,k,r1,s1,p1,sum=0,t;
   ll int i=0;
   char s[100000],c[100000];
  cin>>n>>k>>r1>>s1>>p1;
  cin>>s;
  t=k;
  while(k--)
{
     if(s[i]=='r')
     {
    sum+=p1;
    c[i]='p';
     }
    else if(s[i]=='s')
    {
     sum+=r1;
       c[i]='r';
    }
     else if(s[i]=='p')
     {
     sum+=s1;
       c[i]='s';
     }
     i++;
     }
for(i=t;i<n;i++)
{
    if(s[i]=='r')
    {
        if(c[i-t]!='p')
        {
       sum+=p1;
         c[i]='p';
    }
    else
    {
        if(s[i+t]=='s')
        c[i]='s';
        else if(s[i+t]=='r')
         c[i]='r';
            }
    }
    else if(s[i]=='s')
    {
        if(c[i-t]!='r')
        {
       sum+=r1;
         c[i]='r';
        }
        else
        {
            
        if(s[i+t]=='s')
        c[i]='s';
        else if(s[i+t]=='p')
         c[i]='p';
        }
    }
     else if(s[i]=='p')
    {
        if(c[i-t]!='s')
        {
       sum+=s1;
         c[i]='s';
    }
    else
    {
        
        if(s[i+t]=='p')
        c[i]='p';
        else if(s[i+t]=='r')
         c[i]='r';
    }
    
}
}

cout<<sum;

return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	ll k;
	cin >> s >> k;
	int n = s.size();
	ll ans;
	if (s == string(n, s[0]))
		ans = k * n / 2;
	else {
		int sum = 0;
		for (int i = 0; i < n - 1; i++) {
			int j = i;
			while (s[i] == s[i + 1])
				i++;
			sum += (i - j + 1) / 2;
		}
		ans = sum * k;
		if (s[0] == s[n - 1]) {
			int a = 0, b = 0;
			int i = 0;
			while (i < n - 1 && s[i] == s[i + 1])
				i++;
			a = i + 1;
			i = n - 1;
			while (i > 0 && s[i] == s[i - 1])
				i--;
			b = n - i;
			ans -= (k - 1) * (a / 2 + b / 2 - (a + b) / 2);
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
n,k = gets.split.map &:to_i
as = gets.split.map &:to_i

check = Array.new(n+1, false)
trail = []
pos = 0

(n + 1).times{
	if check[pos] then
		loop_start = trail.find_index(pos)
		loop_end = trail.size
		
		loop_size = loop_end - loop_start

		if k <= loop_start then
			puts trail[k] + 1
		else
			step = (k - loop_start) % loop_size
			puts trail[loop_start + step] + 1
		end
		exit
	else
		check[pos] = true
		trail << pos
		pos = as[pos] - 1
	end
}


Measured memory_bytes: 30556
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

using smallpque = priority_queue<ll,vector<ll>,greater<ll> >;

const int VMAX = 1e6+10, EMAX = 1e6+10;
int V,E;

class UnionFind{
  private:
    vector<int> Parent;
    vector<smallpque> cost;
  public:
    UnionFind(int N){
      Parent = vector<int>(N,-1);
      cost = vector<smallpque>(N);
    }

    void add_cost(int x, ll c){
      cost[x].push(c);
    }

    int find(int x){
      if(Parent[x] < 0) return x;
      return Parent[x] = find(Parent[x]);
    }

    int size(int x){
      return -Parent[find(x)];
    }

    bool unite(int x, int y){
      x = find(x);
      y = find(y);
      if(x==y) return false;

      if(size(x)<size(y))swap(x,y);
      Parent[x] += Parent[y];
      Parent[y] = x;
      while(!cost[y].empty()){
        cost[x].push(cost[y].top());cost[y].pop();
      }
      return true;
    }

    ll connect(int x, int y){
      x = find(x);
      y = find(y);
      if(x==y) return 0;

      if(size(x)<size(y))swap(x,y);

      ll c = cost[x].top() + cost[y].top();
      cost[x].pop();cost[y].pop();

      Parent[x] += Parent[y];
      Parent[y] = x;
      while(!cost[y].empty()){
        cost[x].push(cost[y].top());cost[y].pop();
      }

      return c;
    }

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

int main(void){
  SPEEDUP
  cout << setprecision(15);
  cin >> V >> E;
  vector<PLI> cost(V);
  UnionFind uni = UnionFind(V);
  rep(v,V){
    cin >> cost[v].first;
    uni.add_cost(v,cost[v].first);
    cost[v].second = v;
  }
  sort(all(cost));
  rep(e,E){
    int x,y;cin >> x >> y;
    uni.unite(x,y);
  }

  if(E<(V-1)/2){
    cout << "Impossible" << endl;
    return 0;
  }
  int maxsize = 0;
  int index = 0;
  rep(v,V){
    if(uni.size(v) > maxsize){
      maxsize = uni.size(v);
      index = uni.find(v);
    }
  }
  ll ans = 0;
  rep(v,V){
    if(uni.same(cost[v].second, index))continue;
    ans += uni.connect(index,cost[v].second);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 10744