akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <set>
#include <cstdio>

using namespace std;

int main(){
	printf("?a\n"); fflush(stdout);
	set<string> S; S.insert("a");
	string s, t;
	for(int turn=0; ;turn++){
		cin >> s;
		if(s[0]!='a' || S.count(s)){
			printf("!OUT\n");
			break;
		}
		S.insert(s);
		t = "";
		t += s[s.size()-1];
		t += "aaaa";
		for(int c=turn;c;c/=26) t += (c%26)+'a';
		t += "a";
		cout << "?" << t << endl;
		fflush(stdout);
	}
}

Measured memory_bytes: 0
import sys
from itertools import combinations as combi
input = sys.stdin.readline
N = int(input())
f = [list(map(int, input().split())) for _ in range(N)]
p = [list(map(int, input().split())) for _ in range(N)]
days = [i for i in range(10)]
res = -float("inf")
for x in range(1, 11):
  for c in combi(days, x):
    t = 0
    y = [0] * N
    for i in range(N):
      for j in c:
        if f[i][j]:
          y[i] += 1
      t += p[i][y[i]]
    #print(c, t, y)
    res = max(res, t)
print(res)

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

int main() {

	int n;
	cin >> n;
	map<string, int> vote;

	rep(i, n) {
		string s;
		cin >> s;
		vote[s]++;
	}
	
	int maxv = 0;
	for (auto p: vote) maxv = max(maxv, p.second);
	for (auto p: vote) {
		if (p.second == maxv) cout << p.first << endl;
	}
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    vector<string>w(n);
    map<string,bool>mp;
    bool ans=true;
    rep(i,n){
        cin>>w[i];
        mp.insert(make_pair(w[i],false));
    }
    rep(i,n-1){
        string s1=w[i];
        string s2=w[i+1];
        if(s1[s1.length()-1]!=s2[0]){
            ans=false;
        }
    }
    rep(i,n){
        if(mp[w[i]]==false){
            mp[w[i]]=true;
        }
        else{
            ans=false;
        }
    }
    if(ans==true)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>

using namespace std;


int N;
string s;
int dp[1001][2][2][2] = {};

int main() {

	cin >> N >> s;

	dp[0][1][0][0] = 1;

	long long ans = 0;
	for (int i = 1; i <= N; i++) {
		if (s[i-1] == 'J') {
			dp[i][1][0][0] = dp[i - 1][1][0][0] + dp[i - 1][1][1][0] + dp[i - 1][1][0][1] + dp[i - 1][1][1][1];
			dp[i][1][1][0] = dp[i][1][0][0] + dp[i - 1][0][1][0] + dp[i-1][0][1][1];
			dp[i][1][0][1] = dp[i][1][0][0] + dp[i - 1][0][0][1] + dp[i - 1][0][1][1];
			dp[i][1][1][1] = dp[i][1][1][0] + dp[i - 1][0][0][1];

			if (i == N) {
				ans = dp[i][1][0][0] + dp[i][1][1][0] + dp[i][1][0][1] + dp[i][1][1][1];
			}
		}
		if (s[i-1] == 'O') {
			dp[i][0][1][0] = dp[i - 1][0][1][0] + dp[i - 1][1][1][0] + dp[i - 1][0][1][1] + dp[i - 1][1][1][1];
			dp[i][1][1][0] = dp[i][0][1][0] + dp[i - 1][1][0][0] + dp[i - 1][1][0][1];
			dp[i][0][1][1] = dp[i][0][1][0] + dp[i - 1][0][0][1] + dp[i - 1][1][0][1];
			dp[i][1][1][1] = dp[i][1][1][0] + dp[i - 1][0][0][1];

			if (i == N) {
				ans = dp[i][0][1][0] + dp[i][1][1][0] + dp[i][0][1][1] + dp[i][1][1][1];
			}
		}
		if (s[i-1] == 'I') {
			dp[i][0][0][1] = dp[i - 1][0][0][1] + dp[i - 1][1][0][1] + dp[i - 1][0][1][1] + dp[i - 1][1][1][1];
			dp[i][1][0][1] = dp[i][0][0][1] + dp[i - 1][1][0][0] + dp[i - 1][1][1][0];
			dp[i][0][1][1] = dp[i][0][0][1] + dp[i - 1][0][1][0] + dp[i - 1][1][1][0];
			dp[i][1][1][1] = dp[i][1][0][1] + dp[i - 1][0][1][0];

			if (i == N) {
				ans = dp[i][0][0][1] + dp[i][1][0][1] + dp[i][0][1][1] + dp[i][1][1][1];
			}
		}

		dp[i][1][0][0] %= 10007;
		dp[i][1][1][0] %= 10007;
		dp[i][1][0][1] %= 10007;
		dp[i][1][1][1] %= 10007;
		dp[i][0][1][0] %= 10007;
		dp[i][0][1][1] %= 10007;
		dp[i][0][0][1] %= 10007;
	}


	/*
	ans = max(ans, dp[N][1][0][0]);
	ans = max(ans, dp[N][1][1][0]);
	ans = max(ans, dp[N][1][0][1]);
	ans = max(ans, dp[N][1][1][1]);
	ans = max(ans, dp[N][0][1][0]);
	ans = max(ans, dp[N][0][1][1]);
	ans = max(ans, dp[N][0][0][1]);
	*/

	ans %= 10007;

	cout << ans << endl;


	return 0;
}



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

const ll MAX = 50;
ll dp[MAX+10][MAX*(MAX+10)];

int main(){
  ll N, A; cin >> N >> A;
  
  dp[0][0] = 1;
  ll nowmax = 0;
  for(ll i = 0; i < N; i++){
    ll x; cin >> x;
    for(ll j = i; j >= 0; j--){
      for(ll k = nowmax; k >= 0; k--){
        dp[j+1][k + x] += dp[j][k];
      }
    }
    nowmax += x;
  }
  
  ll ans = 0;
  for(ll i = 1; i <= N; i++){
    for(ll j = 0; j <= nowmax; j++){
      if(j % i == 0 && j / i == A){
        ans += dp[i][j];
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;

typedef long long ll;
const int MAXN=1e5+5;

int n,m;
ll ans[MAXN],q[MAXN];
map<ll,ll> a;
map<ll,ll>::iterator it;

int main(){

    scanf("%d%d",&n,&m);
    if(m==0){
        for(int i=1;i<=n;i++) puts("1");
        return 0;
    }
    for(int i=1;i<=m;i++) scanf("%lld",&q[i]);
    a[q[m]]++; q[0]=n;
    for(int i=m-1;i>=0;i--)
        while(a.rbegin()->first>q[i]){
            it=a.end(); it--;
            a[it->first%q[i]]+=it->second;
            a[q[i]]+=it->second*(it->first/q[i]);
            a.erase(it);
        }
    for(it=a.begin();it!=a.end();it++) ans[it->first]+=it->second;
    for(int i=n;i>=1;i--) ans[i]+=ans[i+1];
    for(int i=1;i<=n;i++)
        printf("%lld\n",ans[i]);

    fclose(stdin);
    fclose(stdout);
}


Measured memory_bytes: 9344
import sys
input_line  = sys.stdin.readline()
arr = input_line.rstrip().split(" ")

count5 = 0
count7 = 0

for i in arr:
    if int(i) == 5:
        count5 += 1
    if int(i) == 7:
        count7 += 1

if count5 == 2 and count7 == 1:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int plusx[4] = {0, 1, 0, -1}, plusy[4]= {1, 0, -1, 0};

int main(){
	cin.tie(false);
	ios_base::sync_with_stdio(false);
	int n , m;
	cin >> n >> m;
	int a[n][m], vis[n][m], tot =0;
	char ch;

	for( int i = 0; i < n; i++ ){
		for( int j = 0; j < m; j++ ){
			vis[i][j] = 0;
			cin >> ch;
			if( ch == '.' ){
				a[i][j] = 1;
				tot++;
			}
			else a[i][j]= 0;
		}
	}

	queue<pair<int, pair<int, int>>> q;
	q.push(make_pair(1, make_pair(0,0)));
	bool bl = false;
	while( !q.empty() ){
		auto par = q.front(); q.pop();
		int d = par.first, x = par.second.first, y = par.second.second;
		vis[x][y] = true;
		
		for( int l = 0; l < 4; l++ ){
			int nx = x+plusx[l], ny = y+plusy[l];
			if( nx >= 0 && nx < n && ny>= 0 && ny < m && !vis[nx][ny] && a[nx][ny] ){
				q.push(make_pair(d+1, make_pair(nx, ny)));
				vis[nx][ny] = true;
				if( nx == n-1 && ny == m-1 ){
					bl = true;
					cout << tot-d-1 << endl;
					break;
				}
			}
		}
	}
	if( !bl ) cout << -1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define NUMBER 3
int max(int v[])
{
    int max = v[0];
    for (int i = 1; i < NUMBER; i++)
    {
        if (max < v[i])
        {
            max = v[i];
        }
    }

    return max;
}
int min(int v[])
{
    int min = v[0];
    for (int i = 1; i < NUMBER; i++)
    {
        if (min > v[i])
        {
            min = v[i];
        }
    }

    return min;
}
int main(void)
{
    int v[NUMBER];
    for (int i = 0; i < NUMBER; i++)
    {
        scanf("%d", &v[i]);
    }

    printf("%d %d\n", min(v), max(v));

    return 0;
}


Measured memory_bytes: 2756
#include<stdio.h>
   
int main(void)
{
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    if(x + r <= W && x - r >= 0){
        if(y + r <= H && y - r >= 0){
             printf("Yes\n");
        }else{
        printf("No\n");
        }
    }else{
        printf("No\n");
    }
    return 0;
}

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

int main()
{
    int k, x;

    cin >> k >> x;

    if((500 * k) >= x) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#include<bits/stdc++.h>
using namespace std;

#if defined(DAIJOBU)
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif

#define fi first
#define se second
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;

int main(){
	FIO
	
	string s;cin >> s;
	deque<char> dq;
	forn(i, s.size())dq.pb(s[i]);
	bool rev = false;
	int q;cin >> q;
	while(q--){
		int t;cin >> t;
		if(t == 1)rev ^= 1;
		else{
			int f;cin >> f;
			char c;cin >> c;
			if(rev){
				if(f == 1)dq.pb(c);
				else dq.push_front(c);
			}
			else {
				if(f == 1)dq.push_front(c);
				else dq.pb(c);
			}
		}
	}
	string ans;
	while(!dq.empty()){
		ans += dq.front();
		dq.pop_front();
	}
	if(rev)reverse(ans.begin(), ans.end());
	cout << ans;
	return 0;
}



Measured memory_bytes: 1368
import numpy as np
n,m,x = map(int, input().split())
c_a = [list(map(int, input().split())) for _ in range(n)]
argo_und = []
ans = 12*(10**5)
for i in range(2 ** n):
    flag = 0
    sums = np.zeros(m+1)
    for j in range(n):
        if ((i >> j) & 1):
            sums = sums + np.array(c_a[j])
    for j in range(1,m+1):
        if sums[j] < x:
            flag = 1
    if flag == 0:
        ans = min(ans, sums[0])
if flag == 1:
    print(-1)
else:
    print(int(ans))

Measured memory_bytes: 27160
fun main(arg: Array<String>) {
    val N = nextInt()
    val S = Array(N) { next().toCharArray().sorted().joinToString(separator = "") }
    val A = S.groupBy{ it }.map { it.value.size.toLong() }.toList()
    var ans = A.sumByLong { (it * (it - 1)) / 2 }
    println(ans)
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
inline fun <T> Iterable<T>.sumByLong(selector: (T) -> Long): Long {
    var sum = 0L
    for (element in this) {
        sum += selector(element)
    }
    return sum
}

Measured memory_bytes: 79212
import collections

N, K = map(int, input().split())

b = []
for i in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for i in A:
        b.append(i)
        
c = collections.Counter(b)

m = len(list(c.keys()))

print(N-m)


Measured memory_bytes: 9476
#include<iostream>
#include<algorithm>
#include<string.h>
#include<vector>
using namespace std;
int main()
{
	int a[5]={},b[5]={},ans;
	for(int w=0;w<4;w++){
		cin>>a[w];
		a[4]=a[4]+a[w];
	}
	for(int w=0;w<4;w++){
		cin>>b[w];
		b[4]=b[4]+b[w];
	}
	if(a[4]>=b[4]) cout<<a[4]<<endl;
	else cout<<b[4]<<endl;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define rep(i, n) for(int i=0; i<n; ++i)
#define REP(i, n) for(int i=1; i<=n; ++i)
#define all(obj) (obj).begin(), (obj).end()
using P = pair<int, int>;
const int inf = 1e9;
const ll INF = 1e18;
const ll MOD = 1e9+7;
const ll MAX = 1e9+7;

struct edge{
    int to;
    int cost;
};
using graph = vector<vector<edge>>;

char grid[2002][2002];
int L[2002][2002];
int R[2002][2002];
int D[2002][2002];
int U[2002][2002];

int main(){
    int h, w; cin >> h >> w;
    rep(i, 2001){
        rep(j, 2001){
            grid[i][j] = '#';
            L[i][j] = 0;
            R[i][j] = 0;
            D[i][j] = 0;
            U[i][j] = 0;
        }
    }
    REP(i, h){
        str s; cin >> s;
        REP(j, w){
            grid[i][j] = s[j-1];
        }
    }
    REP(i, h+1){
        REP(j, w+1){
            if(grid[i][j] == '.') L[i][j] = L[i][j-1] + 1;
            else L[i][j] = 0;
            if(grid[i][w-j+1] == '.') R[i][w-j+1] = R[i][w-j+2] + 1;
            else R[i][w-j+1] = 0;
        }
    }
    REP(i, w+1){
        REP(j, h+1){
            if(grid[j][i] == '.') U[j][i] = U[j-1][i] + 1;
            else U[j][i] = 0;
            if(grid[h-j+1][i] == '.') D[h-j+1][i] = D[h-j+2][i] + 1;
            else D[h-j+1][i] = 0;
        }
    }
    int ans = 0;
    rep(i, 2001){
        rep(j, 2001){
            ans = max(L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3, ans);
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = b - 1; i >= a; i--)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define hash dhsjakhd
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double ld;

unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::mt19937 eng(seed);

uniform_int_distribution<> DD(0, (1ll << 31));

ll random2(){
    return (ll(DD(eng))*(1ll << 31) + ll(DD(eng))) & ((1ll << 62ll)-1);
}

ll n,m,T,k,q;

const ll big = 1000000007;
const ll big2 = 1000000009;
const ll mod =  998244353;

const ll MAXN = 501;

ll M[MAXN][MAXN] = {0};
ll A[MAXN][MAXN] = {0};
ll B[MAXN][MAXN] = {0};


int DP1[MAXN][MAXN][2] = {0};
bool DP1C[MAXN][MAXN][2] = {0};

int dp1(int i, int j, int kind){
    if(i > j)return 0;
    if(kind == -1)return j-i+1;
    if(DP1C[i][j][kind])return DP1[i][j][kind];
    int ans = dp1(i,j-1,kind) + dp1(j,n-1,kind-1);
    DP1[i][j][kind] = ans;
    DP1C[i][j][kind] = 1;
    return ans;
}

int enumerate(int a, int b, int c){
    return dp1(0, a-1, 1) + dp1(a, b-1, 0) + dp1(b, c-1, -1);
}

ll DP[20958500] = {0};
bool DPC[20958500] = {0};

ll dp(int a, int b, int c){
    if(a < 0)return 0;
    int h = enumerate(a,b,c);
    if(DPC[h])return DP[h];
    ll ans1 = A[a][b] + B[a][c] + dp(a-1,b,c);
    ll ans2 = big*big;
    if(b > a+1)ans2 = A[a][a+1] + B[a][b-1] + dp(a-1,a+1,b-1);
    ll ans3 = B[a][a] + dp(a-1, a, a);

    ll ans = ans1;
    ll pek = 0;
    if(ans2 < ans){
        ans = ans2;
        pek = 1;
    }
    if(ans3 < ans){
        ans = ans3;
        pek = 2;
    }

    DPC[h] = 1;
    DP[h] = ans;
    //cerr << a << " " << b << " " << c << "   pek: " << pek << "  ans: " << ans << "\n";
    return ans;
}

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

    //freopen("input.txt","r",stdin);
   // freopen("autput.txt","w",stdout);
    ll a,b,c,d;
    cin >> n;

    rep(c1,0,n){
        rep(c2,0,n-1){
            cin >> a;
            int c3 = c2;
            if(c2 >= c1)c3++;
            M[c1][c3] = a;
        }
    }

    rep(c1,0,n){
        a = 0;
        rep(c2,c1+1,n+1){
            A[c1][c2] = a;
            a += M[c1][c2];
        }
        a = 0;
        per(c2,c1,n){
            B[c1][c2] = a;
            a += M[c2][c1];
        }
    }
/*
    rep(c1,0,n){
        rep(c2,c1,n){
            rep(c3,c2,n){
                dp(c1,c2,c3);
            }
        }
    }
*/
    ll temp = big*big;
    ll extra = 0;
    per(c1,0,n){
        extra += A[c1][n];
        temp = min(temp, dp(c1,c1+1,n-1) + extra);
    }

    cout << temp << "\n";


    return 0;
}


Measured memory_bytes: 192896
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		double a = sc.nextInt();
		double b = sc.nextInt();
		double x = sc.nextInt();
		sc.close();

		double v = x / (a * a);
		double p = b - v;
		double q = a / 2.0;
		if (2 * p <= b) {
			System.out.println(Math.atan2(p, q) * 180 / Math.PI);
		} else {
			q = x * 2 / a / b;
			System.out.println(Math.atan2(b, q) * 180 / Math.PI);
		}
	}
}


Measured memory_bytes: 22740
import math
X = int(input())
if X ==2:
    print(2)
    exit()
elif X%2 == 0:
    X += 1
j = 0
X -= 2
while j == 0:
    X +=2
    for i in range(2,math.ceil(X**0.5)):
        if X%i ==0:
            break
    else:
        print(X)
        exit()



Measured memory_bytes: 3060
def solve():
  N,X=map(int,input().split())
  if N==0 and X==0:
    return False
  P=0
  for i in range(1,N+1):
    for j in range(1,N+1):
      for k in range(1,N+1):
        if i!=j and i!=k and j!=k:
          if i+j+k==X:
            P+=1
  print(P//6)
  return True

while solve():
  None


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  vector<int> b(M);
  for (int i = 0; i < M; i++) cin >> a.at(i) >> b.at(i);
  vector<int> n(N);
  for (int i = 0; i < N; i++) n.at(i) = i + 1;
  
  int ans = 0;
  sort(n.begin(), n.end());
  do {
    if (n.at(0) != 1) continue;
    
    bool check = true;
    for (int i = 1; i < N; i++){
      int aa = n.at(i - 1);
      int bb = n.at(i);
      bool check2 = false;
      for (int i = 0; i < M; i++){
        if (a.at(i) == aa && b.at(i) == bb){
          check2 = true;
          break;
        }
        else if (a.at(i) == bb && b.at(i) == aa){
          check2 = true;
          break;
        }
      }
      if (!check2){
        check = false;
        break;
      }
    }
    if (check) ans++;
  } while (next_permutation(n.begin(), n.end()));
  
  cout << ans << endl;
}


Measured memory_bytes: 3592
def main():
    N = int(input())

    if 1 <= N < 10 ** 1:
        print(N)
    elif 10 ** 1 <= N < 10 ** 2:
        print(9)
    elif 10 ** 2 <= N < 10 ** 3:
        print(9 + (N - 10 ** 2 + 1))
    elif 10 ** 3 <= N < 10 ** 4:
        print(9 + 900)
    elif 10 ** 4 <= N < 10 ** 5:
        print(9 + 900 + (N - 10 ** 4 + 1))
    elif N == 10 ** 5:
        print(9 + 900 + 90000)

    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    string s;
    cin >> s;
    int n = s.size();
    rep(i, n) {
        cout << 'x';
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}


/*
int N;
Graph G;

int main() {
  cin >>N;
  rep(i, N-1){
    int a,b; cin >>a >>b; a--; b--;
    G[a].push_back(b); G[b].push_back(a);
  }
}
*/

int main() {
  int a,b; cin >>a >>b;
  if (a+b == 15) cout <<"+" <<endl;
  else if (a*b == 15) cout <<"*" <<endl;
  else cout <<"x" <<endl;
}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

ll n, m;
ll t;
double P;
double eps = 1e-11;

double solve(ll i, double p) {
    double res = 0;
    if ((i * t) * p < eps) {
        return i * t * p;
    }
    res += solve(i + 1, pow((1.0 - P), i) * P) + (i * t) * p;
    return res;
}

int main() {
    cin >> n >> m;
    P = 1.0/pow(2, m);
    t = (n-m) * 100 + 1900 * m;
    cout << solve(1, P) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef pair<int,int> P;
typedef long long ll;

int main(void){
    int r,d,a;
    cin>>r>>d>>a;
    vector<int>s;
    int num=a;
    for(int i=1;i<=10;i++){
        num=r*num-d;
        s.push_back(num);
    }
    for(int i=0;i<10;i++){
        cout<<s[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
int main(int argc, const char * argv[]) {



    cin.tie(0);
    ios::sync_with_stdio(false);

    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;

    return 0;
}


Measured memory_bytes: 3640
N = int(input())
x = list(map(int, input().split()))
j=0
for i in range(N):
    if x[i]%2==1 or x[i]%3==0 or x[i]%5==0:
        pass
    else:
        j=1
if j==0:
    print("APPROVED")
else:
    print("DENIED")

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

 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin>>t;
	if(t==1){
		cout<<0<<"\n";
	}else{
		cout<<1<<"\n";
	}




	 

	
	

	



	

	



	


 
	
	
	
	
	return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll INF=1e18;
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
    //a^tを求める
    //例：d[i] = mint(k/i).pow(n);
    //mint(2).pow(n); 2^n
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}



int main() {
  ll n,k;
  cin >> n>>k;
  vector<P> v;
  for(ll i=1;i*i<=n;i++){
     v.push_back(make_pair(i,0));
     v.push_back(make_pair(n/i,0));
  }
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());
  rep(i,v.size()-1){
    v[i+1].second=v[i+1].first-v[i].first;
  }
  v[0].second=1;
  map<ll,ll>mp;
  rep(i,v.size()){
    mp[v[i].first]=i;
}
  vector<vector<mint>> dp(k+5, vector<mint>(v.size()+5, 0));
  dp[0][0]=1;
  rep(i,k){
    vector<mint> t(v.size()+5,0);
    t[0]=0;
//

    rep(j,v.size()){
      //
      t[j+1]=t[j]+dp[i][j]*v[j].second;
    //  cout<<t[j+1]<<endl;
    }
    rep(j,v.size()){
      ll m=mp[n/v[j].first];
      dp[i+1][j]+=t[m+1];
    //  cout<<'i'<<i<<'j'<<j<<'v'<<v[j].first<<" "<<v[j].second<<'d'<<dp[i+1][j]<<endl;
    }

  }
  mint ans=0;
  rep(i,v.size()){
    ans+=dp[k][i]*v[i].second;
  }
  cout<<ans;

}


Measured memory_bytes: 60436
###############################################################################

from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


###############################################################################


def main():
    a, b = intin()

    sub = b - a
    ans = 0

    for i in range(sub):
        ans += i

    ans -= a
    print(ans)

if __name__ == '__main__':
    main()


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

int main(){
    long long N, K;
    cin >> N >> K;

    double ans = 0;

    rep(i,N){
        double point = i + 1;
        long long min_count = 0;
        if(point < K){
            min_count = round(ceil(log2(K/point)));
        }
        ans += pow(0.5, min_count);
    }

    cout << fixed << setprecision(10) << ans / N << endl;

    return 0;
}

Measured memory_bytes: 4044
import math
a,b,c,d = map(int, input().split())
C = b//c - (a-1)//c
D = b//d - (a-1)//d
x = c*d//math.gcd(c,d)
CD = b//x - (a-1)//x
print((b-a+1) - (C+D-CD))

Measured memory_bytes: 9020
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main()
{
	long q;
	cin >> q;

	map <string, long> mp;

	for (long i = 0; i < q; i++) {
		int t;
		cin >> t;

		string s;
		cin >> s;

		if (t == 0) {
			long x;
			cin >> x;
			mp[s] = x;
		}
		else if (t == 1) {
			cout << mp.find(s)->second << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 27708
#include <bits/stdc++.h>
#include <stdio.h>
#include <cmath>
#include <tgmath.h>

using namespace std;

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;


int main() {

    int n,k;
    cin>>n>>k;

    vector<int>a(n);
    rep(i,n)cin>>a[i];

    cout<<((n-1)+(k-1)-1)/(k-1)<<endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int n, m, a;
set<P> f[1100];

int main() {
	while (cin >> n >> m >> a&&n + m + a) {
		REP(i, 1100)f[i].clear();
		REP(i, m) {
			int h, p, q;
			cin >> h >> p >> q;
			f[h].insert(P(p, q));
			//f[h].insert(P(q, p));
		}
		int now = a;
		REP(i, 1000) {
			if (f[1000 - i].find(P(now - 1,now)) != f[1000 - i].end())now = now - 1;
			else if (f[1000 - i].find(P(now,now + 1)) != f[1000 - i].end())now = now + 1;
		}
		cout << now << endl;
	}
}

Measured memory_bytes: 3100
#include<iostream>
	#include<vector>
	using namespace std;
	#define LL	long long
	const int MAXN = 2e5+10;

	int N;
	int c[MAXN];
	vector<int> G[MAXN];
//	int tot = 0;
//	int head[MAXN], Next[MAXN], to[MAXN];

	// sub[i]: 顶点i下子树顶点的个数
	int sub[MAXN];
	// cnt[i]: 颜色为i的顶点下子树顶点的个数
	int cnt[MAXN]; 
	// ans[i]: 颜色为i的顶点下不经过颜色i的顶点数
	LL ans[MAXN];
	
	// 一开始起名count结果和c++ count()冲突，调试了半天, md
	inline LL cal(int n) {
		// C(n,2) + n
		return 1LL*n*(n+1)/2;
	}
	/*
	void dfs(int v, int fa) {
		int tmp = cnt[c[v]];
		sub[v] = 1;
		for(int i=head[v]; i; i=Next[i]) {
			int u = to[i];
			if(u == fa) continue;
			cnt[c[v]] = 0;	// 置0重新计数
			dfs(u, v);
			sub[v] += sub[u];
			ans[c[v]] += count(sub[u] - cnt[c[v]]);
		}
		cnt[c[v]] = tmp + sub[v];
	}
	void add(int a, int b) {
		++tot;
		Next[tot] = head[a];
		to[tot] = b;
		head[a] = tot;
	}
	*/
	void dfs(int v, int fa) {
		int tmp = cnt[c[v]];
		sub[v] = 1;
		for(int u:G[v]) {
			if(u==fa) continue;
			cnt[c[v]] = 0;
			dfs(u, v);
			sub[v] += sub[u];
			ans[c[v]]+=cal(sub[u]-cnt[c[v]]);
		}
		cnt[c[v]] = tmp + sub[v];
	}
	
	int main() {
		std::ios::sync_with_stdio(false);
		cin>>N;
		for(int i=1; i<=N; i++) {
			cin >> c[i];
		}
		int a, b;
		for(int i=1; i<N; i++) {
			cin>>a>>b;
			G[a].push_back(b);
			G[b].push_back(a);
		}
		//dfs1(1, 0);
		dfs(1, 0);
		for(int i=1; i<=N; i++) {
			cout << cal(N) - ans[i] - cal(N-cnt[i]) << endl;
		}
		return 0;
	}


Measured memory_bytes: 37144
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main() {

int a,b,c,d,e,f;
   cin >> a;
  b=(a-9),c=(a-99),d=(a-999),e=(a-9999),f=(a-99999);
  {
  if(b<0){
    b=0;
  }
}
  {
  if(c<0){
    c=0;
  }
}
  {
  if(d<0){
    d=0;
  }
  }
  {
  if(e<0){
    e=0;
  }
}
  {
    if(f<0){
      f =0;
    }

  }
  
  cout <<a-b+c-d+e-f<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;

int main(){
    int a, b;
    int g[4][4];
    int i,j;
    
    for(i = 0; i < 4; i++){
        for(j = 0; j < 4; j++){
            g[i][j] = 0;
        }
    }
    
    for(i = 0; i < 4; i++){
        cin >> a >> b;
        g[a-1][b-1] = 1;
        g[b-1][a-1] = 1;
    }
    
    int count = 0;
    int flag = 1;
    
    for(i = 0; i < 4; i++){
        count = 0;
        for(j = 0; j < 4; j++){
            count += g[i][j];
        }
        if(count == 3){
            flag = 0;
            break;
        }
    }
    
    if(flag){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
const ll M=1000000007;
//------------------------------------------//

int main(){
  string S;cin>>S;
  int ans=0;
  rep(i,S.size()){
    ans+=(int)(S[i])-48;
    ans%=9;
  }
  if(ans==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
#define int long long 
using namespace std;


signed main() {
  int N;
  cin >> N;
  
  for( int h = 1; h <= 3500; h++ ){
    for( int n = 1; n <= 3500; n++ ){
      if( 4*h*n - N*n - N*h == 0 ) continue;
      if( ( N*h*n ) % ( 4*h*n - N*n - N*h ) == 0 ){
        int w = ( N*h*n ) / ( 4*h*n - N*n - N*h );
        if( w > 0 ){
          cout << h << " " << n << " " << w << endl;
          return 0;
        }
      }
    }
  }
    
}
  

Measured memory_bytes: 764
// Problem : D - String Formation
// Contest : AtCoder Beginner Contest 158
// URL : https://atcoder.jp/contests/abc158/tasks/abc158_d
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor2)

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define REP(i,n) for (ll i = 0; i < n; i++)
#define REPR(i,n) for(ll i = n-1; i >= 0; i--)
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define FORR(i,a,b) for(ll i = a-1; i>= b; i--)
#define ff first
#define ss second
#define MAXN (ll)1000002
#define MODN (ll)1000000007
#define mp make_pair
#define pb push_back
#define LN(x) (ll)x.length()
#define SZ(x) (ll)x.size()
#define bg(x) (x.begin())
#define rbg(x) (x.rbegin())
#define ENDL cout<<endl
string s;
deque<char> d;
ll q,n;
ll ti,fi;
char c;
bool ir=0;
int main() {
    cin>>s;
	n = LN(s);
	REP(i,n) {
		d.pb(s[i]);
	}
	cin>>q;
	REP(i,q) {
		cin>>ti;
		if(ti==1) {
			ir=!ir;
		} else {
			cin>>fi>>c;
			if(fi==1) {
				if(ir) d.pb(c); else d.push_front(c);
			} else {
				if(ir) d.push_front(c); else d.push_back(c);
			}
		}
	}
	if(ir) {
		auto it=d.rbegin();
		while(it != d.rend()) {
			cout<<*it;
			it++;
		}
	} else {
		auto it = d.begin();
		while(it != d.end()) {
			cout<<*it;
			it++;
		}
	}
}

Measured memory_bytes: 1024
import sys
from heapq import heappush, heappop
def input(): return sys.stdin.readline().strip()


def main():
    s = int(input())
    appear =set([])
    cnt = 0
    while s not in appear:
        appear.add(s)
        if s % 2 == 0: s = s // 2
        else: s = 3 * s + 1
        cnt += 1
    print(cnt + 1)



if __name__ == "__main__":
    main()


Measured memory_bytes: 38340
import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int k=sc.nextInt();
int n=sc.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++)
a[i]=sc.nextInt();
int m=0;
for(int i=0;i<n-1;i++)
{
	if(i==0)
	{
		int t=a[i]-a[n-1]+k;
		m=Math.max(m,t);
	}
	else
	{
		m=Math.max(m,(a[i+1]-a[i]));
	}		
}
int z=m;
System.out.println(k-z);
}

}

Measured memory_bytes: 77368
OVER = 10000

def factor():
	global w, pos
	if buf[pos] == '(':
		pos += 1
		f, v1 = calc()
		if not f: return [f, 0]
		pos += 1
	elif buf[pos] == 'i':
		pos += 1
		v1 = complex(0, 1)
	else:
		v1 = 0
		while pos < w and buf[pos].isdigit():
			v1 = 10*v1 + int(buf[pos])
			pos += 1
			if v1 > OVER: return [False, 0]
	return [True, v1]

def term():
	global w, pos
	f, v1 = factor()
	if not f: return [f, 0]
	while True:
		if pos >= w: break
		if buf[pos] != '*': break
		pos += 1
		f , v2 = factor()
		if not f: return [f, 0]
		v1 *= v2
		if abs(v1.real) > OVER or abs(v1.imag) > OVER: return [False, 0]
	return [True, v1]

def calc():
	global w, pos
	f, v1 = term()
	if not f: return [f, 0]
	while True:
		if pos >= w: break
		op = buf[pos]
		if op != '+' and op != '-': break
		pos += 1
		f , v2 = term()
		if not f: return [f, 0]
		if op == '+': v1 += v2
		else: v1 -= v2
		if abs(v1.real) > OVER or abs(v1.imag) > OVER: return [False, 0]
	return [True, v1]

while True:
	try: buf = list(input().strip())
	except: break
	w, pos = len(buf), 0
	f, ans = calc()
	if not f: print("overflow")
	elif ans.real == 0 and ans.imag == 0: print(0)
	elif ans.real == 0: print(int(ans.imag), 'i', sep='')
	elif ans.imag == 0: print(int(ans.real))
	else: print("{}{:+}i".format(int(ans.real), int(ans.imag)))


Measured memory_bytes: 5664
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m;
    cin >> n >> m;
    vector< int > k[15];
    for( int i = 0; i < m; ++i ) {
        int K;
        cin >> K;
        for( int j = 0; j < K; ++j ) {
            int a;
            cin >> a;
            k[i].pb( a - 1 );

        }
    }

    int p[m];
    for( int i = 0; i < m; ++i ) cin >> p[i];
    bitset< 10 > bs;
    int t = 1;
    int res = 0;
    for( int i = 0; i < n; ++i ) t *= 2;
    for( int i = 0; i < t; ++i ) {
        bs = i;
        bool flg = true;
        for( int j = 0; j < m; ++j ) {
            int cnt = 0;
            
            for( int l = 0; l < k[j].size(); ++l ) {
                if( bs[k[j][l]] ) ++cnt;

            }
            if( cnt % 2 != p[j] ) {
                flg = false;
                break;

            }
        }
        if( flg ) res++;
    }
    cout << res << endl;


    return 0;
}



Measured memory_bytes: 256
package main

import "fmt"

func s(n int) int {
	if n == 0 {
		return 0
	} else {
		return n%10 + s(n/10)
	}
}

func main() {
	var n int
	fmt.Scan(&n)
	if n%s(n) == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

void solve(){
	int n, d, cnt = 0;
	cin >> n >> d;
	vector<long double> v(n);
	for(int i =0; i < n; i++) {
		long double x, y;
		cin >> x >> y;
		v[i] = sqrt(x * x + y * y);
		if(v[i] <= d) cnt++;
	}
	cout << cnt << '\n';
}

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

	int t = 1;
	while(t--) solve();
}

Measured memory_bytes: 6368
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int D = sc.nextInt();
    int E = sc.nextInt();
    int F = sc.nextInt();
    int ans1 = 100 * A;
    int ans2 = 0;
    boolean[] water = new boolean[F + 1];
    boolean[] sugar = new boolean[F + 1];
    for(int i = 1; i <= F; i++) {
      for(int j = 0; j <= 30; j++) {
        int d = i - (100 * A * j);
        if((d >= 0) && ((d % (100 * B)) == 0)) {
          water[i] = true;
          break;
        }
      }
    }
    for(int i = 1; i <= F; i++) {
      for(int j = 0; j <= F; j++) {
        int d = i - (C * j);
        if((d >= 0) && ((d % D) == 0)) {
          sugar[i] = true;
          break;
        }
      }
    }
    for(int i = 0; i <= F; i++) {
      for(int j = 0; j <= (F - i); j++) {
        if(water[i] && sugar[j]) {
          if((E * i) >= (100 * j)) {
            if((ans2 * (i + j)) < (ans1 * j)) {
               ans1 = i + j; 
               ans2 = j;
            }
          }
        }
      } 
    }
    System.out.println(ans1 + " " + ans2);
  }
}

Measured memory_bytes: 23508
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M,C;
  cin>>N>>M>>C;
  vector<int>B(M);
  for(int i=0;i<M;i++)
    cin>>B.at(i);
  vector<vector<int>> A(N,vector<int>(M));
  for(int i=0;i<N;i++){
  for(int j=0;j<M;j++)
    cin>>A.at(i).at(j);
  
  }int sum=0;
  for(int i=0;i<N;i++){
  int sum1=C;
    for(int j=0;j<M;j++)
      sum1+=B.at(j)*A.at(i).at(j);
    
    if(0<sum1)
      sum++;
      
  } cout<<sum<<endl;

   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
  	cin >> N;
    vector<int> A(N);
    double B=0.0;
    for(int i=0; i<N; i++){
        cin >> A[i];
        B+=1.0/A[i];
    }
    cout << setprecision(16) << 1.0/B;
    return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
//#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <bitset>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <cmath>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <cctype>
#include <fstream>

#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define LFOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define LRFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000			 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define DINF 1000000000000000.0
#define PI 3.14159265358979
#define MAXI 7500000

//.size()はunsigned int　0-1をするとオーバーフローする

using namespace std;
typedef long long int ll;
typedef pair<double, pair<int, int> > P;//コスト、現在地、どこからきたか

//int dy[5] = { 0,0,1,-1,0 };
//int dx[5] = { 1,-1,0,0,0 };

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

struct edge
{
	int to;
	double cost;
};

int main(void)
{

	while(1){
		int n;
		cin >> n;
		if(n==0){
			break;
		}
		vector<string> s(n + 1);
		int deep = 0;

		FOR(i,1,n){
			cin >> s[i];
		}

		FOR(i,2,n){
			FOR(j,0,s[i].size()-1){
				if(s[i][j]=='.'||s[i][j]=='|'){
				}else{
					if(j!=0){
						s[i][j - 1] = '+';
						break;
					}
				}
				
			}
		}

		bool flag = false;
		int first, second;

		FOR(i,0,999){
			flag = false;
			FOR(j, 1, n)
			{
				if(s[j].size()<=i){
					continue;
				}
				if(s[j][i]=='+'){
					if(flag){
						second = j - 1;
						FOR(k,first,second){
							if(s[k][i]!='+'){
								s[k][i] = '|';
							}
						}
						flag = true;
					}else{
						first = j + 1;
						flag = true;
					}
					continue;
				}
				if(s[j][i]>='a'&&s[j][i]<='z'){
					flag = false;
					continue;
				}
				s[j][i] = ' ';
			}
		}

		FOR(i,1,n){
			cout << s[i] << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 3576
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>

using namespace std;

vector<int> G[100005];
int dist[100005];
int ans[100005];
bool check[100005];

void bfs(int st) {

	queue<int> que;
	que.push(st);
	dist[st] = 0;
	ans[st] = 1;

	while (!que.empty()) {

		int now = que.front();
		que.pop();

		for (auto nxt : G[now]) {
			if (dist[nxt] > dist[now] + 1) {
				ans[nxt] = now;
				dist[nxt] = dist[now] + 1;
				que.push(nxt);
			}
		}
	}
}



int main()
{
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++)
	{
		int a, b;
		cin >> a >> b;
		G[a].emplace_back(b);
		G[b].emplace_back(a);
	}

	for (int i = 0; i < 100005; i++) {
		dist[i] = ans[i] = 1e9;
	}

	dist[1] = 0;
	bfs(1);

	bool flag = true;
	for (int i = 1; i <= N; i++) {
		if (dist[i] == 1e9) {
			flag = false;
			break;
		}
	}

	if (flag) {
		cout << "Yes" << endl;
		for (int i = 2; i <= N; i++) {
			cout << ans[i] << endl;
		}
	}
	else {
		cout << "No" << endl;
	}


	return 0;
}

Measured memory_bytes: 10780
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
#include <cassert>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1e9)
#define LINF (long long int)(1e18)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}



int main(void){
  fast_io
  cout<<fixed<<setprecision(15);
  ll k;
  cin >> k;
  ll a = 7;
  ll ans = 1;
  rep(i,1000000){
	  if(a%k == 0){
		  cout << ans << endl;
		  return 0;
	  }else{
		  a = a%k;
		  a = 10*a+7;
		  ans++;
	  }
  }
  cout << "-1" << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int n, k;
    cin >> n >> k;
    cout << n - k + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define endl "\n"
    #define int long long int
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define f first
    #define s second

    using namespace std;
int power(int base, int exp)
{
    if (exp == 0)
       return 1;
    else if (exp == 1)
       return base;
    else
    {
       int calc;
       if (exp % 2 == 0)
       {
         calc = power(base, exp/2);
         calc =(calc* calc)%mod;
       }
       else
       {
         calc = (base*power(base, exp-1))%mod;
       }
       return calc%mod;
    }
}
    int32_t main()
    {
        std::ios::sync_with_stdio(false);
        int n;
        cin>>n;
        map<string,int>m;
        for(int i=0;i<n;i++)
        {

            string s;
            cin>>s;
            m[s]++;
        }
        cout<<"AC x "<<m["AC"]<<endl;
        cout<<"WA x "<<m["WA"]<<endl;
        cout<<"TLE x "<<m["TLE"]<<endl;
        cout<<"RE x "<<m["RE"]<<endl;

        return 0;
    }


Measured memory_bytes: 3628