akhauriyash/Code-Regression huggingface dataset:
require 'pp'
# IS_DEBUG = true
IS_DEBUG = false
def dputs str
	if(IS_DEBUG)
		puts str
	end
end
def dpp str
	if(IS_DEBUG)
		pp str
	end
end

# でばっぎゅ部分

# from s to t with limited depth d of graph e
def dls(s,t,d,e)
	if(s == t)
		return true
	end
	cur = e[s]
	if(0 < d)
		cur.each{|nxt|
			if(dls(nxt,t,d-1,e))
				return true
			end
		}
	end
	return false
end

N,M=gets.chomp.split(' ').map{|n| n.to_i}

# 0 index
E = Array.new(N){[]}

1.upto(M){
	p=gets.chomp.split(' ').map{|n| n.to_i}
	p[0]-=1
	p[1]-=1
	E[p[0]].push(p[1])
	E[p[1]].push(p[0])
}
if(dls(0,N-1,2,E))
	puts "POSSIBLE"
else
	puts "IMPOSSIBLE"
end




Measured memory_bytes: 21884
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	uint[] GU => Strs.Select(uint.Parse).ToArray();
	decimal[] GD => Strs.Select(decimal.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	static T[] ConstantArray<T>(int n, T val) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = val; return a; }
	static T[] MakeArray<T>(int n, Func<int, T> f) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = f(i); return a; }
	static ulong One(int k) => 1ul << k;
	static ulong All(int k) => One(k) - 1;
	static bool Has(ulong s, int k) => (s & One(k)) != 0;
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = FL;
		var a = new long[5];
		for (var i = 0; i < 5; i++) a[i] = FL;
		var m = a.Min();
		WriteLine(4 + (N + m - 1) / m);
	}
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<ll, ll> pl;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  V a(m), N(n+1, 0);
  REP(i, m) {
    cin >> a[i];
    N[a[i]] = 1;
  }
  int g1 = 0, g2 = 0;
  for (int i = x; i < n+1; i++) {
    if (N[i]) g1++;
  }
  for (int i = x; i >= 0; i--) {
    if (N[i]) g2++;
  }
  dump(min(g1, g2));
  return 0;
}


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

int main() {
    int n,x; cin >> n >> x;
    vector<int> d(n);
    rep(i,n) cin >> d[i];
    rep(i,n) x -= d[i];
    int minv = 999999;
    rep(i,n){
        minv = min(minv,d[i]);
    }
    int amount = 0;
    amount = x/minv;
    cout << n + amount;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;int d[1<<18],n,q,r,x,y,i;int m(int l,int r,int k){if(x<=l&&r<=y)return d[k];if(y<=l||r<=x)return 2147483647;return min(m(l,(l+r)/2,k*2+1),m((l+r)/2,r,k*2+2));}int main(){cin>>n>>q;r=2;while(r<n)r*=2;n=r,r*=2;while(r--)d[r]=2147483647;while(q--){scanf("%d%d%d",&r,&x,&y);if(r){y++;cout<<m(0,n,0)<<endl;}else{i=x+n-1,d[i]=y;while(i)i=(i-1)/2,d[i]=min(d[i*2+1],d[i*2+2]);}}return 0;}

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

int main()
{
  ios_base::sync_with_stdio(0); cin.tie(0);
  int n,m,c,ans,k,current;
  cin>>n>>m>>c;
  int b[m];
  ans=0;
  for (int i = 0; i < m; i++)
  {
  	cin>>b[i];
  }
  for (int i = 0; i < n; i++)
  {
  	current = c;
  	for (int j = 0; j < m; j++)
  	{
  		cin>>k;
  		current += k * b[j];
  	}
  	if (current > 0)
  	{
  		ans++;
  	}
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()

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

    int H, W;
    cin >> H >> W;
    int N;
    cin >> N;
    vector<int> a(N);
    REP(i, N) cin >> a[i];
    vector<vector<int>> ans(H, vector<int>(W));
    bool rev = false;
    int r = 0, c = 0;
    REP(i, N) {
        REP(cnt, a[i]) {
            ans[r][c] = i + 1;
            if (rev) {
                if (c == 0) {
                    r++;
                    rev = false;
                } else {
                    c--;
                }
            } else {
                if (c == W - 1) {
                    r++;
                    rev = true;
                } else {
                    c++;
                }
            }
        }
    }
    REP(i, H) {
        REP(j, W) {
            cout << ans[i][j] << (j == W - 1 ? "\n" : " ");
        }
    }
}

Measured memory_bytes: 384
n = input()
count = 0
if len(n)%2 == 0:
  for i in range(len(n)//2):
    count += 9*(10**(2*i))
  print(count)
else:
  for i in range(len(n)//2):
    count += 9*(10**(2*i))
  count += int(n) - 10**(len(n)-1)+1
  print(count)
  
    


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define vec vector
#define rep(i,n) for (int i=0; i<(n); i++)
#define reps(i,s,n) for (int i=(s); i<(n); i++)
#define rep1(i,n) for (int i=1; i<=(n); i++)
#define repr(i,s,n) for (int i=(s)-1; i>=(n); i--)
#define print(a) cout << a << endl
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

struct UnionFind {
  vector<int> par;
  UnionFind(int n) : par(n) { par.assign(n, -1); }

  int root(int a) {
    if (par[a] < 0)
      return a;
    return par[a] = root(par[a]);
  }
  int size(int a) { return -par[root(a)]; }
  void unite(int a, int b) {
    int ra = root(a), rb = root(b);
    if (ra == rb)
      return;
    if (par[a]>par[b])
      swap(a, b);
    par[ra] += par[rb];
    par[rb] = ra;
    return;
  }
  bool same(int a, int b) {
    int ra = root(a), rb = root(b);
    return ra == rb;
  }
};
UnionFind uft(200000);


int main() {
  int N,M;
  cin >> N >> M;
  rep(i,M) {
    int a,b;
    cin >> a >> b;
    a--; b--;
    uft.unite(a,b);
  }
  int Max = 0;
  rep(i,N) {
    Max = max(Max,uft.size(i));
  }
  print(Max);
  return 0;
}

Measured memory_bytes: 5004
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int x = 0;
    int max = 0;
    int N;
    string S;
    
    cin >> N >> S;
    
    const char* p = S.c_str();
    
    for (int i = 0; i < N; i++)
    {
        if (*p == 'I')
        {
            x++;
        }
        else
        {
            x--;
        }
        if (x > max)
        {
            max = x;
        }
        
        p++;
    }
    
    cout << max << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const ll MOD = 1e9+7;
const double EPS = 1e-9;


int main(int argc, const char * argv[]) {
  int N, M; cin >> N >> M;
  vector<int> A(N), B(M), C(M);
  for (int i=0; i<N; i++)
    cin >> A[i];
  for(int i=0; i<M; i++){
    cin >> B[i] >> C[i];
  }
  
  priority_queue<pair<int,int>> Q;
  for (int i=0; i<N; i++)
    Q.emplace(A[i], 1);
  for(int i=0; i<M; i++)
    Q.emplace(C[i], B[i]);
  int x, n, num = 0;
  ll ans = 0;
  while (num<N){
    tie(x,n) = Q.top(); Q.pop();
    if (N - num <= n){
      ans += (ll)x * (N - num);
      num = N;
    }else {
      num += n;
      ans += (ll)x * n;
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3572
#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    int m,f,r,c;
   
    while(1){
    cin>>m>>f>>r;
   
     if(m==-1&&f==-1&&r==-1)  break;
      c=m+f;
    if(m==-1||f==-1)  cout<<"F"<<endl;
    else if(c>=80) cout<<"A"<<endl;
      else if(c<80&&c>=65) cout<<"B"<<endl;
     else if(c<65&&c>=50) cout<<"C"<<endl;
    else  if(c<50&&c>=30&&r>=50) cout<<"C"<<endl;
     else if(c<50&&c>=30&&r<50) cout<<"D"<<endl;
     else if(c<30) cout<<"F"<<endl;
    
}
    
    
    
}

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

using namespace std;

int main()
{
    int n,k,ans = 0;
    cin >> n >> k;
    int h[n];
    rep(i, n) cin >> h[i];
    rep(i, n){
        if (h[i] >= k) {
            ++ans;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 640
N, Q = map(int, input().split())
s = input()
td = [input().split() for i in range(Q)]

def tracking(i):
  now = s[i]
  for t, d in td:
    if t == now:
      move = -1 if d=='L' else 1
      i += move
      if i < 0 or i > N-1:
        return i
      now = s[i]
  return i

remove = 0
# 左側に消滅するゴーレムの範囲を求める
left = 0; right = N-1
while left+1 < right:
  mid = (left + right) // 2
  pos = tracking(mid)
  if pos == -1:
    left = mid
  else:
    right = mid

pos_l = tracking(left)
pos_r = tracking(right)
if pos_l == -1:
  if pos_r == -1: # left:消滅, right:消滅 <=> 全ゴーレムが左側に消滅
    remove += N
  else: # left:消滅, right:消滅せず
    remove += left + 1
# else: # left:消滅せず, right:消滅せず <=> どのゴーレムも左側に消滅せず
#   remove += 0

# 右側に消滅するゴーレムの範囲を求める
left = 0; right = N-1
while left+1 < right:
  mid = (left + right) // 2
  pos = tracking(mid)
  if pos == N:
    right = mid
  else:
    left = mid

pos_l = tracking(left)
pos_r = tracking(right)
if pos_r == N:
  if pos_l == N: # left:消滅, right:消滅 <=> 全ゴーレムが右側に消滅
    remove += N
  else: # left:消滅せず, right:消滅
    remove += N - right
# else: # left:消滅せず, right:消滅せず <=> どのゴーレムも右側に消滅せず
#   remove += 0

print(N - remove)

Measured memory_bytes: 41396
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define deb(x) cout << #x": " << (x) << endl;

const int N = 1e3;
const lli INF = 1e18;
const lli MOD = 1e9+7;

vi m;
vi primes(1,2);
vector<vector<ld>>nk;
void sieve(){
	m = vi(N+1,0);
	for(int i = 4; i<N; i+=2)m[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
}

void pascal(){
	nk =vector<vector<ld>>(N,vector<ld>(N,0.0));
	fore(i,0,N)nk[i][0]=nk[i][i]=1.0;
	fore(i,1,N)fore(j,1,i)nk[i][j]=nk[i-1][j-1]+nk[i-1][j];
}

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b, lli mod = MOD){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%mod;
		a = (a*a)%mod;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}

// ---- コーディングはここから！ ('-')7

struct Q{
  int l,r,idx;
};
int main(){_
	int n,q; cin>>n>>q;
	int sq = static_cast<int>(sqrt(n));
	vl v(n),ans(q,0),cnt(n+1,0);
	fore(i,0,n)cin>>v[i];
	vector<Q> qq(q);
	int id = 0;
	lli cur=0;
	for(auto &[a,b,c]:qq){cin>>a>>b;c=id++;a--;}
	sort(all(qq),[&](Q& a,Q& b){
      if(a.l/sq!=b.l/sq)
			return a.l<b.l;
      return bool((a.r<b.r)^((a.l/sq)&1));
    });
	auto add=[&](int x,int val){
	  x=v[x];
	  cur-=(cnt[x]?1:0);
	  cnt[x]+=val;
	  cur+=(cnt[x]?1:0);
	};

	int l=0,r=0;
  for(auto &[nxl,nxr,id]:qq){
    while(r<nxr)add(r++,1);
    while(l>nxl)add(--l,1);
    while(r>nxr)add(--r,-1);
    while(l<nxl)add(l++,-1);
    ans[id]=cur;
  }
	for(auto i:ans)cout<<i<<ENDL;


}


Measured memory_bytes: 21308
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long llong;

#define INFTY 2000000000

int score[100010];
int N;
int H[100010];
int K;



int main() {

	cin >> N >> K;

	for (int i = 0; i < N; i++) {
		cin >> H[i];
	}

	score[0] = 0;

	for (int i = 1; i < N; i++) {
		int obj = INFTY;
		for (int j = 1; j <= min(i, K); j++) {
			obj = min(obj, score[i - j] + abs(H[i] - H[i - j]));
		}
		score[i] = obj;
	}

	cout << score[N - 1] << endl;


	return 0;
}

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

int main() {
  string S, T;
  cin >> S >> T;
  int count;
  int countmin = T.size();
  for (int i = 0; i < S.size() - T.size() + 1; i++) {
    count = 0;
    for (int j = 0; j < T.size(); j++) {
      if (T.at(j) != S.at(i + j)) {
        count++;
      }
    }
    if (count < countmin) {
      countmin = count;
    }
  }
  cout << countmin << endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main(){
    ll n,c; cin>>n>>c;
    vector<ll> col1(c+1), col2(c+1), col3(c+1);
    vector<vector<ll>> d(c, vector<ll>(c));
    rep(i,c) rep(j,c) cin>>d[i][j];
    for(ll i=1; i<=n; i++){
        for(ll j=1; j<=n; j++){
            ll d; cin>>d;
            if((i+j)%3==1) col1[d]++;
            if((i+j)%3==2) col2[d]++;
            if((i+j)%3==0) col3[d]++;
        }
    }
    ll res=1e10;
    for(ll x=1; x<=c; x++){
        for(ll y=1; y<=c; y++){
            for(ll z=1; z<=c; z++){
                if(x==y || x==z || y==z) continue;
                ll tmp=0;
                rep(i,c) tmp += col1[i+1] * d[i][x-1];
                rep(i,c) tmp += col2[i+1] * d[i][y-1];
                rep(i,c) tmp += col3[i+1] * d[i][z-1];
                chmin(res, tmp);
            }
        }
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    char S[19];

    for(int i=0;i<19;++i){
        cin >> S[i];
    }

    for(int i=0;i<5;++i){
        cout << S[i];
    }

    cout << " ";

    for(int i=6;i<13;++i){
        cout << S[i];
    }

    cout << " ";

    for(int i=14;i<19;++i){
        cout << S[i];
    }

    cout << " ";
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import bisect
import collections
import sys

sys.setrecursionlimit(1000000)
ACMOD = 1000000007
INF = 1 << 62



def solve(A: int, B: int):
    print(A*B)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 65164
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

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

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;

  vector<int> rs(N + 1);

  FOR(x, 1, 100) {
    FOR(y, 1, 100) {
      FOR(z, 1, 100) {
        int n = x * x + y * y + z * z + x * y + y * z + z * x;
        if (n >= 0 && n < rs.size()) {
          rs[n]++;
        }
      }
    }
  }

  FOR(i, 1, N+1) {
    cout << rs[i] << newl;
  }
}
#endif


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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (auto i=0; i<n; i++)
#define	Rep1(i, n)	for (auto i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

int	main() {
	int N;
	cin >>N;
	vector<ll> A(N+1, 0);
	Rep0(i, N+1)
		cin >>A.at(i);
	if (N==0) {
		if (A.at(0)==1)
			cout <<1 <<endl;
		else
			cout <<-1 <<endl;
		return 0;
	}
	if (0<A.at(0)) { // &&(N>0)
		cout <<-1 <<endl;
		return 0;
	}
	vector<ll> MP(N+1, 0);
	MP.at(0)=1;
	for (auto i=1; i<=N; i++) {
		MP.at(i)=min((ll)100000000000000, MP.at(i-1)*2-A.at(i));
		if (MP.at(i)<0) {
			cout <<-1 <<endl;
			return 0;
		}
	}
	vector<ll>NN(N+1, 0);
	NN.at(N)=A.at(N);
	for (auto i=N-1; i>=0; i--) {
		if (MP.at(i)*2<NN.at(i+1)) {
			cout <<-1 <<endl;
			return 0;
		}
		ll MaxP=min(NN.at(i+1), MP.at(i));
		NN.at(i)=MaxP+A.at(i);
	}
	ll S=0;
	Rep0(i, N+1)
		S +=NN.at(i);
	cout <<S <<endl;
	return 0;
}



Measured memory_bytes: 5584
import re
RL_list = input()
RL_list = re.findall(r'R*L*',RL_list)
buf = []

for lis in RL_list:
    if len(lis)==2:
        buf.extend([1,1])
    if len(lis)>2:
        r_cnt = lis.count('R')
        l = len(lis) - r_cnt
        if (len(lis) % 2 == 1) & (r_cnt % 2 == 1):
            r = len(lis) // 2 + 1
        #elif (len(lis) % 2 == 1) & (r_cnt % 2 == 0):
        else:
            r = int(len(lis) / 2)
        
        buf.extend([0]*(r_cnt-1))
        buf.extend([r,len(lis)-r])
        buf.extend([0]*(len(lis)-r_cnt-1))
        
print(" ".join(map(str,buf)))


Measured memory_bytes: 13812
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	char c1, c2;
	cin >> c1 >> c2;
	if (c1 < c2) cout << "<\n";
	else if (c1 == c2) cout << "=\n";
	else cout << ">\n";

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,n;
int main()
{
    cin>>a>>b>>c;
    if(b>=a)
    {
        cout<<1<<endl;
        exit(0);
    }
    if(c>=b)
    {
        cout<<-1<<endl;
        return 0;
    }
    if((a-b)%(b-c)>=1)n=1;
    cout<<((a-b)/(b-c)+n)*2+1<<endl;
}

Measured memory_bytes: 256
public class Main {
	public static void main(String[] args){
		java.util.Scanner scan = new java.util.Scanner(System.in);
		int r = scan.nextInt();
		int c = scan.nextInt();

		int[][] arr  = new int[r][c];
		int sum = 0;
		int kai = 0;
		for(int i = 0; i < r; i++){
			sum = 0;
			for(int j = 0; j < c; j++){
				arr[i][j] = scan.nextInt();
				System.out.print(arr[i][j] + " ");
				sum += arr[i][j];
			}
			kai += sum;
			System.out.println(sum);
		}

		for(int i = 0; i < c; i++){
			sum = 0;
			for(int j = 0; j < r; j++){
				sum += arr[j][i];
			}
			System.out.print(sum + " ");
		}
		System.out.println(kai);
	}
}

Measured memory_bytes: 40360
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

int A[5];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	for (int i = 0; i < 5; ++i)
		cin >> A[i];
	cout << find(A, A + 5, 0) - A + 1;
}

Measured memory_bytes: 3644
#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;
typedef pair<ll,int> pli;
const int INF=0x3f3f3f3f;
const ll INFF=0x3f3f3f3f3f3f3f3fll;
const int MAX=1e5+5;
const int MAX_N=MAX;
const ll MOD=998244353;
const long double pi=acos(-1.0);
//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("1009.in","r",stdin);
    freopen("out.txt","w",stdout);
}
int n,cnt;
ll mi[205];
int x[205],y[205];
ll an;
inline bool check(int i,int j,int k)
{
    return ((x[i]-x[j])*(y[k]-y[j])-(x[k]-x[j])*(y[i]-y[j]))==0;
}
int main()
{
    scanf("%d",&n);
    mi[0]=1;for(int i=1;i<=n;i++)mi[i]=2*mi[i-1]%MOD;
    for(int i=1;i<=n;i++)scanf("%d%d",&x[i],&y[i]);
    an=(mi[n]-1-n+MOD)%MOD;
    for(int i=1;i<=n-1;i++)
        for(int j=i+1;j<=n;j++,an=(an-mi[cnt]+MOD)%MOD,cnt=0)
            for(int k=j+1;k<=n;k++)
                if(check(i,j,k))++cnt;
    printf("%lld\n",an);
    return 0;
}


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

using namespace std;

bool isPrime(int N){
    for(int i=2;i*i<=N;++i){
        if(N % i == 0){
            return false;
        }
    }
    return true;
}

int main()
{
    int N=100001;
    vector<bool> isprime(N, 0);
    for(int i=2;i<N;++i){
        isprime[i] = isPrime(i);
    }

    vector<int> ans(N, 0);
    for(int i=3;i<N;++i){
        if(i % 2 == 0){
            ans[i] = ans[i-1];
        }
        else if(isprime[i] && isprime[(i+1)/2]){
            ans[i] = ans[i-1] + 1;
        }
        else{
            ans[i] = ans[i-1];
        }
    }

    int Q, l, r;
    cin >> Q;
    for(int i=0;i<Q;++i){
        cin >> l >> r;
        cout << ans[r] - ans[l-1] << endl;
    }
}


Measured memory_bytes: 1024
#!/usr/bin/env python3
#ARC93 D

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a,b = LI()
lst = []
for _ in range(50):
    lst.append(['#']*100)
for _ in range(50):
    lst.append(['.']*100)
print(100,100)
cnt = 0
flg = True
if cnt != a-1:
    for i in range(25-1):
        for j in range(25-1):
            lst[2*i][2*j] = '.'
            cnt += 1
            if cnt == a-1:
                flg = False
                break
        if not flg:
            break
cnt = 0
flg = True
if cnt != b-1:
    for i in range(25+1,50)[::-1]:
        for j in range(25+1,50)[::-1]:
            lst[2*i+1][2*j+1] = '#'
            cnt += 1
            if cnt == b-1:
                flg = False
                break
        if not flg:
            break
for i in range(100):
    print(''.join(lst[i]))


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

int main() {
    string a, b;
    cin >> a >> b;
    string s = a+b;
    int n = stoi(s);
    int sqrtn = sqrt(n);
    if(n == sqrtn*sqrtn) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 384
n=int(input())
a=list(map(int,input().split()))
A=[]
B=[]
for i in range (n):
  p=abs(a[i])
  A.append(p)
  if a[i]<0:
    B.append(a[i])
if len(B)%2==0:
  print(sum(A))
else:
  print(sum(A)-(min(A)*2),)


Measured memory_bytes: 20060
# https://atcoder.jp/contests/agc018/tasks/agc018_a
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


from fractions import gcd
N, K = read_ints()
A = read_ints()
# 結論からいうとKがminとmaxの間でかつ、gcd(A)の倍数であるならば、必ずKを構成することができる。
# ∵ある2要素a,bからはgcd(a,b)の倍数しか作ることができない。これをすべての要素に適応するだけ。

g = 0  # gcdの単位元
for a in A:
    g = gcd(g, a)

if min(A) <= K <= max(A) and K % g == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N;
  cin >> N;
  VVI xs(2, VI(N));
  cin >> xs;

  int y0 = 0, y1 = 0;
  for(int x=0;x<N;++x){
	y0 += xs[0][x];
	y1 = max(y1, y0) + xs[1][x];
  }

  cout << max(y0, y1) << endl;
  
  return 0;
}

Measured memory_bytes: 256
s = input()

def solve(s):
    maximum = 0
    a = 0
    counting = False
    for i in s:
        if i == "A":
            counting = True
        
        if counting == True:
            a += 1
        
        if i == "Z" and counting == True:
            maximum = a
    
    print(maximum)
        

solve(s)

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

ll N, K, A[1 << 18];

int main(){
    cin >> N >> K;
    for(int i = 1; i <= N; i++){
        cin >> A[i];
    }
    for(int i = K + 1; i <= N; i++){
        if(A[i - K] < A[i]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

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

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> x(N+1);
  x.at(0) = X;
  for( int i = 1; i<N+1; i++ ){
    cin >> x.at(i);
  }
  sort(x.begin(), x.end());
  if( N == 1 ){
    cout << x.at(1) - x.at(0) << endl;
    return 0;
  }
  
  vector<int> sa(N);
  for( int i = 0; i< N; i++ ){
    sa.at(i) = x.at(i+1) - x.at(i);
  }
  
  int koyaku = __gcd(sa.at(0), sa.at(1));
  for( int i = 1; i < N-1; i++ ){
    koyaku = __gcd(koyaku, sa.at(i+1));
  }
  cout << koyaku << endl;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#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 FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define INF 1e9
using namespace std;
typedef long long ll;

signed main() {
  // std::ifstream in ("input.txt"); std::cin.rdbuf(in.rdbuf());
  int a, b, c;
  cin >> a >> b >> c;
  cout << max(c - (a - b), 0) << endl;
}


Measured memory_bytes: 256
if __name__ == '__main__':
    from numpy import zeros
    N, M = map(int, input().split())
    city = zeros(2*M, dtype='int32')
    for i in range(M):
        city[2*i:2*i+2] = list(map(int, input().split()))
    ans = zeros(N+1, dtype='int32')
    for j in city:
        ans[j] += 1
    for i in range(1, N+1):
        print(ans[i])

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

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int A, B;

int main() {
    cin >> A >> B;

    if (A >= 13) {
        cout << B << endl;
    } else if (A >= 6) {
        cout << B / 2 << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int sum(vector<int> A,int N){
    int res = 0;
    rep(i,N) res += A[i];
    return res;
}
class Range {
    public:
        int start;
        int step;
        int length;
        int operator[](int i){
            return start + step * i;
}
};
int sum(Range A){
    return (2 * A.start + (A.length - 1) * A.step) * A.length / 2;
}
template <typename T>
vector<T> slice_vector(vector<T> A,int start_idx,int fin_idx){
    vector<T> res(fin_idx - start_idx);
    for (int i = start_idx; i < fin_idx; i++)
    {
        res[i-start_idx] = A[i];
    }
    return res;
}
template <typename T>
void cout_vector(vector<T> A){
    for (int i=0;i<A.size();i++){
        cout << A[i] << " ";  
    }
    cout << endl;
}
int main(){
    int r,D,x,ans;
    cin >> r >> D >> x;
    rep(i,10){
        x =  r * x - D;
        cout << x << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
#define No cout<<"No"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    ll n;cin>>n;
    vector<ll> a(n);
    rep(i,n){
        cin>>a[i];
    }
    vector<ll> c;
    c.push_back(-a[0]);
    ll num=0;
    for(ll i=1;i<n;i++){
        if(c[num]<=(-a[i])){
            c.push_back(-a[i]);
            num++;
        }
        else{
            //binsearch
            ll k=(upper_bound(ALL(c),-a[i])-c.begin());
            c[k]=(-a[i]);
        }
    }
    cout<<c.size()<<endl;
    return 0;
}


Measured memory_bytes: 2168
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

//ACL

#include <atcoder/all>
using namespace atcoder;

//ACL END

#define int long long

#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

using namespace std;

using P = std::pair<int, int>;
using ll = long long;
using ld = double;

using bint = boost::multiprecision::cpp_int;


template<typename T, typename U>
std::istream& operator>>(std::istream& in, std::pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}

const int MOD = 998244353;

// https://twitter.com/vane11ope ←フォローしましょう
// (ノ)>◡<(ヾ)ﾓﾁﾓﾁ
signed main(signed argc, char* argv[]) {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    int n,m;
    cin>>n>>m;
    scc_graph graph(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        graph.add_edge(a,b);
    }
    auto me=graph.scc();
    cout<<me.size()<<endl;
    for(auto li:me){
        cout<<li.size();
        for(auto it:li)cout<<" "<<it;
        cout<<endl;
    }
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, t, time, i, a, pre=0;
  cin >> n >> t;
  time = t;
  vector<int> vec(n);

  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }

  for (i = 1; i < n; i++) {
    a = vec[i] - vec[i-1];
    time += t;
    if (a < t) time -= (t - a);
    pre = a;
  }
  cout << time << '\n';
}


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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7ll;
const double PI=3.14159265358979323846;

bool my_compare(const tuple<string, int, int>&lt, const tuple<string, int, int> &rt) {
    if(get<0>(lt) != get<0>(rt)) return get<0>(lt) < get<0>(rt);
    else if(get<1>(lt) != get<1>(rt)) return get<1>(lt) > get<1>(rt);
}

int main() {
    int N; cin >> N;
    vector<tuple<string, int, int>> a;
    map<string, int> mp;
    rp(i, 1, N+1) {
        string S; int P;
        cin >> S >> P;
        tuple<string, int, int> t = make_tuple(S, P, i);
        a.emplace_back(t);
    }
    sort(a.begin(), a.end(), my_compare);
    for(auto x: a) {
        cout << get<2>(x) << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
N = int(input())
foods = [int(i) for i in input().split()]
eff = sum([int(i) for i in input().split()])
plus = [int(i) for i in input().split()]
tmp = 0
for i, f in enumerate(foods):
  if i == 0:
    tmp = f
  elif f - tmp == 1:
    eff += plus[f-2]
    tmp = f
  else:
    tmp = f
print(eff)

Measured memory_bytes: 3064
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        List<int> input = new List<int>();

        int minIndex = 0;
        int min = 10;

        for (int i = 0; i < 5; i++)
        {
            int n = int.Parse(ReadLine());
            input.Add(n);

            int x = n - (n / 10) * 10;
            if (x < min && x != 0)
            {
                min = x;
                minIndex = i;
            }
        }

        var res = input.Select(n =>
        {
            int x = n - (n / 10) * 10;
            if (x == 0)
                return n;
            else
                return n - x + 10;
        }).ToArray();

        WriteLine(res.Sum() - res[minIndex] + input[minIndex]);

        ReadKey();
    }
}

static class MyUtil
{
    public static int[] ReadIntArray()
    {
        return ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
    }

    /// <summary>
    /// <see cref="IEnumerable{T}"/>の各要素を並べてコンソールに出力します。各要素の間には半角スペースが一つ入ります。
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="ts"></param>
    public static void WriteToConsole<T>(this IEnumerable<T> ts)
    {
        StringBuilder stringBuilder = new StringBuilder();
        foreach (T t in ts)
        {
            stringBuilder.Append(t.ToString());
            stringBuilder.Append(" ");
        }
        stringBuilder.Remove(stringBuilder.Length - 1, 1);
        Console.WriteLine(stringBuilder.ToString());
    }
}


Measured memory_bytes: 13396
#include<stdio.h>
int main(){
long n,i,j,a[2222],min[2222][2222],ans,x,p;
scanf("%ld%ld",&n,&x);
for(i=0;i<n;i++)
scanf("%ld",&a[i]);
for(i=0;i<n;i++){
for(j=0;j<n;j++)
min[i][j]=100000000000;
}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(j==0)
min[i][i]=a[i];
else{
if(a[(i+j)%n]<min[i][(i+j-1)%n])
min[i][(i+j)%n]=a[(i+j)%n];
else
min[i][(i+j)%n]=min[i][(i+j-1)%n];
}
}
}
ans=10000000000000;
for(i=0;i<n;i++){
p=0;
for(j=0;j<n;j++){
p+=min[j][(j+i)%n];
}
p+=i*x;
if(p<ans)
ans=p;
}
printf("%ld\n",ans);
return 0;
}


Measured memory_bytes: 36992
from bisect import bisect_right
n,h=map(int,input().split())
a=[]
b=[]
for i in range(n):
    a1,b1=map(int,input().split())
    a.append(a1)
    b.append(b1)
a_s=sorted(a, reverse=1)
b_s1=sorted(b)
b_s=sorted(list(b_s1[bisect_right(b_s1,a_s[0]):]),reverse=1)


count=0
sum=0

for j in b_s:
    sum+=j
    count+=1
    if h<=sum:
        print(count)
        break
else:
    if (h-sum)%a_s[0]==0:
        print(count+(h-sum)//a_s[0])
        
    else:
        print(count+1+(h-sum)//a_s[0])

Measured memory_bytes: 19984
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	/**
	 * シーザー暗号を復号化する。
	 *
	 * @param args
	 */
	public static void main(String[] args) throws IOException {

		// 入力がある限り処理を行う
		String line = null;
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		while ((line = reader.readLine()) != null) {

			// 復号化する
			String result = decode(line);

			// 出力する
			System.out.println(result);
		}

		if (reader != null) {
			reader.close();
		}
	}

	/**
	 * 1行分の文字列を復号化する。
	 *
	 * @param line
	 *            暗号化された文字列
	 * @return 復号化された文字列
	 */
	protected static String decode(String line) {

		// アルファベットを1文字ずつずらす
		for (int i = 1; i <= 26; i++){

			String decodedLine = tryDecode(line, i);

			// デバッグ
			// System.out.println(decodedLine);

			if (isDecoded(decodedLine)) {
				// デコードできていたら終了
				return decodedLine;
			}
		}

		return line;
	}

	/**
	 * 引数で渡された文字列のアルファベットを指定された数だけずらす。
	 *
	 * @param line 復号化対象の文字列
	 * @param move アルファベットをどれだけずらすか
	 * @return 復号化した結果
	 */
	protected static String tryDecode(String line, int move) {
		StringBuilder buffer = new StringBuilder();

		// 1文字ずつすべて処理する
		for (char ch : line.toCharArray()){
			if (Character.isLetter(ch)){
				buffer.append(tryDecodeCharacter(ch, move));

			} else {
				// アルファベット以外はそのまま
				buffer.append(ch);
			}
		}

		return buffer.toString();
	}

	/**
	 * 引数で渡された文字を指定された数だけずらす。
	 *
	 * @param ch ずらす対象の文字
	 * @param move アルファベットをどれだけずらすか
	 * @return ずらした結果のアルファベット
	 */
	protected static char tryDecodeCharacter(char ch, int move) {

		// a からの差分を取得する
		int fromA = ch - 'a';

		// さらにずらしたい分だけ加算し、z を超えないように 26 の剰余を取る
		int next = (fromA + move) % 26;

		// 文字に戻す
		return (char)('a' + next);
	}

	/**
	 * 引数で渡された文字列が正しく復号化されているか判定する。
	 *
	 * @param line 復号化された文字列
	 * @return 正しく復号化されていれば true、そうでなければ false
	 */
	protected static boolean isDecoded(String line) {
		// the、this、that のいずれかが含まれるならば復号化完了
		return (line.contains("the") || line.contains("this") || line.contains("that"));
	}
}

Measured memory_bytes: 17856
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>
#define LL long long
using namespace std;
inline bool scan_d(int &num)  
{
        char in;bool IsN=false;
        in=getchar();
        if(in==EOF) return false;
        while(in!='-'&&(in<'0'||in>'9')) in=getchar();
        if(in=='-'){ IsN=true;num=0;}
        else num=in-'0';
        while(in=getchar(),in>='0'&&in<='9'){
                num*=10,num+=in-'0';
        }
        if(IsN) num=-num;
        return true;
}
struct note{
	int num;
	int id;
}a[2000001];
bool cmp(note da,note db){
	return da.num < db.num;
}
map<int,int>ma;
int main(){
	int n,m,dx;
	scanf("%d %d",&n,&m);
	for(int i = 0 ; i < n ; i++){
		scanf("%d",&dx);
		ma[dx]++;
	}
	map<int,int>::iterator it = ma.begin();
	int ans = 0;
	for(;it!=ma.end();it++){
		a[ans].num = it->second;
		a[ans++].id = it->first;
	}
	sort(a,a+ans,cmp);
	int sum = 0;
	for(int i = 0 ; i < ans - m ; i++){
		sum+=a[i].num;
	}
	printf("%d\n",sum);
}

Measured memory_bytes: 11136
void main() {
	auto ip = readAs!(long[]), A = ip[0], B = ip[1], C = ip[2], K = ip[3];
	if(K & 1) (B - A).writeln;
	else (A - B).writeln;
}

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

import std.stdio;
import std.string;
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;
}

T[] deepcopy(T)(T[] a) {
	static if(isArray!T) {
		T[] res;
		foreach(i; a) {
			res ~= deepcopy(i);
		}
		return res;
	} else {
		return a.dup;
	}
}

ulong[] generate_prime_list(T)(T N) if(isIntegral!T) {
	ulong[] prime_list = [2];
	bool not_prime = false;
	foreach(i; 3..N.to!ulong+1) {
		foreach(j; prime_list) {
			if(i % j == 0) {
				not_prime = true;
				break;
			}
		}
		if(!not_prime) prime_list ~= i;
		not_prime = false;
	}
	return prime_list;
}

bool isPrime(ulong n) {
	if(n <= 1) return false;
	else if(n == 2) return true;
	else if(n % 2 == 0) return false;

	foreach(i; iota(3, n.to!double.sqrt.ceil+1, 2)) {
		if(n % i == 0) return false;
	}
	return true;
}

class UnionFind(T) {
	T[] arr;
	this(ulong n) {
		arr.length = n+1;
		arr[] = -1;
	}
	T root(T x) {
		return arr[x] < 0 ? x : root(arr[x]);
	}
	bool same(T x, T y) {
		return root(x) == root(y);
	}
	bool unite(T x, T y) {
		x = root(x);
		y = root(y);
		if(x == y) return false;
		if(arr[x] > arr[y]) swap(x, y);
		arr[x] += arr[y];
		arr[y] = x;
		return true;
	}
	T size(T a) {
		return -arr[root(a)];
	}
}


Measured memory_bytes: 256
s = input()
q = int(input())
x = 1
f, b = '', ''
for i in range(q):
  a = input().split()
  if a[0] == '1':
    x = -x
  elif (1.5-int(a[1]))*x > 0:
    f = a[2] + f
  else:
    b = b + a[2]
s = f + s + b
if x == -1:
  s = s[::-1]
print(s)

Measured memory_bytes: 4428
#include <bits/stdc++.h>
 #define ll long long
 #define int long long
 #define MOD  1000000007
 #define MAX 500005
 #include<iomanip>
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define x first
 #define y second
using namespace std;
int gcd(int a, int b);
  
int power(int x, unsigned int y, unsigned int m)
{
    if (y == 0)
        return 1;
    int p = power(x, y/2, m) % m;
    p = (p * p) % m;
  
    return (y%2 == 0)? p : (x * p) % m;
}
ll modInverse(int a, int m)
{
    int g = gcd(a, m);
   
    {
        // If a and m are relatively prime, then modulo inverse
        // is a^(m-2) mode m
      
             return power(a, m-2, m);
    }
}
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
//void spf(ll num)
//{
//    fore(i,0,num+1)arr[i]=i;
//    for(ll i=2;i<=num;i+=2)
//    {
//        arr[i]=2;
//    }
//    for(ll i=3;i<=num;i+=2)
//    {
//        if(arr[i]==i)
//        for(ll j=i;j<=num;j+=i)
//        {
//           if(arr[j]==j) arr[j]=i;
//        }
//    }
//}
 
 int32_t main()
{
    Need_for_speed(activated);
//    satisfy
//    {}
    ll a,b;
    cin>>a>>b;
    cout<<(a*b)/(gcd(a,b));
    return 0;
    }


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;
typedef pair<ll,int> P;

int n,m,s,t;
vector<P> en[100005];
vector<P> snuke[100005];
ll ed[100005];
ll sd[100005];
const ll INF = 1e18;
const ll a = 1e15;
vector<P> ans;

int main() {
  cin >> n >> m >> s >> t;
  s--,t--;

  for(int i = 0; i < m; i++) {
    int u,v;
    ll a,b;
    cin >> u >> v >> a >> b;
    u--,v--;
    en[u].push_back(P(a,v));
    en[v].push_back(P(a,u));
    snuke[u].push_back(P(b,v));
    snuke[v].push_back(P(b,u));
  }
  fill(ed,ed+n,INF);
  fill(sd,sd+n,INF);
  ed[s] = 0;
  sd[t] = 0;
  priority_queue<P,vector<P>,greater<P> > eq,sq;

  eq.push(P((ll)0,s));

  while(!eq.empty()) {
    P p = eq.top();
    eq.pop();

    if(p.first > ed[p.second]) continue;
    for(int i = 0; i < en[p.second].size(); i++) {
      P e = en[p.second][i];
      if(ed[e.second] > ed[p.second] + e.first) {
	ed[e.second] = ed[p.second] + e.first;
	eq.push(P(ed[e.second],e.second));
      }
    }
  }



  sq.push(P((ll)0,t));

  while(!sq.empty()) {
    P p = sq.top();
    sq.pop();

    if(p.first > sd[p.second]) continue;
    for(int i = 0; i < snuke[p.second].size(); i++) {
      P e = snuke[p.second][i];
      if(sd[e.second] > sd[p.second] + e.first) {
	sd[e.second] = sd[p.second] + e.first;
	sq.push(P(sd[e.second],e.second));
      }
    }
  }

  for(int i = 0; i < n; i++) {
    ans.push_back(P(ed[i] + sd[i],i+1));
  }

  sort(ans.begin(),ans.end());
  int k = 0;
  for(int i = 0; i < n; i++) {
    if(ans[k].second > i) {
     
      cout << a - ans[k].first << endl;
    }
    else {
      while(ans[k].second <= i) k++;
      i--;
    }
  }
}
  

  


Measured memory_bytes: 20980
n = int(input())
a = list(map(int, input().split()))

b = [0] * n


if n % 2 == 1:
    for i in reversed(range(n)):
        if i % 2 == 1:
            b[n // 2 + int(i/2 + 0.9)] = a[i]
        else:
            b[n // 2 - int(i/2 + 0.9)] = a[i]
else:
    for i in reversed(range(n)):
        if i % 2 == 1:
            b[n // 2 - 1 + int(i/2 + 0.9)] = a[i]
        else:
            b[n // 2 - 1 - int(i/2 + 0.9)] = a[i]


if n % 2 == 1:
    for i in b:
        print(i, end=" ")
else:
    for i in reversed(b):
        print(i, end=" ")


Measured memory_bytes: 26016
#include <bits/stdc++.h>
using namespace std;
int main(void){
   int n,count=0;
   cin >> n;
   int a[n+1];
   a[0] = 0;
   for(int i=1;i<=n;i++){
       cin >> a[i];
   }
   for(int i=1;i<=n;i++){
       if(i%2 == 1){
           if(a[i]%2 == 1) count ++;
       }
   }
   cout << count << endl;
}

Measured memory_bytes: 3628
use text_io::*;
use std::collections::*;
use std::process::exit;

fn main() {
    let mut n:usize = read!();
    for a in 1..10 {
        if a<10&&n/a<10&&n%a==0 {
            println!("Yes");
            exit(0);
        }
    }
    println!("No");
}

Measured memory_bytes: 2136
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
using namespace std;

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



int main(void){
	priority_queue <string, vector<string>, greater<string> > pq;

	int n,l;
	string s;
	cin >> n >> l;

	REP(i,n) {
		cin >> s;
		pq.push(s);
		
	}

	REP(i,n) {
		cout << pq.top();
		pq.pop ();
	}
	cout << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    string s,t;
    cin>>s>>t;
    int n=s.size();
    bool f=1;
    rep(i,n){
        if(s[i]==t[i]) continue;
        else f=0;
    }
    if(f) Yes;
    else No;
}/*
./problem.exe
*/

Measured memory_bytes: 3656