akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define sanyes ios_base::sync_with_stdio(0), cout.tie(0); cin.tie(0);
#define llong long long int
#define pb push_back
#define bpc __builtin_popcount
#define f first
#define s second

const llong mxn = 1e5 + 7;
const llong mod = 1e9 + 7;
const llong inf = 1e18 + 9;

using namespace std;

llong cntn = 0, cnts = 0, cntw = 0, cnte = 0;

string s;

int main(){
    cin >> s;
    for (int i = 0; i < s.size(); i ++){
        if(s[i] == 'N'){
            cntn ++;
        }else if(s[i] == 'S'){
            cnts ++;
        }else if(s[i] == 'W'){
            cntw ++;
        }else{
            cnte ++;
        }
    }if((cntn && cnts && ((!cntw && !cnte) || (cntw && cnte))) || (cntw && cnte && ((!cntn && !cnts) || (cntn && cnts)))){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        String s = sc.next();
        int len = s.length();
        String ans = "";
        for (int i = 0; i < len; i++) {
            ans += "x";
        }
        System.out.println(ans);
    }



    private static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte())
                return buffer[ptr++];
            else
                return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr]))
                ptr++;
            return hasNextByte();
        }

        public String next() {
            if (!hasNext())
                throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong() {
            if (!hasNext())
                throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
                throw new NumberFormatException();
            return (int) nl;
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }

}



Measured memory_bytes: 21204
#include <iostream>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int main() {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans += i;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	Scanner sc;
	
	double solve(double[][] point,int n){
		double[][] v=new double[n-1][2];
		for(int i=0;i<n-1;++i){
			for(int j=0;j<2;++j){
				v[i][j]=point[i+1][j]-point[0][j];
			}
		}
		double s=0;
		for(int i=0;i<n-2;++i){
			s+=Math.abs((v[i][0]*v[i+1][1]-v[i][1]*v[i+1][0]))/2;
		}
		return s;
	}
	
	double nd(){
		return sc.nextDouble();
	}
	
	void io(){
		double[][] point=new double[20][2];
		int n;
		sc=new Scanner(System.in).useDelimiter("\\s*,\\s*|\r\n|\n");
		for(n=0;n<20&&sc.hasNext();++n){
			for(int i=0;i<2;++i){
				point[n][i]=nd();
			}
		}
		System.out.println(solve(point,n));
	}
	
	public static void main(String[] args) {
		new Main().io();
	}
}

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

#define int long long
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

signed main()
{
  int n;
  cin >> n;
  
  vi v(n);
  rep(i, n) cin >> v[i];
  
  int ans = 0;
  for(int i = 0; ; i = (i+1)%n){
    int t = v[i]/n; 
    v[i] -= t*n;
    ans += t;

    int ma = -1;
    rep(j, n){
      if(i != j) v[j] += t;
      ma = max(ma, v[j]);
    }
    if(ma < n) break;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
open Base
open Stdio

let () =
  match In_channel.input_line In_channel.stdin with
  | None -> failwith "cannot read input"
  | Some x ->
    let last_char = String.get x ((String.length x) - 1) in
    let num = Int.of_string (String.make 1 last_char) in
    match num with
    | 2 | 4 | 5 | 7 | 9 -> print_endline "hon"
    | 0 | 1 | 6 | 8 -> print_endline "pon"
    | 3 -> print_endline "bon"
    | _ -> failwith "unreachable"


Measured memory_bytes: 5728
// finish date: 2018/03/13

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000
#define pii pair<int,int>


int main() {
    int N, x;
    cin >> N >> x;
    if (x == 1 || x == 2 * N - 1) {
        cout << "No" << endl;
        return 0;
    }
    if (N == 2) {
        if (x != 2) cout << "No" << endl;
        else {
            cout << "Yes" << endl;
            puts("1");
            puts("2");
            puts("3");
        }
        return 0;
    }
    vi arr(2 * N - 1, 0);
    vb used(2 * N, false);
    used[0] = true;
    if (x < 3) {
        arr[N - 1] = x;
        arr[N - 2] = x - 1;
        arr[N] = x + 1;
        arr[N + 1] = x + 2;
        used[x] = used[x - 1] = used[x + 1] = used[x + 2] = true;
    } else {
        arr[N - 1] = x;
        arr[N - 2] = x + 1;
        arr[N] = x - 1;
        arr[N + 1] = x - 2;
        used[x] = used[x + 1] = used[x - 1] = used[x - 2] = true;
    }
    int idx = 1;
    rep(i, 2 * N - 1) {
        if (arr[i] != 0) continue;
        while (used[idx]) idx++;

        arr[i] = idx;
        idx++;
    }


    cout << "Yes" << endl;
    rep(i, 2 * N - 1) cout << arr[i] << endl;


    return 0;
}

Measured memory_bytes: 2304
#include <map>
#include <iostream>

using namespace std;

int main()
{
	int n;

	while (cin >> n, n){
		map<int, int> team;
		int id, m1, m2, m3, m4, s1, s2, s3, s4;
		for (int i = 0; i < n; i++){
			cin >> id >> m1 >> s1 >> m2 >> s2 >> m3 >> s3 >> m4 >> s4;
			team.insert(make_pair(60 * (m1 + m2 + m3 + m4) + s1 + s2 + s3 + s4, id));
		}
		map<int, int>::iterator it = team.begin();
		cout << it->second << endl;
		it++;
		cout << it->second << endl;
		it = team.end();
		it--;
		it--;
		cout << it-> second << endl;
	}

	return (0);
}

Measured memory_bytes: 1428
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

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

using namespace std;

typedef long long int lli;

int main () {
    int N, T, L, B;
    while (cin >> N >> T >> L >> B, N) {
        vector<int> m(N + 1);
        const int lose = 1 << 0;
        const int back = 1 << 1;
        REP (i, 0, L) {
            int li;
            cin >> li;
            m[li] |= lose;
        }
        REP (i, 0, B) {
            int bi;
            cin >> bi;
            m[bi] |= back;
        }
        vector<vector<double>> dp(T + 1, vector<double>(N + 1, 0.0));
        dp[0][0] = 1.0;
        REP (i, 0, T) {
            REP (j, 0, N) {
                REP (k, 1, 7) {
                    int pos = j + k;
                    if (pos > N) pos = N - (pos - N);
                    if (pos < 0) pos = -pos;
                    if ((m[pos] & back) == back) dp[i + 1][0] += (dp[i][j] / 6);
                    else if ((m[pos] & lose) == lose) {
                        if (i + 2 <= T) dp[i + 2][pos] += (dp[i][j] / 6);
                    } else {
                        dp[i + 1][pos] += (dp[i][j] / 6);
                    }
                }
            }
        }
        double sum = 0.0;
        REP (i, 0, T + 1) sum += dp[i][N];
        cout << fixed << setprecision(10) << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 3292
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    int n,a;
    cin>>n;
    a=n/2*2;
    vector<pair<int,int>> A;
    rep(i,a)rep(j,a) if(i<j&&i+1!=a-j) A.push_back(make_pair(i+1,j+1));
    if(n%2) rep(i,a) A.push_back(make_pair(n,i+1));
    cout<<A.size()<<endl;
    rep(i,A.size()) cout<<A[i].first<<" "<<A[i].second<<endl;
}

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

const int MX = (1<<20);

int arr[MX];
int n;
long long sum[MX];

long long solve(){

    long long ans = 0;
    int loz = 0;
    for(int j = 1 ; j <= n ; j++){
        ans += abs(arr[j]);
        if(arr[j] <= 0)
            loz = j;
        sum[j] = sum[j-1] + abs(arr[j]);
    }
    long long cur = 0;

    for(int j = n ; j ; j--){

        if(arr[j] < 0) break;

        long long theta = sum[n] - sum[j-1];

        theta -= 1ll * (n - j + 1) * arr[j];

        theta += sum[loz] + 1ll * loz * arr[j];

        theta += 1ll * arr[j] * (j - 1 - loz) - (sum[j - 1] - sum[loz]);

        ans = min(ans , theta);

        cur += abs(arr[j]);
    }


    return ans;
}
int main(){
    cin>>n;

    for(int j = 1 ; j <= n ; j++){

        cin>>arr[j];
        arr[j] -= j;

    }

    sort(arr + 1 , arr + 1 + n);
    long long shit;
    shit = solve();
    for(int j = 1 ; j <= n ; j++)
        arr[j] *= -1;
    reverse(arr + 1 , arr + 1 + n);
    shit = min(shit , solve());
    cout<<shit<<endl;



}


Measured memory_bytes: 3840
#include<stdio.h>
using namespace std;
int main(void)
{
	int a,b;
	scanf("%d %d",&a,&b);
	printf("%s\n",(a*b)&1?"Odd":"Even");
	return 0;
}
/*
#include<stdio.h>
using namespace std;
int main(void)
{
	int left=1,right=100000000,mid,a,b;
	scanf("%d %d",&a,&b);
	while(left<=right)
	{
		mid=(left+right)/2;
		if(mid==a*b)
			break;
		else if(mid>a*b)
			right=mid;
		else
			left=mid;
	}
	printf("%s\n",mid&1?"Odd":"Even");
	return 0;
}
*/

Measured memory_bytes: 128
def mpow(a,b,M):
	r = 1
	while(b >= 1):
		if(b%2 == 1):
			r=r*a%M
		b//=2
		a=a*a%M
	return r

def minv(a,M):
	return mpow(a,M-2,M)

def mcomb(a,b,M):
	A = 1
	for i in reversed(range(a-b+1,a+1)):
		A = A * i % M
	A = A * minv(mfact(b,M),M) % M
	return A
def mfact(a,M):
	res = 1
	for i in range(1,a+1):
		res = res * i % M
	return res
def main():
	n,a,b  = [int(n) for n in input().split()]
	M=10**9+7
	A = mpow(2,n,M)-1
	A = ((A - mcomb(n,a,M))%M - mcomb(n,b,M))%M
	print(A)
main()

Measured memory_bytes: 38864
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define mod 1000000007
using namespace std;

int main(){
    int x,y;
    int ans = 0;
    cin >> x >> y;
    if(x==1)ans += 300000;
    if(x==2)ans += 200000;
    if(x==3)ans += 100000;
    if(y==1)ans += 300000;
    if(y==2)ans += 200000;
    if(y==3)ans += 100000;
    if(x==1 && y==1)ans += 400000;
 

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
int main(){
    int n,A[400000];
    long long B[200000]={0},C[200000]={0};
    cin>>n;
    rep(i,3*n) cin>>A[i];
    priority_queue<int> q,r;
    rep(i,n) q.push(-A[i]),B[0]+=A[i];
    rep(i,n) q.push(-A[n+i]),B[i+1]=B[i]+A[n+i]+q.top(),q.pop();
    rep(i,n) r.push(A[2*n+i]),C[0]+=A[2*n+i];
    rep(i,n) r.push(A[2*n-i-1]),C[i+1]=C[i]+A[2*n-i-1]-r.top(),r.pop();
    long long ans=B[0]-C[n];
    rep(i,n) if(ans<B[i+1]-C[n-i-1]) ans=B[i+1]-C[n-i-1];
    cout<<ans;
}

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

using namespace std;

const int YearStart[] = { 1868,1912,1926,1989 };
const char YearName[] = { 'M','T', 'S', 'H' };

int main() {
	int e, y, pos;

	cin >> e >> y;
	if (e != 0) {
		cout << YearStart[e - 1] + y - 1 << endl;
		return 0;
	}

	pos = upper_bound(YearStart, YearStart + 4, y) - YearStart - 1;
	//cout << pos << endl;
	cout << YearName[pos] << y - YearStart[pos] + 1 << endl;

	return 0;
}



Measured memory_bytes: 3100
#include <stdio.h>

int main(){
  char b;
  scanf("%c",&b);
  
  if(b == 'A'){
    printf("T");
  }else if(b == 'C'){
    printf("G");
  }else if(b == 'G'){
    printf("C");
  }else{
    printf("A");
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s1;
int len;
stack<char> x;
int main()
{
	cin>>s1;
	len=s1.size();
	if(len%2!=0)
	{cout<<"No";return 0;}
	for(int i=0;i<=len-1;i++)
	{
		x.push(s1[i]);
	}
	int flag=1;
	for(int i=0;i<=len-1;i++)
	{
		char k=x.top();
		x.pop();
		{
			if(k=='b')
			k='d';
			else
			if(k=='d')
			k='b';
			else if(k=='p')
			k='q';
			else if(k=='q')
			k='p';
			if(k!=s1[i])
			{flag=0;break;}
		}
	}
	if(flag)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cfloat>
#define ll long long
#define uint unsigned
#define MOD 1000000007
using namespace std;

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

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

    // --------------------------------
    string s, t;
    int a {}, b {};
    string ch;
    cin >> s >> t >> a >> b >> ch;

    if (ch == s) --a;
    else if (ch == t) --b;
    cout<<a<<" "<<b<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    string s, t; cin >> s >> t;
    int a, b; cin >> a >> b;
    string u; cin >> u;

    if (s == u)cout << a - 1 << " " << b << "\n";
    else cout << a << " " << b - 1 << "\n";
}

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

int c = 0;

void keta(int A) {
	if (A > 9) {
		c++;
		keta(A/10);
	}
	return;
}

int main()
{
	int A, B,C;
	while (cin >> A >> B) {
		c = 0;
		A += B;
		keta(A);
		c++;
		cout << c <<endl;
	}
    return 0;
}

Measured memory_bytes: 3040
x = int(input())
l = []
for i in range(2,x):
    key = "T"
    for j in l:
        if i % j == 0:
            key = "F"
            break
    if key == "T":
        l.append(i)
key = "F"
while key == "F":
    key1 = "T"
    for i in l:
        if x % i == 0:
            key1 = "F"
            break
    if key1 == "T":
        key = "T"
    x += 1
print(x-1)

Measured memory_bytes: 41436
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=1e4+1;

int main(){
ios::sync_with_stdio(false);
    int a,b,t;
    cin>>a>>b>>t;
    cout<<b*(t/a)<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <stack>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    int N;
    cin >> N;
    int cnt[10050];
    fill(cnt, cnt + N + 1, 0);
    int tmp = 0;
    for (int x = 1; x <= 105; x++)
    {
        for (int y = 1; y <= 105; y++)
        {
            for (int z = 1; z <= 105; z++)
            {
                tmp = x * x + y * y + z * z + x * y + y * z + z * x;
                if (tmp < 10050)
                {
                    cnt[tmp]++;
                }
            }
        }
    }
    for (int i = 1; i <= N; i++)
    {
        cout << cnt[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
 
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define mp make_pair
 
typedef long long ll;
typedef unsigned long long int ull;
typedef long double ld;
 
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef pair<string, string> ss;
typedef pair<int, ss> iss;
 
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<ld> vld;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<pll> vpll;
typedef vector<pii> vpii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pair<int, pii>> vpiii;
 
typedef map<string, string> mss;
typedef map<string, int> msi;
typedef map<int, int> mii;
typedef map<int, bool> mib;
typedef map<int, ll> mill;
typedef map<int, vpii> mivpii;

const int MAXN = 21;
const int MOD = 1e9 + 7;

int a[MAXN + 1][MAXN + 1];
int dp[(1 << MAXN) + 1];

void fast_io() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

void add(int &a, int b) {
	a += b;
	if(a >= MOD) a-= MOD;
}

int main() {
	fast_io();
//	freopen("input/dp_o.txt", "r", stdin);
	
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++)
			cin >> a[i][j];
	}
	
	dp[0] = 1;
	for(int mask = 0; mask < (1 << n); mask++) {
		int i = __builtin_popcount(mask);
		for(int j = 0; j < n; j++) {
			if(a[i][j] and !(mask & (1 << j)))
				add(dp[mask ^ (1 << j)], dp[mask]);
		}
	}
	
	int FULL_MASK = (1 << n) - 1;
	cout << dp[FULL_MASK] << '\n';
	
	return 0;
}

Measured memory_bytes: 8448
#include <iostream>
using namespace std;
int main()
{
    int i, j, n, a;
    cin >> n;
    string words[n], word, pre_word;
    cin >> words[0];
    a=0;
    for (i=1; i<n; i++)
    {
        cin >> words[i];
        word=words[i];
        pre_word=words[i-1];
        if (word[0]!=pre_word[pre_word.length()-1])
        {
            a=1;
        }
        for (j=0; j<i; j++)
        {
            if (word==words[j] && i!=j)
                {
                    a=1;
                }
        }
    }
    if (a!=1)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
var obj = init();
Main();
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");}
function init(){
  var inputFile = myin();
  var returnObj = {
    "list" : inputFile, "index" : 0, "max" : inputFile.length,
    "hasNext" : function(){return (this.index < this.max);},
    "next" : function(){if(!this.hasNext()){return "";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
  var X = one[0];
  var Y = one[1];
  var A = one[2];
  var B = one[3];
  var C = one[4];
  var alist = nextIntArray();
  var blist = nextIntArray();
  var clist = nextIntArray();
  alist.sort(function(a,b){
  	return b - a;
  });
  blist.sort(function(a,b){
  	return b - a;
  });
  var select = [];
  for(var i = 0; i < X; i++){
    select.push(alist[i]);
  }
  for(var i = 0; i < Y; i++){
    select.push(blist[i]);
  }
  select = select.concat(clist);
  select.sort(function(a,b){
  	return b - a;
  });
  var output = 0;
  for(var i = 0; i < X + Y; i++){
    output += select[i];
  }
  myout(output);
}

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

using namespace std;

int main(){
  int A, B, C, K, ans=0;
  cin >> A >> B >> C >> K;
  if(K > 0){
    if(K > A){
      ans += A;
      K -= A;
    }else{
      ans += K;
      K = 0;
    }
  }
  if(K > 0){
    if(K > B){
      K -= B;
    }else{
      K = 0;
    }
  }
  if(K > 0){
    ans -= K;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
def check():
    N = int(input())
    plus,minus = [],[]
    for i in range(N):
        S = input()
        now = 0
        mini = 0
        for s in S:
            if s=='(':
                now += 1
            else:
                now -= 1
                mini = min(mini,now)
        if now>=0:
            plus.append([mini,now])
        else:
            minus.append([now-mini,now])
    plus.sort(reverse=True)
    minus.sort(reverse=True)
    now = 0
    for a,b in plus:
        if now + a <0:
            return 'No'
        now += b
    for a,b in minus:
        if now + b-a <0:
            return 'No'
        now += b
    if now > 0:
        return 'No' 
    return 'Yes'
print(check())

Measured memory_bytes: 96016
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
typedef long long ll;
int N, M;
vector<vector<ll>> B;

int main() {
	cin >> N >> M;
	vector<ll> A, AA;
	A.resize(N - 1);
	for (auto& x : A) cin >> x;
	B.resize(N, vector<ll>(M));
	for (auto& x : B) for (auto& y : x) cin >> y;

	AA.resize(N);
	for (int i = 1; i < N; ++i) AA[i] = AA[i - 1] + A[i - 1];
	
	vector<vector<ll>> c(N + 1, vector<ll>(N + 1));
	for (int j = 0; j < M; ++j) {
		vector<pair<ll, int>> a;
		for (int i = 0; i < N; ++i) a.push_back({-B[i][j], i});
		sort(a.begin(), a.end());
		set<int> b;
		b.insert(-1);
		b.insert(N);
		for (auto p : a) {
			ll w = -p.first;
			int z = p.second;
			auto it = b.upper_bound(z);
			int y = *it - 1;
			--it;
			int x = *it + 1;
			b.insert(z);
			c[x][z] += w;
			c[x][y+1] -= w;
			c[z+1][z] -= w;
			c[z+1][y+1] += w;
		}

	}

	for (int i = 0; i <= N; ++i) for (int j = 1; j <= N; ++j) c[i][j] += c[i][j - 1];
	for (int j = 0; j <= N; ++j) for (int i = 1; i <= N; ++i) c[i][j] += c[i - 1][j];

	ll r = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = i; j < N; ++j) {
			r = max(r, c[i][j] - (AA[j] - AA[i]));
		}
	}
	cout << r << endl;
}


Measured memory_bytes: 204236
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
int n,a[25];
ll work(int l,int r,int x,int y)
{
	if(r-l+1<=2)
		return 0;
	ll rtn=1ll<<62;
	for(int mid=l+1;mid<r;++mid)
		rtn=min(rtn,work(l,mid,x,x+y)+work(mid,r,x+y,y)+1ll*a[mid]*(x+y));
	return rtn;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		scanf("%d",a+i);
	printf("%lld",work(1,n,1,1)+a[1]+a[n]);
	return 0;
}


Measured memory_bytes: 128
S=input()
list1=[]
for i in range(4):
    list1.append(int(S[i]))
#print(list1)

list2=[]
for j in range(8):
    k=j
    list2.append(int(k/4))
    k=j%4
    list2.append(int(k/2))
    k=j%2
    list2.append(int(k/1))
    #print(list2)
    
    if list2[0]==1:
        A=list1[0]+list1[1]
    else:
        A=list1[0]-list1[1]
    if list2[1]==1:
        A=A+list1[2]
    else:
        A=A-list1[2]
    if list2[2]==1:
        A=A+list1[3]
    else:
        A=A-list1[3]
    if A==7:
        list3=[]
        for a in range(3):
            if list2[a]==0:
                list3.append("-")
            else:
                list3.append("+")
        print(str(list1[0])+list3[0]+str(list1[1])+list3[1]+str(list1[2])+list3[2]+str(list1[3])+"=7")
        ans=1
        break
    list2=[]


Measured memory_bytes: 3444
#include <cmath>
#include <cstdio>
#include <limits>
#include <tuple>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>
#include <iomanip>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = n-1; i >= 0; --i)
#define REP(i, s, n) for (int i = s; i< (int)(n); ++i)
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;
ll inf = ll(1e18);
using ll1d = vector<ll>;
using ll2d = vector<ll1d>;
using ll3d = vector<ll2d>;

void solve(istream &ccin = cin, ostream &ccout = cout) {
  ll x, y;
  ccin >> x >> y;

  if(abs(x-y)>1)
    ccout << "Alice" << endl;
  else
    ccout << "Brown" << endl;



}

int main() {
  ios::sync_with_stdio(false);
  solve();
  return 0;
}

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

int n,k,s,ans;

void rec(int num,int kk,int sum){
  if(kk < 0 || sum < 0) return;

  if(kk == 0 && sum == 0){
    ans++; return;
  } 

  for(int i = num ; i >= 1 ; i--){
    rec(i-1,kk-1,sum-i);
  }

}

int main(){
  while(cin >> n >> k >> s, n | k | s){
    ans = 0; rec(n,k,s);
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
N, M, R = gets.split.map(&:to_i)
r = gets.split.map(&:to_i)

dist = Array.new(N) { Array.new(N, Float::INFINITY) }
M.times do |i|
  a, b, c = gets.split.map(&:to_i)
  dist[a-1][b-1] = c
  dist[b-1][a-1] = c
end

N.times do |k|
  N.times do |i|
    N.times do |j|
      if dist[i][j] > dist[i][k] + dist[k][j]
        dist[i][j] = dist[i][k] + dist[k][j]
      end
    end
  end
end

min = Float::INFINITY
r.permutation(R) do |seq|
  sum = 0
  #seq.each_cons(2) do |x, y|
  #  sum += dist[x-1][y-1]
  #end
  (R - 1).times do |i|
    sum += dist[seq[i]-1][seq[i+1]-1]
  end
  min = sum if min > sum
end
puts min


Measured memory_bytes: 3324
#include <stdio.h>
#include <math.h>
#define MAX_NUM 100000000

double dist(int x,int y){
	return sqrt((double)(x * x + y * y));
}

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


int n, cx[20], cy[20], dx, dy;

double dfs(int now,double sum,int bit){
	int i;
	double ret = MAX_NUM;
	for(i = 0;i < n;i++)
		if(~bit & (1 << i) && sum + dist(cx[now] - cx[i],cy[now] - cy[i]) >= dist(dx - cx[i],dy - cy[i])) return ret;
	if(sum >= dist(dx - cx[now],dy - cy[now])) return ret;
	if(bit == (1 << n) - 1) return sum;
	for(i = 0;i < n;i++){
		if(~bit & (1 << i)){
			ret = min(dfs(i,sum + dist(cx[i] - cx[now],cy[i] - cy[now]),bit | (1 << i)),ret);
		}
	}
	return ret;
}


int main(void){
	int hx, hy, i;
	double ans;
	while(1){
		scanf("%d%d%d%d%d",&n,&hx,&hy,&dx,&dy);
		if(n == 0 && hx == 0 && hy == 0 && dx == 0 && dy == 0)
			break;
		for(i = 0;i < n;i++)
			scanf("%d%d",&cx[i],&cy[i]);
		ans = MAX_NUM;
		for(i = 0;i < n;i++)
			ans = min(ans,dfs(i,dist(cx[i] - hx,cy[i] - hy),1 << i));
		if(ans != MAX_NUM)
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 1012
n,m = map(int, input().split())
h = list(map(int, input().split()))

ab = [0]*n
for _ in range(m):
  a,b = map(lambda x: int(x)-1, input().split())
  ab[a] = max(ab[a], h[b])
  ab[b] = max(ab[b], h[a])
  
ans = 0
for i in range(n):
  if ab[i] < h[i]: ans += 1
print(ans)

Measured memory_bytes: 20108
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N = ii()
A = li()
d = defaultdict(int)

for num in A:
    d[num] += 1

sum_a = 0
for value in d.values():
    sum_a += (value)*(value-1)//2

for num in A:
    if d[num] == 1:
        print(sum_a)
    elif d[num] == 2:
        print(sum_a-1)
    else:
        print(sum_a-d[num]+1)

Measured memory_bytes: 25920
from itertools import product

S=input()
ans=0
for i in list(product([False,True],repeat=len(S)-1)):
  b=0
  a=S[0]
  for j in range(len(S)-1):
    if i[j]==False:
      a+=S[j+1]
    else:
      b+=int(a)
      a=S[j+1]
  b+=int(a)
  ans+=b
print(ans)


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

/*  using namespace  */
using namespace std;

/*  local var  */
int a,b,n;		//input
int ans = 0;		//output
vector<int> g[100005];  //graph
int distance_Fennec[100005]; //Distance from ふぇねええええええええええええええええええええええええっく
int distance_Sunuke[100005]; //Distance from Snuke

/*  define  */
#define loop(i,j) for(int i = 0; i < j; i++)
#define scan1(d) scanf("%d",&d);
#define scan2(a,b) scanf("%d %d",&a,&b);

/*  typedef  */
//None

/*  distance checker  */
void calc_distance(int r, int f, int d, int dist[]) {
	dist[r] = d;
	for(int x = 0; x < g[r].size(); x++)
		if (g[r][x] != f) calc_distance(g[r][x], r, d + 1, dist);
			
}

/*  main program  */
int main()
{
	scan1(n);

	for(int i = 0; i < n - 1; i++) {
		scan2(a,b);
		a--,b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}

	calc_distance(0  ,-1,0,distance_Fennec);
	calc_distance(n-1,-1,0,distance_Sunuke);

	for(int i = 0;i < n; i++){
		if(distance_Fennec[i] <= distance_Sunuke[i]) ans++;
		else ans--;
	}

	printf("%s\n",(ans > 0) ? "Fennec" : "Snuke");
}


Measured memory_bytes: 14336
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

typedef long long ll;

const int nax = 1e5 + 5;
char sl[nax];
int cnt[nax];
const int mod = 1e9 + 7;

int main() {
	int n;
    scanf("%d", &n);
    scanf("%s", sl);
    for(int i = 0; i < n; ++i) {
        ++cnt[sl[i]-'a'];
    }
    int answer = 1;
    for(int i = 0; i < 26; ++i) {
        answer = (long long) answer * (cnt[i] + 1) % mod;
    }
    --answer;
    if(answer < 0) {
        answer += mod;
    }
    printf("%d\n", answer);
}


Measured memory_bytes: 384
include Math
def distance(x, y)
  return sqrt(x**2 + y**2)
end

n, d = gets.split(" ").map(&:to_i)
x=[]; y = []
n.times do |i|
  x[i], y[i] = gets.split(" ").map(&:to_i)
end
cnt = 0
0.upto(n-1) do |i|
  if distance(x[i], y[i]) <= d
    cnt += 1
  end
end
puts cnt

Measured memory_bytes: 17524
#include<stdio.h>
#define N 100001

main(){

  int i, j, x, n, A[N], p, r;

  scanf("%d", &n);
  for(i = 1;i < n+1;i++){
    scanf("%d", &A[i]);
  }
  p = 1;
  x = A[n];
  i = p - 1;
  for(j = p;j < n;j++){
    if(A[j] <= x){
      i++;
      r = A[i];
      A[i] = A[j];
      A[j] = r;
    }
  }
  r = A[i+1];
  A[i+1] = A[n];
  A[n] = r;

  for(j = 1;j < i+1;j++){
    printf("%d ", A[j]);
  }
  printf("[%d] ", A[i+1]);
  for(j = i+2;j < n;j++){
    printf("%d ", A[j]);
  }
  printf("%d\n", A[j]);
  return 0;
}

Measured memory_bytes: 988
#include <stdio.h>
#include<vector>
#include<iostream>
#include<stack>
#include<string>
using namespace std;

typedef struct datelist {
	char name[10];
	int time;
}DATA;

class Queue {
public:
	void enQ(DATA d) {
		arr[tail] = d;
		tail = (tail + 1) % size;
	}

	DATA deQ() {
		DATA dedata = arr[head];
		head = (head + 1) % size;
		return dedata;
	}

	bool isEmpty() {
		if (head == tail)return 1;
		else return 0;
	}

	Queue(int n) {//コンストラクタ
		arr = new DATA[n];
		size = n;
		head = 0;
		tail = 0;
	};
	~Queue() {
		delete[] arr;
	};
private:
	DATA* arr;
	int size;
	int head;
	int tail;
};
int main() {
	int n;
	int q;
	int ctime = 0;
	DATA tDATA;

	cin >> n;
	cin >> q;
	Queue Q(n);

	for (int i = 0; i < n; i++)
	{
		cin >> tDATA.name;
		cin >> tDATA.time;
		Q.enQ(tDATA);
	}

	while (1)
	{
		tDATA = Q.deQ();
		if (tDATA.time - q <= 0)
		{
			ctime += tDATA.time;
			cout << tDATA.name << " " << ctime << endl;
			if (Q.isEmpty())break;
		}
		else
		{
			ctime += q;
			tDATA.time -= q;
			Q.enQ(tDATA);
		}
	}
	return 0;
}


Measured memory_bytes: 3536
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
 
#define INF_LL 1e18
#define INF 1e9
 
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(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 PII = pair<int, int>;
 
class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;
 
public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}
 
	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}
 
	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;
 
		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}
 
	bool same(int x, int y){
		return find(x) == find(y);
	}
};
 
ll mod = 1e9+7;
 
ll powm(ll x, ll a){
	ll res = 1;
	REP(i, a){
		res = (res * x) % mod;
	}
	return res;
}
 
int main(void){
	int N, C;
	ll A[401], B[401];
	ll dp[401][401] = {};
	cin >> N >> C;
	REP(i, N){
		cin >> A[i];
	}
	REP(i, N){
		cin >> B[i];
	}
	dp[0][0] = 1;
	ll mul[401][401];
 
	REP(i, 401){
		mul[0][i] = 1;
	}
 
	FOR(i, 1, 401){
		REP(j, 401){
			mul[i][j] = (mul[i-1][j] + powm(i, j))%mod;
		}
	}
	REP(i, N){
		REP(j, C+1){
			ll sum = 0;
			REP(k, j+1){
				sum = (sum + dp[i][j-k] * (mul[B[i]][k]-mul[A[i]-1][k]+mod)%mod) % mod;
			}
			dp[i+1][j] += sum;
			dp[i+1][j] %= mod;
		}
	}
	cout << dp[N][C] << endl;
}


Measured memory_bytes: 2816
import java.lang.reflect.Array;
import java.util.*;

/**
 * Created by Santa.
 */
public class Main {

  static int N;
  static int K;
  static long Q;
  static int A;
  static long B;
  static long C;
  // static int[][] map;
  static double min = 9999999;
  static long ans = 0;

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


    int N = scanner.nextInt();

    int T = scanner.nextInt();
    int A = scanner.nextInt();

    int map[] = new int[N];


    int ans = -1;
    for (int i = 0; i < N; i++) {
      map[i] = scanner.nextInt();
      double temp = T - map[i] * 0.006;
      if(min > Math.abs(A - temp)){
        ans = i + 1;
        min = Math.abs(A - temp);
      }
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 24680
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;

const int MOD = 1000000007;
typedef long long ll;


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A,B,C;
  cin>>A>>B>>C;
  if(A==B&&B==C){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	void run(){
		Scanner in = new Scanner(System.in);
		for(int n = in.nextInt(); n > 0; n = in.nextInt()){
			int ma = Integer.MIN_VALUE, mi = Integer.MAX_VALUE;
			for(int i=0; i<n; i++){
				int sum = 0;
				for(int j=0; j<5; j++){
					sum += in.nextInt();
				}
				ma = Math.max(ma, sum);
				mi = Math.min(mi, sum);
			}
			System.out.println(ma + " " + mi);
		}
	}


	public static void main(String args[]){
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include<stdio.h>
#include<string.h>

int main()
{
    int i,j,asize,flag=0;
	char a[101],b[101],c[101];
    scanf("%s",a);
    scanf("%s",b);
	asize=strlen(a);
	//printf("%d\n",asize);
	for(i=0;i<asize;i++)
	{
		c[0]=a[asize-1];
		for(j=0;j<asize-1;j++)
		{
			c[j+1]=a[j];
		}
		if(strncmp(c,b,asize)==0)flag=1;
		strcpy(a,c);
	}
    if(flag)printf("Yes");
	else printf("No");
}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    REP(i, 100000000) {
        if ((a * i) % b == c) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;

}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main()
{
    vector<vector<int>> c(3, vector<int>(3));
    rep(i, 3) rep(j, 3)
    {
        cin >> c[i][j];
    }

    vector<int> a(3), b(3);
    b[0] = c[0][0];
    b[1] = c[0][1];
    b[2] = c[0][2];
    a[0] = 0;
    a[1] = c[1][0] - b[0];
    a[2] = c[2][0] - b[0];

    rep(i, 3) rep(j, 3)
    {
        if (c[i][j] != a[i] + b[j]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

using namespace std;

int main (void)
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int a, b, c;
  cin >> a >> b >> c;
  if ((a == 5 && b == 5 && c == 7) || (a == 5 && b == 7 && c == 5) || (a == 7 && b == 5 && c == 5)) {
    cout << "YES\n";
  }
  else {
    cout << "NO\n";
  }
  return 0;
}
// created: 20.07.2020 16:50:01 IST


Measured memory_bytes: 3652
#include<stdio.h>
using namespace std;
int main(){
    int A, B, C;
    scanf("%d",&A);
    scanf("%d",&B);
    scanf("%d",&C);
    

    if(B >= A*C){
        printf("%d",C);
    }else{
        printf("%d",(B/A));
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;
	vector<int>h(N);

	for (int i = 0; i < N; i++) {
		cin >> h[i];
	}
	int ans = 1e9;

	sort(h.begin(), h.end());
	for (int i = 0; i + K <= N; i++) {
		ans = min(ans, h[i + K - 1] - h[i]);
	}

	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 640
#include <map>
#include <cmath>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 100005;
const int mod = 1e9 + 7;
LL a[maxn], b[maxn], aa[maxn], bb[maxn];
map<LL, int> mp;
vector<int> p;
#define N 1234
bool vis[N];
void pre() {
    for (int i=2; i<N; i++) {
        if (!vis[i]) {
            p.push_back(i);
            for (int j=i+i; j<N; j+=i) {
                vis[j] = 1;
            }
        }
    }
}
int main() {
    int n,ans=0;
    pre();
    cin>>n;
    for (int i=0; i<n; i++) {
        cin>>a[i];b[i]=a[i];
    }
    for (int i=0; i<n; i++) {
        aa[i] = 1, bb[i] = 1;
        for (int j=0; j<p.size(); j++) {
            int cnt = 0;
            while (a[i] % p[j] == 0) {
                a[i] /= p[j];
                cnt++;
            }
            if (cnt % 3 == 1) {
                aa[i] *= p[j]; bb[i] *= p[j] * p[j];
            } else if (cnt % 3 == 2) {
                bb[i] *= p[j]; aa[i] *= p[j] * p[j];
            }
        }
        aa[i] *= a[i];
        LL t = floor(sqrt(a[i]*1.0));
        if (t * t == a[i]) bb[i] *= t;
        else {
            if (bb[i]*a[i]>0 && bb[i]*a[i]*a[i]>0) bb[i] *= a[i] * a[i];
            else bb[i] = 0;
        }
        mp[aa[i]]++;
    }
    //for (int i=0; i<n; i++) {
    //    cout<<b[i]<<": "<<aa[i]<<" "<<bb[i]<<endl;
    //}
    int flag = 0;
    for (int i=0; i<n; i++) {
        if (aa[i] == 1) {
            if (flag == 0) {ans++; flag=1;}
        } else {
            ans += max(mp[aa[i]], mp[bb[i]]);
            mp[aa[i]] = mp[bb[i]] = 0;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
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; }
const ll INF = 1LL << 60;
int main(){
    ll h,w;
    cin >> h >> w;
    if(h==1 || w==1){
        cout << 1 << endl;
        return 0;
    }
    ll t1 = (h+1)/2;
    ll t2 = h/2;
    ll ans = t1*((w+1)/2) + t2*(w/2);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
let string_to_list str =
  let rec loop i limit =
    if i = limit then []
    else (String.get str i) :: (loop (i + 1) limit)
  in
  loop 0 (String.length str)

let solve s =
  let lis = string_to_list s in
  let rec diff = function
      [] -> 0
    | x::y::xs when x <> y -> 1 + diff (y::xs)
    | x::y::xs when x == y -> diff (y::xs)
    | _ -> 0
  in diff lis
              

let () =
  let rec read () =
    try let ans = (Scanf.scanf "%s\n" solve) in
        Printf.printf "%d\n" ans
    with End_of_file -> ()
  in
  read ()
;;


Measured memory_bytes: 9600
#include<stdio.h>
#include<stdlib.h>

#define SENTINEL 1000000000

int count=0;

void merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  int *L,*R;
  n1=mid-left;
  n2=right-mid;
  L=(int *)malloc(sizeof(int)*(n1+1));
  R=(int *)malloc(sizeof(int)*(n2+1));
  for(i=0;i<=n1-1;i++){
    L[i]=A[left+i];
  }
  for(j=0;j<=n2-1;j++){
    R[j]=A[mid+j];
  }
  L[n1]=SENTINEL;
  R[n2]=SENTINEL;
  i=0;
  j=0;
  for(k=left;k<=right-1;k++){
   if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
      count++;
    }
    else{
      A[k]=R[j];
      j++;
      count++;
    }
  }
  free(L);
  free(R);
}

void mergeSort(int A[],int left,int right){
  int i,mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}


int main(){
  int A[500000];
  int n,i;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  mergeSort(A,0,n);
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i<n-1)printf(" ");
  }
  printf("\n");
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 5468
while True:
    x,y,s=map(int,input().split())
    if x==0 and y==0 and s==0:
        break
        
    ans=0
    for a in range(1,s):
        for b in range(1,a+1):
            S1=(a*(100+x)//100)+(b*(100+x)//100)
            if S1==s:
                S2=(a*(100+y)//100)+((b*(100+y)//100))
                ans=max(ans,S2)
    print(ans)


Measured memory_bytes: 5596
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

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

int main(){
    char X, Y;
    cin >> X >> Y;
    if (X > Y) {
        cout << ">" << endl;
    } else if (X < Y) {
        cout << "<" << endl;
    } else {
        cout << "=" << endl;
    }
    return 0;
}

Measured memory_bytes: 256