akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
//#define MOD (ll)(998244353)
#define MOD (ll)(1e9+7)
#define INF (1e17)
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
int fpow(int b,int p){
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int dp[3050][3050][2];
//  dp[dish][time][choose?]

int32_t main() {
#ifdef LOCAL_TEST
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\input.in","r",stdin);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\output.out","w",stdout);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);

	//code...
	int n; cin>>n; cout<<n*n<<"\n";
	return 0;
}

Measured memory_bytes: 256
import collections

n, w = map(int, input().split())
ls = [list(map(int, input().split())) for _ in range(n)]

dp = [collections.defaultdict(lambda: 0) for _ in range(n + 1)]
dp[0][0] = 0
for i, (w0, v0) in enumerate(ls):
    for w1, v1 in dp[i].items():
        if w1 <= w:
            dp[i + 1][w1] = max(dp[i + 1][w1], v1)
        if w0 + w1 <= w:
            if w0 + w1 in dp[i].keys():
                dp[i + 1][w0 + w1] = max(dp[i + 1][w0 + w1], dp[i][w0 + w1],
                                         v0 + v1)
            else:
                dp[i + 1][w0 + w1] = v0 + v1
print(max(dp[n].values()))

Measured memory_bytes: 12328
#include<stdio.h>
int main(){
  int a,b,g=0;
  scanf("%d %d",&a,&b);
  for(int i=a; i<=b; i++){
    int c,d,e,f,h=i;
    c=h/10000;d=h%10;
    h%=10000;h/=10;
    e=h/100;f=h%10;
    if(c==d&&e==f){g++;}
  }
  printf("%d",g);
  return 0;}


Measured memory_bytes: 128
//#pragma GCC optimize(2)
//南京市第三区OI委提醒您：
//代码千万条，-O2第一条。
//-O2不规范，超时两行泪。
// Happy TLE and WA every day!
// by: zxb
#include<bits/stdc++.h>
#define mp              make_pair
#define rep(i,n)        for(int i = 0; i < n; i++)
#define foreach(i,c)    for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define BINF            0x7fffffff
#define INF             0x3f3f3f3f
#define LINF            4557430888798830399
#define pb              push_back
#define F               first
#define S               second
#define Time            clock()/CLOCKS_PER_SEC
#define read            ZXBs_fast_input
#define write           ZXBs_fast_output
//#define usingFiles
using namespace std;

typedef unsigned int ui;
typedef pair<int, int> pii;
typedef long long ll;

inline bool read(int& x){
	x = 0;
	int c;
	int sign = 1;
	while( (c = getchar()) < '0' || c > '9' ) if(c == '-') sign = -1;
	x = c ^ '0';
	while( (c = getchar()) >= '0' && c <= '9' ) x = (x<<3) + (x<<1) + (c ^ '0');
	x *= sign;
	return 1;
}

inline bool write(int x){
	if(x >= 10) write(x / 10);
	putchar(x % 10 + '0');
	return 1;
}

const int rp = 666666;
const bool debug = 1;
const bool I_good_vegetable_a = 1;

string s;
int n;

signed main(){
	ios::sync_with_stdio(false);
	#ifdef usingFiles
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	cin >> s;
	n = s.size();
	ll ans = 0;
	for(int i = 0; i < (1 << (n - 1)); i++){
		ll num = s[0] - '0';
		for(int j = 0; j < n-1; j++){
			if(i & (1 << j)){
//				cout << num << endl;
				ans += num;
				num = 0;
			}
			num = num * 10 + s[j+1] - '0';
		}
		ans += num;
	}
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int N;
cin >> N;
vector<int> vec(N);
for (int i = 0;i < N;i++) cin >> vec.at(i);

sort(vec.begin(),vec.end());
cout << vec.at(N-1) - vec.at(0) << endl;



return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n,c;
  while(cin>>n,n){
    int a[n+1][n+1];
    rep(i,n){c=0;rep(j,n){
        cin>>a[i][j];
        c+=a[i][j];
      }
      a[i][n]=c;
    }
    rep(j,n+1){c=0;rep(i,n){
      c+=a[i][j];
    }
    a[n][j]=c;
  }
  rep(i,n+1){rep(j,n+1){printf("%5d",a[i][j]);}cout<<endl;}
  }
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int N, K;
int a[5010];

bool dp[5010]; //dp[j]合計がjの時があるなら1
bool solve(int idx){
	rep(j, 5010) dp[j] = 0;
	dp[0] = 1;
	rep(i, N)REP(j, K + 1){
		if(dp[j] == 0) continue;
		if(i == idx) continue;
		if(j + a[i] > K) continue;
		dp[j + a[i]] = 1;
	}
	reps(i, max(0, K - a[idx]), K){
		if(dp[i]) return true;
	}
	return false;
}

int main(void){
	cin >> N >> K;
	rep(i, N) cin >> a[i];
	sort(a, a + N);
	int l = -1, r = N;
	while(r - l > 1){ //[l, r)
		int m = (l + r) / 2;
		if(!solve(m)) l = m;
		else r = m;
	}
	printf("%d\n", l + 1);
	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++)
#define intt int64_t
#define all(vec) vec.begin(), vec.end()

int main() {
    int m, d;
    scanf("%d %d", &m, &d);
    int ans=0 ;
    rep(i,m) {
        rep(j,d) {
            int D=j+1, M=i+1;
            if (D/10 >= 2 && D%10 >= 2) {
                if (D/10*(D%10) == M) ans++;
            }
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 768
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class A_161_ABCSwap
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列配列の入力
            string[] inputStrArray = Console.ReadLine().Split(' ');

            string[] outputStrArray = new string[3];

            outputStrArray[0] = inputStrArray[2];
            outputStrArray[1] = inputStrArray[0];
            outputStrArray[2] = inputStrArray[1];



            Console.WriteLine(string.Join(" ", outputStrArray));

            Console.Out.Flush();
        }
    }
}


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

int n;
int a[200000];
int cnt[1000001];
bool ng[1000001];

int main() {
	int i, j;
	
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		cnt[a[i]]++;
	}
	
	for (i = 1; i <= 1000000; i++) {
		if (cnt[i] > 0) {
			for (j = i * 2; j <= 1000000; j += i) {
				ng[j] = true;
			}
		}
	}
	
	int ans = 0;
	for (i = 1; i <= 1000000; i++) {
		if (cnt[i] == 1 && !ng[i]) {
			ans++;
		}
	} 
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 9256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) \
  SORT(var);       \
  REVERSE(var)
#define OPTIMIZE_STDIO         \
  ios::sync_with_stdio(false); \
  cin.tie(0);                  \
  cout.precision(10);          \
  cout << fixed
#define endl '\n'

const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
struct mint {
  ll x;
  mint() : x(0) {
  }
  mint(ll x) : x((x % MOD + MOD) % MOD) {
  }
  mint& operator+=(const mint& r) {
    if ((x += r.x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint& operator-=(const mint& r) {
    if ((x -= r.x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint& operator*=(const mint& r) {
    if ((x *= r.x) > MOD) {
      x %= MOD;
    }
    return *this;
  }
  mint& operator++() {
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint operator++(int) {
    mint ret = x;
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return ret;
  }
  mint& operator--() {
    if ((--x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint operator--(int) {
    mint ret = x;
    if ((--x) < 0) {
      x += MOD;
    }
    return ret;
  }
  mint operator+(const mint& r) {
    mint ret;
    return ret = x + r.x;
  }
  mint operator-(const mint& r) {
    mint ret;
    return ret = x - r.x;
  }
  mint operator*(const mint& r) {
    mint ret;
    return ret = x * r.x;
  }
  mint operator-() {
    return mint() - *this;
  }
  bool operator<(const mint& a) {
    return x < a.x;
  }
  bool operator>(const mint& a) {
    return x > a.x;
  }
  bool operator<=(const mint& a) {
    return x <= a.x;
  }
  bool operator>=(const mint& a) {
    return x >= a.x;
  }
  bool operator==(const mint& a) {
    return x == a.x;
  }
  bool operator!=(const mint& a) {
    return x != a.x;
  }
};
ostream& operator<<(ostream& os, const mint& r) {
  os << r.x;
  return os;
}
ostream& operator>>(ostream& os, const mint& r) {
  os >> r.x;
  return os;
}

int n, m, q;
vector<int> a, b, c, d;
int ans;

void dfs(vector<int> buf) {
  if (buf.size() == n + 1) {
    int now = 0;
    REP(i, q) {
      if ((buf[b[i]] - buf[a[i]]) == c[i]) now += d[i];
    }
    ans = max(ans, now);
    return;
  }

  buf.push_back(buf.back());
  while (buf.back() <= m) {
    dfs(buf);
    buf.back()++;
  }
}

void solve(istream& cin, ostream& cout) {
  cin >> n >> m >> q;
  a = b = c = d = vector<int>(q);
  REP(i, q) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  dfs(vector<int>(1, 1));
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE cout << -1 << endl;return 0
#define MM <<" "<<
#define Endl endl


signed main(void){
    int N,K;
    int d[114][514]={};
    cin >> N >> K;
    if(K > (N-1)*(N-2)/2){
        cout << "-1" << endl;
        return 0;
    }
    int L=(N-1)*(N-2)/2;
    REP(i,N-1){
        d[0][i+1]=1;
    }
    K=L-K;
    //cout << K << endl;
    
    REP(j,N){
        REP(i,j){
            if(K<=0)break;
            if(i==0)continue;
            d[i][j]=1;
            K--;
        }
    }
    int M=0;
    REP(j,N){
        REP(i,j){
            if(d[i][j]==1){
                M++;
            }
        }
    }
    cout << M << endl;
    REP(j,N){
        REP(i,j){
            if(d[i][j]==1){
                cout << i+1 MM j+1 MM endl;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const int MOD = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//cin.tie(0);ios::sync_with_stdio(false);
//cout << fixed << setprecision(15) << y << endl;
int main() {
  int k;
  cin >> k;

  int even = (k / 2);
  int odd = k - even;

  cout << even * odd << endl;
  return 0;
}


Measured memory_bytes: 3628
n = gets.to_i

results = n.times.map do
  x, u = gets.split
  case u
  when 'JPY'
    x.to_f
  when 'BTC'
    x.to_f * 380_000.0 * 10_000.0 / 10_000.0
  end
end
puts results.reduce(:+)


Measured memory_bytes: 1788
#![allow(non_snake_case)]
use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let mut N: usize = read();
    let K: usize = read();
    let mut ans = 0;
    while N > 0 {
        ans += 1;
        N /= K;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
#include <limits>
#include <cmath>
#include <numeric>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;

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

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

int main() {
	double W, H, X, Y;
	cin >> W >> H >> X >> Y;
	double area = W * H;
	printf("%.9f", area / 2);
	if (X == W / 2 && Y == H / 2) {
		cout << " " << 1 << endl;
	}
	else {
		cout << " " << 0 << endl;
	}
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int H, W, D, Q;
int A[300][300];
int X[300*300], Y[300*300];
int cost[300*300];
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> H >> W >> D;
  rep(y, H) rep(x, W) cin >> A[x][y], A[x][y]--, X[A[x][y]]=x,Y[A[x][y]]=y;
  rep(k, D) {
    int s = 0;
    for (int i=k; i<W*H; i+=D) {
      cost[i]=s;
      if (i+D<W*H) s+=abs(X[i+D]-X[i])+abs(Y[i+D]-Y[i]);
    }
  }
  cin>>Q;
  rep(i, Q) {
    int l, r;
    cin >> l >> r;
    l--, r--;
    cout << cost[r]-cost[l] << "\n";
  }
  return 0;
}


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

unsigned long long Lucas(int num, vector<unsigned long long> &memo){
  if(memo.at(num) != -1){
    return memo.at(num);
  }
  memo.at(num) = Lucas(num - 1, memo) + Lucas(num - 2, memo);
  return memo.at(num);
}

int main(){
  int n;
  cin >> n;
  vector<unsigned long long> memo(n + 1,-1);
  memo.at(0) = 2;
  memo.at(1) = 1;
  cout << Lucas(n, memo) << endl;
}

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

#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...) void()
#endif

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> beg, end;
  for (int i = 0, a; i < n; i++) {
    cin >> a;
    if (i % 2 == 0) {
      beg.emplace_back(a);
    } else {
      end.emplace_back(a);
    }
  }
  vector<int> ans;
  for (int i = (int)beg.size() - 1; ~i; i--) {
    ans.emplace_back(beg[i]);
  }
  for (int i = 0; i < (int)end.size(); i++) {
    ans.emplace_back(end[i]);
  }
  if (n % 2 == 0) reverse(ans.begin(), ans.end());
  cout << ans[0];
  for (int i = 1; i < n; i++) {
    cout << ' ' << ans[i];
  }
  cout << '\n';
  return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:
// Description: 素集合を管理するデータ構造 
// TimeComplexity: 初期化$\mathcal{O}(n)$ 更新$\mathcal{O}(\log n)$
// Verifyed: AOJ DSL_1_A

struct Union_find{
	Union_find(int n){par.resize(n),iota(_all(par),0);}
	int find(int x){return (par[x]==x)?x:par[x]=find(par[x]);}
	void unite(int a,int b){a=find(a),b=find(b);par[a]=b;}
	bool same(int a,int b){return find(a)==find(b);}
	vector<int> par;
};

vector<int> lang[100010];

int main(void){
	int n,m;
	cin >> n >> m;

	Union_find uf(n);
	rep(i,n){
		int k;
		cin >> k;
		rep(j,k){
			int in;
			cin >> in,in--;
			lang[in].push_back(i);
		}
	}

	rep(i,m){
		if(lang[i].empty()) continue;
		int lead=lang[i][0];
		for(auto &it:lang[i]) uf.unite(lead,it);
	}

	bool ok=true;
	rep(i,n) if(uf.same(0,i)==false) ok=false;

	if(ok)
		puts("YES");
	else
		puts("NO");
	return 0;
}

Measured memory_bytes: 4860
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 62;

int main() {
  //
  ll k;
  cin >> k;
  ll n = 50;
  vl a(n);
  ll d = k / n;
  ll r = k % n;
  rep(i, n) a[i] = i + d;
  rep(i, r) {
    a[i] += n;
    rep(j, n) {
      if (j == i) continue;
      a[j] -= 1;
    }
  }
  cout << n << endl;
  rep(i, n) { cout << a[i] << endl; }
  return 0;
}


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

    }
    cout<<"NO"<<endl;
    return 0;


}

Measured memory_bytes: 3608
#include <math.h>
#include <iostream>
#include<string>
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>
#include <stdlib.h>
using namespace std;

int main()
{
int N;cin >> N;
string S,T;cin >> S >> T;
for(int i=0;i<N;i++){cout << S.at(i) << T.at(i);}
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
cnta=0
cntb=0
li=[i for i in range(1,n+1)]
import itertools
k=0
for i in itertools.permutations(li):
    if list(i)==a:
        cnta=k
    if list(i)==b:
        cntb=k
    k+=1
print(abs(cnta-cntb))

Measured memory_bytes: 9140
#include "bits/stdc++.h"
using namespace std;
const int maxn=5010;
long long n,a[2][3],dp[maxn*maxn],cost[maxn],ben[maxn];
int main()
{
	cin>>n;
	for(int j=0;j<3;j++)
	{
		cin>>a[0][j];
	}
	for(int i=0;i<3;i++)
	{
		cin>>a[1][i];
		ben[i]=abs(a[0][i]-a[1][i]);
		cost[i]=min(a[0][i],a[1][i]);
//		cout<<cost[i]<<" ";
	}
//	cout<<endl;
	for(int i=1;i<=n;i++)
	{
		dp[i]=max(0LL,dp[i-1]);
		for(int j=0;j<3;j++)
		{
			if(i-cost[j]>=0&&a[0][j]<a[1][j])
			{
				dp[i]=max(dp[i],dp[i-cost[j]]+ben[j]);
			}
		}
	}
	n+=dp[n];
	memset(dp,0,sizeof dp);
	for(int i=1;i<=n;i++)
	{
		dp[i]=max(0LL,dp[i-1]);
		for(int j=0;j<3;j++)
		{
			if(i-cost[j]>=0&&a[0][j]>a[1][j])
			{
				dp[i]=max(dp[i],dp[i-cost[j]]+ben[j]);
			}
		}
	}
	n+=dp[n];
	cout<<n<<endl;
	return 0;
}
/*
5000
9 7 11
11 8 13
Output:6110

5000
14 16 18
13 14 17

*/

Measured memory_bytes: 196352
<?php
fscanf(STDIN, "%d", $n);
$s = fgets(STDIN);
if($n % 2 === 1) {
    echo "No";
} else if($n % 2 === 0) {
    $error = 0;
    for($i = 0; $i < $n/2; $i++) {
        if($s[$i] !== $s[$i + $n/2]) {
            $error = 1;
        }
    }
}
if($error === 1) {
    echo "No";
} else if($error === 0) {
    echo "Yes";
}

Measured memory_bytes: 4728
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

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

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class AAtCoderGroupContest {
public:
    void solve(std::istream &in, std::ostream &out) {
        int n;
        in >> n;
        vi A(3 * n);
        in >> A;
        sort(all(A));
        ll res = 0;
        for (int i = n; i < 3 * n; i += 2) {
            res += A[i];
        }
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    AAtCoderGroupContest solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


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

int main(){
    int n,b,f,r,v;
    cin >> n;
    int resident[4][3][10]={0};
    for(int i=0; i<n; i++){
        cin >> b >> f >> r >> v;
        resident[b-1][f-1][r-1]+=v;
    }
    for(int i=0; i<4; i++){
        for(int j=0; j<3; j++){
            for(int k=0; k<10; k++){
                cout<< " " << resident[i][j][k];
            }
            cout << endl;
        }
        if(i<3){
            cout<< "####################" << endl;
        }
    }
}



Measured memory_bytes: 3116
while True:
    n,r = map(int,input().split())
    if n==r==0: break
    l = list(range(n,0,-1))
    for _ in range(r):
        p,c = map(int,input().split())
        l = l[p-1:p+c-1]+l[:p-1]+l[p+c-1:]
    print(l[0])

Measured memory_bytes: 7536
//https://atcoder.jp/contests/abc119/tasks/abc119_b
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int N;
    cin >> N;
    double result{};
    for(int i = 0; i < N; ++i){
        double a;
        string u;
        cin >> a >> u;
        u == "BTC" ? result += 380000.0*a : result += a;
    }
    cout << fixed << setprecision(8) << result << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
      	int kotae = 0;
      	if(a%2==0){
        	kotae = (a/2)-1;
        }else{
        	kotae = (a/2);
        }
      System.out.println(kotae);
	}
}

Measured memory_bytes: 23764
A, B, C = [input() for _ in range(3)]
turn = 'a'
while True:
    if turn == 'a':
        if not A:
            print('A')
            break
        else:
            turn = A[0]
            A = A[1:]
    elif turn == 'b':
        if not B:
            print('B')
            break
        else:
            turn = B[0]
            B = B[1:]
    elif turn == 'c':
        if not C:
            print('C')
            break
        else:
            turn = C[0]
            C = C[1:]


Measured memory_bytes: 3064
if !ENV['RUBY_THREAD_VM_STACK_SIZE']
    #Rubyパスを取得するには、rbconfigかrubygemsを使う。AtCoderでは--disable-gemsされているので、require 'rubygems'は必須である。
    #require 'rbconfig';RUBY=File.join(RbConfig::CONFIG['bindir'],RbConfig::CONFIG['ruby_install_name'])
    require 'rubygems';RUBY=Gem.ruby
    exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},RUBY,$0) #100MB
end

count = 0
$n = 0
$m = 0
coin_str = ""
STDIN.each_line {|line|
  if count == 0
    count = 1
    n_m = line.split " "
    $n = n_m[0].to_i
    $m = n_m[1].to_i
  end

  coin_str = line
}

$coin_list = coin_str.split " "
$coin_list.map! {|item| item.to_i }
# $coin_list.sort! {|a, b| b <=> a }

$coin_count_map = {}
for index in 1..$n
  $coin_count_map[index] = $n + 1
end

$coin_count_map[0] = 0
def solve i
    if i == $m
      return $coin_count_map[$n]
    end

    # if n == 0
    #   return $coin_count_map[0]
    # end

    now_coin = $coin_list[i]
    for price in now_coin..$n
      $coin_count_map[price] = [$coin_count_map[price], $coin_count_map[price - now_coin] + 1].min
    end
    # tmp = n - coin
    # solve i + 1

  return solve i + 1
end

puts solve 0


Measured memory_bytes: 9132
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>  
using namespace std;
using namespace __gnu_pbds;

#define int long long int
#define float long double
#define pb push_back
#define fi first
#define se second
#define vii vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define pq priority_queue<int>
#define test int tcase; cin>>tcase; for(int tc = 1; tc <= tcase; tc++)
#define inp(a,n,f) int a[n+f];for(int hh=f;hh<n+f;hh++)cin>>a[hh];
#define prdec(k) cout<<fixed<<setprecision(k);
#define mem(a,k) memset(a,k,sizeof(a))
#define ub upper_bound
#define lb lower_bound
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mii map<int,int>
#define all(v) v.begin(),v.end()
#define mod (int)(1e9+7)
#define inf LLONG_MAX
int exp(int x,int y){int res=1;x=x%mod;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
int modinv(int x){return exp(x,mod-2);}


signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n,x,m,idx=-1,res=-1,idx2=-1,ans=0,sum=0;
	cin>>n>>x>>m;
	vector<int> v;
	set<int> s;
	s.insert(x);
	v.pb(x);
	for(int i=2;i<=n;i++)
	{
		int val=(x*x)%m;
		if(s.count(val)>0)
		{
			res=val;
			idx=i;
			break;
		}
		s.insert(val);
		v.pb(val);
		x=val;
	}
	if(idx==-1)
	{
		for(int x:v)
			ans+=x;
		cout<<ans;
		return 0;
	}
	for(int i=0;i<idx;i++)
	{
		if(v[i]==res)
		{
			idx2=i;
			break;
		}
	}
	for(int i=0;i<idx2;i++)
		ans+=v[i];
	n-=idx2;
	int k=(int)v.size() - idx2;
	for(int i=idx2;i<idx;i++)
		sum+=v[i];
	ans+=(n/k)*sum;
	for(int i=idx2;i<idx2+(n%k);i++)
		ans+=v[i];
	cout<<ans;
	return 0;
}

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

int main() {
	int a,b,n;
	while(1){
		cin>>n;
		if(n==0)break;
		int Pa=0,Pb=0;
		for(int i=0;i<n;i++){
			cin >>a>>b;
			if(a>b)Pa+=a+b;
			else if(a<b)Pb+=a+b;
			else{Pa+=a;Pb+=b;}
		}
		
		cout<<Pa<<" "<<Pb<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 cin.tie(0);
 ios::sync_with_stdio(false);
 int x,y;
 cin>>x>>y;
 if (x>y){
     cout<<"safe";
 }
 else{
     cout<<"unsafe";
     }
}   

Measured memory_bytes: 3640
#include <iostream>
using namespace std;
typedef long long ll;
#define MAX 50004
int dp[MAX], d[MAX];

int main(){
	int n, m = 0;
	static bool c[MAX]={true, true};
	for(ll i = 2;i < MAX;i++){
		if(!c[i]){
			for(ll j = 2;i*j < MAX;j++)c[i*j] = true;
			d[m] = i;m++;
		}
	}
	int f = 1;
	//for(int i = 2990;i < 3000;i++)cout << d[i] << " ";
	for(int i = 0;i < 3000;i++){
		for(int j = i;d[i]+d[j] < MAX-3;j++){
			int dd = d[i] + d[j];
			dp[dd]++;
			//if(d[i] + d[j] == 2)cout << "fuck";
		}
	}
	//for(int i = 0;i < 30;i++)cout << dp[i] << " ";
	
	while(cin >> n, n){
		cout << dp[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 3284
#
# agc010 a
#

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3
1 2 3"""
        output = """YES"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """5
1 2 3 4 5"""
        output = """NO"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    A = list(map(int, input().split()))

    e = 0
    o = 0
    for a in A:
        if a % 2 == 0:
            e += 1
        else:
            o += 1

    if o % 2 == 0:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 27480
#include <stdio.h>
int main(void) {
    int h = 0,m = 0,s = 0;
    int Sec;
    
    scanf("%d",&Sec);
    
    h = Sec / 3600;
    m = (Sec - h * 3600) / 60;
    s = Sec % 60;
    
    printf("%d:%d:%d\n",h,m,s);
    
    return 0;
}

Measured memory_bytes: 592
#! /usr/bin/env python
# -*- coding: utf-8 -*-

P = [0]*(123456*2+1)# for i in range(123456*2+1):
for i in range(2, 123456*2+1):
    if P[i]==0:
        j = i
        for j in range(i+i, 123456*2+1, i):
            P[j] = 1

n = int(raw_input())
while n!=0:
    cnt = 0
    for i in range(n+1, 2*n+1):
        if P[i] == 0:
            cnt += 1
    print cnt

    n = int(raw_input())

Measured memory_bytes: 17660
from math import gcd
n = int(input())
A = list(map(int, input().split()))

# 以降のGCD
left_gcds = [A[0]]
for a in A[1:]:
    left_gcds.append(gcd(left_gcds[-1], a))

right_gcds = [A[-1]]
for a in A[:n-1][::-1]:
    right_gcds.append(gcd(right_gcds[-1], a))
right_gcds.reverse()

ans = 0
for i in range(n):
    if i == 0:
        tmp = right_gcds[i+1]
    elif i == n-1:
        tmp =left_gcds[i-1]
    else:
        tmp = gcd(left_gcds[i-1], right_gcds[i+1])
    ans = max(ans, tmp)
print(ans)


Measured memory_bytes: 99544
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni();
        char[] s = in.ns().toCharArray();
        int[] Wl = new int[n];
        int[] Rr = new int[n];
        Wl[0] = (s[0]=='W')?1:0;
        for (int i = 1; i < n; i++) {
            Wl[i] = Wl[i-1];
            if(s[i]=='W') Wl[i] += 1;
        }
        Rr[n-1] = (s[n-1]=='R')?1:0;
        for (int i = n-2; i >= 0; i--) {
            Rr[i] = Rr[i+1];
            if(s[i]=='R') Rr[i] += 1;
        }
        int ans = Math.min(Wl[n-1], Rr[0]);
        for (int i = 0; i < n-1; i++) {
            ans = Math.min(ans, Math.max(Wl[i], Rr[i + 1]));
        }
        out.println(ans);
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 38516
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
 
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll a;
    cin>>a;
    cout<<999-(a-1)%1000;
}

Measured memory_bytes: 3684
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int[][] red = new int[N][2];
    int[][] blue = new int[N][2];
    for (int i = 0; i < N; i++) {
      red[i][0] = scanner.nextInt();
      red[i][1] = scanner.nextInt();
    }
    for (int i = 0; i < N; i++) {
      blue[i][0] = scanner.nextInt();
      blue[i][1] = scanner.nextInt();
    }

    List<Edge>[] graph = new List[N * 2 + 2];
    for (int i = 0; i < N * 2 + 2; i++) graph[i] = new ArrayList<>();
    for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) if (red[i][0] < blue[j][0] && red[i][1] < blue[j][1]) addEdge(graph, i + 1, j + N + 1, 1);
    for (int i = 1; i <= N; i++) addEdge(graph, 0, i, 1);
    for (int i = 1; i <= N; i++) addEdge(graph, i + N, N * 2 + 1, 1);
    System.out.println(fordFulkerson(graph, N * 2 + 2));
  }

  private static void addEdge(List<Edge>[] graph, int from, int to, int cap) {
    Edge e1 = new Edge(cap, to);
    Edge e2 = new Edge(0, from);
    e1.rev = e2;
    e2.rev = e1;
    graph[from].add(e1);
    graph[to].add(e2);
  }

  private static int fordFulkerson(List<Edge>[] graph, int N) {
    int flow = 0;
    while (true) {
      boolean[] visited = new boolean[N];
      int d = dfs(graph, visited, 0, N - 1, N);
      if (d == 0) break;
      flow += d;
    }
    return flow;
  }

  private static int dfs(List<Edge>[] graph, boolean[] visited, int s, int t, int f) {
    if (s == t) return f;
    visited[s] = true;
    for (Edge e : graph[s]) {
      if (e.cap > 0 && !visited[e.to]) {
        int d = dfs(graph, visited, e.to, t, Math.min(e.cap, f));
        e.cap -= d;
        e.rev.cap += d;
        if (d > 0) return d;
      }
    }
    return 0;
  }

  private static class Edge {
    private int cap;
    private final int to;
    private Edge rev;

    private Edge(int cap, int to) {
      this.cap = cap;
      this.to = to;
    }
  }
}


Measured memory_bytes: 24020
#include <iostream>

using namespace std;
typedef long long llong;

void solve_test()
{
	int a, b;
	cin >> a >> b;

	for (int ans = 1; ans <= 2000; ans++)
	{
		int first = int(0.08 * ans);
		int second = int(0.1 * ans);
		if (first == a && second == b)
		{
			cout << ans << "\n";
			return;
		}
	}
	cout << "-1\n";
}

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

	int tests = 1;
	//cin >> tests;
	while (tests--)
		solve_test();

	return 0;
}


Measured memory_bytes: 3668
import sys
import heapq


# \n
def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    def diff(s,cc):
        count = 0
        for i in range(N):
            if A[i] == B[(i + s) % N]:
                count += 1
                if count>cc:
                    return cc+1
        if count == 0:
            print("Yes")
            L = []
            for i in range(N):
                L.append(B[(i + s) % N])
            print(*L)
            exit()

        return count
    n = N // 3
    l = 0
    r = N - 1
    diff(l,N)
    diff(r,N)

    while r - l > 2:
        m1 = l + (r - l) // 3
        m2 = l + 2 * (r - l) // 3
        a = diff(m1,N)
        b = diff(m2,a+1)
        if a > b:
            l = m1
        else:
            r = m2
    diff((l + r) // 2,N)

    print("No")


if __name__ == "__main__":
    main()


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

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(t, c) for (auto&& t : c)
#define ALL(c) begin(c), end(c)
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl '\n'
#define fk first
#define sv second

const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1}, dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int value[] = {6000, 4000, 3000, 2000};

  int t, n;
  REP(i, 4) {
    cin >> t >> n;
    cout << value[t - 1] * n << endl;
  }
}

Measured memory_bytes: 3188
//=template==================================================================//
// include
#include <vector>
#include <list>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>

// namespace
using namespace std;

// define
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(i,n) FOR(i,0,n)
#define MIN_V(v) *min_element(v.begin(), v.end())
#define MAX_V(v) *max_element(v.begin(), v.end())

// typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef long long LL;
typedef unsigned long long ULL;

// conversion
inline int toInt(string s) {int v; istringstream sin(s); sin>>v; return v;}
inline int countChar(string s, char c) {int cnt,i; cnt=0; REP (i,s.size()) {if (s[i]==c) cnt++;} return cnt;}
template<class T> inline string toString(T x) {ostringstream sout; sout<<x; return sout.str();}
//===========================================================================//

//=function prototype========================================================//

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

//=variables=================================================================//

//===========================================================================//
int main(void)
{
  // Scan begin.
  int n, k;

  cin >> n >> k;
  // Scan done.

  // Code begin.
  if (n%k==0) {
    cout << 0 << endl;
  }
  else {
    cout << 1 << endl;
  }
  // Code done.

  return 0;
}

//=functions=================================================================//

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int n, x;
  scanf("%d %d", &n, &x);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  long long ans = 0;
  for (int i = 2; i <= n; i++) {
    if (a[i - 1] + a[i] >= x) {
      int d = min(a[i], a[i - 1] + a[i] - x);
      ans += d;
      a[i] -= d;
    }
    if (a[i - 1] + a[i] >= x) {
      int d = min(a[i - 1], a[i - 1] + a[i] - x);
      ans += d;
      a[i - 1] -= d;
    }
  }
  printf("%lld\n", ans);
  return 0;
}


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

int pre[110],suf[110],n;
char s[110];

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	int ans=n+1;
	for (int i=0;i<26;i++)
	{
		suf[n+1]=0;
		for (int j=n;j;j--) suf[j]=(s[j]==i+'a')?0:suf[j+1]+1;
		int res=0;
		for (int i=1;i<=n;i++) res=max(res,suf[i]);
		ans=min(ans,res);
	}
	printf("%d\n",ans);
	return 0;
}

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

void Main()
{
  ll N, M; cin >> N >> M;
  ll ans = 0;
  ll p = pow(2, M);
  //cout << (ll)1900*M << endl;
  //cout << (N-M)*(ll)100 << endl;
  //cout << p << ","<< ((p-1)*(p-1)) << endl;
  ans = ((ll)1900*M + (N-M)*(ll)100) * p;
  cout << ans << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

int r, p, s;

int opnum(char x) {
    if (x == 's') {
        return (r);
    }
    if (x == 'r') {
        return (p);
    }
    if (x == 'p') {
        return (s);
    }
    return 0;
}
char op(char x) {
    if (x == 's') {
        return ('r');
    }
    if (x == 'r') {
        return ('p');
    }
    if (x == 'p') {
        return ('s');
    }
    return 0;
}

int main() {
    long a, x = 10, ans = 0;
    vector<int> as(5), bs(5);
    for (int i = 0; i < 5; i++) {
        cin >> as[i];
        bs[i] = as[i] % 10;
    }
    sort(bs.begin(), bs.end());
    for (int i = 0; i < 5; i++) {
        if (bs[i] != 0) {
            x = bs[i];
            break;
        }
    }

    for (int i = 0; i < 5; i++) {
        if (as[i] % 10 != 0) {
            a = as[i] / 10;
            as[i] = 10 * (a + 1);
        }
    }

    ans = 0;
    for (int i = 0; i < 5; i++) {
        ans += as[i];
    }

    cout << ans - 10 + x;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int S,h,m,s;
    scanf("%d",&S);
    h=S/3600;
    S %=3600;
    m=S/60;
    S %=60;
    s=S;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}

Measured memory_bytes: 1820
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int N = Integer.parseInt(in.next());
            int[] h = new int[N];
            for (int i = 0; i < N; i++) {
                h[i] = Integer.parseInt(in.next());
            }
            int[] dp = new int[N];
            Arrays.fill(dp, Integer.MAX_VALUE);
            dp[0] = 0;
            for (int i = 1; i < N; i++) {
                dp[i] = Math.min(dp[i], dp[i - 1] + Math.abs(h[i] - h[i - 1]));
                if (i > 1) dp[i] = Math.min(dp[i], dp[i - 2] + Math.abs(h[i] - h[i - 2]));
            }

            out.println(dp[N - 1]);
        }

    }
}



Measured memory_bytes: 48988
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n;
  string s;
  cin >> n >> s;
  
  ll cnt=0;
  rep2(i, n-1) if(s[i]=='E') cnt++;
  ll ans=cnt;
  rep2(i, n-1) {
    if(s[i-1]=='W') cnt++;
    if(s[i]=='E') cnt--;
    chmin(ans, cnt);
  }
  cout << ans << newl;
  return 0;
}

Measured memory_bytes: 720
#include<stdio.h>
#define RANGE 45
int main(){
  int i,j,n,fib[RANGE];
  scanf("%d",&n);
  fib[0]=1;
  fib[1]=1;
  for(i=2;i<RANGE;i++){
     fib[i]= fib[i-1]+fib[i-2];
  }
  printf("%d\n",fib[n]);
  return 0;
}
      



Measured memory_bytes: 2112
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{ 
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var str = ReadLine();
        WriteLine(str.Substring(0, str.Length - 8));
    }
    
}


Measured memory_bytes: 11092