akhauriyash/Code-Regression huggingface dataset:
pub struct Poper<'a> {
	iter: std::str::SplitWhitespace<'a>,
}

impl<'a> Poper<'a> {
	pub fn new(iter: std::str::SplitWhitespace) -> Poper {
		Poper { iter: iter }
	}
	pub fn read<T: std::str::FromStr>(&mut self) -> T
	where
		<T as std::str::FromStr>::Err: std::fmt::Debug,
	{
		self.iter.next().unwrap().parse().unwrap()
	}
}

fn main() {
	let input = {
		use std::io::Read;
		let mut s = String::new();
		std::io::stdin().read_to_string(&mut s).unwrap();
		s
	};
	let mut iter = Poper::new(input.split_whitespace());
	let n: usize = iter.read();

	let a_list: Vec<i64> = (0..n).into_iter().map(|_| iter.read()).collect();

	let mut x_list: Vec<i64> = vec![0; n];

	let mut f = 1;
	for i in 0..n {
		x_list[0] += f * a_list[i];
		f = -f;
	}

	for i in 0..n - 1 {
		x_list[i + 1] = a_list[i] * 2 - x_list[i];
	}

	let x = x_list
		.into_iter()
		.map(|n| n.to_string())
		.collect::<Vec<String>>()
		.join(" ");
	println!("{}", x);
}


Measured memory_bytes: 14588
(defun split (string &key (delimiterp #'delimiterp))
  (loop :for beg = (position-if-not delimiterp string)
    :then (position-if-not delimiterp string :start (1+ end))
    :for end = (and beg (position-if delimiterp string :start beg))
    :when beg :collect (subseq string beg end)
    :while end))
(defun delimiterp (c) (position c " ,.;/"))

(defun main ()
  (let ((n (read))
        (a_list (map 'list #'parse-integer (split (read-line))))
        (x nil))
    (setq x (/ (reduce #'+ a_list) n))
    (if (>= (- x (floor x)) (- (ceiling x) x))
      (setq x (ceiling x))
      (setq x (floor x)))

    (princ
      (reduce
        #'+
        (map 'list #'(lambda (l) (* (- l x) (- l x))) a_list)))
    (princ #\newline)

    ))
(main)

Measured memory_bytes: 18784
#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout<<x<<" "<<endl;
#define gg(x,y) cout<<x<<" & "<<y<<" "<<endl
#define jam(t) cout<<"Case #"<<t<<": "
#define ggg(x,y,z) cout<<x<<" & "<<y<<" & "<<z<<" "<<endl
#define all(x) x.begin(),x.end()
#define input_from_file  freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 400005
#define bitcnt(x) __builtin_popcountll(x)

using namespace std;

void solve(){
  string s,t;
  cin >> s >> t;
  ll len = min(s.length(),t.length());
  bool ok = true;
  for(ll i=0;i<len;i++){
    if(s[i] != t[i])
      ok = false;
  }
  if(ok){
    g("Yes");
  }
  else
  {
    g("No");
  }
}
int main()
{
#ifndef ONLINE_JUDGE
input_from_file
#endif
 
    FASTIO
    cin.tie(NULL);
    fflush(stdout);
    ll t = 1;
   // cin >> t;
    for(ll tcase = 1;tcase <= t;tcase++){
      solve();
        
    }
return 0;
}

Measured memory_bytes: 3652
from itertools import product


N = int(input())
all_testimonies = []
for i in range(N):
    A = int(input())
    testimony = [list(map(int, input().split())) for _ in range(A)]
    all_testimonies.append({'A': A, 'test': testimony})
    
    
# bit全探索
for bits in sorted(product(*[range(2) for _ in range(N)]), key=lambda x: sum(x), reverse=True):
    valid = True
    for i,testimony in enumerate(all_testimonies):
        person_is_honest = bool(bits[i])
        if person_is_honest:
            for j,y in testimony['test']:
                if bits[j-1] == y:
                    continue
                valid = False
    if valid:
        print(sum(bits))
        break

Measured memory_bytes: 81692
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n;
   cin>>n;
   for(int i=1;i<=9;i++)
   {
       for(int j=1;j<=9;j++)
       {
           if(i*j==n)
           {
               cout<<"Yes";
               return 0;
           }
       }
   }
   cout<<"No";

}




Measured memory_bytes: 3464
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 998244353;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
} c(200005);

int main() {
  ll N, M, K;
  cin >> N >> M >> K;
  mint ans = 0;
  mint col = M;
  for (int x = N - 1; x >= 0; x--) {
    mint now = col;
    now *= c(N - 1, x);
    if (x <= K) ans += now;
    col *= M - 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6232
# -*- coding:utf8 -*-
## Nは支払額, Aは1円の枚数
def t1(N, A):
    # 制約
    ## Nは1以上の10000以下の整数
    ## Aは0以上の1000以下の整数

    ### Nが整数かどうか判定
    if not (isinstance(N, int)):
        return ("No")
    ### Nは1以上の10000以下かチェック
    if not (1 <= N <= 10000):
        return ("No")

    ### Aが整数かどうか判定
    if not (isinstance(A, int)):
        return ("No")

    ### Aは0以上の1000以下かチェック
    if not (0 <= A <= 1000):
        return ("No")

    amari = N % 500

    if not amari:
        return ("Yes")

    if A >= amari:
        return ("Yes")
    else:
        return ("No")

loop_count = 0
input_list = []
while loop_count < 2:
    n = input()
    input_list.append(n)
    loop_count += 1
goukei = input_list[0]
ichien = input_list[1]
print (t1(goukei, ichien))

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


int main() {
  int D;
  cin >> D;
  int eve_number = 25 - D;
  string ans = "Christmas";
  for (int i = 0; i < eve_number; i++) {
    ans += " Eve";
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	double average;
	cin>>n;
	int f[n];
	for(int i=0;i<n;i++)
	{
		cin>>f[i];
		average+=f[i];
	}
	average/=n;
	double ans,minn=999999999;
	for(int i=0;i<n;i++)
	if(abs((double)f[i]-average)<minn)
	{
		minn=abs(f[i]-average);
		ans=i;
	}
	cout<<ans;
}

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

int main() {
  string s;
  cin>>s;
  int count=0;
  for(int i=0;i<s.size();i++){
    for(int j=i+1;j<s.size();j++){
      if (s[i]==s[j]){
        count++;
      }
    }
  }
  if(count==2){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  
}

Measured memory_bytes: 256
M, D = [int(i) for i in input().split()]

count = 0

for m in range(1, M+1):
    for d in range(1, D+1):
        d1 = d % 10
        d10 = d // 10
        # print(m, d10, d1)
        if d1 < 2 or d10 < 2:
            continue
        if m == d1 * d10:
            count += 1

print(count)


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

using namespace std;
int arr[100005];
int main()
{
    int n;
    cin>>n;
    int num = 0;
    for(int i = 1;i<=n;i++)
        scanf("%d",arr+i);
    for(int i = 1;i<=n;i++)
    {
        if(i==n)
        {
            if(arr[i]==i)
            {
                int temp;
                temp = arr[i];
                arr[i] = arr[i-1];
                arr[i-1] = temp;
                num++;
            }
        }
        else
        {
            if(arr[i]==i)
            {
                int temp;
                temp = arr[i];
                arr[i] = arr[i+1];
                arr[i+1] = temp;
                num++;
            }
        }
    }
    cout<<num;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    int x;
    cin >> x;
    cout << !x << endl;

    return 0;
}


Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>


using namespace std;
#define out(s) cout<<(s)<<endl;
using ll = long long;


int main()
{
	int N, K, X, Y;
	cin >> N >> K >> X >> Y;
	int result = 0;
	for (size_t i = 0; i < N; i++)
	{
		if (i < K) {
			result += X;
		}
		else {
			result += Y;
		}
	}
	out(result);
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

#define MAX(a,b) ((a) > (b) ? (a) : (b))

i32 gcd (i32 a, i32 b) {
  i32 r = a % b;
  while (r > 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  i32 *a = (i32 *) calloc (n, sizeof (i32));
  for (i32 i= 0; i < n; ++i) {
    scanf ("%" SCNi32, a + i);
  }
  i32 *r = (i32 *) calloc (n, sizeof (i32));
  r[n - 1] = a[n - 1];
  for (i32 i = n - 2; i >= 0; --i) {
    r[i] = gcd (r[i + 1], a[i]);
  }
  i32 max = r[1];
  i32 prev = a[0];
  for (i32 i = 1; i + 1 < n; ++i) {
    i32 g = gcd (prev, r[i + 1]);
    max = MAX(max, g);
    prev = gcd (prev, a[i]);
  }
  max = MAX(max, prev);
  printf ("%" PRIi32 "\n", max);
}

int main (void) {
  run();
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  while(n--) {
    double xa, ya, ra, xb, yb, rb, a, b, result;
    cin >> xa >> ya >> ra >> xb  >> yb  >> rb;
    if(xa==xb && ya==yb) {
      if(ra>rb) result=2;
      else result=-2;
    } else {
      b=sqrt((yb-ya)*(yb-ya)+(xb-xa)*(xb-xa));
      if(b>ra+rb) result=0;
      else if(b+ra<rb) result=-2;
      else if(b+rb<ra) result=2;
      else result=1;
    }
    cout << result << endl;
  }
  return 0;
}


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

using namespace std;

//FILE *fi=freopen("1.txt","r",stdin);

int a,b;

int main()
{
    scanf("%d %d",&a,&b);
    if (a<=9 && b<=9) cout<<a*b;
    else cout<<-1;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x%MOD,n/2);
  return x*POW(x,n-1)%MOD;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

int main()
{
  ll a,b,c;
  cin >> a >> b >> c;
  printf("%lld",min(b/a,c));
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
ll mod=1e9+7;
ll pow_(ll a,ll b){
    ll n=b,ans=1;
    while(n>0){
        if(n&1) ans=ans*a%mod;
        n=n/2;
        a=a*a%mod;
    }
    return ans;
}
int main(){
    ll n,m;
    cin>>n>>m;
    ll A[200001];
    rep(i,m) A[i+1]=pow_(m/(i+1),n);
    ll ans=0;
    for(int i=m;i>0;i--){
        vec B;
        for(int j=1;j<=sqrt(i);j++){
            if(i%j==0){
                B.push_back(j);
                if(j*j!=i) B.push_back(i/j);
            }
        }
        for(auto j:B){
            if(i!=j) A[j]=(A[j]-A[i]+mod)%mod;
        }
        (ans+=ll(i)*A[i]%mod)%=mod;
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 4364
/* */

#include <cstdio>
#include <cstring>
#include <cassert>
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <map>
#include <set>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using pll = pair<ll, ll>;

#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
#else
	#define errp(...)
#endif
#define dbg(x) errp("%s = %s\n", #x, to_string(x).data())
#define dbg_al(s, x) for(auto e:x)s+=to_string(e)+" "
#define dbg_rt(x) string s="[ ";dbg_al(s,x);s+="]";return s;
#define dbg_fd1 template<typename T>string to_string
#define dbg_fd2 template<typename U, typename V>string to_string
#define dbg_d1(c) dbg_fd1(c<T>);
#define dbg_d2(c) dbg_fd2(c<U, V>);
#define dbg_f1(c) dbg_fd1(c<T> v){dbg_rt(v);}
#define dbg_f2(c) dbg_fd2(c<U, V> v){dbg_rt(v);}
string to_string (char s) { return "\'"+string(1, s)+"\'"; }
string to_string (string s) { return "\"" + s + "\""; }
dbg_d1(vector) dbg_d1(set) dbg_d2(map)
dbg_fd2(pair<U, V> p) { return "("+to_string(p.first)+", "+to_string(p.second)+")"; }
dbg_f1(vector) dbg_f1(set) dbg_f2(map)
/* ==================== */ 
const int N = 100010;
ll f[N], g[N], fm[N], gm[N], a[N], n;

int main() {
	scanf("%lld", &n);
	for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
	f[0] = (a[0] > 0) ? 0 : -a[0] + 1;
	fm[0] = (a[0] > 0) ? a[0] : 1;
	g[0] = (a[0] < 0) ? 0 : a[0] + 1;
	gm[0] = (a[0] < 0) ? -a[0] : 1;

	for (int i = 1; i < n; i++) {
		f[i] = g[i - 1];
		g[i] = f[i - 1];
		
		if (a[i] > gm[i - 1]) fm[i] = a[i] - gm[i - 1];
		else {
			f[i] += (gm[i - 1] - a[i] + 1); 
			fm[i] = 1;
		}
		
		if (-a[i] > fm[i - 1]) gm[i] = -a[i] - fm[i - 1];
		else {
			g[i] += (fm[i - 1] + a[i] + 1);
			gm[i] = 1;
		}
	}
	printf("%lld\n", min(f[n - 1], g[n - 1]));
}


Measured memory_bytes: 4096
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int numArray[] = new int[n];
        for (int i = 0; i < n; i++) {
            numArray[i] = scan.nextInt();
        }
        int latestNum = numArray[0];
        int maxCount = 0, tmpCount = 0;
        for (int i = 1; i < n; i++) {
            if (latestNum >= numArray[i]) {
                tmpCount++;
            }
            else{
                if(maxCount < tmpCount){
                    maxCount = tmpCount;
                }
                tmpCount = 0;
            }
            latestNum = numArray[i];
        }
        if(maxCount < tmpCount){
            maxCount = tmpCount;
        }
        System.out.println(maxCount);
    }
}


Measured memory_bytes: 50256
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

//INT_MAX	2,147,483,647 = 2*1.0e9


const int MOD = 1000000007;
const int nMax = 200050;

long long fact[nMax];  // Array of Factorial
long long invFact[nMax]; // Array of Factorial of Inverse Elements
long long inv[nMax]; // Array of Inverse Elements

void calcFact(){
    fact[0] = 1; fact[1] = 1;
    invFact[0] = 1; invFact[1] = 1;
    inv[1] = 1;     //1に対する逆元は1

    for(int i = 2; i < nMax; i++){
        fact[i] = fact[i-1] * i % MOD;
        inv[i] = (- inv[MOD % i] * (MOD/i) ) % MOD + MOD;
        invFact[i] = invFact[i-1] * inv[i] % MOD;
    }
}

long long calcComb(long long _n, long long _k){
    if (_n < 0 || _k < 0) return 0;
    if (_n < _k) return 0;
    return fact[_n] * (invFact[_n-_k] * invFact[_k] % MOD) % MOD;
}

int main(){
  ll N, M, K;
  cin >> N >> M >> K;

  ll ans = 0;
  calcFact();


  //xについて求める
  ll pat = calcComb(N*M-2, K-2);
  ll dx_sum = 0;
  for(int i = 0; i < M; i++){
    dx_sum += ll(i) * ll(M-i);
    dx_sum %= MOD;
  }
  dx_sum *= N;
  dx_sum %= MOD;
  dx_sum *= N;
  dx_sum %= MOD;

  //yについて求める
  ll dy_sum = 0;
  for(int i = 0; i < N; i++){
    dy_sum += ll(i) * ll(N-i);
    dy_sum %= MOD;
  }
  dy_sum *= M;
  dy_sum %= MOD;
  dy_sum *= M;
  dy_sum %= MOD;

  ans = dy_sum + dx_sum;
  ans %= MOD;

  ans *= pat;
  ans %= MOD;

  cout << ans << endl;

  return 0;
}


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

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

    int64_t wk=k-a;
    int64_t wk2=wk-b;

    if(wk<=0)
        cout<<k<<endl;
    else if(wk2<=0)
        cout<<a<<endl;
    else
        cout<<a-(k-(a+b))<<endl;


return 0; 
} 


Measured memory_bytes: 3632
import java.util.*;
import java.io.*;
import java.math.*;

public class Main {
	 
	static final Scanner sc = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;
 
	static void solve() {
		String str = sc.next();
		
		for(int i=1; i<str.length(); i++) {
			if(str.charAt(i)==str.charAt(i-1)) {
				out.println(i + " " + (i+1));
				return;
			} else if(i-2>=0 && str.charAt(i)==str.charAt(i-2)) {
				out.println((i-1) + " " + (i+1));
				return;
			}
		}
		out.println("-1 -1");
	}
 
	public static void main(String[] args) {
		solve();

		out.flush();
		out.close();
	}
}

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

constexpr long long mod{1000000007};

using vll = std::vector<long long>;
using vvll = std::vector<vll>;

vvll pow(vvll, int);
vvll product(vvll, vvll);

int main()
{
	int N;
	scanf("%d", &N);
	long long to[11][4]{
	//   A, G, C, T
		{1, 8, 0, 0},	//		0
		{1, 2, 3, 4},	// A	1
		{9, 5, 10, 6},	// AG	2
		{1, 10, 0, 0},	// AC	3
		{1, 7, 0, 0},	// AT	4
		{9, 8, 10, 0},	// AGG	5
		{1, 8, 10, 0},	// AGT	6
		{9, 8, 10, 0},	// ATG	7
		{9, 8, 0, 0},	// G	8
		{1, 2, 10, 4},	// GA	9
		{10, 10, 10, 10}// out	10
	};
	long long matrix[11][11]{};
	for (int i{}; i < 11; i++)
		for (int j{}; j < 4; j++)
			matrix[i][to[i][j]]++;
	vvll dp(N + 1, vll(11));
	dp[0][0] = 1;
	for (int i{}; i < N; i++)
	{
		for (int j{}; j < 11; j++)
			for (int k{}; k < 11; k++)
				dp[i + 1][k] = (dp[i + 1][k] + dp[i][j] * matrix[j][k] % mod) % mod;
	}
	long long sum{};
	for (int i{}; i < 10; i++)
		sum = (sum + dp[N][i]) % mod;
	printf("%lld\n", sum);

	return 0;
}

Measured memory_bytes: 256
x,k,d = map(int,input().split())

if x >= 0 :
    a = abs(x//d)
    if a <= k :
        if (k - a) % 2 == 0 :
            print(abs(x-a*d))
        else :
            print(abs(x-(a+1)*d))
    else :
        print(abs(x-k*d))
else :
    if x%d == 0 :
        a = abs(x//d)
    else :
        a = abs(x//d+1)

    if a <= k :
        if (k - a) % 2 == 0 :
            print(abs(x+a*d))
        else :
            print(abs(x+(a+1)*d))
    else :
            print(abs(x+k*d))

Measured memory_bytes: 9096
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)

X = int(input())

if X >= 30:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 68708
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
using namespace std;

int main(){
  int A,B;
  cin >> A >> B;
  if((A<=8)&&(B<=8)){
    cout << "Yay!";
  }else{
    cout <<":(";
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    // F - LCS
    public static String lcs(String s, String t) {
        char[] ss = s.toCharArray();
        char[] tt = t.toCharArray();
        int n = ss.length, m = tt.length;

        if (n == 0 || m == 0) return "";
        int[][] dp = new int[n+1][m+1];

        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                if (ss[i-1] == tt[j-1]) {
                    dp[i][j] = dp[i-1][j-1] + 1;
                } else {
                    dp[i][j] = Math.max(dp[i-1][j], dp[i][j-1]);
                }
            }
        }

        // System.out.println("lcs.length = " + dp[n][m]);

        int L = dp[n][m];
        if (L == 0) return "";

        char[] ans = new char[L];
        int i = n, j = m;
        while (i > 0 && j > 0) {
            if (ss[i-1] == tt[j-1]) {
                ans[--L] = ss[i-1];
                i--;
                j--;
            } else if (dp[i-1][j] > dp[i][j-1]) {
                i--;
            } else {
                j--;
            }
        }

        return new String(ans);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();

        in.close();

        // call function hear
        String ans = lcs(s, t);
        System.out.println(ans);
    }
}

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

int main() {
	long a,b,k,cur;
	cin >> a >> b >> k;
	cur=min(k,a);
	a-=cur; k-=cur;
	cur=min(k,b);
	b-=cur; k-=cur;
	printf("%lld %lld\n",a,b);
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://beta.atcoder.jp/contests/abc103/tasks/abc103_b>
 問題文============================================================
 =================================================================
 解説=============================================================
 うく
 ================================================================
 */
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    string S,T; cin >> S >> T;
    S += S;
    if(S.find(T)==string::npos)cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main (void)
{
    int kansya[4][3][10];
    int kazu,tou,kai,ban,hito;
    int a,b,c,d;
 
    for(a=0;a<4;a++)//?????????
    {
        for(b=0;b<3;b++)
        {
            for(c=0;c<10;c++)
            {
                kansya[a][b][c]=0;
            }
        }
    }
 
 
    scanf("%d",&kazu);
 
    for(a=0;a<kazu;a++)//??\???
    {
        scanf("%d %d %d %d",&tou,&kai,&ban,&hito);
        kansya[tou-1][kai-1][ban-1]=hito + kansya[tou-1][kai-1][ban-1];
         
    }
 
     
    for(a=0;a<4;a++)//??????
    {
        for(b=0;b<3;b++)
        {
     
            for(c=0;c<10;c++)
            {
                printf(" %d",kansya[a][b][c]);
            }
     
             
            printf("\n");
 
        }
        if(a<3)
        {
             
            printf("####################\n");
             
        }
    }
     
 
 
    return 0;
}

Measured memory_bytes: 612
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
  int N,M;
  int CASE = 1;
  while(cin>>N>>M && N){
    printf("Case %d: ", CASE++);
    int dp[2][100] = {};
    dp[0][0] = N;
    REP(iter, 10000000){
      memset(dp[(iter + 1) % 2], 0, sizeof(dp[(iter + 1) % 2]));
      for(int i = 0; i <= M; i++){
        dp[(iter + 1) % 2][i + 1] += dp[iter % 2][i]/2;
        dp[(iter + 1) % 2][0] += dp[iter % 2][i]/2;
        if(dp[iter % 2][i] % 2 == 1) dp[(iter + 1) % 2][i] += 1;
      }
      if(dp[(iter + 1) % 2][M]){
        cout<<iter + 1<<endl;
        break;
      }
    }
  }

  return 0;
}

Measured memory_bytes: 1192
#include<stdio.h>
#include<math.h>

int main(void){
   int tmp=0;
   int tmp2=0;
   int X,Y,Z;
   scanf("%d %d %d",&X,&Y,&Z);
   tmp=X;
   X=Y;
   Y=tmp;
   tmp2=X;
   X=Z;
   Z=tmp2;
   printf("%d %d %d",X,Y,Z);
   return 0;
}
   

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);
const ll MOD = (ll)(1e9 + 7);

int n;
ll a[MAX_N];

int main(void) {
  // Here your code !
  scanf("%d", &n);

  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &(a[i]));
  }

  unordered_map<ll, ll> cnt;

  cnt[0LL] = 3LL;

  ll ans = 1LL;

  for (int i = 1; i <= n; ++i) {
    if (cnt.find(a[i]) == cnt.end()) {
      ans = 0LL;
      break;
    }

    ans *= cnt[a[i]];
    ans %= MOD;

    cnt[a[i]] -= 1LL;
    cnt[a[i] + 1LL] += 1LL;
  }

  printf("%lld\n", ans);

  return 0;
}


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

typedef long long ll;

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

int N, D;

int main() {
  scanf("%d %d", &N, &D);
  if (N % (2*D+1) == 0)
    printf("%d\n", N / (2 * D + 1));
  else
    printf("%d\n", N / (2 * D + 1) + 1);
  return 0;
}


Measured memory_bytes: 256
#! env python
# -*- coding: utf-8 -*-

import os
import sys


# atcoder.main
# Date: 2020/06/18
# Filename: main 
# Author: acto_mini

def main():
    X, N = map(int, input().split())
    P = list(map(int, input().split()))

    if not X in P:
        print(X)
        exit()

    min_num = 0
    min_dist = 101
    P.sort()
    for i in range(0, 102):
        if i in P: continue

        dist = abs(X - i)

        if dist < min_dist:
            min_dist = dist
            min_num = i

    print(min_num)

    return


if __name__ == '__main__':
    main()


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

using namespace std;

char a[11][11];

void no () {
	cout << "Impossible";
	exit (0);
}

int main () {
	int n, m;
	cin >> n >> m;
	for (int i = 1;i <= n;i ++) {
		for (int j = 1;j <= m;j ++) {
			cin >> a[i][j];
		}
	}   
	for (int i = 1;i <= n;i ++) {
		for (int j = 1;j <= m;j ++) {
			if (a[i][j] == '.') continue;
			int kol = 0, kol1 = 0;
			if (a[i - 1][j] == '#') kol1 ++;
			if (a[i + 1][j] == '#') kol ++;
			if (a[i][j - 1] == '#') kol1 ++;
			if (a[i][j + 1] == '#') kol ++;
			if (kol + kol1 > 2) no ();
			if (kol1 > 1) no ();
			if (kol > 1) no ();
		}
	}
	cout << "Possible";
	return 0;
}

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

count = dict()

for x in range(1, n+1):
    count[str(x)] = a[x-1]


count_sorted = sorted(count.items(), key=lambda x: x[1])

ans = ''

for x in range(n):
    ans += count_sorted[x][0]
    if x != n-1:
        ans += ' '

print(ans)


Measured memory_bytes: 27892
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define rn(i,n) for(int i=1;i<=n;i++)
#define ll long long


int main(void){
  double w,h,x,y;
  cin>>w>>h>>x>>y;


  if(x*2==w&&y*2==h){
    cout<<w*h/2<<" "<<1<<endl;
  }else{
    cout<<w*h/2<<" "<<0<<endl;
  }


  return 0;
}


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

int main()
{
  int i,n,count=0;
  cin >> n;
  char s[n];
  cin >> s;
  for(i=0;i<n-1;i++)
  {
      if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
      {
          count++;
      }
  }
  cout << count << "\n";
}


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

int main() {
  //input
  string S;
  cin >> S;
  //calc
  int n = S.size();
  int half = n / 2;
  int diff_count = 0;
  rep(i,half) {
    if ( S.at(i) != S.at(n-1-i) ) {
      diff_count++;
    }
  }
  int answer = diff_count;
  //output
  cout << answer << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<utility>
#include<queue>
using namespace std;
int main(){
  int n,q,time,cnt_time = 0;
  string name;
  queue<pair<string,int> > que;
  cin >> n >> q;
  for(int i=0;i<n;i++){
    cin >> name >> time;
    que.push(make_pair(name,time));
  }
  while(!que.empty()){
    pair<string,int> top = que.front();
    que.pop();
    if(top.second <= q){
      cnt_time += top.second;
      cout << top.first << " " << cnt_time << endl;
    }else{
      cnt_time += q;
      que.push(make_pair(top.first,top.second-q));
    }
  }
}



Measured memory_bytes: 6224
s = input()

temp = s[0]
temp2 = ""
count1 = 0
count2 = 0
for i in range(3):
    if temp == s[i+1]:
        count1 += 1
    elif temp2 == "":
        temp2 = s[i+1]
    elif temp2 == s[i+1]:
        count2 += 1
    else:
        break

if count1 == 1 and count2 == 1:
    print("Yes")
else:
    print("No")
    

Measured memory_bytes: 3060
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll n;
ll a[200000];
map<ll,ll> m;
int main(){
	cin >> n;
	REP(i,n) {
		cin >> a[i];
	}

	REP(i,n) {
		m[a[i]] = 0;
	}

	REP(i,n) {
		m[a[i]]++;
	}

	ll cou = 0;

	for(auto v : m) {
		cou += v.sc - 1;
	}

	cout << n - (cou + 1) / 2 * 2 << endl;
	return 0;
}


Measured memory_bytes: 7296
#include <iostream>
#include <string>

typedef long long int ll;
using namespace std;


ll dfs(ll n, string S){
  // 終了条件
  int len = S.size();
  if(len == 0) {
    return n;
  }

  // 探索の結果を足す
  ll sum = 0;
  for (int i = 1; i <= len; ++i) {
    ll m = stoll(S.substr(0, i));
//    cout << m << endl;
    sum += dfs(n+m, S.substr(i, len - i));
  }

  return sum;
}

int main() {

  // 入力
  string S;
  cin >> S;


  // 解く
  cout << dfs(0, S) << endl;

  return 0;

}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fast_io cin.tie(0);cout.tie(0);ios::sync_with_stdio(0)
#define MOD 1000000007
using namespace std;

int main(){
	fast_io;
	ll n;
	cin>>n;
	ll m = n;
	vector<ll> v;
	while(m--){
        ll x;
        cin>>x;
        v.pb(x);
	}
	sort(v.begin(),v.end());
	ll i = n/2;
	ll j = i-1;
	ll cnt = 0;
	cnt+=(v[i]-v[j]);
	cout<<cnt;
}


Measured memory_bytes: 1400
def resolve():
    n = int(input())
    p = list(map(int,input().split()))
    dif=0
    for i,x in enumerate(p,1):
        if i!=x:
            dif = dif+1
    if dif==0 or dif==2:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 3060
import java.util.*;
import java.io.*;
public class Main{
	public static void main(String[] args) throws IOException{
    	BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] list = reader.readLine().split(" ");
        int t = Integer.parseInt(list[0]);
        String[] l = new String[t];
        for(int i = 0 ;i<t;i++){
            l[i] = reader.readLine();
        }
        Arrays.sort(l);
        for(String p:l){
        	System.out.print(p);
            }
	}}
        

Measured memory_bytes: 22612
import sys
if __name__ == "__main__":
    N = int(input())
    S = input()
    T = input()
    for i in range(N):
        left = 0
        ok = True
        for j in range(i, N):
            if (S[j] == T[left]):
                left += 1
            else:
                ok = False
        if (ok):
            print (N + i)
            sys.exit()
    print (2 * N)


Measured memory_bytes: 2940
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    
    A = Number(input.split(" ")[0]);
    B = Number(input.split(" ")[1]);
    K = Number(input.split(" ")[2]);
    karray = new Array;
    j = 0;
    
    for(i = 1;i <= 100; i++){
        if(A%i ==0 && B%i == 0){
            karray[j]=i;
            j=j+1;
        }
    }
    console.log(karray[karray.length-K]);
}
    

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));




Measured memory_bytes: 7372
using System;
class Program{
	static void Main(){
		int[] s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		int[] x=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		int[] y=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		for(int i=0;i<s[0];i++){s[2]=Math.Max(s[2],x[i]);}
		for(int i=0;i<s[1];i++){s[3]=Math.Min(s[3],y[i]);}
		Console.WriteLine("{0}",s[2]<s[3]?"No War":"War");
	}
}

Measured memory_bytes: 13140
#include<stdio.h>
int m[]={2189,89,1232,866,1796,2603},a,b,c,d,r;int main(){for(char s[9];~scanf("%s",s);r+=a%3?b%3?(b+6-a)%6<3?2:5:3+!b:a?6:1)*s<65?r&&printf("%d\n",r),a=c=r=0,b=1:*s%6-4?d=(*s-78?*s%5-1:0)+c&3,a=m[a]>>3*d&7,b=m[b]>>3*d&7:c+=3+*s;}

Measured memory_bytes: 0
#include<stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main()
{
    long long int n,i,j,flag;
    scanf("%lld", &n);
    for(i=n;i<=100003;i++)
    {
        flag=0;
        for(j=2;j<=sqrt(i);j++)
        {
            if(i%j==0)
            {
                flag=1;
                break;
            }
        }
        if(flag==0)
        {
            break;
        }
    }
    printf("%lld\n", i);
    return 0;
}


Measured memory_bytes: 128
Sd = str(input())
T = str(input())

NS = len(Sd)
NT = len(T)

if NS < NT:
  print("UNRESTORABLE")
else:
  flag = False
  for i in range(NS-NT+1):
    for j in range(NT):
      if Sd[i+j] != "?" and Sd[i+j] != T[j]:
        break
      if j == NT-1:
        flag = True
        if "change" not in locals():
          change = i #j番目からTに変えれば満たせる。
        else:
          change = max(change,i) #変更は一番右側にして残りはaにする。
  if flag:
    if "change" in locals():
      ans = Sd[:change]+T+Sd[change+NT:]
    else:
      ans = Sd
    print(ans.replace("?","a"))
  else:
    print("UNRESTORABLE")

Measured memory_bytes: 3064
import itertools
import math

N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))

P_index = ''.join(map(str, P))
Q_index = ''.join(map(str, Q))
S = ''.join(map(str, sorted(P)))

Index = [''.join(i) for i in itertools.permutations(S)]
 
print(abs(Index.index(P_index)-Index.index(Q_index)))

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

int main() {
  // N要素の配列で初期化
  int N;
  cin >> N;
  vector<int> vec(N);
  vector<int> num(N);

  // N個の入力を受け取る
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  //2で割れるだけ割ってみる
  for (int i = 0; i < N; i++) {
    while (true) {
      if (vec.at(i) % 2 == 0) {
        vec.at(i) = vec.at(i) / 2;
        num.at(i) ++;
      }
      else {
        break;
      }
    }
  }
  
  sort(num.begin(),num.end());
  
  cout << num.at(0) << endl;

}



Measured memory_bytes: 256
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
bool isprime(int n) { //素数判定
    if(n==1)return false;
    if(n==2)return true;
    for(int i = 2;i<=sqrt(n);i++) {
        if(n%i==0) return false;
    }
    return true;
}
/* ----------------------end----------------------- */
#pragma endregion

signed main() {
    int a,b,c;cin >> a >> b >> c;
    int k = a;
    rep(i, (int)1e8) {
        if(k%b==c) {
            puts("YES");
            return 0;
        }
        k+=a;
    }
    puts("NO");
    return 0;
}

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

struct node{
    int key;
    node *next;
    node *prev;
};

class DLList{
private:
//    node *z;
public:
node *z;
    DLList(){
        z = new node;
        z->key = -1;
        z->next = z;
        z->prev = z;
    }
    
    ~DLList(){
        node *tmp = z->next;
        node *tmpnext;
        
        while(tmp != z){
            tmpnext = tmp->next;
            delete tmp;
            tmp = tmpnext;
        }
        delete z;
    }
    
    void insert(int v){
        node *tmp;
        tmp = new node;
        tmp->prev = z;
        tmp->next = z->next;
        tmp->key = v;
        z->next->prev = tmp;
        z->next = tmp;
    }
    
    void deleteKey(int v){
        node *tmp;
        tmp = z->next;
        
        while(tmp != z){
            if(tmp->key == v){
                tmp->prev->next = tmp->next;
                tmp->next->prev = tmp->prev;
                delete tmp;
                break;
            }
            tmp = tmp->next;
        }
    }
    
    void deleteFirst(){
        if(z->next != z){
            node *tmp;
            tmp = z->next;
            tmp->next->prev = z;
            z->next = z->next->next;
            delete tmp;
        }
    }
    
    void deleteLast(){
        if(z->prev != z){
            node *tmp;
            tmp = z->prev;
            tmp->prev->next = z;
            z->prev = z->prev->prev;
            delete tmp;
        }
    }
    
    void show(){
        node *tmp;
        tmp = z->next;
        
        if(tmp !=z){
            cout << tmp->key;
            tmp = tmp->next;
        }
        
        while(tmp != z){
            cout << " " << tmp->key;
            tmp = tmp->next;
        }
        
        cout << endl;
    }
};

int main(void){
    DLList li;
    int n;
    string op;
    int v;
    int i;
    
    cin >> n;
    
    for(i = 0; i < n; i++){
        cin >> op;
        
        if(op == "insert"){
            cin >> v;
            li.insert(v);
        }
        
        if(op == "delete"){
            cin >> v;
            li.deleteKey(v);
        }
        
        if(op == "deleteFirst"){
            li.deleteFirst();
        }
        
        if(op == "deleteLast"){
            li.deleteLast();
        }
    }
    
    li.show();
    return 0;
}

Measured memory_bytes: 34356
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
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 MOD 1e9 + 7
#define INF 1e9
#define SENTINEL 2e9
#define PIE 3.1415926535

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;}
template <class T>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}

#define itn int

int main() {
    itn n, r;
    cin >> n >> r;
    if (n>=10)
        cout << r << endl;
    else
        cout << r + 100 * (10 - n) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[100005];
int x=0,y=0,ans=0;
int main()
{
    cin>>a;
    for (int i=0;i<sizeof(a);i++)
     if (x==y){x++; if(a[i]=='p') ans--;}
     else{y++; if(a[i]=='g') ans++;} 
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Numerics;

class Class3
{
    static void Main(string[] args)
    {
        string s = (Console.ReadLine());

        char[] c = s.ToCharArray();

        string last = c[c.Length - 1].ToString();

        if ("s".Equals(last))
        {
            s = s + "es";
        } else
        {
            s = s + "s";
        }

        Console.WriteLine(s);




    }
}

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

int main()
{
	int K;
  cin >> K;
  int x = 7 % K;
  for(int i = 1; i <= K; ++i){
  	if(x == 0){
    cout << i << endl;
      return 0;
    }
    x = (x * 10 + 7) % K;
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 3628
import sys
sys.setrecursionlimit(10**9)

N = int(input())
As = list(map(int, input().split()))
adjL = [[] for _ in range(N)]
for _ in range(N-1):
    A, B = map(int, input().split())
    adjL[A-1].append(B-1)
    adjL[B-1].append(A-1)

def dfsTree(vNow):
    useds[vNow] = True
    for v2 in adjL[vNow]:
        if not useds[v2]:
            chlds[vNow].append(v2)
            dfsTree(v2)

vRoot = 0
chlds = [[] for v in range(N)]
useds = [False] * N
dfsTree(vRoot)

def dfs(vNow):
    if not chlds[vNow]:
        return As[vNow]
    cs = []
    for chld in chlds[vNow]:
        c = dfs(chld)
        if c == -1:
            return -1
        cs.append(c)
    sumC = sum(cs)
    T = 2*As[vNow] - sumC
    L = sumC - As[vNow]
    if T < 0 or L < 0:
        return -1
    if min(sumC-max(cs), sumC//2) >= L:
        return T
    else:
        return -1

ans = dfs(vRoot)
isLeaf = len(chlds[vRoot]) == 1
if (isLeaf and ans == As[vRoot]) or (not isLeaf and ans == 0):
    print('YES')
else:
    print('NO')


Measured memory_bytes: 115360
#include <stdio.h>
#include <math.h>

int main(){
	int a[100000] = {0}, i, sum=0;
	double h, n;
	
	scanf("%lf %lf", &h, &n);
	for(i = 0; i < n; i++){
		scanf("%d ", &a[i]);
		sum+=a[i];
	}
	if(sum >= h){
		printf("Yes");
	}else{
		printf("No");
	}
	
	return 0;
}

Measured memory_bytes: 512
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C_fix
# CreatedDate:  2020-06-27 14:37:15 +0900
# LastModified: 2020-06-27 15:25:50 +0900
#


import os
import sys
from itertools import combinations
import numpy as np
# import pandas as pd


def main():
    n, m, x = map(int, input().split())
    s = []
    for i in range(n):
        s.append(list(map(int, input().split())))
    s = np.array(s)
    total = 100000000


    for i in range(1, n+1):
        for lili in list(combinations(range(n), i)):
            s_list = np.zeros((m+1), dtype=np.int32)
            for li in lili:
                s_list += s[li]

            if (s_list[1:] >= x).all() and s_list[0] < total:
                total = s_list[0]
    if total == 100000000:
        print(-1)
    else:
        print(total)


if __name__ == "__main__":
    main()


Measured memory_bytes: 27688
n = int(input())
d, x = map(int,input().split())
choco = [0]*(d+1)
for i in range(n):
    a = int(input())
    p = 0
    while a*p+1 <= d:
        choco[a*p+1] += 1
        p += 1
print(sum(choco)+x)

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

const int N = 2e5+10;
int fa1[N],fa2[N];
int findroot1(int u)
{
    return fa1[u]==u?u:fa1[u]=findroot1(fa1[u]);
}
int findroot2(int u)
{
    return fa2[u]==u?u:fa2[u]=findroot2(fa2[u]);
}
set<int>s2[N];
int ans[N];
int main()
{
    int n,k,l;
    int u,v;
    // freopen("in.txt","r",stdin);
    scanf("%d%d%d",&n,&k,&l);
    for(int i=1;i<=n;i++) fa1[i]=fa2[i]=i;
    for(int i=1;i<=k;i++)
    {
        scanf("%d%d",&u,&v);
        int uu=findroot1(u);
        int vv=findroot1(v);
        if(uu==vv) continue;
        else fa1[vv]=uu;
    }
    for(int i=1;i<=l;i++)
    {
        scanf("%d%d",&u,&v);
        int uu=findroot2(u);
        int vv=findroot2(v);
        if(uu==vv) continue;
        else fa2[vv]=uu;
    }
    for(int i=1;i<=n;i++)
    {
        v=findroot2(i);
        s2[v].insert(i);
    }
    for(int i=1;i<=n;i++)
    {
        if(!s2[i].empty())
        {
            map<int,int>mp;
            for(auto it:s2[i])
            {
                int uu=findroot1(it);
                mp[uu]++;
            }
            for(auto it:s2[i])
            {
                int uu=findroot1(it);
                ans[it]=mp[uu];
            }
        }
    }
    for(int i=1;i<=n;i++)
    {
        printf("%d",ans[i]);
        if(i!=n) printf(" ");
        else printf("\n");
    }
    return 0;
}


Measured memory_bytes: 23808