akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

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

    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int x = sc.nextInt();
    int y = sc.nextInt();
    long ans = x * a + y * b;

    for(int i = 1; i <= Math.max(x, y); i++){
      long buf = i * 2 * c + Math.max(0, x - i) * a + Math.max(0, y - i) * b;
      if(buf < ans){
        ans = buf;
      }
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i] << " "
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
bool isPerfectSquare(long double x) {   
    long double sr = sqrt(x); 
    return ((sr - floor(sr)) == 0); 
} 
bool isPrime(int x){
    for(int i = 2; i * i <= x; ++i){
        if(x % i == 0) return 0;
    }
    return 1;
}
int fun(int n){
    if(n & 1) return 3 * n + 1;
    else return n/2;
}
int32_t main(){
    SPEED;
    int n;
    cin >> n;
    int arr[n];
    vector<int> a;
    map<int, int> fre;
    for(int i = 0; i < n; ++i){
        cin >> arr[i];
        a.pb(arr[i]);
        fre[arr[i]]++;
    }
    int Max = *max_element(arr, arr + n);
    if(fre[Max] > 1){
        for(int i = 0; i < n; ++i){
            cout << Max << endl;
        }
    }
    else{
        sort(all(a));
        for(int i = 0; i < n; ++i){
            if(arr[i] == Max){
                cout << a[n - 2] << endl;
            }
            else{
                cout << Max << endl;
            }
        }
    }
}

Measured memory_bytes: 13604
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF 9223372036854775807
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define RFOR(i,a,b) for(long long i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;

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

  string s;
  int n;
  cin >> s >> n;
  
  int cnt = 0;
  while(cnt < s.size()){
    cout << s[cnt];
    cnt += n;
  }

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
   public static void main(String[] args){
      Scanner reader = new Scanner(System.in);
      int number = 0;
      
      for(int i = 2; i >= 0; i--){
            number += reader.nextInt()*Math.pow(10, i);
      }
      
      double det = number/4.0;
      
      if((det%1.0) > 0){
         System.out.println(" NO");
      } else {
         System.out.println("YES");
      }
   }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
char str[200005], t[200005];
int main()
{
    scanf("%s %s", str, t);
    int res= 0;
    for(int i=0; str[i]; i++)
    res+= (str[i]!=t[i]);
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 4216
/*
ex 9_1
tomatokan
*/

#include <stdio.h>
#include<stdlib.h>
#define LIM 12

typedef struct stack{//スタック
    int count;
    int msg[LIM];
    int *top;
}stack;

stack new_stack(){//初期化されたスタック(空)を返す。
    stack st;
    st.count=0;
    for(int i=0;i<LIM;i++){
        st.msg[i]=0;
    }
    st.top=st.msg;
    return st;
}

void push_stack(stack *st, int elem){
    if(st->count>=LIM){
        fprintf(stderr,"stack overflow");
        exit(1);
    }
    (st->count)++;
    st->msg[st->count-1]=elem;
    (st->top)++;
}

int pop_stack(stack *st){
    if(st->count<=0){
        fprintf(stderr,"stack underflow");
        exit(1);
    }
    (st->count)--;
    (st->top)--;
    return *(st->top);
}

void print_stack(stack *st){
    for(int i=0;i<st->count;i++){
        printf("%d",st->msg[i]);
    }
    printf("\n");
}

int is_empty(stack *st){
    if(st->count==0){
        return 1;
    }
    return 0;
}

int main(void){
    char input[12];
    char *ptr;
    stack st;
    ptr=input;
    fgets(input,12,stdin);//入力の読み取り
    st=new_stack();
    while(*ptr!='\0'&&*ptr!='\n'){
        if(*ptr=='0'){
            push_stack(&st,0);
        }else if(*ptr=='1'){
            push_stack(&st,1);
        }else{
            if(!is_empty(&st)){
                pop_stack(&st);
            }
        }
        ptr++;
    }
    print_stack(&st);//結果の表示
    return 0;
}

Measured memory_bytes: 1584
n,m,l = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
b = [list(map(int,input().split())) for i in range(m)]

for i in range(n):
    c = []
    for j in range(l):
        cc = 0
        for k in range(m):
            cc += a[i][k]*b[k][j]
        c.append(cc)
    print(*c)   #*を付けることによって[]なしで出力できる
    #行列を作ってから出力じゃなくて、1行ごとに出力した
   


Measured memory_bytes: 6580
#include <iostream>
using namespace std;
int main() {
	for (int i=0; i<3; i++) {
		int h1,m1,s1,h2,m2,s2;
		cin>>h1>>m1>>s1>>h2>>m2>>s2;
		int s=s2-s1, m=m2-m1, h=h2-h1;
		if (s<0) {
			s+=60;
			m--;
		}
		if (m<0) {
			m+=60;
			h--;
		}
		cout << h << " " << m << " " << s << endl;
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include <iomanip>
using namespace std;

int main(){
	int n,sum=0,ans=0;
	string s="Yes";
	cin>>n;
    vector<long long int>t(10000000);
    vector<long long int>x(10000000);
    vector<long long int>y(10000000);
    t[0]=0;
    x[0]=0;
    y[0]=0;
    for(int i=1;i<n+1;i++){
        cin>>t[i]>>x[i]>>y[i];
    }
    for(int i=0;i<n;i++){
    	if((t[i+1]-t[i])%2!=(abs(x[i+1]-x[i])+abs(y[i+1]-y[i]))%2||(abs(x[i+1]-x[i])+abs(y[i+1]-y[i]))>t[i+1]-t[i]){
    		s="No";
    	}
    }
    
    
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 234624
a = int(input())

b = []
for i in range(a):
    c = input().split(' ')
    b.append(c)

total = 0
for j in range(a):
    if b[j][1] == 'JPY':
        total += float(b[j][0])
    else:
        total += float(b[j][0]) * 380000

print(total)



Measured memory_bytes: 3060
#include <stdio.h>

int max(int a, int b) {
  return a > b ? a : b;
}

int main(void) {
  int a, b;

  scanf("%d %d", &a, &b);
  int ans = max(a + b, a - b);
  printf("%d\n", max(ans, a * b));

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lli long long int
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n%10==7)
	{
		cout<<"Yes";
	}
	else if((n%100)/10 == 7)
	{
		cout<<"Yes";
	}
	else if(n/100 == 7)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

template<typename T>
//価値v,重さw,個数m,重さの上限W
T knapsaq(vector<T>& v,vector<int>& w,vector<int>& m, int W){
    int n = (int)v.size();
    vector<T> dp(W+1), deqv(W+1);
    vector<int> deq(W+1);
    rep(i,n){
        rep(a,w[i]){
            int s = 0,t = 0;
            for(int j = 0; j*w[i]+a <= W; j++){
                T val = dp[j*w[i]+a] - j*v[i];
                while(s < t && deqv[t-1] <= val){
                    t--;
                }
                deq[t] = j;
                deqv[t++] = val;
                dp[j*w[i]+a] = deqv[s] + j*v[i];
                if(deq[s] == j-m[i]){
                    s++;
                }
            }
        }
    }
    return dp[W];
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, W;
    cin >> n >> W;
	vi v(n), w(n), m(n);
	rep(i,n){
		cin >> v[i] >> w[i] >> m[i];
	}
	cout << knapsaq(v, w, m, W) << "\n";
    return 0;
}



Measured memory_bytes: 3332
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n+1];
    int k = 1;
    int count = 0;

    for (int i = 1; i <= n; i++) {
      a[i] = sc.nextInt();
    }

    for (int i = 1; i <= n; i++) {
      k = a[k];
      count++;
      if (k == 2) {
        System.out.println(count);
        return;
      }
    }
    System.out.println("-1");
  }

}


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

int main(int argc, const char * argv[])
{
    int i, k;
    char input[21];
    for (i = 0; i < 20; i++) {
        input[i] = getchar();
        if (input[i] == '\n') {
            break;
        }
    }
    for (k = i - 1; k >= 0; k--) {
        cout << input[k];
    }
    cout << endl;
    return 0;
}

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

using namespace std;

#define pb push_back
#define mem(a) memset(a,0,sizeof(a))

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

const int mn=55;

int n;
ll m,D;
int a[mn];
vector<int> g[mn];
struct item{
	ll v,w,num;//value weight
	bool operator < (const item &e) const{
		return v*e.w>e.v*w;
	}
}p[mn];
void dfs(int v,int x){
	p[x].w+=a[v];
	p[x].v++;
	for(int &i:g[v]){
		dfs(i,x);
	}
}

ll d[mn*mn*mn];

inline ll greedy(ll m){
	ll ans=0;
	for (int i = 1; i <= n; i++) {
		ll u = min(m / p[i].w,p[i].num);
		m -= u * p[i].w, ans += p[i].v * u;
	}
	return ans;
}

int main() {
#ifdef LOCAL
	freopen("../1.txt", "r", stdin);
#endif
	ios::sync_with_stdio(0);
	cin >> n >> m >> D;
	cin >> a[1];
	for (int i = 2; i <= n; i++) {
		int u;
		cin >> a[i] >> u;
		g[u].pb(i);
		p[i].num = max(D - 50,0ll);
	}
	p[1].num = 1e9;
	for (int i = 1; i <= n; i++) dfs(i, i);
	sort(p + 1, p + n + 1);
	int maxpos = 0;
	fill_n(d, mn*mn*mn, 1ll << 58);
	d[0] = 0;
	for (int i = 1; i <= n; i++) {
		for (int k = 1; k <= min(50ll, D); k++) {
			maxpos += p[i].v;
			for (int j = maxpos; j >= p[i].v; j--) {
				d[j] = min(d[j], d[j - p[i].v] + p[i].w);
			}
		}
	}
	ll ans=0;
	for (int i = 0; i <= maxpos; i++) {
		if (d[i] <= m) ans=max(ans,greedy(m-d[i])+i);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 1536
#include<stdio.h>

long a[100000],b[100000];

int main(){
	long n,i,ans=0;
	scanf("%ld",&n);
	for(i=0;i<n;i++){
		scanf("%ld %ld",&a[i],&b[i]);
	}
	for(i=n-1;i>=0;i--){
		a[i]+=ans;
		ans+=(b[i]-a[i]%b[i])%b[i];
	}
	printf("%ld\n",ans);
	return 0;
}

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

int main(){
    int n,x;
    cin>>n>>x;
    int a[n];
    int minv=2000;
    int sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
        minv=min(minv,a[i]);
    }
    cout<<n+(x-sum)/minv<<endl;
    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int m = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            if ((m == -1) && (f == -1) && (r == -1)) {
                break;
            }
            if (m == -1 || f == -1) {
                System.out.println("F");
            } else if (m + f >= 80) {
                System.out.println("A");
            } else if (m + f >= 65) {
                System.out.println("B");
            } else if (m + f >= 50) {
                System.out.println("C");
            } else if (m + f >= 30) {
                if (r >= 50) {
                    System.out.println("C");
                } else {
                    System.out.println("D");
                }
            } else {
                System.out.println("F");
            }
        }
        sc.close();
    }
}


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

#define f first
#define s second
typedef long long ll;
typedef pair<int,ll> P;

const int XD = 1e5 + 2;
ll dp[ XD ][ 101 ];
P item[ 101 ];

int main()
{
    ios_base::sync_with_stdio( false );
    int n, w; cin >> n >> w;
    for( int i = 1; i <= n; i++ )
        cin >> item[ i ].f >> item[ i ].s;
    for( int i = 1; i <= w; i++ )
    {
        for( int j = 1; j <= n; j++ )
        {
            if( item[ j ].f > i ) dp[ i ][ j ] = dp[ i ][ j - 1 ];
            else dp[ i ][ j ] = max( dp[ i ][ j - 1 ], dp[ i - item[ j ].f ][ j - 1 ] + item[ j ].s );
        }
    }
    cout << dp[ w ][ n ];
    return 0;
}


Measured memory_bytes: 79232
#include <iostream>
#include <vector>
#include <algorithm>
#include<functional>
#include <numeric>
using namespace std;

int main() {

	long long n, k;
	cin >> n >> k;

	if (n % k == 0)
	{
		cout << 0 << endl;
		return 0;
	}
	if (n % k < (abs((n % k)-k)) % k)
	{
		cout << n % k << endl;
	}
	else
	{
		cout << (abs((n % k)-k)) % k << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a, b, c, d, e, k;
    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);
    scanf("%d", &d);
    scanf("%d", &e);
    scanf("%d", &k);
    if (e - a > k) printf(":(\n");
    else printf("Yay!\n");   
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>
#include <cmath>

using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

const double eps = 1e-6;
const ll MOD = 1000000007;
const ll INF = 1e15;

class UnionFind {
public:
	vector<int> rank;
	UnionFind(int N) : rank(N, -1) {}
	int root(int x) {
		if (rank[x] < 0)
			return x;
		else
			return rank[x] = root(rank[x]);
	}
	bool find(int a, int b) {
		return root(a) == root(b);
	}
	void uni(int a, int b) {
		if (find(a, b))
			return;
		a = root(a); b = root(b);
		if (a < b)
			rank[b] = a;
		else if (b < a)
			rank[a] = b;
		else {
			rank[b] = a;
			rank[a]--;
		}
	}
};

int main() {
	ll N, M;
	cin >> N >> M;
	vector<ll> p(N);
	for (int i = 0;i < N;i++)
		cin >> p[i];
	UnionFind uf(N);
	for (int i = 0;i < M;i++) {
		ll x, y;
		cin >> x >> y;
		x--; y--;
		uf.uni(x, y);
	}
	ll ans = 0;
	for (int i = 0;i < N;i++) {
		if (uf.find(p[i] - 1, i))
			ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,k,n) for(int i=k;i<n;i++)
using namespace std;

void output(int a[],int x){
  rep(i,x-1){
    cout << a[i] << " ";
  }
  cout << a[x-1] << endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h,w,n;
  cin >> h >> w >> n;
  int a[100100];
  rep(i,n) cin >> a[i+1];
  int p = 1;
  rep(y,h){
    int s[110];
    for(int x = (y%2)*(w-1); (y%2)?x>=0:x<w;(y%2)?--x:++x){
      if(a[p]>0){
        a[p]--;
      }else{
        p++;
        a[p]--;
      }
      s[x] = p;
    }
    output(s,w);
  }
  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
int main()
{
	int a, b;
	char c;
	scanf("%d %c%d", &a, &c, &b);
	if (c == '+')cout << a + b << endl;
	else cout << a - b << endl;
	//cout << a*a-b << endl;
	//printf((s[0]==s[1]&&s[1]==s[2]||s[1]==s[2]&&s[2]==s[3]) ? "Yes\n" :"No\n");
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Map<Integer, Integer> m = new HashMap<>();
        for (int i = 0; i < 12; i++) {
            int n = sc.nextInt();
            if (m.containsKey(n)) {
                m.put(n, m.get(n) + 1);
            } else {
                m.put(n, 1);
            }
        }
        int c = 0;
        for (Map.Entry<Integer, Integer> e : m.entrySet()) {
            if (e.getValue() == 4) {
                c++;
            }
            if (e.getValue() == 8) {
                c+=2;
            }
            if (e.getValue() == 12) {
                c=3;
            }
        }
        System.out.println(c == 3 ? "yes" : "no");
    }
}


Measured memory_bytes: 26360
import java.io.*;
import java.util.*;
//import java.util.stream.*;
//import java.math.*;

public class Main {

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long x = sc.nextLong();
        long num = 0;
        if (a % x == 0) {
            num = Math.abs((a / x) - (b / x))+1;
        } else {
            num = Math.abs((b / x) - (a / x));
        }
        System.out.println(num);
        bw.flush();
    }
}


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

using namespace std;

int intpow(int a, int n) {
    if (n == 0) {
        return 1;
    } else {
        return a * intpow(a, n - 1);
    }
}

const int MAX_N = 12;
const int MAX_M = 1000;
const int MAX_COST = 1e9;

int main() {
    int N, M;
    cin >> N >> M;
    vector<pair<int, int> > keys(M);
    vector<vector<int> > memo(M, vector<int>(intpow(2, N), MAX_COST));

    for (int i = 0; i < M; i++) {
        int a, b; cin >> a >> b;
        keys[i].first = a;

        int k = 0;
        for (int j = 0; j < b; j++) {
            int c; cin >> c;
            k += intpow(2, c-1);
        }
        keys[i].second = k;
    }

    memo[0][0] = 0;
    memo[0][keys[0].second] = keys[0].first;
    for (int i = 1; i < M; i++) {
        for (int j = 0; j < intpow(2, N); j++) {
            if (memo[i-1][j] != MAX_COST) {
                memo[i][j|keys[i].second] = min(memo[i-1][j|keys[i].second], min(memo[i-1][j] + keys[i].first, memo[i][j|keys[i].second]));
            }
        }
        for (int j = 0; j < intpow(2, N); j++) {
            if (memo[i-1][j] != MAX_COST) {
                memo[i][j] = min(memo[i-1][j], memo[i][j]);
            }
        }
    }

    if (memo[M-1][intpow(2, N) - 1] == MAX_COST) {
        cout << -1 << endl;
    } else {
        cout << memo[M-1][intpow(2, N) - 1] << endl;
    }
}

Measured memory_bytes: 16256
#include<stdio.h>
long gcd(long m,long n)
{
    if(n==0)
        return m;
        //printf("%ld %ld\n",n,m%n);
    return gcd(n,m%n);

}

int main()
{
    long  a,b,gCommon,i,j,k,cnt=1;
    scanf("%ld%ld",&a,&b);

    gCommon = gcd(a,b);
    //printf("%ld\n",gCommon);

        for(i=2; gCommon>1 && gCommon>=i*i ; )
        {
            for(j=0; gCommon%i==0; j++)
                gCommon/=i;
                    if(j>0)
                        cnt++;
                    if(i==2)
                        i++;
                    else
                        i+=2;
        }

        if(gCommon>=i)
            cnt++;
        printf("%ld\n",cnt);
        return 0;
}

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

#define ll long long int
#define vi vector<int>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vv vector

ll min(ll a,ll b)
{
    return (a<b)?a:b;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll n,cap;
    cin>>n>>cap;
    ll w[n],v[n];
    for(ll i=0;i<n;i++)
        cin>>w[i]>>v[i];
    ll vmax=0;
    for(int i=0;i<n;i++)
        vmax+=v[i];
    ll dp[vmax+1][n];
    for(int i=0;i<=vmax;i++)
        for(int j=0;j<n;j++)
            dp[i][j]=1e12+1;
    for(ll i=0;i<=vmax;i++){
        for(ll j=0;j<n;j++){
            if(i==0)
                dp[i][j]=0;
            else if(j==0){if(i==v[0])
                dp[i][j]=w[j];}
            else if(v[j]<=i)
                dp[i][j]=min(dp[i][j],w[j]+dp[i-v[j]][j-1]);
            if(j>0)
                dp[i][j]=min(dp[i][j-1],dp[i][j]);
        }
    }
    /*for(int i=0;i<=vmax;i++){
        for(int j=0;j<n;j++)
            cout<<dp[i][j]<<' ';
        cout<<'\n';
    }*/
    ll ans=0;
    for(int j=0;j<=vmax;j++)
        if(dp[j][n-1]<=cap)
            ans=j;
    cout<<ans;
}

Measured memory_bytes: 81644
#include<cstdio>
int n,c[510],s[510],f[510],i,a,j;main(){for(scanf("%d",&n);~scanf("%d%d%d",c+j++,s+j,f+j););for(f[j-1]=1;i<n;a=!printf("%d\n",a))for(j=i++;j<n;)a=(a<s[j]?s[j]:(~-a/f[j]+1)*f[j])+c[j++];}

Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
typedef pair<ll,ll> Q;
typedef pair<Q,ll> R;
int n,k;
int main(){
	cin>>n>>k; k--;
	repn(i,n){
		int x; cin >> x;
		if(x == 1){
			int L = i-1, R = n-i;
			ll ans = 1e18;
			rep(x,k+1){
			    ll zan1 = max(0LL,1LL*L-x);
			    ll zan2 = max(0LL,1LL*R-(k-x));
			    ans = min(ans, (zan1+k-1)/k + (zan2+k-1)/k + 1);
			}
			cout<<ans<<endl;
			return 0;
		}
	}
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<string.h>
using namespace std;
int main(){
	int a;
	cin>>a;
	if(a/10==9)cout<<"Yes"<<endl;
	else if(a%10==9)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


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

int main(){
  int N,A,B,x;
  int plan1,plan2;

  cin >> N >> A >> B;
  plan1 = N * A;
  plan2 = B;

  if (plan2 > plan1){
    x = plan1;
  }
  else {
    x = plan2;
  }
  cout << x << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pii pair<int,int> 
#define pb push_back
#define INF INT_MAX 
#define mod 1000000007ll
#define fi first
#define se second
#define f(i,p,q) for(int i=p;i<q;i++)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define psi(a) printf(" %d",a)
#define poi(a) printf("%d",a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld\n",a)
#define Nline() printf("\n")
#define sstr(str) scanf("%s",str)
#define pstr(str) printf("%s\n",str)
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vvi vector<vi>
#define all(v) (v).begin(),(v).end()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define VI(a,n) vi a(n); rep(i,n)cin>>a[i];
#define sq(n) (n)*(n)
#define iso ios::sync_with_stdio(false); cin.tie(0);cout.tie(NULL);
map<int,int>mp;
int main()
{
    iso;
    int t;
    string s;
    cin>>t;
    ll as=0,al=0,bs=0,bl=0;ll x=0;
    while(t--)
    { cin>>s; 
    for(int i=1;i<s.length();i++)
        if(s[i]=='B'&&s[i-1]=='A')
            x++;
            
    if(s[0]=='B'&&s[s.length()-1]=='A')as++;
    else if(s[0]=='B')al++;
   else if(s[s.length()-1]=='A')bs++;

    }
    if(as==0)
     x+=min(al,bs);
     else if(al+bs>0)
     x+=as+min(al,bs);
     else if(al+bs==0)
      x+=as-1;
     cout<<x;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1e8;
const double pi=acos(-1);

ll n,ans;
vector<ll> dp,num;

int main(){
	while(1){
		cin>>n;
		if(!n) break;
		ans=-inf;
		dp=vector<ll>(n);
		num=vector<ll>(n);
		for(int i=0;i<n;i++) cin>>num[i];
		dp[0]=num[0];
		for(int i=0;i<n-1;i++) dp[i+1]=max(num[i+1],num[i+1]+dp[i]);
		for(int i=0;i<n;i++) ans=max(ans,dp[i]);
		cout<<ans<<endl;
	}
}

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<int, int, lli> tiil;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

int main(){
	fast_io
	int a,b,c; cin>>a>>b>>c;
	if(a+b>=c) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)

print(ans)

Measured memory_bytes: 47404
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  string s;
  cin >> s;
  if (s[s.size()-1]=='1' || s[0]=='0') {
    cout << -1 << endl;
    return 0;
  }
  for (int i=0; i<s.size()/2; ++i) {
    if (s[i]!=s[s.size()-2-i]) {
      cout << -1 << endl;
      return 0;
    }
  }
  int p = 1;
  for (int i=0; i<s.size()-1; ++i) {
    if (s[i]=='1') {
      cout << p << " " << i+2 << endl;
      p = i+2;
    } else {
      cout << p << " " << i+2 << endl;
    }
  }
  return 0;
}


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

int main(){
  int N;
  cin >> N;
  char S[N];
  char c;
  int count =0;

  for(int i=0;i<N;i++){
    cin >> S[i];
    if(c == S[i]){
        count++;
    }else{
    }
    c= S[i];
  }
  cout << N-count;
}


Measured memory_bytes: 384
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007



x = I()
print(x // 11 * 2 + bool(x % 11) + bool(x % 11 > 6))

Measured memory_bytes: 39024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

int main(){
  
  int h,w; cin>>h>>w;
  int ch,cw,dh,dw; cin>>ch>>cw>>dh>>dw;
  
  vector s(h+2,vector(w+2,'#'));
  vector c(h+2,vector(w+2,-1));
  for(int i=1; i<=h; i++){
    for(int j=1; j<=w; j++){
      cin >> s.at(i).at(j);
    }
  }
  c.at(ch).at(cw) = 0; 
  deque <pair<int,int>> q;
  q.push_front({ch,cw});
  while(!q.empty()){
    auto p = q.front();
    int ph = p.first;
    int pw = p.second;
    q.pop_front();
    for(int i=-1; i<=1; i++){
      for(int j=-1; j<=1; j++){
        if(abs(i)+abs(j)==2) continue;
        if(s.at(ph+i).at(pw+j)=='#') continue;
        if(c.at(ph+i).at(pw+j)==-1||c.at(ph+i).at(pw+j)>c.at(ph).at(pw)){
          c.at(ph+i).at(pw+j) = c.at(ph).at(pw);
          q.push_front({ph+i,pw+j});
        }
      }
    }
    for(int i=-2; i<=2; i++){
      for(int j=-2; j<=2; j++){
        if(i+ph<0||h+1<i+ph||j+pw<0||w+1<j+pw) continue;
        if(s.at(ph+i).at(pw+j)=='#') continue;
        if(c.at(ph+i).at(pw+j)==-1){
          c.at(ph+i).at(pw+j) = c.at(ph).at(pw)+1;
          q.push_back({ph+i,pw+j});
        }
      }
    }
  }

  cout<<c.at(dh).at(dw)<<endl;
}


Measured memory_bytes: 8684
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <tr1/unordered_map>
using namespace std;
#define ll long long
#define re register
#define pb push_back
#define fi first
#define se second
const int N=1e6+10;
const int M=1e6;
const int mod7=1e9+7;
const int mod=998244353;
void read(int &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0')
        if(ch=='-')
            d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9')
        a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
void read(ll &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0')
        if(ch=='-')
            d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9')
        a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
int main()
{
    double a;
    cin>>a;
    printf("%.2f",3.1415926*a*2);
    return 0;
}

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

using namespace std;

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

    int k = static_cast<int>(s.size());

    int cnt = 0;
    for (int i = 0; i < k; i++) {
        if (s[i] == 'o') {
            cnt++;
        }
    }

    cout << (15 - k >= 8 - cnt ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
using namespace std;
int main(void){
	int ans,i,n,x,min=10000,m;
	scanf("%d %d",&n,&x);
	for(i=0;i<n;i++){
		scanf("%d",&m);
		if(min>m) min=m;
		x-=m;
	}
	ans=x/min+n;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#pragma region macro
#include <bits/stdc++.h>
typedef long long int64;
using namespace std;
using P = pair<int64, int64>;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const int64 INF = 1LL << 62;
const int inf = 1<<30;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
#define bn '\n'
template <typename T>
ostream& operator<<(ostream& os, const vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T,typename S>
ostream& operator<<(ostream& os, pair<T,S> const&P){
    os << "(";
    os << P.first;
    os << " , ";
    os << P.second;
    os << ")";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
vector<pair<int,int>> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)};
#pragma endregion
//fixed<<setprecision(10)<<ans<<endl;

int cnt = 0;
int N;
bool dfs(string S, int now, int digit){
    if(now==digit){
        cnt++;
        if(cnt==N){
            cout << S << bn;
            return true;
        }
        return false;
    }
    int upper, lower;
    if(now==0){
        lower = 1;
        upper = 9;
    }else{
        lower = max(0,S[now-1]-'0'-1);
        upper = min(9,S[now-1]-'0'+1);
    }
    for(int x=lower; x<=upper;x++){
        auto tmp = S;
        tmp[now] = x+'0';
        auto res = dfs(tmp,now+1,digit);
        if(res) return true;
    }
    return false;
}

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

    int ans=0;
    REP(i,12){
        auto res = dfs(string(i+1,'.'), 0, i+1);
        if(res){
            return 0;
        }
    }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sz(a) int((a).size())
#define int long long
#define Int int32_t
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define pii pair< int , int >
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define bitcnt(n) __builtin_popcountll(n)
#define setpre(n) cout << fixed << setprecision(n)
#define tr(c) for(auto x : c )cout << x << " ";
#define ol(c , s , e ) for(int pos=s; pos<e ; pos++) cout << c[pos] << " ";
#define inf 1e18;
#define PI acos(-1)
const int M = 1000000007;
const int N=1e5+5;

//#define rohit
#ifdef rohit
template<typename... T >
void bug(T... __VA_ARGS__) {
    ((cerr << __VA_ARGS__ << " ") , ...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", bug(__VA_ARGS__) , cerr << endl;
#endif
void solve() {
    string s;
    cin >> s;
    if(s == "ABC"){
        cout << "ARC\n";
    }
    else{
        cout << "ABC\n";
    }

}
signed main()
{
    FAST;
    //TODO:  check test cases are there or not?
    int tc=1;
//    cin >> tc;
    for(int t = 1 ; t <= tc ; t++)
    {
        solve();
    }
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <utility>

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

int N;
vector<int> G[1005];
int X[1005];

P dfs(int v)
{
	if(G[v].size() == 0) return make_pair(0, X[v]);
	
	P res;
	vector< vector<bool> > dp;
	dp.resize(G[v].size()+1);
	for(int i = 0; i <= G[v].size(); i++){
		dp[i].resize(X[v]+1);
		for(int j = 0; j <= X[v]; j++){
			dp[i][j] = false;
		}
	}
	dp[0][0] = true;
	
	int sum = 0;
	for(int i = 0; i < G[v].size(); i++){
		res = dfs(G[v][i]);
		if(res.first < 0) return make_pair(-1, -1);
		sum += res.first + res.second;
		for(int j = 0; j <= X[v]; j++){
			if(!dp[i][j]) continue;
			if(j + res.first <= X[v]) dp[i+1][j+res.first] = true;
			if(j + res.second <= X[v]) dp[i+1][j+res.second] = true;
		}
	}
	
	for(int i = X[v]; i >= 0; i--){
		if(dp[G[v].size()][i]){
			return make_pair(sum - i, X[v]);
		}
	}
	return make_pair(-1, -1);
}

int main(void)
{
	cin >> N;
	int p;
	for(int i = 2; i <= N; i++){
		cin >> p;
		G[p].push_back(i);
	}
	for(int i = 1; i <= N; i++) cin >> X[i];
	
	if(dfs(1).first >= 0) cout << "POSSIBLE" << endl;
	else cout << "IMPOSSIBLE" << endl;
	
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
// int facctorialMethod(int k){
//     int sum = 1;
//     for (int i = 1; i <= k; ++i)
//     {
//         sum *= i;
//     }
//     return sum;
// }
int main(){
    vector<int> vec(3);
    for(int i=0;i<3;i++){
        cin >> vec.at(i);
    }
    sort(vec.begin(),vec.end());
    if(vec.at(0)==vec.at(1)){
        if(vec.at(2)!=vec.at(0)){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else if(vec.at(1)==vec.at(2)){
        if(vec.at(2)!=vec.at(0)){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
def isp(n):
  for i in range(2,int(n**(1/2))+1):
    if n % i == 0:
      return False
  return True

A = [0 for i in range(50000)]
for i in range(1, 50000):
  A[i] = A[i-1]
  if isp(i+1) and isp(2*i+1):
    A[i] += 1
    
Q = int(input())
for i in range(Q):
  r, l = map(int, input().split())
  print(A[l//2]-A[max(0, r//2-1)])

Measured memory_bytes: 52328
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
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; }

int main(void){
    int A,B,C; cin >> A >> B >> C;
    int n = A, m = A%B;
    int i=0;

    while(i==0 || n%B != m){
        if(n%B == C){
            cout << "YES" << endl;
            return 0;
        }
        n += A;
        i++;
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
function main(input) {
  input=input.trim();
  const W = parseInt(input.split(" ")[0], 10);
  const H = parseInt(input.split(" ")[1], 10);
  const x = parseInt(input.split(" ")[2], 10);
  const y = parseInt(input.split(" ")[3], 10);
  console.log(W*H/2);
  if(W/2==x&&H/2==y){
    console.log(1);
  }else{
    console.log(0);
  }
  
}



main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 21064
#!/usr/bin/python3
# -*- coding: utf-8 -*-

n, x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]

ans = 0
if a[0] > x:
    ans += a[0] - x
    a[0] = x
for i, v in enumerate(a[:-1]):
    if a[i] + a[i + 1] > x:
        ans += a[i] + a[i + 1] - x
        a[i + 1] = x - a[i]

print(ans)


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

using namespace std;
int cuts(const vector<vector<int>>& grid, int mask, int k, int h, int w) {
  // h-1 bits
  vector<int> cuts;
  for (int i = 0; i < h - 1; ++i)
    if (mask & (1 << i))
      cuts.push_back(i);
  cuts.push_back(10);
  vector<int> pieces(cuts.size());
  int c(0);
  
  for (int j = 0; j < w; ++j) {
    int x(0);
    for (int i = 0; i < h; ++i)
      pieces[i == cuts[x] ? (x++) : x] += grid[i][j];
    
    bool test(true);
    for (int n = 0; n < pieces.size(); ++n) {
      if (pieces[n] > k) {
        c++;
        memset(&pieces[0], 0, 4 * pieces.size());
        x = 0;
        
        for (int i = 0; i < h; ++i) {
          if (pieces[x] == k && grid[i][j]) return -1;
          pieces[i == cuts[x] ? (x++) : x] += grid[i][j];
        }
      }
    }
  }
  
  return c;
}

int main() {
  int h, w, k;
  char c;
  cin >> h >> w >> k;
  vector<vector<int>> grid(h, vector<int>(w));
  for (int i = 0; i < h; ++i)
    for (int j = 0; j < w; ++j) {
      cin >> c;
      grid[i][j] = c - '0';
    }
  int hs(1 << (h - 1)), ans(h + w - 2);
  for (int mask = 0; mask < hs; ++mask) {
    int t = cuts(grid, mask, k, h, w);
    ans = min(ans, t == -1 ? h + w - 2 : __builtin_popcount(mask) + t);
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
a, b, k = map(int, input().split())

ans_A = []
ans_B = []
for i in range(a, min(b, a + k)):
    ans_A.append(i)
for i in range(max(a, b - k + 1), b+1):
    ans_B.append(i)
ans = sorted(list(set(ans_A) | set(ans_B)))

for i in ans:
    print(i)

Measured memory_bytes: 9116
//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 200005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

ll arr[MAX];

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

    int n, k;

    cin>>n>>k;

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

    sort(arr, arr + n);
    reverse(arr, arr + n);

    ll sum = 0;
    for(int i = k; i < n; i++){
        sum += arr[i];
    }

    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define WHOLE(v) v.begin(), v.end()
using namespace std;
int main() {
    string S;
    cin >> S;
    sort(WHOLE(S));
    if(S[0] == S[1] && S[2] == S[3] && S[1] != S[2]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef vector<int>         vi;
const int mod = 1000000007;


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x;
    cin>>x;
    int ele = x/11LL;
    int rem = x%11LL;
    if(rem==0){
        cout<<ele*(2LL)<<endl;
    }
    else if(rem<=6){
        cout<<ele*(2LL)+(1LL)<<endl;
    }
    else{
        cout<<ele*(2LL)+(2LL)<<endl;
    }
    }
    
    






















Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");;
	var N = Number(input[0].split(" ")[0]);
    var M = Number(input[0].split(" ")[1]);
    var S = input[1];
    var ans;
    
    if(N <= M){
        ans = N;
    }else{
        var ansArray = new Array();
        var presentIdx = 0;
        for(var i=M; i>0; i--){
            if(N-presentIdx-i <= 0){
                ansArray.unshift(N-presentIdx);
                presentIdx = N;
                break;
            }
            if(S[N-presentIdx-i] == "0"){
                ansArray.unshift(i);
                presentIdx += i;
                i = M + 1;
            }
        }
      	if(ansArray.length != 0 && N == presentIdx){
            ans = ansArray.join(" ");
        }else{
            ans = -1;
        }
    }
	//出力
	console.log('%s',ans);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 14284
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner scanner = new Scanner(System.in);

		while (true) {
			// 文字列入力
		String strLine = scanner.next();
			if (("-").equals(strLine)) {
				break;
			}
			// 入れ替え回数
			int intCount = scanner.nextInt();

			for (int intI = 0; intI < intCount; intI++) {
				// 入れ替える文字数を入力して入れ替え
				int intNum = scanner.nextInt();
				strLine = strLine.substring(intNum) + strLine.substring(0,intNum);
			}
			System.out.println(strLine);
		}
	}
}



Measured memory_bytes: 26488
h, w = map(int, input().split())
a = [list(input()) for x in range(h)]

row = [False]*h
col = [False]*w

for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            col[j] = True
            row[i] = True

for x in range(h):
    if row[x]:
        for y in range(w):
            if col[y]:
                print(a[x][y], end='')
        print()
        

Measured memory_bytes: 4596
from fractions import gcd

n, m = map(int, input().split())
a = list(map(int, input().split()))
b = [a[i]//2 for i in range(n)]
lcm_a = 1
for i in range(n):
    lcm_a = (lcm_a * b[i]) // gcd(lcm_a, b[i])
for i in range(n):
    if (lcm_a//b[i]) % 2 == 0:
        print(0)
        exit()
if m < lcm_a:
    print(0)
else:
    m -= lcm_a
    print(1 + m // (lcm_a*2))

Measured memory_bytes: 16316