akhauriyash/Code-Regression huggingface dataset:
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define exf(x)	 for(auto&& tmp : x) { cout << tmp << endl; }	// 拡張for
#define PI 3.14159265358979323846264338327950288
#define testP	 cout << "------------------ test ------------------" << endl;	// 動作確認テスト
#define testX(x) cout << "testout : " << x << endl;	// テストアウト
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

// ------------------ ベクター表示 ------------------ //
void printVec(vector<int>& vec) {
	cout << "";
	for (auto it = vec.begin(); it != vec.end(); it++) cout << *it << " ";
	cout << endl;
}

// ------------------ ベクター合計 ------------------ //
int sumVec(vector<int> v) {
	int sum = 0;
	for (size_t i = 0; i < v.size(); i++) sum += v[i];
	return sum;
}

// -------------------------------------------------- //
// ------------------ ここから本編 ------------------ //
// -------------------------------------------------- //

int main(void) {

	int N, M, C;
	cin >> N >> M >> C;
	int cnt = 0;

	int B[22];
	rep(i, M) cin >> B[i];

	int A[22][22];
	rep(i, N) {
		int tmp = 0;
		rep(j, M) {
			cin >> A[i][j];
			tmp += A[i][j] * B[j];
		}
		if (tmp + C > 0)cnt++;
	}

	cout << cnt << endl;
	return 0;
}


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

using namespace std;

#define int long long

const int N = 2e5 + 100;
vector<int> adj[N];
int n, m, vis[N], dis[N];
stack<int> stk;

void dfs(int u) {
    vis[u] = 1;
    for (auto it:adj[u]) {
        if (!vis[it]) {
            dfs(it);
        }
    }
    stk.push(u);
}

void solve() {
    cin >> n >> m;
    for (int i = 1; i <= m; i++) {
        int u, v;
        cin >> u >> v;
        adj[u].push_back(v);
    }
    memset(vis, 0, sizeof(vis));
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (!vis[i]) {
            dis[i] = 0;
            dfs(i);
        }
    }
    while (!stk.empty()) {
        int node = stk.top();
        stk.pop();
        for (auto it:adj[node]) {
            dis[it] = max(dis[it], dis[node] + 1);
            ans = max(ans, dis[it]);
        }
    }
    cout << ans << "\n";
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    //cin>>t;
    while (t--) {
        solve();
    }
}

Measured memory_bytes: 13312
use std::cmp;
use std::collections::BinaryHeap;

#[derive(Copy, Clone, Eq, PartialEq)]
struct State {
    i: usize,
    cost: i64,
}

impl Ord for State {
    fn cmp(&self, other: &State) -> std::cmp::Ordering {
        other.cost.cmp(&self.cost)
    }
}

impl PartialOrd for State {
    fn partial_cmp(&self, other: &State) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}

fn main() {
    let stdin = std::io::stdin();
    let mut sc = scanner::Scanner::new(stdin.lock());
    let x: usize = sc.read();
    let y: usize = sc.read();
    let z: usize = sc.read();
    let n = x + y + z;
    let mut a: Vec<i64> = vec![];
    let mut b: Vec<i64> = vec![];
    let mut c: Vec<i64> = vec![];
    for _ in 0..n {
        a.push(sc.read());
        b.push(sc.read());
        c.push(sc.read());
    }

    let mut s = (0..n)
        .map(|i| (a[i] - b[i], a[i], b[i], c[i]))
        .collect::<Vec<_>>();
    s.sort();

    let mut heap = BinaryHeap::new();
    let mut b_sum = 0;
    let mut c_sum = 0;
    let mut max_bc = vec![(0, 0); n];
    for (i, &(_, _, b, c)) in s.iter().enumerate() {
        heap.push(State { i: i, cost: b - c });
        b_sum += b;
        if heap.len() == y + 1 {
            let min = heap.pop().unwrap();
            let (_, _, b, c) = s[min.i];
            b_sum -= b;
            c_sum += c;
        }
        max_bc[i] = (b_sum, c_sum);
    }

    let mut heap = BinaryHeap::new();
    let mut a_sum = 0;
    let mut c_sum = 0;
    let mut max_ac = vec![(0, 0); n];
    for (i, &(_, a, _, c)) in s.iter().enumerate().rev() {
        heap.push(State { i: i, cost: a - c });
        a_sum += a;
        if heap.len() == x + 1 {
            let min = heap.pop().unwrap();
            let (_, a, _, c) = s[min.i];
            a_sum -= a;
            c_sum += c;
        }
        max_ac[i] = (a_sum, c_sum);
    }

    let mut ans = 0;
    for i in (y - 1)..n {
        if i + 1 > n - x {
            break;
        }
        let (a, c1) = max_ac[i + 1];
        let (b, c2) = max_bc[i];
        ans = cmp::max(ans, a + b + c1 + c2);
    }
    println!("{}", ans);
}

pub mod scanner {
    use std::fmt::Debug;
    use std::io::Read;
    use std::str::{self, FromStr};

    pub struct Scanner<R: Read> {
        reader: R,
        buf: Vec<u8>,
    }

    impl<R: Read> Scanner<R> {
        pub fn new(reader: R) -> Self {
            Scanner {
                reader: reader,
                buf: Vec::new(),
            }
        }

        pub fn read<T>(&mut self) -> T
        where
            T: FromStr,
            T::Err: Debug,
        {
            self.buf.clear();
            for c in self
                .reader
                .by_ref()
                .bytes()
                .map(|b| b.unwrap())
                .skip_while(|&b| (b as char).is_whitespace())
                .take_while(|&b| !(b as char).is_whitespace())
            {
                self.buf.push(c);
            }

            unsafe { str::from_utf8_unchecked(&self.buf) }
                .parse()
                .expect("Parse error.")
        }
    }
}


Measured memory_bytes: 21660
import itertools
def Cal_Dist(i,j):
    a=((i[0]-j[0])**2+(i[1]-j[1])**2)**0.5
    return a

N=int(input())

town=[[0]*2 for i in range(N)]
for i in range (N):
    xy=list(map(int,input().split()))
    town[i]=xy
R=list(itertools.permutations(range(N)))

distance=[]


for k in range(len(R)):
    temp_town=[]
    for h in range(N):
        temp_town.append(town[R[k][h]])
    
    temp_distance=[]
    for i in range (N-1):
        distance_sections=Cal_Dist(temp_town[i],temp_town[i+1])
        temp_distance.append(distance_sections)
    else:
        distance.append(sum(temp_distance))
        # print(a,b,c,temp_distance)

# print(town)
# print(R)
print(sum(distance)/len(R))

Measured memory_bytes: 15700
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		final int K = sc.nextInt();
		final int S = sc.nextInt();
		
		int counter = 0;
		for( int i = 0; i <= K; i++){
			for( int j = 0 ; j <= K; j++){
				int k = S - i - j ;
				if( 0 <= k && k <= K){
						counter++;
				} 
			}
		}
		System.out.println(counter);
	}
}

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

int main() {
  int n; cin >>n;
  vector<int> d(n);
  for (int i=0; i<n; i++) cin >>d.at(i);
  sort(d.begin(), d.end());
  int ans = d.at(n/2) - d.at(n/2-1);
  cout <<ans;
  cout <<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;
// const int MOD = 998244353;

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

   int n;
   cin >> n;
   int one = n % 10;
   if (one == 2 || one == 4 || one == 5 || one == 7 || one == 9) {
      printf("hon\n");
   } else if (one == 0 || one == 1 || one == 6 || one == 8) {
      printf("pon\n");
   } else {
      printf("bon\n");
   }
   return 0;
}

Measured memory_bytes: 3604
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
typedef long long ll;
#include <cmath>
#include <iomanip>

const int MOD = 1000000007;


int main(int argc, char *argv[])
{
	int x;
	cin>>x;
	cout<<(1-x)<<endl;
	return 0;
}



Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define ll  long long int
#define pb push_back
int main()
{
    ll i,j,k,l,m,n,x,y,a[100005],b[100005],c[100005],v[300005],d,p;
    cin>>x>>y>>l>>m>>n;
    for(i=0;i<l;i++)
    {
        scanf("%lld",&a[i]);
    }
    for(i=0;i<m;i++)
    {
        scanf("%lld",&b[i]);
    }
    for(i=0;i<n;i++)
    {
        scanf("%lld",&c[i]);
    }
    sort(a,a+l);
    sort(b,b+m);
    if(x+y<n)
    {
        sort(c,c+n);
        j=0;
        d=x+y;
        while(d--)
        {
            v[j]=c[n-1];
            j++;
            n--;
        }
    }
    else
    {
        j=0;
        for(i=0;i<n;i++)
        {
            v[j]=c[i];
            j++;
        }
    }
    d=x+y;
    while(x--)
    {
        v[j]=a[l-1];
        j++;
        l--;
    }
    while(y--)
    {
        v[j]=b[m-1];
        j++;
        m--;
    }
    sort(v,v+j);
    p=0;
    while(d--)
    {
        p+=v[j-1];
        j--;
    }
    printf("%lld\n",p);
    return 0;
}

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

int main(void){
  int r,c;
  int spredSheet[105][105];
  cin >> r >> c;
  for(int i = 0; i < r; i++){
	for(int j = 0; j < c; j++){
	  cin >> spredSheet[i][j];
	}
  }

  int sum = 0;
  for(int i = 0; i < r; i++){
	for(int j = 0; j < c; j++){
	  sum += spredSheet[i][j];
	}
	spredSheet[i][c] = sum;
	sum = 0;
  }
  for(int j = 0; j < c; j++){
	for(int i = 0; i < r; i++){
	  sum += spredSheet[i][j];
	}
	spredSheet[r][j] = sum;
	sum = 0;
  }
  for(int i = 0; i < r; i++){
	for(int j = 0; j < c; j++){
	  sum += spredSheet[i][j];
	}
  }
  spredSheet[r][c] = sum;

  for(int i = 0; i < r + 1; i++){
	for(int j = 0; j < c + 1; j++){
	  if(j == c)
		cout << spredSheet[i][j];
	  else
		cout << spredSheet[i][j] << " ";
	}
	cout << endl;
  }

  return 0;
}
	  
	
  



Measured memory_bytes: 3128
N,Y = map(int, input().split())
a,b,c = -1,-1,-1
for i in range(N+1):
    for j in range(N+1-i):
        k = N-i-j
        s = 10000*i + 5000*j + 1000*k
        if s == Y:
            a = i
            b = j
            c = k             
print(a,b,c)


Measured memory_bytes: 9100
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

//gcd,lcm,べき,二進展開
//組み合わせ、mod計算
//最短路問題、bit、union find

///////////////////////////


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

	if (b >= a) { cout << a;}
	else { cout << a - 1; }
	system("PAUSE");
}

Measured memory_bytes: 504
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main(void){
    int a,b,c,d,ans;
    char buf[100];
    // Your code here!
    fgets(buf, sizeof(buf), stdin);
    sscanf(buf, "%d %d %d %d", &a,&b,&c,&d);
    
    if(abs(a-c)<=d){                        //直接可能
        ans=1;
    }else if(abs(a-b)<=d && abs(b-c)<=d){   //間接可能
        ans=1;
    }else{
        ans=0;
    }
    switch(ans){
        case 1:
            printf("Yes");
            break;
        case 0:
            printf("No");
            break;
    }
}

Measured memory_bytes: 128
#include "bits/stdc++.h"

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

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cerr << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define debug(...) CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) (__VA_ARGS__)

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

void Main() {
  int k, n;
  cin >> k >> n;
  vector<int> A(n);
  rep(i, n) cin >> A[i];
  vector<int> diff(n);
  rep(i, n-1) diff[i] = A[i+1] - A[i];
  diff[n-1] = A[0] + k - A[n-1];
  sort(diff.begin(), diff.end());
  ll ans = 0;
  rep(i, n-1) ans += diff[i];
  cout << ans << endl;
}

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



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define tt this->
#define ll long long
using namespace std;
int main ()
{
string c1,c2,a;
int x,y;
cin>>c1>>c2>>x>>y>>a;
if (a==c1)x--;
else
    y--;
cout<<x<<" "<<y;

    return 0;
}

/*
▀█████████▄     ▄████████    ▄████████    ▄████████
  ███    ███   ███    ███   ███    ███   ███    ███
  ███    ███   ███    ███   ███    ███   ███    ███
 ▄███▄▄▄██▀    ███    ███  ▄███▄▄▄▄██▀   ███    ███
▀▀███▀▀▀██▄  ▀███████████ ▀▀███▀▀▀▀▀   ▀███████████
  ███    ██▄   ███    ███ ▀███████████   ███    ███
  ███    ███   ███    ███   ███    ███   ███    ███
▄█████████▀    ███    █▀    ███    ███   ███    █▀
                            ███    ███

*/



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

int main(){
	char c;
	cin >> c;
	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
		cout << "vowel" << endl;
	}
	else{
		cout << "consonant" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int ,input().split()))
d = dict()
for x in a:
  if x in d:
    d[x] += 1
  else:
    d[x] = 1
ans = 0
for x in d:
  if d[x] < x:
    ans += d[x]
  else:
    ans += d[x] - x
print(ans)

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

using namespace std;

struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク

    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};

int main(){
  int N,K,L;
  cin >> N >> K >> L;
  UnionFind road(N);
  UnionFind train(N);
  rep(i,K){
    int p,q;
    cin >> p >> q;
    p--; q--;
    road.merge(p,q);
  }

  rep(i,L){
    int r,s;
    cin >> r >> s;
    r--; s--;
    train.merge(r,s);
  }

  map<pair<int,int>, int > Route;
  rep(i,N){
    Route[make_pair(train.root(i),road.root(i))] ++;
  }
  rep(i,N){
    //cout << i<< " : "<<townRoad[i] << ' ' << townTrain[i] << endl;
    if(i != N-1) cout << Route[make_pair(train.root(i),road.root(i))] <<  ' ';
    else         cout << Route[make_pair(train.root(i),road.root(i))] <<  endl;
  }
  return 0;
}


Measured memory_bytes: 15104
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define LL long long

using namespace std;

LL v[105],w[105],dp[105][100005];

LL solve(int pos,int rem) {
    if (rem<0) return INT_MAX;
    if (pos<0) return INT_MAX;
    if (rem==0) return 0;
    if (dp[pos][rem]!=-1) return dp[pos][rem];
    return dp[pos][rem]=min(solve(pos-1,rem),solve(pos-1,rem-v[pos])+w[pos]);
}

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    LL m;
    cin >> n >> m;
    for (int i=1;i<=n;i++) cin >> w[i] >> v[i];  
    memset(dp,-1,sizeof(dp));
    int ans=0;
    for (int i=1;i<=100000;i++) {
        if (solve(n,i)<=m) ans=i;
    }
    cout << ans << endl;  
    return 0;
}


Measured memory_bytes: 82304
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;
/// khodaya komak kon
/// ya navid navid
const int N=2e5+100;
vector <int> g[N];
ll dp[N][2];

ll dfs(ll v,ll p){
    ll p1=0;
    for (int i=0;i<g[v].size();i++){
        ll u=g[v][i];
        if (u==p){
            continue;
        }
        dfs(u,v);
        dp[v][1]+=dp[u][1];
        if (dp[u][1]==0){
            p1++;
        }
    }
    p1=max(p1-1,(ll)0);
    dp[v][1]+=p1;

    //cout << v << " " << dp[v][0] << " " << dp[v][1] << endl;
}
int32_t main(){
    ll n;
    cin >> n;
    ll ans=0;
    for (int i=0;i<n-1;i++){
        ll u,v;
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    //cout << ans+1 << endl;
    vector <int> b;
    for (int i=0;i<n;i++){
        if (g[i].size()==1){
            b.pb(i);
        }
    }

    ll mi=1e9+100;
    for (int i=0;i<min((ll)10,(ll)b.size());i++){
        ll v=b[i];
        memset(dp,0,sizeof dp);
        dfs(v,v);

        mi=min(mi,dp[g[v][0]][1]+1);
    }
    cout << mi;
}


Measured memory_bytes: 15744
import numpy as np
n = int(input())
a = np.array([int(i) for i in input().split()])
d = a.min()
while True:
    a1 = a % d
    if all(a1 == 0):
        ans = d
        break
    d = min(a1[a1 != 0])    
print(ans)

Measured memory_bytes: 37840
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;

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

    int sum=0;
    sort(L.begin(),L.end(),greater<int>());

    for(int i=0;i<N-2;i++){
        for(int j=i+1;j<N;j++){
            for(int k=j+1;k<N;k++){
                if(L[i]<L[j]+L[k] && L[j]<L[i]+L[k]){
                    //cerr << L[i] << " " << L[j] << " " << L[k] << endl;
                    sum++;
                }
            }
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from heapq import heappop,heappush
from bisect import bisect,bisect_left
N,Q=map(int,input().split())
table=[]
for i in range(N):
    s,t,x=map(int,input().split())
    if t-1-x<0:
        continue
    #print((max(0,s-x),t-1-x))
    table.append((x,max(0,s-x),t-1-x))
H=[]
D=[int(input()) for i in range(Q)]
#print(D)
for x,a,b in table:
    #print(x,a,b,(x,bisect_left(D,a),bisect(D,b)))
    heappush(H,(bisect_left(D,a),bisect(D,b),x))
K=[]
U=[10**12]*Q
J=[]
for i in range(Q):
    while len(H)>0 and H[0][0]<=i:
        a,b,x=heappop(H)
        heappush(J,(x,a,b))
    while len(J)>0 and J[0][2]<=i:
        x,a,b=heappop(J)
    if len(J)>0:
        U[i]=min(U[i],J[0][0])
    #print(i,J,H,U[i])
for i in range(Q):
    if U[i]==10**12:
        print(-1)
    else:
        print(U[i])


Measured memory_bytes: 76336
/*****include*****/
#include <iostream>
#include <set>
/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
/*****変数置き場*****/
	int n;
	int field[11][11];
	bool wrong[10];
	bool fail[11][11];
	int table_x[] = {0,1,2,0,1,2,0,1,2};
	int table_y[] = {0,0,0,1,1,1,2,2,2};
	set <int>appear;
	/*****処理部*****/
	cin >> n;
	while(n>0){
		n--;
		for(int i=0;i<11;i++)
			for(int j=0;j<11;j++){
				field[i][j] = 0;
				fail[i][j] = 0;
			}
		for(int i=0;i<10;i++)
			wrong[i] = false;
		for(int i=1;i<=9;i++)
			for(int j=1;j<=9;j++)
				cin >> field[i][j];
		appear.clear();
		
		for(int i=1;i<=9;i++){
			for(int j=1;j<=9;j++){
				if(appear.find(field[i][j]) != appear.end()){
					wrong[field[i][j]] = true;
				}else
					appear.insert(field[i][j]);
			}
			appear.clear();
			for(int k=1;k<=9;k++)
				if(wrong[field[i][k]])
					fail[i][k] = true;
			for(int k=0;k<10;k++){
				wrong[k] = false;
			}
		}
		for(int j=1;j<=9;j++){
			for(int i=1;i<=9;i++){
				if(appear.find(field[i][j]) != appear.end()){
					wrong[field[i][j]] = true;
				}else
					appear.insert(field[i][j]);
			}
			appear.clear();
			for(int k=1;k<=9;k++)
				if(wrong[field[k][j]])
					fail[k][j] = true;
			for(int k=0;k<10;k++){
				wrong[k] = false;
			}
		}

		for(int i=1;i<=9;i+=3)
			for(int j=1;j<=9;j+=3){
				for(int k=0;k<9;k++)
					if(appear.find(field[i+table_y[k]][j+table_x[k]]) != appear.end())
						wrong[field[i+table_y[k]][j+table_x[k]]] = true;
					else
						appear.insert(field[i+table_y[k]][j+table_x[k]]);
				appear.clear();
				for(int k=0;k<9;k++)
					if(wrong[field[i+table_y[k]][j+table_x[k]]])
						fail[i+table_y[k]][j+table_x[k]] = true;
				for(int k=0;k<10;k++){
					wrong[k] = false;
				}
			}
		
		for(int i=1;i<=9;i++){
			for(int j=1;j<=9;j++){
				if(fail[i][j])
					cout << "*";
				else
					cout << " ";
				cout << field[i][j];
			}
			cout << endl;
		}
		if(n!=0)	cout << endl;
	}
	/*****処理終了後*****/
	return 0;
}

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

using namespace std;

typedef long long ll;

void cldflm()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(0);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w" , stdout);
#endif
}

int main()
{

	cldflm();

	int arr[105];
	int n, cnt = 0;

	cin >> n;

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

	for (int i = 0; i < n; i += 2)
	{
		if (arr[i] % 2 == 1)
			cnt++;
	}

	cout << cnt;

	return 0;
}



Measured memory_bytes: 3608
A_hp, B_attack, C_hp, D_attack = map(int, input().split())
turn = 0
while A_hp > 0 and C_hp > 0:
    turn = turn + 1
    if turn%2 == 1:
        C_hp = C_hp - B_attack
    else:
        A_hp = A_hp - D_attack
if turn%2 == 1:
    print('Yes')
else:
    print('No')
    

Measured memory_bytes: 9168
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb emplace_back
#define koto_memory(a) cout<<(sizeof(a)/1048576.0)<<" MB";
#define res(v) sort(all(v)),v.erase(unique(all(v)), v.end());
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
#define deb(x) cout<<"\n["<<#x<<" = "<<x<<"]\n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
int n,child[N][26],is_end[N*26],nxt=1,ans;string s[N];vvi a;
void solve(){
  cin>>n;a.resize(n+1);
  rep(i,1,n){
    cin>>s[i];
    reverse(s[i].begin(),s[i].end());
    int node=0;
    for(int j=0;j<s[i].length();j++){
      a[i].push_back(node);
      if(child[node][s[i][j]-'a']==0)
        child[node][s[i][j]-'a']=nxt++;
      node=child[node][s[i][j]-'a'];
    }
    is_end[node]=1;
  }
  rep(i,1,n){
    set<int>prefix;
    //s[i].length()-1 elements must match in original string
    for(int j=s[i].length()-1;j>-1;j--){
      prefix.insert(s[i][j]);
      int node=a[i][j];
      for(auto tmp:prefix)
        if(is_end[child[node][tmp-'a']]==1)
          ans++;
    }
  }
  cout<<ans-n;
}
int32_t main()
{
  ibs;cti;
  solve();return 0;
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 287416
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int main() {
    int S;
    cin >> S;
    int h = S / 3600;
    int m = (S / 60) % 60;
    int s = S % 60;
    cout << h << ":" << m << ":" << s << endl;
    return 0;
}


Measured memory_bytes: 3136
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int  main(){
	int a[3];
	for(int i=0;i<3;i++){
		scanf("%d",&a[i]);
	} 
	sort(a,a+3);
	if(a[0]+a[1]==a[2]){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for (ll i = (begin); i < (end); i++)
#define REP(i, n) FOR(i, 0, n)
#define IFOR(i, begin, end) for (ll i = (begin)-1; i >= (end); i--)
#define IREP(i, n) IFOR(i, n, 0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(), greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v)                                                              \
  cout << #v << "=(" << v[0];                                                  \
  FOR(i_debug, 1, v.size()) { cout << "," << v[i_debug]; }                     \
  cout << ")" << endl;
#define mdebug(m)                                                              \
  cout << #m << "=" << endl;                                                   \
  REP(i_debug, m.size()) {                                                     \
    REP(j_debug, m[i_debug].size()) { cout << m[i_debug][j_debug] << ","; }    \
    cout << endl;                                                              \
  }
#define Lower_bound(v, x)                                                      \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x)                                                      \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;

template <typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) {
  REP(i, a.size()) {
    cin >> a[i];
    a[i]--;
  }
}

ll mod = 1000000007;

int main() {
  ll r, g, b;
  cin >> r >> g >> b;

  ll ans = r * 100 + g * 10 + b;

  if (ans % 4 == 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

using namespace std;

typedef long long ll;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>pb_ds;

#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
#define pi pair<int,int>
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define mod 1000000007
#define pai acos(-1)
#define N 1000000

map<int,int>mp;
int prime[N+5],ar[N+5];

void sieve(){
   for(int i=1;i<=N;i++) prime[i]=i;
   for(int i=2;i<=N;i++){
      if(prime[i]==i){
         for(int j=i+i;j<=N;j+=i) prime[j]=i;
      }
   }
   return ;
}

int main ()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   sieve();
   int n;cin>>n;
   int gc=0;
   for(int i=1;i<=n;i++){
      cin>>ar[i];
      gc=__gcd(gc,ar[i]);
   }
   for(int i=1;i<=n;i++){
      while(ar[i]>1){
         int p=prime[ar[i]];
         while(ar[i]%p==0) ar[i]/=p;
         mp[p]++;
      }
   }
   int mx=0;
   for(auto tp:mp){
      mx=max(tp.S,mx);
   }
   if(mx==1||mx==0) cout<<"pairwise coprime\n";
   else if(gc==1) cout<<"setwise coprime\n";
   else cout<<"not coprime\n";
   return 0;
}



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

#define nth(b, n) ((b) & (1 << n))
#define bit(n)  (1 << (n))

int n;
bool a[N][N];
ll dp[N][1<<N];

int next_combination(int s) {
    int x = s & -s;
    int y = s + x;
    return ((s & ~y) / x) >> 1 | y;
}

ll mod(ll n) {
    n %= MOD;
    if(n < 0)  n += MOD;
    return n;
}

ll modadd(ll &a, ll b) {
    return a = mod( mod(a) + mod(b) );
}

int main() {
    int n;
    cin >> n;
    for(int m = 0; m < n; m++)  for(int w = 0; w < n; w++)  cin >> a[m][w];
    for(int w = 0; w < n; w++)  dp[0][bit(w)] = a[0][w];

    for(int m = 0; m < n-1; m++) {
        for(int s = bit(m+1)-1; s < bit(n); s = next_combination(s)) {
            for(int w = 0; w < n; w++)
                if(a[m+1][w] && !nth(s, w))
                    modadd(dp[m+1][s|bit(w)], dp[m][s]);
        }
    }

    cout << dp[n-1][bit(n)-1] << endl;
}

Measured memory_bytes: 307584
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
MOD = 10**9+7
for i in range(2, 2*10**5+1):
    g1.append((g1[-1] * i) % MOD)
    inverse.append((-inverse[MOD % i] * (MOD // i)) % MOD)
    g2.append((g2[-1] * inverse[-1]) % MOD)

def comb(n, r, mod=MOD):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n-r] % mod

H, W, A, B = map(int, input().split())
ans = 0
n = H + W - B - 1
for i in range(1, H-A+1):
  ans += comb(n-i, H-i) * comb(B+i-2, B-1) % MOD
  ans %= MOD

print(ans)

Measured memory_bytes: 27120
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	n := nextInt()
	d := nextInt()

	cnt := 0
	for i := 0; i < n; i++ {
		x := nextInt()
		y := nextInt()
		dist := math.Sqrt(float64(x*x + y*y))
		if dist <= float64(d) {
			cnt++
		}
	}

	fmt.Println(cnt)
}

// ---- readfunc
func scanInit() {
	const cap = 64 * 1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 4972
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef gp_hash_table<int, null_type,hash<int>, equal_to<int>, direct_mask_range_hashing<int>, linear_probe_fn<>,
    hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>,true>> hash_set;
typedef gp_hash_table<int,null_type> hash_map;

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define all(a) a.begin(),a.end()
#define println printf("\n");
#define readln(x) getline(cin,x);
#define pb push_back
#define endl "\n"
#define INT_INF 0x3f3f3f3f
#define LL_INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-9
#define MOD 1000000007
#define MOD2 1494318097
#define SEED 131
#define mp make_pair
#define fastio cin.tie(0); cin.sync_with_stdio(0);

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef pair<int,pii> triple;
typedef int8_t byte;

const ld PI = (ld)4*atanl(1);

mt19937 g1(chrono::steady_clock::now().time_since_epoch().count());

int randint(int a, int b){return uniform_int_distribution<int>(a, b)(g1);}
ll randlong(ll a,ll b){return uniform_int_distribution<long long>(a, b)(g1);}

ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}

char c;

int main(){
    scanf("%c",&c);
    printf("%c\n",c+1);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    int A, B, M; cin >> A >> B >> M;
    vector<int> a(A), b(B);
    for (auto &aa : a) cin >> aa;
    for (auto &bb : b) cin >> bb;
    int ans = 1e9;
    ans = min(ans, *min_element(begin(a), end(a)) + *min_element(begin(b), end(b)));
    for (int i = 0; i < M; i++) {
        int x, y, c; cin >> x >> y >> c; x--, y--;
        ans = min(ans, a[x] + b[y] - c);
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int X, Y, Z, K;
  cin >> X >> Y >> Z >> K;
  //vector<vector<char>> d(H, vector<char>(W));
  vector<long> A(X);
  vector<long> B(Y);
  vector<long> C(Z);
  for (int i=0; i<X; i++) cin >> A.at(i);
  for (int i=0; i<Y; i++) cin >> B.at(i);
  for (int i=0; i<Z; i++) cin >> C.at(i);
  vector<long> S;
  for (int i=0; i<X; i++)
    for (int j=0; j<Y; j++) {
      //cout << A.at(i) << ":" << B.at(j) << endl;
      S.push_back(A.at(i)+B.at(j));
    }
  sort(S.begin(), S.end());
  reverse(S.begin(), S.end());
  int L=min((int)S.size(), K);
  // cout << L << endl;/////////////////
  //for (int i=0; i<L; i++) cout << i << ":" << S.at(i) << endl;//////////////
  vector<long> T(L*Z);
  for (int i=0; i<L; i++)
    for (int j=0; j<Z; j++)
      T.at(i*Z+j)=S.at(i)+C.at(j);
  sort(T.begin(), T.end());
  reverse(T.begin(), T.end());
  L=min((int)T.size(), K);
  for (int i=0; i<L; i++) cout << T.at(i) << endl;
  return 0;
}


Measured memory_bytes: 31980
#include<iostream>

using namespace std;

int main(){
	int a, b, c,ans,q;
	int count = 0;

	cin >> a >> b >> c;
	
	for (int i = 1; i<=c; ++i){
		if (c%i==0){
			for (int j = 0;a+j<=b;++j){
				ans = a + j;
				if (i==ans){
					count = count + 1;
				}
			}
			
		}
	}
	cout << count<<endl;
	cin >> q;
}


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

int dp[100];

//最大公約数
int gcd(int x, int y){
  if(x % y == 0) return y;
  return gcd(y, x % y);
}
//最小公倍数
int lcm(int x, int y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}


int main(){
  set<int> poor;
  rep(i,3){
    int a;
    cin >> a;
    poor.insert(a);
  }
  if(poor.size() == 2) cout << "Yes" << endl;
  else cout << "No" << endl;
}




Measured memory_bytes: 256
n,k = map(int, input().split())
ans = [0]*n
for i in range(k):
    a=[]
    di = int(input())
    a = list(map(int, input().split()))
    for j in range(n):
        for l in range(di):
            if j+1 == a[l]:
                ans[j] = 1
print(ans.count(0))

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int a, b;
  scanf("%d %d", &a, &b);
  vector<string> board(100, string(100, '#'));
  for (int i = 50; i < 100; ++i) {
    board[i] = string(100, '.');
  }
  int white = 1, black = 1;

  if (a > white) {
    for (int r = 0; r < 49; r += 2) {
      for (int c = 0; c < 100; c += 2) {
        board[r][c] = '.';
        if (++white == a) { break; }
      }
      if (white == a) { break; }
    }
  }
  if (b > black) {
    for (int r = 51; r < 100; r += 2) {
      for (int c = 0; c < 100; c += 2) {
        board[r][c] = '#';
        if (++black == b) { break; }
      }
      if (black == b) { break; }
    }
  }

  printf("100 100\n");
  for (int i = 0; i < 100; ++i) {
    printf("%s\n", board[i].c_str());
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string rota(string ip)
{
	int i=0,s=ip.size();
	string t="";
	for(;i<s-1;i++)
	{
		t+=ip[i];
	}
	string ans=ip[i]+t;
	return ans;
}
int main(void)
{
	string ip,com,opr[110]={""};
	int i;
	cin>>ip;
	cin>>com;
	opr[0]=ip;
	if(opr[0]==com)
	{
		cout<<"Yes";
		return 0;
	}
	for(i=1;i<ip.size();i++)
	{
		opr[i]=rota(opr[i-1]);
		if(opr[i]==com)
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
} 

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

long long mod = 1000000007;

long long div(long long a, long long b, long long c) { return b / c - (a - 1) / c; }

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}
long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}

int main() {
    long long n, a = 1, b;
    double sum = 0;
    cin >> n;
    vector<int> x(n);
    vector<int> y(n);
    vector<int> perm(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i];
        cin >> y[i];
    }
    for (int i = 0; i < n; i++) {
        perm[i] = i;
    }
    for (int i = 1; i <= n; i++) {
        a *= i;
    }
    do {
        for (int i = 0; i < n - 1; i++) {
            sum += sqrt(double((x[perm[i]] - x[perm[i + 1]]) * (x[perm[i]] - x[perm[i + 1]]) +
                               (y[perm[i]] - y[perm[i + 1]]) * (y[perm[i]] - y[perm[i + 1]])));
        }
    } while (next_permutation(perm.begin(), perm.end()));
    cout << double(sum / a) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll a, b, c;
    cin >> a >> b >> c; // Aの倍数をBで割った余りがCに等しくなるか
    ll now = a % b;
    for (ll i = 0; i < b; i++) {
        if (now == c) {
            cout << "YES" << endl;
            return 0;
        }
        now = (now + a) % b;
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.Map
import scala.collection.mutable.Queue

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N = in.next().toInt
  val A = new Array[Int](N+1)
  for (i <- 1 to N)
    A(i) = in.next().toInt




  //
  def check(num: Int): Int = {
    val memo = new Array[Int](N+1)
    memo(1) = num
    memo(N) = num
    for (i <- 2 to N) {
      val tmp = A(i-1) - memo(i-1)
      memo(i-1) += tmp
      memo(i) += tmp
    }

    val res = A(N) - memo(N)
    Math.abs(res)
  }

  // 下に凸のグラフの最小値
  def ternarySearchInt(small: Int, big: Int): Int = {
    if(big - small <= 2) {
      val mid = (big + small) / 2
      if(check(big) <= check(mid)) big
      else if(check(small) <= check(mid)) small
      else mid
    }
    else{
      val midl = (big + small) / 2
      val midr = midl + 1
      if (check(midl) >= check(midr))
        ternarySearchInt(midl, big)
      else
        ternarySearchInt(small, midr)
    }
  }


  val ans = ternarySearchInt(0, 1e9.toInt)

  val memo = new Array[Int](N+1)
  val com = new Array[Int](N+1)
  memo(1) = ans
  memo(N) = ans
  com(1) = ans
  for (i <- 2 to N) {
    val tmp = A(i-1) - memo(i-1)
    com(i) = tmp
    memo(i-1) += tmp
    memo(i) += tmp
  }

  val res = A(N) - memo(N)
  Math.abs(res)

  pw.print(com(1)*2)
  for(i <- 2 to N)
    pw.print(s" ${com(i)*2}")
  pw.println
  pw.flush()
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}


Measured memory_bytes: 65672
import java.util.Arrays;
import java.util.Scanner;

public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			int L = sc.nextInt(), n = sc.nextInt(), m = sc.nextInt(), X = sc.nextInt();
			if((L|n|m|X)==0)break;
			int[] e1 = new int[n], s1 = new int[n];
			for(int i=0;i<n;i++){
				sc.next(); e1[i] = sc.nextInt(); s1[i] = sc.nextInt();
			}
//			debug(e1); debug(s1);
			int[] e2 = new int[m], s2 = new int[m];
			for(int i=0;i<m;i++){
				sc.next(); e2[i] = sc.nextInt(); s2[i] = sc.nextInt();
			}
			int[][][] dp1 = new int[n][3][L+1];
			for(int i=0;i<n;i++)for(int x=1;x<=2;x++)for(int l=0;l<=L;l++)dp1[i][x][l] = -1;
			for(int l=e1[0];l<=L;l++)dp1[0][1][l] = s1[0];
			for(int i=1;i<n;i++)for(int x=1;x<=2;x++)for(int l=0;l<=L;l++){
				int max = -1;
//				System.out.println("L:" + l);
				if(l>0)max = dp1[i][x][l-1];
				if(l-e1[i]<0){
					max = Math.max(max, dp1[i-1][x][l]); 
					dp1[i][x][l] = max;
				}
				else {
					if(dp1[i-1][x][l]>=0)max = Math.max(max, dp1[i-1][x][l]);
					if(dp1[i-1][x-1][l-e1[i]]>=0)max = Math.max(max, dp1[i-1][x-1][l-e1[i]]+s1[i]);
				}
				dp1[i][x][l] = max;
//				if(i==n-1)
//					System.out.println("i:" + i + " x:" + x + " L:" + l + " dp:" + dp1[i][x][l]);
			}
			int[][][] dp2 = new int[m][m+1][L+1];
			for(int i=0;i<m;i++)for(int x=1;x<=m;x++)for(int l=0;l<=L;l++)dp2[i][x][l] = -1;
			for(int l=e2[0];l<=L;l++)dp2[0][1][l] = s2[0];
			for(int i=1;i<m;i++)for(int x=1;x<=m;x++)for(int l=0;l<=L;l++){
				int max = -1;
				if(l>0)max = dp2[i][x][l-1];
				if(l-e2[i]<0){
					max = Math.max(max, dp2[i-1][x][l]); 
					dp2[i][x][l] = max;
				}
				else {
					if(dp2[i-1][x][l]>=0)max = Math.max(max, dp2[i-1][x][l]);
					if(dp2[i-1][x-1][l-e2[i]]>=0)max = Math.max(max, dp2[i-1][x-1][l-e2[i]]+s2[i]);
				}
//				System.out.println("i:"+i+" x:"+x+" l:"+l+" dp:"+max);
				dp2[i][x][l] = max;
			}
//			debug(dp2[0]);
//			debug(dp2[1]);
//			System.out.println("DP1:" + dp1[n-1][1][L]);
//			System.out.println("DP2:" + dp1[n-1][2][L]);
			int max = 0;
			for(int x=X;x<=m;x++)for(int l=0;l<=L;l++){
//				System.out.println("x:" + x + " L:" + l  + " dp2:" + dp2[m-1][x][l]);
				if(dp2[m-1][x][l]==-1)continue;
				if(dp1[n-1][1][L-l]==-1&&dp1[n-1][2][L-l]==-1)continue;
				int v = dp2[m-1][x][l] + Math.max(dp1[n-1][1][L-l], dp1[n-1][2][L-l]);
//				System.out.println(dp1[n-1][1][L-1]+ " "+dp1[n-1][2][L-1]);
				if(max<v){
//					System.out.println("V:" + v + " x:" + x + " L:" + l);
				}
				max = Math.max(max, v);
			}
			System.out.println(max);
		}
	}
	
	void debug(Object...o){
		System.out.println(Arrays.deepToString(o));
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}

int main() {
  int a=10,num=5;
  vector<int> n(5);
  rep(i,5) cin>>n[i];
  rep(i,5){
    if(n[i]%10!=0){
      a=min(n[i]%10,a);
      n[i]+=10-n[i]%10;
      num--;
    }
  }
  if(a==10){
    a=0;
  }
  if(num!=5){
    cout<<n[0]+n[1]+n[2]+n[3]+n[4]-(10-a)<<endl;
  }else{
    cout<<n[0]+n[1]+n[2]+n[3]+n[4]<<endl;
  }
  
}


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

const int P=1000000007;
int n,k,dp[105][3282];

int power(int a,int x){
	int ans=1;
	for(;x;x>>=1,a=1LL*a*a%P)if(x&1)ans=1LL*ans*a%P;
	return ans;
}
void upd(int &x,int y){
	x=x+y>=P?x+y-P:x+y;
}

int main(){
	scanf("%d%d",&n,&k);
	dp[n+1][0]=1;
	for(int i=n;i;--i)
		for(int j=0;j<=3281;++j)
			if(dp[i+1][j]){
				for(int a=0;a<=i&&a<=k;++a)
					upd(dp[i][j+(a+j)/i],dp[i+1][j]);
				if(i<k)
					dp[i][j]=(dp[i][j]+1LL*(k-i)*dp[i+1][j])%P;
			}
	int ans=1LL*n*(1+k)*k/2*power(k+1,n-1)%P;
	for(int i=1;i<=3281;++i)
		ans=(ans-1LL*dp[1][i]*i)%P;
	printf("%d\n",(ans+P)%P);
}


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

using namespace std;

using ll = long long;

int main() {
  const int sqrtN = 512;
  int n, q;
  cin >> n >> q;
  int bucket_sz = (n+sqrtN-1)/sqrtN;
  vector<ll> a(n, (1LL<<31)-1);
  vector<ll> bucketMin(bucket_sz, (1LL<<31)-1);
  auto update = [&](int k, int x) {
    a[k] = x;
    k /= sqrtN;
    int l = k*sqrtN, r = (k+1)*sqrtN;
    ll mn = x;
    for(int i = l; i < r; ++i) mn = min(mn, a[i]);
    bucketMin[k] = mn;
  };
  auto query = [&](int s, int t)->ll{
    ll res = (1LL<<31)-1;
    for(int i = 0; i < bucket_sz; ++i) {
      int l = i*sqrtN, r = (i+1)*sqrtN;
      if(r <= s || t <= l) continue;
      if(s <= l && r <= t) res = min(res, bucketMin[i]);
      else {
	for(int j = max(s, l); j < min(t, r); ++j) {
	  res = min(res, a[j]);
	}
      }
    }
    return res;
  };
  while(q--) {
    ll t, x, y;
    cin >> t >> x >> y;
    if(t == 0) update(x, y);
    else cout << query(x, y+1) << endl;
  }

  return 0;
}



Measured memory_bytes: 3576
#include<iostream>
using namespace std;
int main()
{
    int N;
    cin>>N;
    int a[N],x=0;
    for(int i=1;i<=N;i++){
        cin>>a[i];
        if(i%2==1&&a[i]%2==1)
            x++;
    }
    cout<<x<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<n;++i)
#define ll long long

using namespace std;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

ll int gcd(ll int m, ll int n) {
   if (m == 0) {
     return n;
   } 
   if (n == 0) {
     return m;
   }
 
   if (m >= n) {
     return gcd(m%n, n);
   } else {
     return gcd(m, n%m);
   }
 }

ll int A;
ll int B;

int main () {
  scanf("%lld%lld", &A, &B);
  ll int n = gcd(A, B);
  ll int tmp = n;

  int ans = 0;

  for (ll int i=2;i*i<=n;++i) {
    if (tmp % i == 0) {
      ans++;
      while (tmp % i == 0) {
        tmp /= i;
      }
    }
  }
  if (tmp != 1) ans++;

  printf("%d\n", ans+1);
}

Measured memory_bytes: 256