akhauriyash/Code-Regression huggingface dataset:
protocol InitFromString {
    init?(_ str: String)
}

extension Int: InitFromString {}
extension Int8: InitFromString {}
extension Int16: InitFromString {}
extension Int32: InitFromString {}
extension Int64: InitFromString {}
extension String: InitFromString {}

func input<T: InitFromString>() -> [T] {
    readLine()!.split(separator: " ").map(String.init).compactMap(T.init)
}

let n: Int = input()[0]
let a: [Int] = input()

var res = [Int](repeating: 0, count: n)
a.forEach { (i) in
    res[i - 1] += 1
}

print(res.map(String.init).joined(separator: "\n"))


Measured memory_bytes: 18612
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B,i,S=0;
  cin>>A>>B;
  for(i=A;i<=B;i++){
    if(i/10000==i%10&&i/1000%10==i/10%10)S++;
  }
  cout<<S<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include <random>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll r;
    cin>>r;
    cout<<r*r<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
 
using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;
constexpr ll MOD = 1000000007;
constexpr ll base = 257;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n;
  cin>>n;
  vecint a(n);
  for(auto&& e:a)cin>>e;
  vecint b(n);
  for(auto&& e:b)cin>>e;
  ll all1 = 0;
  for(auto&& i:irange(0l,n)) {
    all1 *= base;
    all1 += 1;
    all1 %= MOD;
  }
  ll pn1 = 1;
  for(auto&& i:irange(0l,n)) {
    pn1 *= base;
    pn1 %= MOD;
  }
  vecll tb(30);
  for(auto&& i:irange(0,30)) {
    ll hs = 0;
    for(auto&& e:b) {
      int bit = (e >> i) & 1;
      hs *= base;
      hs += bit;
      hs %= MOD;
    }
    tb[i] = hs;
  }
  vector<vecll> ta(30, vecll(n));
  for(auto&& i:irange(0,30)) {
    ll hs = 0;
    for(auto&& e:a) {
      int bit = (e >> i) & 1;
      hs *= base;
      hs += bit;
      hs %= MOD;
    }
    for(auto&& j:irange(0l,n)) {
      ta[i][j] = hs;
      int bit = (a[j] >> i) & 1;
      hs *= base;
      hs += MOD - (pn1 * bit) % MOD;
      hs += bit;
      hs %= MOD;
    }
  }
  vector<bool> ok(n, true);
  for(auto&& i:irange(0,30)) {
    for(auto&& j:irange(0l,n)) {
      ll comp = all1 + MOD - ta[i][j];
      comp %= MOD;
      if (tb[i] != ta[i][j] && tb[i] != comp) ok[j] = false;
    }
  }
  for(auto&& i:irange(0l,n)) {
    if (ok[i]) {
      cout<<i<<' '<<(a[i]^b[0])<<endl;
    }
  }
  return 0;
}


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

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

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection) (collection).begin(), (collection).end()  // begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)       // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)      // repeat reverse
#define size(collection) ((ll) (collection).size())               // collection size

#endif


int main(void)
{
	ll n; cin >> n; n--;

	//vector<ll> test(n);
	//rep(i, 0, n)
	//	test[i] = i+1;

	//ll temp = 0;
	//ll ans = 0;
	//vector<ll> v(n);
	//do {
	//	rep (i, 0, n) {
	//		temp += (i+1) % test[i];
	//	}
	//	if (temp > ans)
	//	{
	//		ans = temp;
	//		rep(i, 0, n)
	//			v[i] = test[i];
	//	}
	//	temp = 0;
	//} while (next_permutation(all(test)));

	//cout << ans << endl;
	//for (auto& e : v)
	//	cout << e << " ";

	cout << n * (n + 1) / 2;

	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++)
typedef long long int ll;

int main()
{
  ll n;
  cin >> n;
  cout << (n*(n-1))/2 << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int n,s=0,i;
cin>>n;
long long int a[n+1],dp[n+1];
a[0]=1000000000;
for(i=1;i<=n;i++)
{
cin>>a[i];

}
dp[0]=0;
dp[1]=0;
s=1;
for(i=2;i<=n;i++)
{
dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));

}
cout<<dp[n]<<endl;


}


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

using namespace std;
using ll = long long;

int main(){
    int a, b; 
    cin >> a >> b;
    int c = 0;
    int now = 1;
    while(now < b){
        now += a - 1;
        c++;
    }
    cout << c << endl;

    return 0;
}

Measured memory_bytes: 256
// problem: "https://atcoder.jp/contests/abc149/tasks/abc149_b"

#include<bits/stdc++.h>
#define ll long long

using namespace std;

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

    if(a < k)
    {
        b = b-(k-a);

        if(b < 0)
            b = 0;
            
        a = 0;
    }
    else
    {
        a = a-k;
    }

    cout<<a<<' '<<b;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

template<typename T>
struct Kruskal{
  struct edge{
    int from,to;
    T cost;
    int used;
    edge(int from,int to,T cost):
      from(from),to(to),cost(cost),used(0){}
    bool operator<(const edge& e) const{
      return cost<e.cost;
    }
  };
 
  int n;
  vector<int> r,p;
  vector<edge> es;
 
  Kruskal(){}
  Kruskal(int n):n(n),r(n,1),p(n){
    iota(p.begin(),p.end(),0);
  }
 
  int find(int x){ return (x==p[x]?x:p[x]=find(p[x])); }
 
  bool same(int x,int y){ return find(x)==find(y); }
 
  void unite(int x,int y){
    x=find(x);y=find(y);
    if(x==y) return;
    if(r[x]<r[y]) swap(x,y);
    r[x]+=r[y];
    p[y]=x;
  }
 
  void add_edge(int u,int v,T c){ es.emplace_back(u,v,c); }
 
  T build(){
    sort(es.begin(),es.end());
    T res=0;
    for(auto &e:es){
      if(!same(e.from,e.to)){
        res+=e.cost;
        unite(e.from,e.to);
        e.used=1;
      }
    }
    return res;
  }
};
 
vector<pair<P,ll>> edges;
vector<ll> a(mx);
ll n,d;

ll dist(int x,int y){ return d*abs(x-y)+a[x]+a[y]; }

void dfs(int l, int r){
  if(l+1>=r){ return; }
  ll mini=longinf, idx=-1;
  int m=(l+r)/2;
  for(int i=l; i<m; i++){ if(dist(i,m)<mini)mini=dist(i,m),idx=i; }
  for(int i=m; i<r; i++){ edges.push_back({{idx,i},dist(idx,i)}); }

  mini=longinf; idx=-1;
  for(int i=m; i<r; i++){ if(dist(i,l)<mini)mini=dist(i,l),idx=i; }
  for(int i=l; i<m; i++){ edges.push_back({{idx,i},dist(idx,i)}); }
  
  dfs(l,m);
  dfs(m,r);
}

int main(){
  cin >> n >> d;
  rep(i,n){ cin>>a[i]; }
  
  dfs(0,n);
  
  Kruskal<ll> ks(n);
  for(auto e:edges){
    int u=e.F.F,v=e.F.S; ll c=e.S;
    ks.add_edge(v,u,c);
  }
  ll ans=ks.build();
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 185176
// D - AtCoDeerくんと変なじゃんけん

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

int main() {
	string s;
	cin >> s;

	int ans = 0;

	for (int i=0; i<s.size(); i++) {
		if (i % 2 == 0) {
			if (s[i] == 'p') ans--;
		} else {
			if (s[i] == 'g') ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

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

#define MOD 1000000009

typedef long long int LLI;
typedef LLI Matrix[75][75];

int Case;
int w;
LLI h;
int n;

void Add(Matrix &A, Matrix &B, Matrix &C) {
  for (int i=0; i<w; i++) {
    for (int j=0; j<w; j++) {
      C[i][j] = (A[i][j]+B[i][j])%MOD;
    }
  }
}

void Mul(Matrix &A, Matrix &B, Matrix &C) {
  Matrix res;
  for (int i=0; i<w; i++) {
    for (int j=0; j<w; j++) {
      res[i][j] = 0;
      for (int k=0; k<w; k++) {
        res[i][j] = (res[i][j]+A[i][k]*B[k][j]%MOD)%MOD;
      }
    }
  }

  for (int i=0; i<w; i++) {
    for (int j=0; j<w; j++) {
      C[i][j] = res[i][j];
    }
  }
}

void Exp(Matrix &A, LLI k, Matrix &C) {
  Matrix mul;
  Matrix res;

  for (int i=0; i<w; i++) {
    for (int j=0; j<w; j++) {
      mul[i][j] = A[i][j];
      if (i == j) C[i][j] = 1;
      else C[i][j] = 0;
    }
  }

  LLI g = 0;
  while (k >> g) {
    if (k >> g & 1) {
      Mul(C, mul, C);
    }
    Mul(mul, mul, mul);
    g++;
  }
}

int main() {
  while (1) {
    scanf("%d%lld%d", &w, &h, &n);
    if ((w|h|n) == 0) return 0;

    map<LLI, set<int> > objs;
    for (int i=0; i<n; i++) {
      int x;
      LLI y;
      scanf("%d%lld", &x, &y);
      if (y == 1) continue;
      objs[y].insert(x);
    }
    objs[h].insert(0);

    Matrix Ans;
    Matrix Base;
    for (int i=0; i<w; i++) {
      for (int j=0; j<w; j++) {
        if (i == j) Ans[i][j] = 1;
        else Ans[i][j] = 0;
        if (i-1 <= j && j <= i+1) Base[i][j] = 1;
        else Base[i][j] = 0;
      }
    }
  
    LLI cury = 1;
    for (auto &itr : objs) {
      LLI t = itr.first;
      Matrix mul, one;

      if (t-1-cury > 0) {
        Exp(Base, t-1-cury, mul);
        Mul(Ans, mul, Ans);
      }

      for (int j=0; j<w; j++) {
        for (int k=0; k<w; k++) {
          if (itr.second.count(k+1)) one[j][k] = 0;
          else one[j][k] = Base[j][k];
        }
      }
      Mul(Ans, one, Ans);
      cury = t;
    }
  
    printf("Case %d: %lld\n", ++Case, Ans[0][w-1]);
  }
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	vector <ll> V(N);
	for (int ii = 0; ii < N; ++ii){
		cin >> V[ii];
	}

	vector <ll> C(N);
	for (int ii = 0; ii < N; ++ii){
		cin >> C[ii];
	}

	ll ans = 0;
	for (int ii = 0; ii < (1<<N); ++ii){
		int ref = ii;
		ll X = 0;
		ll Y = 0;
		for (int jj = 0; jj < N; ++jj){
			if (ref & 1){
				X += V[jj];
				Y += C[jj];
			}
			ref = ref >> 1;
		}
		ans = max(ans, X - Y);
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 3596
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) throws IOException{

		Scanner sc = new Scanner(new InputStreamReader(System.in));
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if((a==b+c)||(b==a+c)||(c==a+b)){
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 22228
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var n = cin.ReadInt;
            var temp = 0;
            var ans = 0;
            for (var i = 0; i < n; i++) {
                var h = cin.ReadInt;
                if (temp <= h) {
                    ans++;
                    temp = h;
                }
            }
            WriteLine(ans);


        }

        private double MultipleCeil(double value, double multiple) {return Math.Ceiling(value / multiple) * multiple;}

    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 13268
from collections import defaultdict

def main():
    num, k = map(int, input().split())
    data = defaultdict(int)
    for i in range(num):
        a, b = map(int, input().split())
        data[a] += b

    data = sorted(data.items(), key=lambda x: x[0])
    for aaa, count in data:
        k -= count
        if k <= 0:
            print(aaa)
            break

if __name__ == '__main__':
    main()


Measured memory_bytes: 54968
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
	string S;
	cin >> S;
	if (S == "Sunny") cout << "Cloudy" << endl;
	else if (S == "Cloudy") cout << "Rainy" << endl;
	else if (S == "Rainy") cout << "Sunny" << endl;
	return 0;
}

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

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];

	vector<int> numbers(100010, 0);

	for (int i = 0; i < N; i++) {
		numbers[A[i]]++;
	}

	int Q, B, C;
	long long S = 0;

	for (int i = 0; i < N; i++) S += A[i];

	cin >> Q;

	for (int i = 0; i < Q; i++) {
		cin >> B >> C;
		S += numbers[B] * (C - B);
		numbers[C] += numbers[B];
		numbers[B] = 0;
		cout << S << endl;
	}



	return 0;
}


Measured memory_bytes: 4000
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using boost::adaptors::reversed;
using boost::irange;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    ll N, K;
    cin >> N >> K;
    if (N % K == 0) cout << 0 << endl;
    else cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define mod 1000000007
using namespace std;

int n;
double dp[301][301][301];

double fun(int c1,int c2,int c3){
	if(c1==1 && c2==0 && c3==0)
		return n;

	double &ans = dp[c1][c2][c3];
	if(ans != -1)
		return dp[c1][c2][c3];

	ans = (double)n/(c1+c2+c3);
	// cout<<ans<<" ";
	if(c1>0){
		ans+=c1*fun(c1-1,c2,c3)/(c1+c2+c3);
	}
	if(c2>0){
		ans+=c2*fun(c1+1,c2-1,c3)/(c1+c2+c3);
	}
	if(c3>0){
		ans+=c3*fun(c1,c2+1,c3-1)/(c1+c2+c3);
	}
	// cout<<c1<<" "<<c2<<" "<<c3<<" "<<ans<<'\n';
	return ans;
}

int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);cout.tie(NULL);
	int x;
	cin>>n;
	for(int i=0;i<301;i++){
		for(int j=0;j<301;j++)
			for(int k=0;k<301;k++)
				dp[i][j][k] = -1;
	}

	int c1=0,c2=0,c3=0;
	for (int i = 0; i < n; ++i)
	{
		cin>>x;
		switch(x){
			case 1:c1++;break;
			case 2:c2++;break;
			case 3:c3++;break;
		}
	}
	// cout<<c1<<" "<<c2<<" "<<c3<<" "<<n;
	cout.precision(10);
	cout<<fixed<<fun(c1,c2,c3);


	// cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
	return 0;
}

Measured memory_bytes: 213376
n,a,b=map(int,input().split())
s=input()
c=0
c_b=0
for i in range(n):
    
    p=s[i]
    if p=='c':
        print('No')
    elif p=='a':
        if c<a+b:
            c+=1
            print('Yes')
        else:
            print('No')
    else:
        if c<a+b and c_b<b:
            c+=1
            c_b+=1
            print('Yes')
        else:
            print('No')


Measured memory_bytes: 9040
#include <bits/stdc++.h>
using namespace std;
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int64_t a, b, c;
    cin >> a >> b >> c;
    int64_t ans = -1;
    ans = min((a % 2) * b * c, min((b % 2) * c * a, (c % 2) * a * b));
    cout << ans << endl;
    return 0;
}

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


int main(){
  int A,B;
  cin >> A >> B;
  int ans=-1e9;
  ans = max(ans,A*B);
  ans = max(ans,A-B);
  ans = max(ans,A+B);
  cout << ans << endl;
}
      


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

using namespace std;

long long H, W;
long long S[3];

void solve() {
	long long ans = 10000000000, h1 = 0, h2 = 0, h3 = 0, w1 = 0, w2 = 0, w3 = 0;
	if ((H * W) % 3 == 0) {
		ans = 0;
	}
	else {
		for (long long i = 1; i <= W; i++) {
			w1 = i;
			w2 = W - w1;
			h1 = H / 2;
			h2 = H - h1;
			S[0] = w1 * H;
			S[1] = w2 * h1;
			S[2] = w2 * h2;
			sort(S, S + 3);
			if (ans < 0) {
				ans = 0;
			}
			ans = min(ans, S[2] - S[0]);
			
		}
		
		for (long long i = 1; i <= W; i++) {
			w1 = i;
			w2 = (W - w1) / 2;
			w3 = (W - w1) - w2;
			S[0] = w1 * H;
			S[1] = w2 * H;
			S[2] = w3 * H;
			sort(S , S + 3);
			ans = min(ans, S[2] - S[0]);
		}

		for(long long i = 1; i <= H; i++) {
			h1 = i;
			h2 = H - h1;
			w1 = W / 2;
			w2 = W - w1;
			S[0] = h1 * W;
			S[1] = h2 * w1;
			S[2] = h2 * w2;
			sort(S, S + 3);
			ans = min(ans, S[2] - S[0]);
		}
		for (long long i = 1; i <= H; i++) {
			h1 = i;
			h2 = (H - h1) / 2;
			h3 = (H - h1) - h2;
			S[0] = h1 * W;
			S[1] = h2 * W;
			S[2] = h3 * W;
			sort(S, S + 3);
			ans = min(ans, S[2] - S[0]);
		}
			
	}

	cout << ans << endl;
}

int main() {
	cin >> H >> W;

	solve();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()
typedef vector<int> vi;
const int INF = 1LL << 58;
const int MOD = 1000000007;
const int MAX_N = 200100;

signed main()
{
    //  以降 cin の入力元が 'input.txt' になる
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    int A, B;
    cin >> A >> B;

    int ans = 1;
    int ta, tb;
    while (true)
    {
        ta = ans * 8 / 100;
        tb = ans * 10 / 100;
        if (ta == A && tb == B)
        {
            cout << ans << endl;
            return 0;
        }
        if (tb - ta > 1 + (B - A))
        {
            cout << -1 << endl;
            return 0;
        }
        ans++;
    }

    return 0;
}

Measured memory_bytes: 256
x, y = map(int,input().split())
diff = abs(abs(x)-abs(y))
sgn = 0
if x == 0 or y == 0:
    if x > y:
        sgn += 1
elif x*y < 0:
    sgn += 1
elif x > y:
    sgn += 2

print(diff + sgn)

Measured memory_bytes: 3060
/* C++標準ヘッダファイル */
/* 文字列ライブラリ */
#include <string>

/* コンテナライブラリ */
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>

/* アルゴリズムライブラリ */
#include <algorithm>

/* 数値演算ライブラリ */
#include <cmath>
#include <math.h>

/* 入出力ライブラリ */
#include <iostream>

/* std使用<-namespace */
using namespace std;

/* define */
#define rpt(i, n) for(ll i = 0; i < (n); i++)  // リピート
#define PI (acos(-1))  // 円周率pi

/* typedef */
// long long
typedef long long ll;

// pair
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef pair<double, double> d_d;


/* main関数 */
int main(void) {
	int n, s[100000 + 1], r[100000 + 1];
	cin >> n;
	rpt(i, n) cin >> s[i];
	rpt(i, n) {
		r[s[i] - 1] = i + 1;
	}
	rpt(i, n) cout << r[i] << " ";
	cout << endl;

	return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define debug(x) cout << "debug: " << x << endl
#define MOD 1e9 + 7
#define INF 1e9

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

//const double pi = 3.1415926535;

int main(){
    int n, w;
    cin >> n >> w;
    int weight[n];
    int value[n];
    rep(i, n) cin >> weight[i] >> value[i];
    vector<vector<int>> dp(n + 1, vector<int>(100100, INF+1));
    dp[0][0] = 0;
    rep(i, n) {
        rep(j, 100100) {
            if (j - value[i] >= 0) 
                chmin(dp[i + 1][j], dp[i][j - value[i]] + weight[i]);
            chmin(dp[i + 1][j], dp[i][j]);
        }
    }
    //rep(i, n) cout << dp[n][i] << endl;
    ll res = 0;
    for (int i = 0; i<100100; i++){
        if (dp[n][i] <= w)
            res = i;
    }
    cout << res << endl;
}


Measured memory_bytes: 40320
#!/usr/bin/env python3
while True:
    n = int(input())
    if n == 0:
        break
    s = ['a' + input() for _ in range(n)]
    m = max(len(x) for x in s)
    for i in range(1, m + 1):
        dic = dict()
        for x in s:
            code = ''
            for j in range(len(x)):
                if len(code) == i:
                    break
                if j > 0 and x[j - 1] in ['a', 'i', 'u', 'e', 'o']:
                    code += x[j]
            if code in dic:
                break
            dic[code] = True
        else:
            print(i)
            break
    else:
        print(-1)




Measured memory_bytes: 5620
n = int(input())
s = []
while n != 0:
    rem = n%2
    if rem < 0:
        rem += 2
    
    n = (n-rem)//(-2)
    s.append(str(0+rem))

if len(s) == 0:
    print(0)
else:
    print(''.join(s[::-1]))



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

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

    vector<float> A(N);
    for(int i=0;i<N;i++){
        cin >> A.at(i);
    }


    float sum = 0.0f;

    for(int i=0;i<N;i++){
        sum += 1/(A.at(i));
    }

    float ans = 1/sum;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
x = int(input())

if x >= 400 and x <= 599:
    ans = 8
elif x >= 600 and x <= 799:
    ans = 7
elif x >= 800 and x <= 999:
    ans = 6
elif x >= 1000 and x <= 1199:
    ans = 5
elif x >= 1200 and x <= 1399:
    ans = 4
elif x >= 1400 and x <= 1599:
    ans = 3
elif x >= 1600 and x <= 1799:
    ans = 2
elif x >= 1800 and x <= 1999:
    ans = 1

print(ans)


Measured memory_bytes: 61904
#ifdef FAIRLY_LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <iostream>
#include <vector>
using namespace std;

typedef long long int ll;

const int MOD = 1e9 + 7;

ll pow_log2(ll a, ll b) {
    if (b == 0) {
        return 1ll;
    }

    ll t = pow_log2(a, b / 2);
    if (b % 2) {
        return ((t * t) % MOD * a) % MOD;
    }
    return (t * t) % MOD;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 2; i <= n; ++i) {
        res = (res * i) % MOD;
    }
    return res;
}

ll get_invert(ll a) { 
    return pow_log2(a, MOD - 2);
}

int main() {
#ifdef FAIRLY_LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int n, a, b;

    cin >> n >> a >> b;


    vector<ll> dp(b + 1, 1);
    for (int i = 1; i <= b; ++i) {
        dp[i] = ((dp[i - 1] * (n - i + 1)) % MOD * get_invert(i)) % MOD;
    }

    ll ans = (pow_log2(2, n) - dp[a] - dp[b] + 2 * MOD - 1) % MOD;

    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 1792
import java.util.*;

class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                String longest = ""; 
                String often = ""; 
                int max = 0;
                Hashtable<String, Integer> list = new Hashtable<String, Integer>();
                while(sc.hasNext()){
                        String s = sc.next();
                        longest = longest.length() < s.length() ? s : longest;
                        if(list.containsKey(s)){
                                list.put(s, list.get(s)+1);
                        }else{
                                list.put(s, 1); 
                        }   
                        if(max < list.get(s)){
                                max = list.get(s);
                                often = s;
                        }   
                }   
                sc.close();
                System.out.println(often+" "+longest);

        }   
}

Measured memory_bytes: 12000
s=input()
t=input()

a=len(s)
b=len(t)

dp=[ [0 for _ in range(a+1)] for _ in range(b+1)]

for j in range(1,b+1):
    for i in range(1,a+1):
        if s[i-1]==t[j-1]:
            dp[j][i]= dp[j-1][i-1]+1
        else:
            dp[j][i]= max(dp[j-1][i],dp[j][i-1])

#print(dp)

ans=""
x=a
y=b
while dp[y][x]!=0:
    if dp[y][x]==dp[y-1][x]:
        y -=1
    elif dp[y][x]==dp[y][x-1]:
        x -=1
    else:
        ans += s[x-1]
        y -=1
        x -=1
print(ans[::-1])

Measured memory_bytes: 119644
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#define LL long long
using namespace std;
LL n,a[55],la[55];
int main()
{
	scanf("%lld",&n);
	for(LL i=1;i<=n;i++) scanf("%lld",&a[i]);
	LL ans=0,cnt=0;
	bool flag=true;
	while(flag)
	{
		flag=false;
		LL k=cnt;cnt=0;
		for(int i=1;i<=n;i++)
		{
			a[i]+=k-la[i];
			LL tot=a[i]/n;a[i]%=n;
			la[i]=tot;ans+=tot;cnt+=tot;
			if(la[i]) flag=true;
		}
	}
	printf("%lld",ans);
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	/** 引き出しのできる数字 */
	private static final int[] NUMBERS = new int[] { 1, 6, 9 };

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			// dp[i]は金額iを引き出すのに必要な最小回数
			int[] dp = new int[n + 1];
			Arrays.fill(dp, Integer.MAX_VALUE);
			dp[0] = 0;
			IntStream.rangeClosed(1, n).forEach(i -> {
				for (int number : NUMBERS) {
					int current = number;
					while (i >= current) {
						dp[i] = Math.min(dp[i], dp[i - current] + 1);
						if (number > 1) {
							current *= number;
						} else {
							break;
						}
					}
				}
			});
			System.out.println(dp[n]);
		}
	}
}


Measured memory_bytes: 36416
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


ll s[5], k;
int main() {
	REP(i, 5)cin >> s[i];
	cin >> k;
	sort(s, s + 5);

		if (s[4] - s[0] > k) {
			cout << ":(" << endl;
			return 0;
		}
	cout << "Yay!" << endl;

}




Measured memory_bytes: 256
import javax.print.DocFlavor;
import java.awt.*;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        println(lcm(nextInt(), nextInt()));
    }

    static long lcm (long a, long b) {
        long temp;
        long c = a;
        c *= b;
        while((temp = a%b)!=0) {
            a = b;
            b = temp;
        }
        return (c/b);
    }

    static int nextInt() {
        return Integer.parseInt(next());
    }

    static Long nextLong() {
        return Long.parseLong(next());
    }

    static String next() {
        return sc.next();
    }

    static String nextLine(){
        return sc.nextLine();
    }

    static void println(Object o) {
        out.println(o);
        out.flush();
    }

    static void print(Object o) {
        PrintWriter out = new PrintWriter(System.out);
        out.print(o);
        out.flush();
    }
}


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

int main()
{
  map<string, int> m;
  m["AC"] = 0;
  m["WA"] = 0;
  m["TLE"] = 0;
  m["RE"] = 0;

  int N; cin >> N;
  string S;
  for (int n = 0; n < N; n++) {
    cin >> S;
    m[S] += 1;
  }

  cout << "AC x " << m["AC"] << endl;
  cout << "WA x " << m["WA"] << endl;
  cout << "TLE x " << m["TLE"] << endl;
  cout << "RE x " << m["RE"] << endl;

  return 0;
}


Measured memory_bytes: 3628
// ABC049 B - たてなが
#include <stdio.h>

int main(void) {
    int H, W;
    scanf("%d %d", &H, &W);
    char Pix[H][W + 1];
    int i = 0;
    for (i = 0; i < H; i++) {
        scanf("%s", &Pix[i][0]);
    }

    for (i = 0; i < H; i++) {
        printf("%s\n", Pix[i]);
        printf("%s\n", Pix[i]);
    }
    return 0;
}

Measured memory_bytes: 256
a = int(input())
R = [int(input()) for _ in range(a)]

minv = R[0]
#print("最小値の初期値",minv)
maxv = R[1]-R[0] 
#print("最大値の初期値",maxv)
for j in range(len(R)-1):
    maxv = max(maxv,R[j+1]-minv)
    minv = min(minv,R[j+1])
    #print(maxv)
print(maxv)


Measured memory_bytes: 13592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N;
const ll INF = 1e8;
const int max_n = 1e6;
ll memo[max_n];
ll rec(ll n){
  if(n == 0) return 0;
  if(memo[n] != -1) return memo[n];

  ll res = n;

  for(int pow6=1 ; pow6<=n ; pow6*=6){
    res = min(res, rec(n-pow6)+1);
  }
  for(int pow9=1 ; pow9<=n ; pow9*=9){
    res = min(res, rec(n-pow9)+1);
  }
  return memo[n] = res;
}

int main(){
  cin >> N;
  for(int i=0 ; i<=N ; i++)  memo[i] = -1;
  cout << rec(N) << endl;
  return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i <= (int)(n); i++)
const long long INF = 1LL << 60;
const double PI=3.14159265358979323846;
#define NIL -1

struct Node {int parent, left, right;};
struct Node T[30];

int preorder(int u){
    cout << " " << u;
    if(T[u].left != NIL)preorder(T[u].left);
    if(T[u].right != NIL)preorder(T[u].right);
}

int inorder(int u){
    if(T[u].left != NIL)inorder(T[u].left);
    cout << " " << u;
    if(T[u].right != NIL)inorder(T[u].right);
}

int postorder(int u){
    if(T[u].left != NIL)postorder(T[u].left);
    if(T[u].right != NIL)postorder(T[u].right);
    cout << " " << u;
}


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

    rep(i,n){
        T[i].parent = T[i].left = T[i].right = NIL;
    }

    rep(i,n){
        int id,l,r;
        cin >> id;
        cin >> l;
            T[id].left = l;
            T[l].parent = id;
        cin >> r;
            T[id].right = r;
            T[r].parent = id;
    }

    int r;
    rep(i,n){
        if(T[i].parent == NIL)r=i;
    }

    cout << "Preorder" << endl;
    preorder(r);
    cout << endl;
    cout << "Inorder" << endl;
    inorder(r);
    cout << endl;
    cout << "Postorder" << endl;
    postorder(r);
    cout << endl;
}


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

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in));
		int num = Integer.parseInt(br.readLine());
		int total = 0;
		for(int i = 0 ; i < num ; i++){
			String spl[] =  br.readLine().split(" ");
			int n = Integer.parseInt(spl[0]);
			n -= Integer.parseInt(spl[1]);
			n *= -1;
			total += ++n;
		}
		System.out.println(total);

	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
/////////////////////////////////////////////////////////////////////
int main()
{int k,a,b;
	cin>>k>>a>>b;

	if(b<k){
		cout<<"NG";
		return 0;
	}
	else 
	FOR(i,a,b)
	{
		if(i%k==0){
			cout<<"OK";
			return 0;
		}
	}
	cout<<"NG";
    return 0;
}

Measured memory_bytes: 3636
n, m = [int(i) for i in input().split(" ")]
sc = []
for i in range(m):
  sc.append([int(j) for j in input().split(" ")])

for i in range(10**(n-1) if n > 1 else 0, 10**(n), 1):
  f = True
  for con in sc:
    if str(i)[con[0]-1] != str(con[1]):
      f = False
  if f :
    print(i)
    break
else:
  print(-1)

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

int n, k, x, ans, cnt;
struct Node{
	int num, id;
}w[200010];

inline bool cmp(Node a, Node b){
	return a.num < b.num;
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> n >> k;
	for(int i = 1; i <= n; ++i){
		w[i].id = i;
	}
	for(int i = 1; i <= n; ++i){
		cin >> x;
		w[x].num++;
	}
	for(int i = 1; i <= n; ++i){
		if(w[i].num != 0) ++cnt;
	}
	if(cnt <= k){
		cout << "0" << endl;
		return 0;
	}
	sort(w + 1, w + n + 1, cmp);
	for(int i = 1; i <= n; ++i){
		if(w[i].num == 0) continue;
		ans += w[i].num;
		--cnt;
		if(cnt == k){
			cout << ans << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x,a,b;
  cin >> x >> a >> b;
  if(b <= a) {
    cout << "delicious" << endl;
  }else if(x >= b - a) {
    cout << "safe" << endl;
  }else {
    cout << "dangerous" << endl;
  }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LINF = 1e18;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

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

int lcm(int a, int b) { return a * b * gcd(a, b); }

bool compareP(pair<int, int> a, pair<int, int> b) {
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

int main() {
    int n;
    cin >> n;
    P a[n];
    rep(i, n) {
        a[i].first = i + 1;
        cin >> a[i].second;
    }
    sort(a, a + n, compareP);
    rep(i, n) {
        cout << a[i].first;
        if (i != n - 1)
            cout << " ";
    }
    cout << endl;
}

Measured memory_bytes: 1536
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main(){    
char search[21], word[21];    
int count=0;    
int i;        
scanf("%s", search);    
while(1){        
scanf(" %s", word);        
if(strcmp(word, "END_OF_TEXT")==0)break;        
for(i=0;word[i]!='\0';i++){            
word[i]=tolower(word[i]);        }        
if(strcmp(word, search)==0){            
count++;        }    }    
printf("%d\n", count);    
return 0;
}



Measured memory_bytes: 2048
s = int(input())
mod = 10**9 + 7

f = [0]*2001
g = [0]*2001

f[3]=1
f[4]=1
g[3]=1
g[4]=2

for i in range(4,s+1):
    f[i]=1 + g[i-3]
    f[i]%=mod
    g[i]=f[i] + g[i-1]
    g[i]%=mod
print(f[s])

Measured memory_bytes: 9100
n = int(input())
if n < 10:
    print(n)
elif n < 100:
    print(9)
elif n < 1000:
    print(n - 90)
elif n < 10000:
    print(909)
elif n < 100000:
    print(n - 9090)
else:
    print(90909)

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  int A,B,ans;
  cin>>A>>B;
  if(B/100==1) ans=A*1000+B;
  else if(B/10==0) ans=A*10+B;
  else ans=A*100+B;
  
  bool CAN=false;
  REP(i,350){
    if(ans==i*i) CAN=true;
  }
  
  if(CAN) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
int main(){
int N, s, t, A; long ans=0; cin >> N;
  
long P[10][10]={};
for(s=1; s<=9; s++){ for(t=1; t<=9; t++){
for(A=1; A<=N; A++){ if(A%10==t&&to_string(A)[0]==to_string(s)[0]){P[s][t]++;} }
}}
  
for(A=1; A<=N; A++){ 
s=(int)(to_string(A)[0]-'0'); t=A%10;
if(t!=0){ ans+=P[t][s]; }
}
cout << ans << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define pb push_back
void solve(){
    ll x;
    cin>>x;
    for(ll a=-1000;a<=1000;a++){
        for(ll b=-1000;b<=1000;b++){
            if(a*a*a*a*a - b*b*b*b*b == x){
            cout<<a<<" "<<b;return;}
        }
    }
}
int  main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t;
    //cin>>t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define mp make_pair
#define ff first
#define ss second
 
using namespace std;
using vi=vector<int>;
using pii=pair<int, int>;
using ull=unsigned long long;
using ll=long long;
int m[3][3];
bool ac[3][3];

bool verify()
{
	// row
	for (int i = 0; i < 3; i++)
		if (ac[i][0] == 1 && ac[i][1] == 1 && ac[i][2] == 1)
			return true;

	//column
	for (int i = 0; i < 3; i++)
		if (ac[0][i] == 1 && ac[1][i] == 1 && ac[2][i] == 1)
			return true;

	//diagonal
	if (ac[0][0] == 1 && ac[1][1] == 1 && ac[2][2] == 1)
		return true;

	if (ac[0][2] == 1 && ac[1][1] == 1 && ac[2][0] == 1)
		return true;

	return false;
}

void search(int n){
	for (int i = 0; i < 3; i++)
		for (int j = 0; j < 3; j++)
			if (m[i][j] == n)
				ac[i][j] = 1;
	
}
 
int main()
{
	for (int i = 0; i < 3; i++)
		for (int j = 0; j < 3; j++)
			cin >> m[i][j];

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

		search(num);

	}

	if (verify())
		cout << "Yes\n";
	else
		cout << "No\n";

}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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

signed main() {
  init();
  string N;
  cin >> N;

  rep(i, N.size()) {
    if (N[i] == '9') {
      N[i] = '1';
    } else if (N[i] == '1') {
      N[i] = '9';
    }
  }
  COUT(N);
  return 0;
}

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


def solve(K: int):
    s = 0
    for i in range(1, K + 1):
        for j in range(1, K + 1):
            g1 = gcd(i, j)
            for k in range(1, K + 1):
                g2 = gcd(g1, k)
                s += g2
    print(s)
    return


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
    # m = min(a, b)
    # g = 1
    # for i in range(1, m+1):
    #    if a % i == 0 and b % i == 0:
    #        g = i 
    # return g


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    solve(K)

if __name__ == '__main__':
    main()

Measured memory_bytes: 68076
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get_be(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
//get_be biger & equal
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

void solve(){
	 ll n,m,ans=0;
	 cin>>n>>m;
	 priority_queue<int> q;
	 vector<VI> job(m);//第i天做job刚好到第m天拿工资 
	 rep(i,0,n){
	 	int x,y;
	 	cin>>x>>y;
	 	if(x<=m){
	 		job[m-x].pb(y);
		 }
	 }
	 for(int i=m-1;i>=0;i--){
	 	for(int j=0;j<job[i].size();j++)q.push(job[i][j]);
	 	if(!q.empty()){
	 		ans+=q.top();
	 		q.pop();
		 }
	 }
	 cout<<ans;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}





Measured memory_bytes: 5632
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int N,M,C,B[30],r=0;
	cin>>N>>M>>C;
	for(int i=0;i<M;i++)
	{
		int b;
		cin>>b;
		B[i]=b;
	}
	for(int i=0;i<N;i++)
	{
		int t=C;
		for(int j=0;j<M;j++)
		{
			int a;
			cin>>a;
			t+=a*B[j];
		}
		if(t>0)r++;
	}
	cout<<r<<endl;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll N;
    cin >> N;
    vector<ll> a(N + 1);
    for (ll i = 1; i <= N; i++) {
        cin >> a[i];
    }

    vector<ll> ans;
    for (ll i = N; i > 0; i--) {
        if (a[i] % 2 == 1) {
            ans.push_back(i);
            for (ll j = 1; j * j <= i; j++) {
                if (i % j == 0) {
                    a[j]++;
                    if (j * j != i) {
                        a[i / j]++;
                    }
                }
            }
        }
    }

    cout << ans.size() << endl;
    for (ll i = 0; i < ans.size(); i++) {
        cout << ans[i] << " \n"[i == ans.size() - 1];
    }
}

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

main(){
  int a,b,k,i;
  cin >> a >> b >> k;
  for (i=1;i<=k;i++){
    if (i%2==1){
      if (a%2==1) a-=1;
      a/=2;
      b+=a;
    }
    else {
      if (b%2==1) b-=1;
      b/=2;
      a+=b;
    }
  }
  cout << a << " " << b << endl;
}


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

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

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

	int N; cin >> N;

	if(N == 1) cout << "Hello World" << endl;
	else {
		int A, B; cin >> A >> B; 
		cout << A+B << endl;
	}

	return 0;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x) x.begin(), x.end()
#define rep(i, s, n)      for(int i(s); i < int(n); ++i)
#define endl '\n'
#ifndef YDK
#define eprintf(...)
#endif
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr const int INF  = 0x3f3f3f3f;
constexpr const i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr const int MOD  = int(1e9) + 7;
// }}}

// Library {{{

// }}}


signed main()
{
    int N, A, B;
    cin >> N >> A >> B;

    cout << min(N*A, B) << endl;
    return 0;
}


Measured memory_bytes: 256