akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n;


signed main(){
    while(true){
        int n;
        cin >> n;
        if(n==0) break;
        int tot1=0,tot2=0;
        REP(i,n){
            int x;
            cin >> x;
            tot1 += x;
            tot2 += x*x;
        }
        double x = (double)tot1/(double)n;
        double y = (double)tot2/(double)n;
        x = x*x;
        printD(sqrt(y-x));

    }
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}






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

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

using namespace std;

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

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int n;
	cin>>n;
	int x = n%10;
	if(x==3) cout<<"bon"<<endl;
	else if(x==0 || x==1 || x==6 || x==8)cout<<"pon"<<endl;
	else cout<<"hon"<<endl;
	return 0;
}

Measured memory_bytes: 3636
n,k=map(int,input().split())
a=list(map(int,input().split()))
f=list(map(int,input().split()))

a=sorted(a)[::-1]
f=sorted(f)

ok=10**18
ng=-1

import math
def isOK(val,arr,farr,k):
  s=0
  for i in range(len(arr)):
    s+=max(math.ceil(a[i]-val/f[i]),0)
  return s<=k
  
while abs(ok-ng)>1:
  mid=abs(ok+ng)//2
  if isOK(mid,a,f,k):
    ok=mid
  else:
    ng=mid
    
print(ok)


Measured memory_bytes: 122700
#include <bits/stdc++.h>
using namespace std;
int main(){
int N, M, i, AC=0, WA=0; cin >> N >> M; int p[M], C[N]={}, D[N]={}; string S[M];
for(i=0; i<M; i++){
  cin >> p[i] >> S[i];
if(S[i]=="AC"&&C[p[i]-1]==0){ AC++; C[p[i]-1]=1; D[p[i]-1]=i; }
}
for(i=0; i<M; i++){  
if(S[i]=="WA"&&C[p[i]-1]==1&&i<D[p[i]-1]){ WA++; }
}
cout << AC << " " << WA << "\n";
}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int a = 10;
		
		for(int i = 1; i <= 9; i++) {
			if(n%i == 0) {
				 a = n/i;
			}
			if(a<10) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		System.out.println("No");
		
		
		
		
	}

}


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

int main(){
  int n,m;
  cin>>n>>m;
  
  int a[m],b[m];
  for(int i=0;i<m;i++){
    cin>>a[i]>>b[i];
  }
  
  int num[n+1]={0};
  for(int i=0;i<m;i++){
    num[a[i]]++;
    num[b[i]]++;
  }
  for(int i=1;i<=n;i++){
    cout<<num[i]<<endl;
  }
  
}

Measured memory_bytes: 256
from heapq import *
n = int(input())
INF = float("inf")
adj = [[] for _ in range(10**4+4)]
for _ in range(n):
    a,*b = map(int,input().split())
    if b[0] != 0:
        c = b[1:]
        for i in range(len(c)//2):
            k,w = c[2*i],c[2*i+1]
            adj[a].append((k,w))
H = []
heapify(H)
searched = [0]*n
d = [INF]*n
d[0] = 0
heappush(H, (0,0))
while H:
    f = heappop(H)
    u = f[-1]
    searched[u] = 1
    if d[u] < f[0]:
        continue
    for j in range(len(adj[u])):
        v = adj[u][j][0]
        if searched[v]:
            continue
        if d[v] > d[u]+adj[u][j][-1]:
            d[v] = d[u]+adj[u][j][-1]
            heappush(H,(d[v],v))
for i in range(n):
    ans = -1 if d[i] == INF else d[i]
    print(i,ans)


Measured memory_bytes: 69600
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
vector<ll>v[100005];
ll deg[100005]={0};
ll d[100005]={0};
queue<ll>q;
void bfs(ll u)
{
    q.push(u);
    ll i;
    while(!q.empty())
    {
        ll x=q.front();
        q.pop();
        for(i=0;i<v[x].size();i++)
        {
            deg[v[x][i]]--;
            if(d[v[x][i]]<=d[x]+1)
                d[v[x][i]]=d[x]+1;
            if(deg[v[x][i]]==0)
                q.push(v[x][i]);
        }
    }
}

int main()
{
    ll n,m,i,j,k,l,x,y;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>x>>y;
        v[x].push_back(y);
        deg[y]++;
    }
    for(i=1;i<=n;i++)
    {
        if(deg[i]==0&&d[i]==0)
        {
            bfs(i);
        }
    }
    ll ans=0;
    for(i=1;i<=n;i++)
    {
        ans=max(ans,d[i]);
    }
    cout<<ans;
    return 0;
}

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

#define rep(i,z) for(int i = 0; i<(int)(z); i++)
#define rep1(i,z) for(int i = 1; i<=(int)(z); i++)
 
using namespace std;

typedef long long ll;
const ll MOD=1e9+7;
using pear = pair<int,int>;



int main(){
   int n, m; cin>>n >>m;
   vector<int> ans(n);
   if(n > 1) ans[0] = 1;
   vector<bool> already(n);
   rep(i, n) already[i] = false;
   rep(i, m){
       int s, c; cin>>s >>c;
       s--;
        if(s == 0 && c == 0 && n > 1){
            cout<< -1 <<endl;
            return 0;
        }
       if(already[s] && ans[s] != c) {
           cout<< -1 <<endl;
           return 0;
        }else{
           
           already[s] = true;
           ans[s] = c;
       }
   }
   rep(i, n) cout<<ans[i];
   cout<<""<<endl;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using edge = pair<ll, P>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
using Graph = vector<vector<ll>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N, M;
    cin >> N >> M;
    priority_queue<int> que;
    rep(i, N) {
        int a;
        cin >> a;
        que.push(a);
    }

    while (M > 0) {
        M--;
        int q = que.top(); que.pop();
        q /= 2;
        que.push(q);
    }

    ll ans = 0;
    while (que.size() != 0) {
        int q = que.top(); que.pop();
        ans += q;
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n, m;
    cin >> n >> m;
    vec x(m);
    rep(i, m) cin >> x[i];

    if (n >= m) {
        cout << 0 << endl;
        exit(0);
    }

    sort(all(x));
    vec d(m-1);
    rep(i, m-1) d[i] = abs(x[i+1] - x[i]);

    sort(all(d), greater<int>());

    int res = accumulate(d.begin() + n - 1, d.end(), 0);
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  long long int mod=1000000007,ans=1,n,a[100010],b[100010],i;
  scanf("%lld\n",&n);
  for(i=0;i<n;i++){
    b[i]=0;
    scanf("%lld\n",&a[i]);
  }
  b[0]=3;
  for(i=0;i<n;i++){
    ans=ans*b[a[i]]%mod;
    b[a[i]+1]++;
    b[a[i]]--;
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for (ll i = ll(a); i <= ll(b); i++)
 
ll m = 7 + 1e9;
ll p = 7 + 1e9;
 
ll fact[200001];
 
ll gcd(ll a, ll b, ll &x, ll &y) {
    if (a == 0)
    {
        x = 0;
        y = 1;
        return b;
    }
    
    ll x1, y1;
    ll d = gcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}
 
ll inv(ll a)
{
	ll x, y;
	ll g = gcd(a, m, x, y);
 
    x = (x % m + m) % m;
    return x;
}
 
void multiply(ll &a, vector<ll> B)
{
	for(auto b:B)
	{
		a*=b;
		a%=p;
	}
}
 
ll choose(ll a, ll b)
{
	ll ret=1;
	multiply(ret,{fact[a],inv(fact[b]),inv(fact[a-b])});
	return ret;
}
 
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
 
	//ifstream cin("input.txt");
	//ifstream cin("test.in");
	//ofstream cout("test.out");
 
	fact[0]=1;
 
	REP(i,1,200000)
	{
		fact[i]=i*fact[i-1];
		fact[i]%=p;
	}
 
	ll n,m,k;
	cin>>n>>m>>k;
 
	if(k==1)
	{
		cout << 0 << endl;
		return 0;
	}
 
	ll col11=1;
 
	multiply(col11,{n,n,m,m,n-1,inv(2)});
 
	ll col12=1;
 
	multiply(col12,{n,m,m,n-1,n+n-1,inv(6)});
 
	swap(n,m);
 
	ll col21=1;
 
	multiply(col21,{n,n,m,m,n-1,inv(2)});
 
	ll col22=1;
 
	multiply(col22,{n,m,m,n-1,n+n-1,inv(6)});
 
	ll ans = col11 - col12 + p;
	ans%=p;
	ans += col21 - col22 + p;
	ans%=p;
 
	multiply(ans,{choose(k,2),choose(n*m,k),inv(choose(n*m,2))});
 
	cout << ans << endl;
}

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

#define MAX_N 100000
#define MOD 1000000007
int64_t S[MAX_N+1];
int64_t DPA[MAX_N+1];
int64_t DPB[MAX_N+1];

int main(){
    int N;
    int64_t A,B;
    cin>>N>>A>>B;
    S[0]=INT64_MIN;
    for(int i=1;i<=N;i++){
        cin>>S[i];
    }
    DPA[0]=DPB[0]=1;
    int Azero=-1,Bzero=-1;
    for(int i=2;i<=N;i++){
        int KB = min((int)(upper_bound(S,S+i,S[i]-B)-S)-1,i-2);
        //DPB[i-1]=(KB>Azero?DPA[KB]-(Azero>=0?DPA[Azero]:0):0)+DPB[i-2];
        if(KB>Azero){
            if(Azero>=0){
                DPB[i-1]=(DPA[KB]+MOD-DPA[Azero])%MOD;
            }else{
                DPB[i-1]=DPA[KB];
            }
        }
        DPB[i-1]=(DPB[i-1]+DPB[i-2])%MOD;

        int KA = min((int)(upper_bound(S,S+i,S[i]-A)-S)-1,i-2);
        //DPA[i-1]=(KA>Bzero?DPB[KA]-(Bzero>=0?DPB[Bzero]:0):0)+DPA[i-2];
        if(KA>Bzero){
            if(Bzero>=0){
                DPA[i-1]=(DPB[KA]+MOD-DPB[Bzero])%MOD;
            }else{
                DPA[i-1]=DPB[KA];
            }
        }
        DPA[i-1]=(DPA[i-1]+DPA[i-2])%MOD;

        if(S[i]<S[i-1]+A){
            Azero=max(Azero,i-2); //..Azero]の区間は0
        }
        if(S[i]<S[i-1]+B){
            Bzero=max(Bzero,i-2);
        }
    }
    int64_t ans=0;
    ans=(ans+DPA[N-1]+MOD-DPA[Azero])%MOD;
    ans=(ans+DPB[N-1]+MOD-DPB[Bzero])%MOD;
    cout<<ans<<endl;
    return 0;
}

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

int main() {
  int n,m,a,sum = 0;
  cin >> n >> m;
  for(int i=0; i<m; i += 1){
  	cin >> a;
  	sum += a; 
  }
  if(sum<=n){
 	cout << n-sum << endl;
  }else{
  	cout << -1 << endl;
  }
  

  return 0;
}

Measured memory_bytes: 3616
/*input
1
0
*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const ll MOD = (ll)1e9 + 7;
int n, a[25][25];
ll dp[25][(1 << 21) + 5];

ll solve(int ind, int mask){
	if(ind == n){
		return __builtin_popcount(mask) == n; //all paired 
	}
	if(dp[ind][mask] != -1){
		return dp[ind][mask];
	}
	ll ans = 0;
	for(int i = 0; i < n; i++){
		if(a[ind][i] && !(mask & (1 << i))){
			ans += solve(ind + 1, mask | (1 << i));
			ans %= MOD;
		}
	}
	return dp[ind][mask] = ans % MOD;
}

int main(){
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			scanf("%d", a[i] + j);
		}
	}
	memset(dp, -1, sizeof dp);
	printf("%lld\n", solve(0, 0));
	return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<string> s;
  vector<int> a,b;
  string str,st;
  int c,d;
  while(cin >> st >> c >> d){
    s.pb(st);
    a.push_back(c+d);
    b.push_back(c*200+d*300);
  }
  rep(i,s.size()){
    cout << s[i] << " " << a[i]<< " " << b[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 3208
# -*- coding: utf-8 -*-

N = int(input())
Z = []
for i in range(N):
    Z.append(list(map(int, input().split())))

dp = [[0] * 3 for _ in range(N)]
#print(dp)
dp[0] = Z[0]

for i in range(1,N):
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + Z[i][0]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + Z[i][1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + Z[i][2]
    #print(dp)

print(max(dp[-1]))


Measured memory_bytes: 47384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  bool ans = false ;
  if(s.at(0) == 'A'){
    int c = 0;
    for( int i = 2;i<s.size() -1;i++){
      if(s.at(i) == 'C'){
        c++;
      }
    }
    int dai = 0;
    if( c == 1){
      for( int i = 0;i<s.size();i++){
        if( s.at(i) < 'a' || s.at(i) > 'z'){
          dai++;
        }
      }
    }
    if(  dai == 2){
      ans = true;
    }
  }
  if( ans == true ){
    cout << "AC";
  }
  else{
    cout << "WA";
  }
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	Scanner sc;
	
	private void calc() {
		sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		System.out.println(6-A-B);
	}

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

Measured memory_bytes: 21716
//Δ_B
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 1111;
int n,k,m;
LL a[N],b[N*N],ans;
int main()
{
	int i,j,o;
	scanf("%d%d",&n,&k);
	for(i=1;i<=n;i=i+1)
		scanf("%d",a+i),a[i]+=a[i-1];
	for(i=0;i<=n;i=i+1)
		for(j=i+1;j<=n;j=j+1)
			b[++m]=a[j]-a[i];
	for(j=60;j>=0;j=j-1){
		o=0;
		for(i=1;i<=m;i=i+1)
			if(b[i]&((LL)1<<j))
				o++;
		if(o<k)
			continue;
		ans|=(LL)1<<j;
		for(i=1;i<=m;i=i+1)
			if(!(b[i]&((LL)1<<j)))
				b[i]=0;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
using edge = vector<VI>;
#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 SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T> inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    int n; cin >> n;
    VL a(n); cin >> a;

    ll bit = 0, ans = 0;
    int left = 0, right = 0;
    for (; left < n; left++){
        while (right < n && (bit | a[right]) == (bit + a[right])){
            bit |= a[right];
            right++;
        }
        ans += right - left;
        bit &= ~a[left];
    }

    cout << ans << "\n";
}

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

int main()
{
    int n;
    cin >> n;

    int start = 1, end = n, mid;

    while(start <= end){
        mid = (start + end) / 2;

        double x = (double) mid * 1.08;
        //x += 0.5;

        int xx = (int)x;

        if(xx == n){
            cout << mid << "\n";
            return 0;
        }

        if(xx > n) end = mid-1;
        else start = mid+1;
    }

    cout << ":(" << "\n";

    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define float long double
#define all(c) (c).begin(), (c).end()
#define endl '\n'



int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
//     int t;
//      cin >> t;

//      while(t--){



// }
     uint64_t a;
     double b;
     cin >> a >> b;
     int x = b*100 + 0.01;
     a = a*x;
     a = a/100;
     cout << a << endl;


return 0;
}




Measured memory_bytes: 3652
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace D
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var s = Console.ReadLine();
            var q = int.Parse(Console.ReadLine());
            var rightBuilder = new StringBuilder(s, q);
            var leftBuilder = new StringBuilder(q);
            var isReverse = false;
            Func<string, string> reverse = str =>
            {
                var builder = new StringBuilder(str.Length);
                for (var i = str.Length - 1; i >= 0; i--)
                {
                    builder.Append(str[i]);
                }
                return builder.ToString();
            };

            for (var i = 0; i < q; i++)
            {
                var query = Console.ReadLine().Trim().Split(' ');
                if (query[0] == "1")
                {
                    isReverse = !isReverse;
                }
                else if (query[0] == "2")
                {
                    if (query[1] == "1")
                    {
                        if (isReverse) rightBuilder.Append(query[2]);
                        else leftBuilder.Append(query[2]);

                    }
                    else if (query[1] == "2")
                    {
                        if (isReverse) leftBuilder.Append(query[2]);
                        else rightBuilder.Append(query[2]);
                    }
                }
            }
            var right = rightBuilder.ToString();
            var left = leftBuilder.ToString();
            var result = isReverse ? reverse(right) + left : reverse(left) + right;
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 18868
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<queue>
#include<bitset>

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)

using namespace std;

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

int main() {
	int n, i, j, k, count, m;
	vi h;

	cin >> n;
	h.resize(n);
	rep(i, n) {
		cin >> h[i];
	}

	count = 0;
	while (true) {
		i = 0;
		while (h[i] == 0) {
			i++;
			if (i == n) {
				break;
			}
		}
		if (i == n) {
			break;
		}
		m = h[i];
		for (j = i + 1; j < n; j++) {
			if (h[j] == 0) {
				for (k = i; k < j; k++) {
					h[k] -= m;
				}
				count += m;
				break;
			}
			else {
				m = min(h[j], m);
			}
		}
		if (j == n) {
			for (k = i; k < n; k++) {
				h[k] -= m;
			}
			count += m;
		}

	}

	cout << count;

	return 0;
}

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

int main(){
  int a,b;
  int s;
  
  cin>>a>>b;
  s=a*b;
  
  if(s%2==0){
    cout<<"Even"<<endl;
  }
  else{
    cout<<"Odd"<<endl;
  }
  
}

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

using namespace std;
using vi = vector<int>;

int main(void)
{
    int n, sum;
    vi  a;
    cin >> n;

    sum = 0;
    a.resize(n);
    for (auto &ai : a)
    {
        cin >> ai;
        sum ^= ai;
    }

    for (auto ai : a)
        cout << (ai ^ sum) << " ";
    cout << endl;

    return 0;
}


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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

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

    int x;
    cin >> x;

    cout << (x >= 30 ? "Yes" : "No") << "\n";

    return 0;
}


Measured memory_bytes: 3592
import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )
import Data.List

import qualified Data.Vector.Unboxed as U

cReadLn :: IO Int
cReadLn = fst . fromJust . C.readInt <$> C.getLine

getParms :: IO [Int]
getParms = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  [n,k] <- getParms
  as    <- getParms
  print $ f k as

f :: Int -> [Int] -> Int
f k as 
  | k >= l = 0 -- There are enough, no need to rewrite.
  | k <  l = g ns (l-k) 0
  where
    as' = group . sort $ as
    l   = length as' -- # of kinds.
    ns  = sort . map (U.length . U.fromList) . group . sort $ as -- A list of # of kinds.

    g :: [Int] -> Int -> Int -> Int
    g _      0 x = x -- Assuming k<=n.
    g (n:ns) k x = g ns (k-1) (x + n)

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

int main(){
  int n, m;  scanf("%d %d", &n, &m);
  int **graph;
  graph = (int **)malloc(sizeof(int*)*(n+5));
  for(int i=0; i<=n+1; i++)  graph[i] = (int *)malloc(sizeof(int)*(m+5));

  for(int i=0; i<m; i++){
    int a, b;  scanf("%d %d", &a, &b);
    graph[a][++graph[a][0]] = b;
    graph[b][++graph[b][0]] = a;
  }

  int visited[100005] = {0};
  visited[1] = 1;
  int ans[100005] = {0};
  int start = 0, end = 0;
  int will[200005] = {0};
  will[end++] = 1;
  while((end-start) != 0){
    int from = will[start];
    start = (start + 1) % 200005;
    for(int i=1; i<=graph[from][0]; i++){
      int to = graph[from][i];
      if(visited[to] == 0){
	visited[to] = 1;
	//	will[++will[0]] = to;
	will[end] = to;
	end = (end + 1) % 200005;
	ans[to] = from;
      }
    }
  }
  for(int i=2; i<=n; i++)
    if(ans[i] == 0){
      printf("No\n");
      return 0;
    }
  printf("Yes\n");
  for(int i=2; i<=n; i++){
    printf("%d\n", ans[i]);
  }  
  return 0;
}


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

int main() {
    int N, X, T;
    cin >> N >> X >> T;
    if(N % X == 0) cout << N / X * T << endl;
    else cout << (N / X + 1) * T;  
}

Measured memory_bytes: 3584
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
out=0
bb=0
for i in range(n):
  if bb<a[n-i]:
    out+=bb
    a[n-i]=a[n-i]-bb
  else:
    out+=a[n-i]
    a[n-i]=0
    
  if a[n-i]<b[n-i-1]:
    out+=a[n-i]
    bb=b[n-i-1]-a[n-i]
  else:
    out+=b[n-i-1]
    bb=0

if a[0] > bb:
  out+=bb
else:
  out+=a[0]
print(out)
    

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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
  return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
  return a / gcd(a, b) * b;
}

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

int main()
{
  int k;
  ci >> k;

  co << k / 2 * (k - k / 2) << en;
  
  return 0;
}


Measured memory_bytes: 256
from bisect import bisect_left, bisect_right
q = int(input())
lr = []
for _ in range(q):
    l, r = map(int, input().split())
    lr.append((l, r))
primes = set(range(3, 10**5, 2))
primes.add(2)
for i in range(3, 10**5, 2):
    if i not in primes:
        continue
    for j in range(i*2, 10**5, i):
        primes.discard(j)
nums = []
for i in primes:
    if (i+1)//2 in primes:
        nums.append(i)
nums.sort()
for l, r in lr:
    print(bisect_right(nums, r)-bisect_left(nums, l))

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

const int N = 1e5+5;
const int M = 1e9+7;
long long suf[N][30], ans;
int n;
string s;

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

    cin >> n >> s;
    for(int i=n-1;i>=0;i--){
        suf[i][s[i] - 'a']++;
        for(int j=0;j<26;j++){
            suf[i][j] += suf[i+1][j];
        }
    }

    for(int i=0;i<n;i++){
        long long res = 1;
        int k = s[i] - 'a';
        for(int j=0;j<26;j++){
            if(j!=k){
                res *= (suf[i+1][j] + 1);
                res %= M;
            }
        }
        ans += res;
        ans %= M;
    }

    cout << (ans%M + M)%M << '\n';


    return 0;
}


Measured memory_bytes: 23888
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<ll, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

ll ufp[100100];
ll ufr[100100];

int ufind(int p){
	if(ufp[p] != p){
		ufp[p] = ufind(ufp[p]);
	}
	return ufp[p];
}

void unionf(int x, int y){
	x = ufind(x);
	y = ufind(y);
	if(x == y){
		return;
	}
	if(ufr[x]>ufr[y]){
		ufp[y] = x;
		ufr[x] += ufr[y];
	}else{
		ufp[x] = y;
		ufr[y] += ufr[x];
	}
}

vector<E> g,f[100100];

bool c[100100],r[100100];

queue<int> q;

bool comp(E a, E b){
	return (a.first<b.first);
}

int main(void){
	int n,m,i,j,u,v,ans=0;
	ll s=0ll,a;
	cin >> n >> m;
	fill(c,c+100100,false);
	fill(r,r+100100,false);
	for(i=0; i<n; ++i){
		cin >> ufr[i];
		ufp[i] = i;
	}
	for(i=0; i<m; ++i){
		cin >> u >> v >> a;
		--u; --v;
		g.push_back(E(a,P(u,v)));
	}
	sort(g.begin(),g.end(),comp);
	for(i=0; i<m; ++i){
		a = g[i].first;
		u = g[i].second.first;
		v = g[i].second.second;
		f[u].push_back(E(a,P(v,i)));
		f[v].push_back(E(a,P(u,i)));
		unionf(u,v);
		if(ufr[ufind(u)]>=a){
			c[i] = true;
		}
	}
	for(i=(m-1); i>=0; --i){
		if(r[i] || (!c[i])){
			continue;
		}
		a = g[i].first;
		q.push(g[i].second.first);
		q.push(g[i].second.second);
		r[i] = true;
		while(!q.empty()){
			u = q.front();
			q.pop();
			for(j=(f[u].l_ength()-1); j>=0; --j){
				if(r[f[u][j].second.second] || f[u][j].first > a){
					continue;
				}
				r[f[u][j].second.second] = true;
				q.push(f[u][j].second.first);
			}
		}
	}
	for(i=0; i<m; ++i){
		if(r[i]){
			continue;
		}
		++ans;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 11248
#include<stdio.h>

int main(){
    long a, b;
    scanf("%ld%ld", &a, &b);
    long ans;
    if(a%2==0 && b%2==1){
        int num = (b-a+1)/2%2;
        ans = num;
    }
    else if(a%2==1 && b%2==1){
        int num = (b-a)/2%2;
        ans = num;
        ans ^= a;
    }
    else if(a%2==1 && b%2==0){
        int num = (b-a-1)/2%2;
        ans = num;
        ans ^= a;
        ans ^= b;
    }
    else{
        int num = (b-a)/2%2;
        ans = num;
        ans ^= b;
    }
    printf("%ld", ans);
    return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////

int s[26],t[26];
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    string S,T; cin >> S >> T;
    int N = S.size();

    rep(i,26) s[i] = t[i] = -1;
    char c = 0;
    char d = 0;
    rep(i,N) {
        int a = S[i] - 'a';
        if (s[a]==-1) s[a] = c++;
        S[i] = s[a];
        int b = T[i] - 'a';
        if (t[b]==-1) t[b] = d++;
        T[i] = t[b]; 
    }
    cout << (S==T ? "Yes" : "No") << ln;
}


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

int main(){
    long long n, t, a;
    cin >> n >> t >> a;

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

    long double dif_min = 1e9;
    long long index_min;

    for(long long i = 0; i < n; i++){
        long double temp = (long double)t - (long double)h[i]*0.006;
        if(abs(a-temp) < dif_min){
            dif_min = abs(a-temp);
            index_min = i;
        }
    }

    cout << index_min + 1 << endl;
    return 0;

}

Measured memory_bytes: 3612
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31))

ll n,k;
ll ans;
int main(){
	scanf("%lld%lld",&n,&k);
	rep(b,k+1,n+1){
		//商がいくつまでいけるか
		ll up=n/b;
		//商がup未満なら全部いける
		ans+=up*(b-k);
		//ただし0は除く
		if(k==0)ans--;
		//商がupのときはn%bまでいける
		if(n%b>=k)ans+=n%b-k+1;
//		printf("%lld ",ans);
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 128
N = int(input())
ans = 0
for i in range(1,N+1):
    if i % 3 == 0 and i % 5 == 0:
        pass
    elif i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    else:
        ans += i

print(ans)


Measured memory_bytes: 9160
#include <iostream>
using namespace std;
int main(){
  int natu,suugaku,kokugo,suu,koku;
  cin >> natu >> kokugo >> suugaku >> koku >> suu;
  int km = (kokugo/koku);
  if(kokugo%koku > 0)km++;
  int sm = (suugaku/suu);
  if(suugaku%suu > 0)sm++;
  if( km > sm ){
    cout << natu-km << endl;
  }else {
    cout << natu-sm << endl; 
  }
  return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
int main()
{

 int a,b,c;
 scanf("%d%d%d",&a,&b,&c);

     if(abs(a-b)> abs(a-c) )
     {
         if(abs(a-b)> abs(b-c))
             printf("%d",abs(a-b));
         else
            printf("%d",abs(b-c));

     }
     else
     {
         if(abs(a-c)>abs(b-c))
            printf("%d",abs(a-c));
         else
            printf("%d",abs(b-c));
     }


return 0;
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define repd(i, n) for (int i = (n)-1; i >= 0; --i)
#define repds(i, n) for (int i = (n); i > 0; --i)
#define loop(i, x, n) for (int i = (x); i < (n); ++i)
#define loops(i, x, n) for (int i = (x); i <= (n); ++i)
#define loopd(i, x, n) for (int i = (x); i > (n); --i)
#define loopds(i, x, n) for (int i = (x); i >= (n); --i)
#define itrep(i, a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i, a) for (auto i = rbegin(a); i != rend(a); ++i)
#define each(i, x) for (auto &&i : x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(a) ((int)a.size())
#define pow2(n) (n * n)
#define int ll
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
using p_queue = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-8;
ll mod = static_cast<ll>(1e9 + 7);
template <class T, class... Args>
constexpr void mins(T &a, Args... args) { a = min<T>({a, args...}); }
template <class T, class... Args>
constexpr void maxs(T &a, Args... args) { a = max<T>({a, args...}); }
template <class F>
class FixPoint : private F {
public:
    explicit constexpr FixPoint(F &&f) : F(std::forward<F>(f)) {}
    template <class... Args>
    constexpr decltype(auto) operator()(Args &&... args) const { return F::operator()(*this, std::forward<Args>(args)...); }
};
template <class F>
constexpr decltype(auto) funcs(F &&f) { return FixPoint<F>{std::forward<F>(f)}; }
template <class T>
std::vector<T> vecs(int n, T &&val) { return std::vector<T>(std::forward<int>(n), std::forward<T>(val)); }
template <class... Args>
decltype(auto) vecs(int n, Args &&... args) { return std::vector<decltype(vecs(std::forward<Args>(args)...))>(std::forward<int>(n), vecs(std::forward<Args>(args)...)); }
template <class V, class T>
void fill(V &x, const T &val) { x = val; }
template <class V, class T>
void fill(vector<V> &vec, const T &val) {
    for (auto &&v : vec)
        fill(v, val);
}

void solve() {
    int n, d;
    cin >> n >> d;
    vector<int> x(n), y(n);
    rep(i, n) cin >> x[i] >> y[i];

    int ans = 0;
    rep(i, n) if (pow2(x[i]) + pow2(y[i]) <= d * d)++ ans;
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout.flush();
    return 0;
}

Measured memory_bytes: 6328
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
vector<int> grf[MAXN];
int visited[MAXN],tin[MAXN],low[MAXN];
int timer = 0, n,m;
set<int> arp;


void dfs(int u,int p=-1){
    visited[u]=true;
    tin[u]=low[u]= timer++;
    int childs=0;
    for(auto x: grf[u]){
        if(x==p){continue;}
        if( visited[x]){
            // ancestor
            low[u]=min(low[u],tin[x]);
        }
        else{
            childs++;
            dfs(x,u);
            low[u] = min(low[u],low[x]);
            if(p!= -1 and low[x] >= tin[u]){
                arp.insert(u);
            }
        }
    }

    if( p==-1 and childs>1){
        arp.insert(u);
    }
}

int main() {
    // freopen("./input.txt","r",stdin);
    // freopen("./output.txt","w",stdout);
    cin>>n>>m;
    for(int i=0; i<m; i++){
        int x,y; cin>>x>>y;
        grf[x].push_back(y);
        grf[y].push_back(x);
    }
    for(int i=0; i<n; i++){
        if(!visited[i]){
            dfs(i);
        }
    }
    for(auto p: arp){
        cout<<p<<"\n";
    }
}


Measured memory_bytes: 6936
/*3.4 hightierra*/
#include <stdio.h>
 
int main(void){
    //変数Nを定義、値を入力
    int N;
    scanf("%d",&N);
 
    int i,j; //掛け算する数
    int judge = 0; //九九で表せるかの判定
 
    /*二重ループで九九にあるかを判定*/
    for(i=1; i<10; i++){
      	for(j=1; j<10; j++){
          if(N == i*j){
            judge = 1; //表せたらjudgeを１に
            break; //内側for文を抜ける
          }
      	}
        if(judge){
            break; //外側for文を抜ける
        }
    }
    // 判定
    if(judge){
      	printf("Yes\n");
    }else{
      	printf("No\n");
    }
 
    return 0;
}

Measured memory_bytes: 128
function Main(input){
	input = ~~input;
  var i = input/2;
  return Math.floor(i)*Math.ceil(i);
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
50
`);

Measured memory_bytes: 7372
#ifndef ___Rank_Union_Find
#define ___Rank_Union_Find

#include <vector>

// ------ Class ------ //
class UnionFind {
private:
	unsigned size_; std::vector<unsigned> par, rank;
public:
	UnionFind() : size_(0), par(std::vector<unsigned>()), rank(std::vector<unsigned>()) {};
	UnionFind(unsigned size__) : size_(size__) {
		par.resize(size_); rank.resize(size_);
		for (unsigned i = 0; i < size_; i++) par[i] = i, rank[i] = 0;
	}
	unsigned size() { return size_; }
	unsigned root(unsigned x) { return par[x] == x ? x : par[x] = root(par[x]); }
	bool same(unsigned x, unsigned y) { return root(x) == root(y); }
	void unite(unsigned x, unsigned y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) par[x] = y;
		else if (rank[x] == rank[y]) par[y] = x, rank[x]++;
		else par[y] = x;
	}
	bool operator==(const UnionFind &u) { return par == u.par; }
	bool operator!=(const UnionFind &u) { return par != u.par; }
};

#endif

#include <set>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int n; string s;
int main() {
	while (cin >> n, n) {
		vector<int> r1(26), r2(26);
		UnionFind uf(26);
		for (int i = 0; i < n; i++) {
			cin >> s;
			int l = s.front() - 97, r = s.back() - 97;
			uf.unite(l, r);
			r1[l]++;
			r2[r]++;
		}
		set<int> s_;
		for (int i = 0; i < 26; i++) {
			if (r1[i] || r2[i]) s_.insert(uf.root(i));
		}
		bool ok = true;
		for (int i = 0; i < 26; i++) {
			if (r1[i] != r2[i]) ok = false;
		}
		cout << (ok && (s_.size() == 1) ? "OK" : "NG") << endl;
	}
	return 0;
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;++i)
#define M(a,b) make_pair(a,b)
#define f first
#define s second
using namespace std;
int dx[]={0,0,1,1,-1,-1,},dy[]={1,-1,1,0,-1,0};
bool v[200][200];
int a,b,t,n;
int main(){
  while(cin>>t>>n,t){
    r(i,200)r(j,200)v[i][j]=0;
    while(n--){
      cin>>b>>a;
      v[a+100][b+100]=1;
    }cin>>a>>b;int c=0;
    queue<pair<pair<int,int>,int> >q;
    q.push(M(M(b+100,a+100),0));
    while(!q.empty()){
      pair<pair<int,int>,int > p=q.front();q.pop();
      if(p.s==t+2)continue;
      c++;
      v[p.f.f][p.f.s]=1;
      r(i,6)if(!v[p.f.f+dy[i]][p.f.s+dx[i]]&&p.s+1<=t){
        q.push(M(M(p.f.f+dy[i],p.f.s+dx[i]),p.s+1));
        v[p.f.f+dy[i]][p.f.s+dx[i]]=1;
      }
    }
    cout<<c<<endl;
  }
}

Measured memory_bytes: 3072
while True:
    H,W=map(int,input().split())
    
    if H==0 and W==0:
        break
    
    for i in range(H):
        for j in range(W):
            if i==0 or j==0:
                print("#",end="")
            elif i==H-1 or j==W-1:
                print("#",end="")
            else:
                print(".",end="")
        print()
        
    print()


Measured memory_bytes: 7000
#include<cstdio>
#include<string>
#include<cstring>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<algorithm>
#include<vector>
#include<iostream>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define inf 0x7fffffff
using namespace std;
ll cnt(ll x)
{
	if(x==1ll)
	{
		return 1ll;
	}
	return 1+2ll*cnt(x/2);
}
int main()
{
	ll i,j,k,n,m,x,y,z,t;
	scanf("%lld",&n);
	cout<<cnt(n);
}


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

//#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX


int main(){
    int x,a;
    cin>>x>>a;
    if ((x<a) ? cout<<0<<endl : cout<<10<<endl);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define fi first
#define sec second
#define pr priority_queue
ll mod = 1000000007;
int main(){
  int n;
  cin>>n;
  ll a[n],q=0;
  ll s=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    s=(s+a[i]+mod)%mod;
  }
  for(int i=0;i<n;i++){
    ll d=(s-a[i]+mod)%mod;
    ll k=(a[i]*d)%mod;
    q=(q+k)%mod;
    s=(s-a[i]+mod)%mod;
  }
  cout<<q;
}


Measured memory_bytes: 5188
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int n,m;

  cin >> n >> m;

  double ans = 0;
  double per = (double)1 / (1 << m);
  double rate = 1;
  
  for(int i=1;i<100000;i++){
    ans += (100 * (n - m) + 1900 * m) * i * rate * per;
    rate *= (1 - per);
    //debug(rate * per);
  }

  printf("%d\n",int(ans+1e-6));

  
  return 0;
}


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

using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int N = 2002;
struct Edge
{
	long long l,r;
	long long h;
	int f;
}e[N<<1];

bool cmp(Edge a,Edge b)
{
	return a.h < b.h;
}
struct Node
{
	int l,r;
	int s;
	long long len;
}q[N*8];
double x[N<<1];
#define ls i<<1
#define rs i<<1|1
#define m(i) ((q[i].l+q[i].r)>>1)
void pushup(int i)
{
	if (q[i].s)
	{
		q[i].len = x[q[i].r+1] - x[q[i].l];
	}
	else if (q[i].l == q[i].r) q[i].len = 0;
	else q[i].len = q[ls].len + q[rs].len;
}
void build(int i,int l,int r)
{
	q[i].l = l,q[i].r = r,q[i].s = 0;q[i].len = 0;
	if (l == r) return ;
	int mid = m(i);
	build(ls,l,mid);
	build(rs,mid+1,r);
}
void update(int i,int l,int r,int f)
{
	if (l == q[i].l &&q[i].r == r)
	{
		q[i].s += f;
		pushup(i);
		return ;
	}
	int mid = m(i);
	if (r <= mid) update(ls,l,r,f);
	else if (l > mid) update(rs,l,r,f);
	else
	{
		update(ls,l,mid,f);
		update(rs,mid+1,r,f);
	}
	pushup(i);
}
int main()
{
    int n;int kas = 0;
    scanf("%d",&n);
    	int tot = 0;
    	for (int i = 1;i <= n;++i,tot+=2)
    	{
    		long long x1,x2;
    		long long y1,y2;
    		scanf("%lld %lld %lld %lld",&x1,&y1,&x2,&y2);
    		Edge &t1 = e[tot],&t2 = e[tot+1];
    		t1.l = x1,t1.r = x2,t1.h = y1,t1.f = 1;//上边是1
			t2.l = x1,t2.r = x2,t2.h = y2,t2.f = -1;//下边是-1
			x[tot] = x1,x[tot+1] = x2;
		}
		sort(x,x+tot);sort(e,e+tot,cmp);
		int k = 1;
		//x[0]
		for (int i = 1;i < tot;++i)
		{
			if (x[i]!=x[i-1])
			{
				x[k++] = x[i];
			}
		}
		build (1,0,k-1);//离散后区间是[0,k-1]
		long long ans = 0;
		for (int i = 0;i < tot;++i)
		{
			int l = lower_bound(x,x+k,e[i].l) - x;//找到实际坐标对应的离散坐标
			int r = lower_bound(x,x+k,e[i].r) - x - 1;
			update(1,l,r,e[i].f);
			ans += q[1].len*(e[i+1].h-e[i].h);
		}

    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    int sum = 0;
    int tmp = N;
    while(tmp) {
        sum += tmp % 10;
        tmp /= 10;
    }

    if(N % sum == 0)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}

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

bool isPalindrome(const string& str) {
  // cout << str << endl;
  for(int i = 0; i < str.size() / 2; ++i) {
    if(str[i] != str[str.size() - 1 - i]) {
      return false;
    }
  }
  return true;
}

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

  if(isPalindrome(s) && isPalindrome(s.substr(0, (s.size() - 1) / 2)) &&
     isPalindrome(s.substr((s.size() + 1) / 2))) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
fn main() {
    let a: u32 = read();
    let b: u32 = read();
    let c: u32 = read();

    println!("{}", if (a == b && b != c) ||(a == c && b != c)  || (b == c && a != b) { "Yes" } else { "No" });
}

use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  int a,b,c=1,d,e,g=0;cin>>a>>b;
  rep(i,a)c*=100;
  if(b==100)cout<<c*(b+1);
  else cout<<c*b;
}


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

string ans = "";
int sy, sx, ty, tx;

int main() {
   cin >> sx >> sy >> tx >> ty;

   int dy = abs(sy - ty), dx = abs(sx - tx);
   ans += string(dy, 'U') + string(dx, 'R'); // Path1
   ans += string(dy, 'D') + string(dx, 'L'); // Path2
   ans += 'L' + string(dy+1, 'U') + string(dx+1, 'R') + 'D'; // Path3
   ans += 'R' + string(dy+1, 'D') + string(dx+1, 'L') + 'U'; // Path4

   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>

using namespace std;

int main(){
  priority_queue<int> Q;
  int value;
  string order;

  while (cin >> order ,order != "end") {
    if (order == "insert") {
      cin >> value;
      Q.push(value); 
    } else {
      cout << Q.top() << endl;
      Q.pop();
    }
  }

  return 0;
}

Measured memory_bytes: 6508