akhauriyash/Code-Regression huggingface dataset:
// AUTHOR: ROSHAN SRIVASTAVA
// WEBSITE: https://www.youtube.com/channel/UC6uQdd7kLLOdlHSVklhV7Cw

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007

int n; 

int spf[1000009];

int __gcd(int a, int b) { 
    if (a == 0) 
        return b; 
    return __gcd(b % a, a); 
} 


void pre() { 
    
    memset(spf, 0, sizeof spf);

    spf[1] = 1; 
  
    for (int i = 2; i <= 1000000; i++) { 
        if (spf[i] == 0) { 
            spf[i] = i; 
            for (int j = 2 * i; j <= 1000000; j += i) 
                if (spf[j] == 0) 
                   spf[j] = i; 
        } 
    } 
}

int main(){

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


    cin >> n;
    vector<int> a(n);

    pre();
    
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    bool flag = true;

    map <int, int > mp;

    for(int i = 0; i < n; i++) {
        if(a[i] == 1) continue;
        
        int xx = a[i];
        set<int> tmp;

        while(xx > 1) {
            tmp.insert(spf[xx]);
            xx /= spf[xx];
        }
        for(auto x: tmp) {
            mp[x] += 1;
            if(mp[x] > 1) {
                flag = false;
                break;
            }
        }
        if(!flag) break;

    }
    

    if(flag) cout << "pairwise coprime" <<endl;
    else {
        int gg = a[0];
        for(int i = 1; i < n; i++){
            gg = __gcd(gg, a[i]);
        }
        if(gg == 1) cout << "setwise coprime" << endl;
        else cout << "not coprime" << endl;
    }

    return 0;
}



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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  vector<int> vec(3);
  vec.at(0) = A;
  vec.at(1) = B;
  vec.at(2) = C;
  sort(vec.begin(),vec.end());
  
  if( vec.at(0) == 5 && vec.at(1) == 5 && vec.at(2) == 7 )
    cout << "YES" << endl;
  else 
    cout << "NO" << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define  rep(i,a,b)for(int i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
typedef long long ll;
const ll INF=10000000000LL;
ll r197(ll n){
	return n%1000000007;
}

typedef pair<int,int>P;

typedef pair<int,P>Pa;
vector<int> v[100001];
bool b[100005]={};
struct edge{
	int score;
	int num;
};
ll dp[1003][1003]={};
int main() {
	int h,w;
	cin>>h>>w;
	string str[1001];
	dp[0][0]=1;
	rep(i,0,h)cin>>str[i];
	rep(i,0,h){
		rep(j,0,w){
			if(i+1<h&&str[i+1][j]=='.'){
				dp[i+1][j]=r197(dp[i+1][j]+dp[i][j]);
			}
			if(j+1<w&&str[i][j+1]=='.'){
				dp[i][j+1]=r197(dp[i][j+1]+dp[i][j]);
			}
		}
	}
	cout<<dp[h-1][w-1];
	return 0;
}


Measured memory_bytes: 11648
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;

int main() {
    int N;
    long long D;
    cin >> N >> D;

    D = D*D;
    int ans = 0;

    for (int i = 0; i < N; ++i) {
        long long X;
        long long Y;
        cin >> X >> Y;

        if (X*X + Y*Y <= D) {
            ++ans;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;cin>>n>>k;
  vector<int>l(n);
  for(int i=0;i<n;++i){
    cin>>l[i];
  }
  sort(l.begin(), l.end(),greater<int>());
  int ans=0;
  for(int i=0;i<k;++i){
    ans+=l[i];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		int max = Math.max(Math.max(a, b), c);
		int k = max * 3 - a - b - c;
		if (k % 2 == 0) {
			System.out.println(k / 2);
		} else {
			k += 3;
			System.out.println(k / 2);
		}
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long i,l,j,n;
	cin >> n;
	long long a[n+1];
	long long dp[n+1][n+1] = { };
	a[0] = 0;
	for(i=1;i<=n;i++)
	{
		cin >> a[i];
	}
	for(i=n;i>0;i--)
	{
		for(j=i;j<=n;j++)
		{
			if(i==j)
			dp[i][j]=a[i];
			else
			dp[i][j] = max(a[i]-dp[i+1][j],a[j]-dp[i][j-1]);
		}
	}
	cout << dp[1][n] <<endl;
}

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

typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll n;
  cin >> n;
  vector<ll> p(n);
  for (ll i = 0; i < n; ++i) {
    cin >> p[i];
  }
  sort(p.begin(), p.end(), greater<ll>());

  ll ans = 0;
  p[0] = p[0]/2;
  for (ll i = 0; i < p.size(); ++i) {
    ans += p[i];
  }

  cout << ans << endl;

  return 0;
}


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

struct edge{
    int u, v, cost;
};

bool compare(const edge &e1, const edge &e2){
    return e1.cost < e2.cost;
}

vector<edge> nodes;
vector<int> par;
vector<int> ranks;
int V, E;

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

void unit(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;

    if(ranks[x] < ranks[y]){
        par[x] = y;
    }else{
        par[y] = x;
        if(ranks[x] == ranks[y]) ranks[x]++;
    }
}

void init(int n){
    for(int i; i < n; i++){
        par.push_back(i);
        ranks.push_back(1);
    }
}

int solve(){
    int result = 0;
    sort(nodes.begin(), nodes.end(), compare);

    for(int i = 0; i < E; i++){
        edge node = nodes[i];
        if(find(node.u) != find(node.v)){
            unit(node.u, node.v);
            result += node.cost;
        }
    }
    return result;
}

int main(){
    cin >> V >> E;
    init(V);

    for(int i = 0; i < E; i++){
        edge e;
        cin >> e.u >> e.v >> e.cost;
        nodes.push_back(e);
    }
    cout << solve() << endl;
}


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

judge = True

h[0] -= 1

for i in range(1,n):
    if h[i] > h[i-1]:
        h[i] -= 1
    elif h[i] < h[i-1]:
        judge = False
        break
if judge:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 63856
(let* ((n (read))
       (m (read))
       (fib (make-array (list (1+ n))))
       (p 1000000007)
       (s 0)
       (ans 1))
  (setf (aref fib 0) 1)
  (setf (aref fib 1) 1)
  (loop :for i :from 2 :to n
        :do (setf (aref fib i)
                  (mod (+ (aref fib (- i 1)) (aref fib (- i 2))) p)))
  (defun step-num (x y)
    (if (<= x y)
        (aref fib (- y x))
        0))
  (loop :for i :from 1 :to m
        :for a := (read)
        :do (let ((e (1- a)))
              (setf ans (mod (* ans (step-num s e)) p))
              (setf s (1+ a))))
  (setf ans (mod (* ans (step-num s n)) p))
  (format t "~A~%" ans))


Measured memory_bytes: 77056
N, M = map(int, input().split())

x = 0
y = N
for i in range(M):
    L, R = map(int, input().split())
    x = max(x, L)
    y = min(y, R)

ans = y-x+1
if ans < 0:
    print (0)
else:
    print (ans)


Measured memory_bytes: 3060
//                          VIVEK UPADHYAY
//                          MANIT, BHOPAL(M.P)
/**********************************************************************************************/
/**********************************************************************************************/
//                        $$ JAB-TAK TODEGA NHI,
//                           TAB -TAK CHODEGA NHI :D

// g++ -std=c++11 file_name.cpp
// ./file_name.out
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
//#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define YES printf("YES\n") ;
#define NO printf("NO\n") ;
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define LINE cout<<"\n" ;
#define ok cout<<"ok\n" ;
#define dbg(x) cout<<#x<<" = "<<(x)<<"\n";
#define fill(A, VAL) memset(A, VAL, sizeof(A))
#define sz(a) ((ll) a.size())
typedef long long ll ;
const int MAXN = 1e6 + 10;
ll inf  = 1e18 ;
using namespace std ;
ll mod = 1e9 + 7;
ll mul(ll a , ll b){return ((a%mod)*(b%mod))%mod;}
ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a) ;}
ll powr(ll a , ll b) {if(b == 0) return 1LL ;ll x = powr(a,b/2) ;x = mul(x,x) ;if(b%2) return mul(a,x);return x;}
int main () {
    
    int N ;
    cin >> N ;
    ll a[N + 1] ;
    for(int i = 1 ; i <= N ;i++)
        cin >> a[i] ;
    int b[N + 1] ;
    for(int i =1 ; i <= N;i++)
        b[i] = 0 ;
    vector<int> pos ;
    for(int i = N ; i >=1 ; i--){
        int cnt = 0 ;
        for(int j = i ; j <= N ;j +=i)
            cnt+=b[j] ;
        if(cnt%2 == a[i]) continue ;
        else {
            pos.pb(i) ;
            b[i]++ ;
        }
    }
    
    cout<<sz(pos)<<endl;
    for(int i = 0 ; i < pos.size() ;i++)
        cout<<pos[i]<<" " ;
    //LINE ;
            
    
    return 0 ;
}


Measured memory_bytes: 3832
#include <stdio.h>

int main(){
	int n;
	int p[52];
	int i,j,in,cont=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&in);
		p[i]=in;
		if(!(in==(i+1)) ){
			cont++;
		}
	}
	//printf("cont:%d\n",cont);
	if(cont==0){
		printf("YES\n");
	}else if(cont==2){
		for(i=0;i<n;i++){
			if(!(p[i]==(i+1)) ){
				//printf("bad p[%d]==%d\n",i,p[i]);
				for(j=i+1;j<n;j++){
					if(!(p[j]==(j+1)) ){
						//printf("finded p[%d]==(%d+1) && p[%d]==(%d+1)\n",p[i],j,p[j],i);
						if(p[i]==(j+1)&&p[j]==(i+1)){
							printf("YES\n");
						}else{
							printf("NO\n");
						}
						return 0;
					}
				}
			}
		}
	}else{
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,n,q,a,b;
    cin>>n;
    vector<int>v(n);
    for(i=0;i<n;i++){
        cin>>v[i];
    }
    cin>>q;
    while(q--){
        cin>>a>>b;
        reverse(v.begin()+a,v.begin()+b);
    }
    for(i=0;i<v.size();i++){
        cout<<v[i]<<((i==v.size()-1)?'\n':' ');
    }

}



Measured memory_bytes: 3108
#include <iostream>
#include <cstring>
#include <string>
using namespace std;

const int MAXN = 30010;
struct Node {
	int nxt[10];
	Node() {
		memset(nxt, 0xff, sizeof(nxt));
	}
	Node operator=(const Node &rhs) {
		memcpy(nxt, rhs.nxt, sizeof(nxt));
		return *this;
	}
	int& operator[](const int index) {
		return nxt[index];
	}
}tree[MAXN], root;
int n;

int dfs(int p, int depth) {
	if (depth == 3)
		return 1;
	int ans = 0;
	for (int i=0; i<10; i++)
		if (tree[p][i] != -1)
			ans += dfs(tree[p][i], depth+1);
	return ans;
}
int main() {
	string ss;
	cin>>n>>ss;
	for (int i=n-1; i>=0; i--) {
		tree[i] = root;
		root[ss[i]-'0'] = i;
	}
	// for (int i=0; i<n; i++, cout<<" << "<<i<<endl)
	// 	for (int p=0; p<10; p++)
	// 		cout<<tree[i][p]<<" ";

	int ans = 0;
	for (int i=0; i<10; i++)
		if (root[i] != -1)
			ans += dfs(root[i], 1);
	cout<<ans<<endl;
	return 0;
}

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

long long n,W,v[101],w[101],dp[101][101][301];

long long solve(long long i,long long j,long long sum){
    if(w[0]*j+sum>W)return 0;
    if(i==n)return 0;
    if(dp[i][j][sum]!=0)return dp[i][j][sum];
    else{
        dp[i][j][sum]=solve(i+1,j,sum);
        if(w[0]*(j+1)+sum+w[i]-w[0]<=W){
            dp[i][j][sum]=max(solve(i+1,j,sum),solve(i+1,j+1,sum+w[i]-w[0])+v[i]);
        }
        return dp[i][j][sum];
    }
}

int main(void){
    cin>>n>>W;
    for(int i=0;i<n;i++){
        cin>>w[i]>>v[i];
    }
    cout<<solve(0,0,0)<<endl;
    return 0;
}


Measured memory_bytes: 22016
n, k = map(int, input().split())
b = k
r = n-k
MOD = 10**9+7

def comb(n, k, MOD):
    return fact[n] * invfact[k] * invfact[n-k] % MOD

lenlist = 4*(10**6)
fact = [1] * lenlist
invfact = [1] * lenlist

for i in range(1, lenlist):
    fact[i] = fact[i-1] * i % MOD

invfact[lenlist - 1] = pow(fact[lenlist - 1], MOD-2, MOD)

for i in range(lenlist-1, 0, -1):
    invfact[i-1] = invfact[i] * i % MOD

for i in range(k):
    if i == 0:
        print(r+1)
        continue
    if i > r:
        print(0)
        continue
    ans = comb(r+1, i+1, MOD)
    ans *= comb(b-1, i, MOD)
    ans %= MOD
    print(ans)

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

int main()
{
	long long int a,b,k;
	cin>>a>>b>>k;
	if(k>a)
	{
		k=k-a;
		a=0;
	}
	else{
		a=a-k;
		k=0;
	}
	if(k>0)
	{
		if(b>k)
		{
			b=b-k;
		}
		else{
			b=0;
		}
	}
	cout<<a<<" "<<b;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=long long int;

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

    if (s.length() < 3) {
        cout << 0 << endl;
        return 0;
    }

    vector<int> a(s.length(), 0);
    ll cnt = 0;
    a[0] = s[0] == 'A' ? 1 : 0;
    a[1] = s[1] == 'A' ? a[0] + 1 : 0;
    for (int i = 2; i < s.length(); ++i) {
        if (s[i-2] == 'A' && s[i-1] == 'B' && s[i] == 'C') {
            cnt += a[i-2];  
            a[i] = a[i-2];
            s[i] = 'A';
        } else {
            if (s[i] == 'A') {
                a[i] = a[i-1] + 1;
            } else {
                a[i] = 0;
            }
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 1412
#include<stdio.h>

#define min(a,b) ((a)<(b)?(a):(b))

int main(){
	int n,k,a[100000],i,one,ans=0,ans2=0;
	scanf("%d%d",&n,&k);
	/*for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		if(a[i]==1)one=i;
	}
	ans=one/(k-1);
	if(one%(k-1)!=0){
		ans++;
		one=(k-1)*ans-1;
	}
	//printf("%d,%d\n",ans,one);
	ans+=(n-one-2)/(k-1);
	if((n-one-2)%(k-1)!=0)ans++;
	for(i=0;i<n;i++){
		if(a[i]==1)one=i;
	}
	ans2+=(n-one-2)/(k-1);
	if((n-one-2)%(k-1)!=0){
		ans2++;
		one=n-(k-1)*ans2+1;
	}
	ans2+=one/(k-1);
	if(one%(k-1)!=0)ans2++;*/
	ans=(n-1)/(k-1);
	if((n-1)%(k-1)!=0)ans++;
	printf("%d\n",ans);
	return 0;
}

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

int main() {
  ll n, ans = 0;
  cin >> n;

  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];

  for (int i = 0; i < n - 1; i++) {
    if (a[i] > a[i + 1]) {
      ans += a[i] - a[i + 1];
      a[i + 1] = a[i];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4768
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
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;
}

//LOVE NyantakoGG

using namespace std;


int main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (i % 2 == 0) {
			cout << s[i];
		}
	}
	cout << endl;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double x = sc.nextDouble();
		if(x > a * a * b / 2) {
			System.out.println(Math.toDegrees(Math.atan(2 * (a * a * b - x) / (a * a * a))));
		} else {
			System.out.println(Math.toDegrees(Math.atan(a * b * b / 2 / x)));
		}
	}

}


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

int main(){
    int k;
    cin >> k;
    if(k%2==0||k%5==0){
        cout << "-1" << endl;
        return 0;
    }
    int v = 0;
    for(int i=1; ;++i){
        v = (v*10 + 7)%k; // Ai (mod k) = v
        if(v%k==0){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
constexpr ll mod = 1e9 + 7;
#define endl '\n'
 
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
 
  ll n;
  cin >> n;
  ll ans = 0;
  for (ll a = 1; a < n; ++a) {
    ans += (n-1)/a;
  }
  cout << ans << endl;

}


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

const int mod = 1e9 + 7;
int cnt[1010];
int n;

void po(int m)
{
	while (m != 1) {
		for (int i = 2; ; ++i)
			if (m % i == 0){
				m /= i;
				cnt[i]++;
				break;
			}
	}
}

int main()
{
	cin >> n;

	for (int i = 1; i <= n; ++i){
		po(i);
	}

	long long ans = 1;
	for (int i = 0; i < 1010; ++i){
		if (cnt[i]){
			ans *= (cnt[i] + 1);
			ans %= mod;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
bool a,b;
int main(){
	string ss;
	cin>>ss;
	for(int i=0;i<ss.size();i++){
		if(ss[i]=='C')a=1;
		if(ss[i]=='F'&&a==1)b=1;
	}
	if(b)cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>

using namespace std;

int main(){
	
	int jumlah;
	scanf ("%d",&jumlah);
	int arr[jumlah+6];
	for (int a=0;a<jumlah;a++){
		scanf ("%d",&arr[a]);
	}
	
	sort(arr,arr+jumlah);
	
	printf ("%d",arr[jumlah-1] - arr[0]);
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <cmath>
#include <stack>
#include <vector>
#include <queue>
#include <deque>
#include <list>
#include <iterator>
#include <cctype>
#include <cstdio>
#include <cstring>
#define rep(counter, limit) for (int counter = 0; counter < limit; counter++)
typedef long long ll; using namespace std;const int INF=1001001001;
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }
int lcm(int a, int b) { return a * b / gcd(a, b); }
bool primenum(int a) { if (a == 1) { return false; }if (a == 2) { return true; }if (a % 2 == 0) { return false; }for (int i = 3; i < sqrt(a) + 1; i += 2) { if (a != i) { if (a % i == 0) { return false; } } }return true; }
int main() {

  double r;
  cin>>r;
  cout<<(r*2)*3.1415926535<<endl;

}


Measured memory_bytes: 3808
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1ll<<30;
const ll longINF = 1ll<<60;
const ll MOD = 1000000007;
const bool debug = 0;
//---------------------------------//

ll mod_pow(ll x, ll n, ll mod = MOD) {
	if (n == 0) return 1;
	ll res = mod_pow(x * x % mod, n / 2, mod);
	if (n & 1) res = res * x % mod;
	
	return res;
}

vector<ll> fact, inv;
void fact_inv(int n, ll mod = MOD) {
	fact.resize(n + 1);
	inv.resize(n + 1);
	
	fact[0] = 1;
	FOR(i, 1, n + 1) fact[i] = fact[i - 1] * i % mod;
	inv[n] = mod_pow(fact[n], mod - 2, mod);
	for (int i = n; i > 0; i--) inv[i - 1] = inv[i] * i % mod;
}

ll ncr(ll n, ll r, ll mod = MOD) {
	if (n < r || n < 0 || r < 0) return 0;
	if (r > n - r) r = n - r;
	ll res = 1;
	for (ll i = n; i >= n - r + 1; i--) res = res * i % mod;
	res = res * inv[r] % mod;
	return res;
}

ll solve(ll H, ll W, ll K) {
	ll res = 0;
	
	ll allp = ncr(H * W - 2, K - 2);
	
	FOR(w, 1, W + 1) {
		ll pat = W - w;
		pat = pat * H % MOD * H % MOD * allp % MOD;
		res = (res + pat * w % MOD) % MOD;
	}
	
	return res;
}

int main() {
	fact_inv(212345);
	
	int N, M;
	ll K;
	cin >> N >> M >> K;
	
	ll ans = (solve(N, M, K) + solve(M, N, K)) % MOD;
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3584
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a; //Aの元々の温度
    int b; //Bの目的の温度
    int c, d, e;
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> d;
    cin >> e;
    if(a>0)
        cout << (b-a)*e << endl;
    else if(a==0)
        cout << d+e*b << endl;
    else
        cout << c*(-a)+d+e*b << endl;
}


Measured memory_bytes: 3084
#include<stdio.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
const int oo=999;
int L,n,m,x[80],y[80],z[80],S,T,bi[21],bm,bv[21],las;
inline void add(int xx,int yy,int zz){
	x[++m]=xx;
	y[m]=yy;
	z[m]=zz;
}
int main(){
	bi[0]=1;
	fo(i,1,20) bi[i]=bi[i-1]<<1;
	scanf("%d",&L);
	L--;
	S=n=1;
	fd(i,20,0) if (bi[i]<=L+1){//bi[i]<=L
		bm=i-1;
		break;
	}
	//printf("%d\n",bm);
	bv[bm+1]=S;
	fd(i,bm,0){
		bv[i]=++n;
		add(bv[i+1],bv[i],0);
		add(bv[i+1],bv[i],bi[i]);
	}
	las=bi[bm+1];
	fd(i,bm,0) if (las+bi[i]-1<=L){
		add(S,bv[i],las);
		las+=bi[i];
	}
	printf("%d %d\n",n,m);
	fo(i,1,m) printf("%d %d %d\n",x[i],y[i],z[i]);
	return 0;
} 

Measured memory_bytes: 128
#include <stdio.h>
 
 int main(){
 	
 	int AB, BC, CA, area;
 	scanf("%d %d %d", &AB, &BC, &CA);
 	
 	if(AB > BC && AB > CA){
 	area = 0.5*(BC*CA);
 	printf("%d", area);
	 }
 	
 	if(BC > AB && BC > CA){
 	area = 0.5*(AB*CA);
 	printf("%d", area);
	 }
	 
	if(CA > AB && CA > BC){
 	area = 0.5*(AB*BC);
 	printf("%d", area);
	 }
 	
 	return 0;
 }

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

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

    if(N < 0){
        N = -N;
    }
    shouryaku = N/D;

    if(shouryaku < K){
        N = N-(shouryaku*D);
        K = K-shouryaku;
        if(K % 2 == 0){
            cout << N << endl;
        }else if(K % 2 == 1){
            cout << -(N-D) << endl;
        }
    }else{
        N = N - K*D;
        cout << N << endl;
    }
}

Measured memory_bytes: 3548
import sys
def main():
    input = sys.stdin.readline
    H,W = map(int, input().split())
    A = [list(map(int, input().split())) for _ in range(H)]
    B = [list(map(int, input().split())) for _ in range(H)]
    C = [[abs(A[i][j] - B[i][j]) for j in range(W)] for i in range(H)]

    M = 160*80
    dp = [[0 for _ in range(W)] for __ in range(H)]
    dp[0][0] = 1 << (C[0][0] + M)
    for i in range(H):
        for j in range(W):
            for ni,nj in [(i,j+1),(i+1,j)]:
                if ni >= H or nj >= W: continue
                t = C[ni][nj]
                dp[ni][nj] |= dp[i][j] << t
                dp[ni][nj] |= dp[i][j] >> t
    
    a = dp[H-1][W-1]
    ans = 0
    while True:
        if a & (1 << (M+ans)) or a & (1 >> (M-ans)): break
        ans += 1
    print(ans)

if __name__ == '__main__':
    main()

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

using ll = long long;

int main(void)
{
  ll a, b, x;
  std::cin >> a >> b >> x;

  ll A = (a-1 < 0) ? 0 : (a-1)/x + 1; 
  ll B = b / x + 1;

  std::cout << B-A << std::endl;

  return 0;
}

Measured memory_bytes: 3576
from math import ceil 
def interest(debt, rate, weeks):
    if weeks == 1:
        return ceil(debt * (1 + rate))
    else:
        return ceil(interest(debt, rate, weeks - 1) * (1 + rate))

rounds = 1000
rate = 0.05
debt = 100000
weeks = int(input())
print(int(rounds*interest(debt/rounds, rate, weeks)))

Measured memory_bytes: 7672
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);  cin.tie(0) ; cout.tie(0);
#define debug(x) cout << #x << " : " << x << endl;
#define pi 3.14159265359
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
using ll = long long int;
using db = double;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
const int MOD = 1e9+9;

void solve()
{
    ll n , q ,old , nw , sum = 0;
    cin >> n ;
    unordered_map<ll,ll> map;
    for(int i = 0 ; i < n ; i++)
        {
            cin >> q;
            map[q]++;
            sum += q;
        }
    cin >> q;
    while(q--)
    {
        cin >> old >> nw;
        if(map.find(old) == map.end()) 
            cout << sum << endl;
        else
        {
            ll count = map[old];
            sum += (nw-old)*count;
            map.erase(old);
            map[nw] += count;
            cout << sum<< endl;
        }
    }
}

int main()
{
//  #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin); 
//     freopen("output.txt", "w", stdout);
//  #endif
    fastio;

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

Measured memory_bytes: 6480
#include <iostream>
#include <string>
#include <list>
using namespace  std;

void fnLinkedListSet(list<int> &a_rltiNumber)
{
  list<int>::iterator itlti;
  list<int>::iterator itltEND = a_rltiNumber.end();
  string sCommand;
  int iMaxCommand, iNumber;

  cin.tie(0);
  ios::sync_with_stdio(false);
 
  cin >> iMaxCommand;
  for (int i = 0; i < iMaxCommand; i++)
  {
    cin >> sCommand;
    if (sCommand == "insert")
    {
      cin >> iNumber;
      a_rltiNumber.push_front(iNumber);
    }
    else if (sCommand == "deleteFirst")
      a_rltiNumber.pop_front();
    else if (sCommand == "deleteLast")
      a_rltiNumber.pop_back();
    else if (sCommand == "delete")
    {
      cin >> iNumber;
      for (itlti = a_rltiNumber.begin(); itlti != itltEND; ++itlti)
        if (*itlti == iNumber)
        {
          a_rltiNumber.erase(itlti);
          break;
        }
    }
  }
}

void fnLinkedListGet(const list<int> &a_cnrltiNumber)
{
  list<int>::const_iterator itlti;
  list<int>::const_iterator itltEND = a_cnrltiNumber.end();
  int i = 0;
  for (itlti = a_cnrltiNumber.begin(); itlti != itltEND; ++itlti)
  {
    if (i++) cout << " ";
    cout << *itlti;
  }
  cout << endl;
}

int main()
{
  list<int> ltiNumber;
  fnLinkedListSet(ltiNumber);
  fnLinkedListGet(ltiNumber);

  return 0;
}

Measured memory_bytes: 32476
// defines
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define casti static_cast<int>
#define cast static_cast
#define ll long long int
#define vi vector<int>
#define vpi vector<pair<int,int >>

// includes
#include <bits/stdc++.h>

using namespace std;

ll modF=1e9+7;

// topcoder



//codechef and codeforces and atcoder

//int main(){
//    boost_io;
//    int n;
//    cin>>n;
//    int h;
//    int i=n;
//    string ans="";
//    while(i>0){
//        h=i%26;
//        if(h==0){
//            ans="z"+ans;
//            i/=26;
//            i--;
//        }
//        else{
//            i/=26;
//            ans=cast<char>(h+96)+ans;
//        }
//    }
//    cout<<ans<<"\n";
//    return 0;
//}

int main(){
    boost_io;
    int n;
    cin>>n;
    ll ans=0;
    map<int,int> m;
    int inp;
    for(int i=0;i<n;i++){
        cin>>inp;
        ans+=inp;
        if((m.find(inp))==m.end()){
            m[inp]=1;
        }
        else{
            m[inp]++;
        }
    }
    int q;
    cin>>q;
    int b,c;
    for(int i=0;i<q;i++){
        cin>>b>>c;
        if((m.find(b))!=m.end()){
            ans+=(c-b)*m[b];
            if(m.find(c)==m.end())
                m[c]=m[b];
            else
                m[c]+=m[b];
            m.erase(b);
        }
        cout<<ans<<"\n";
    }
    return 0;
}


Measured memory_bytes: 6480
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#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 unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using ll=long long;
using vi=vector<int>;
using pii=pair<int, int>;

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
ll read(){ll a;scanf("%lld",&a);return a;}

const int inf = 3 * TEN(18) + 10;
const int mod = 998244353;

int rui[210];
bool ok[210];

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

	rep(i, n) {
		if (s[i] == '(') {
			for (int j = i; j < n; ++j) {
				if (s[j] == ')' and not ok[j]) {
					ok[i] = ok[j] = true;
					break;
				}
			}
		}
	}

	int l = 0, r = 0;

	rep(i, n) {
		if (not ok[i]) {
			if (s[i] == ')') l++;
			else r++;
		}
	}

	rep(i, l) printf("(");
	rep(i, n) printf("%c", s[i]);
	rep(i, r) printf(")");
	puts("");
}




Measured memory_bytes: 256
(n,), aa, (q,), *bc = [list(map(int, l.split())) for l in open(0)]

from collections import defaultdict, Counter

d = defaultdict(int)
rd = defaultdict(set)

co = Counter(aa)

ans = sum([x*y for x, y in co.items()])

for b, c in bc:
    co[c] += co[b]
    ans += co[b]*(c-b)
    del co[b]
    print(ans)

Measured memory_bytes: 40144
#import numpy as np
import math
#from fractions import gcd

def main():

    ##get int
    first_input = list(map(lambda x:int(x), input().split(" ")))
    #second_input = list(map(lambda x:int(x), input().split(" ")))

    ##get float
    #first_input = list(map(lambda x:float(x), input().split(" ")))
    #second_input = list(map(lambda x:float(x), input().split(" ")))

    ##get string
    #first_input = input().split(" ")

    R = first_input[0]

    print(R*2*math.pi)

if __name__ == '__main__':
    main()


Measured memory_bytes: 62008
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

const ll P = 1e9+7;
ll fact[3000000];

// Extended Euclid's greatest common divisor algorithm
// Find (x, y, g)
// where $a*x + b*y = g$ and g is the greatest common divisor of (a, b)
ll ext_gcd(ll a, ll b, ll &x, ll &y){
	if(b == 0){
		x = 1;
		y = 0;
		return a;
	}
	ll nx, ny;
	ll g = ext_gcd(b, a%b, nx, ny);
	x = ny;
	y = nx - a/b *ny;
	return g;
}

// Modular inverse of x given modulo p, y
// x*y = 1 mod p
// <=> x*y + z*p = 1
ll inv_mod(ll x, ll p){
	ll y,z;
	ext_gcd(x, p, y, z);
	return y>=0 ? y : p+(y%p);
}


// Modular factorial of n, also counting p's appearance e
// n! = a * p^e
// return: a % p
// n! = n * (n-1) * ... * (k*p+1) *
//      (k*p) * (k*p-1) * ... ((k-1)*p+1) *
//      ...
//      p * (p-1) * ... * 2 * 1   (k = floor(n/p))
//    = (n%p) * ... * 1 *
//      (k*p) * (p-1) * ... * 1 *
//      p * (p-1) * ... * 1       (mod p, preserving p's multiples)
//    = (n%p)! * p^k * k! * (p-1)^k
//    = (n%p)! * p^k * k! * (p-1)^(k%2)
//
// From the facts:
//   (p-1)! = p-1 (mod p) (c.f. Willson's theorem)
//   (p-2)**2 = 1 (mod p)
ll fact_mod(ll n, ll p, ll &e){
	if(n == 0){
		e = 0;
		return 1;
	}

	ll na = fact_mod(n/p, p, e);

	e += n/p;
	ll a = na * fact[n%p] % p;

	if((n/p)%2) a = a * (p-1)%p;
	return a;
}


// Modular combination (n, m) given module p
// (n, m) = n!/(n-m)!m!
//        = (a_n * p^(e_n)) / ((a_{n-m} * p^(e_{n-m}) * (a_m * p^e_m))
//        = a_n / (a_{n-m} * a_m) * p^(e_n - e_{n-m} - e_m)
ll comb_mod(ll n, ll m, ll p){
	ll e1,e2,e3;
	ll a1 = fact_mod(n, p, e1);
	ll a2 = fact_mod(m, p, e2);
	ll a3 = fact_mod(n-m, p, e3);

	if(e1 > e2+e3) return 0;
	else return a1*inv_mod(a2*a3%p, p)%p;
}

int main() {
	long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);

	if((X+Y)%3!=0){
		cout << 0 << endl;
		return 0;
	}

	int k = (2*Y-X)/3;
	int j = (2*X-Y)/3;
	if(k<0||j<0){
		cout << 0 << endl;
		return 0;
	}

	fact[0] = fact[1] = 1;
	for(int i=2; i<3000000; i++) fact[i] = fact[i-1]*i%P;

	cout << comb_mod(k+j, j, P) << endl;

	return 0;
}


Measured memory_bytes: 23680
package main

import (
	"fmt"
	"math"
)

var N, ans int
var memo [2][101][100000]int

func main() {
	fmt.Scan(&N)

	A := make([][]int, 2)
	for i := 0; i < 2; i++ {
		A[i] = make([]int, N)

		for j := 0; j < N; j++ {
			fmt.Scan(&A[i][j])
		}
	}
	fmt.Println(dfs(0, 0, A[0][0], A))
}

func dfs(h int, w int, sum int, A [][]int) int {
	if h == 1 && w == N-1 {
		return sum
	} else {
		if memo[h][w][sum] != 0 {
			return memo[h][w][sum]
		}

		var x, y int

		if h == 0 {
			x = dfs(h+1, w, sum+A[h+1][w], A)
		}
		if w < N-1 {
			y = dfs(h, w+1, sum+A[h][w+1], A)
		}
		memo[h][w][sum] = max(x, y)
		return memo[h][w][sum]
	}
}

/*  ----------------------------------------  */

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }

type XY struct {
	x int
	y int
}
type SortBy []XY

func (a SortBy) Len() int      { return len(a) }
func (a SortBy) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool {
	if a[i].x == a[j].x {
		return a[i].y > a[j].y
	}
	return a[i].x > a[j].x
}


Measured memory_bytes: 156160
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val (x, t) = readListOfInt()
    println(listOf(x-t, 0).max()!!)
    pw.flush()
}

/****** Decrared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
    }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j] % MOD)
        }
    }
    return v.map { it.toList() }.toList()
}

fun gcd(a: Long, b: Long): Long = 
    if(b != 0L) a else gcd(b, a % b)

fun lcm(a: Long, b: Long) = 
    if(b==0L) a else gcd(b, a % b)

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


Measured memory_bytes: 36016
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define INF 1000000001

int main() {
    string s,t;cin >> s >> t;
    vector<vector<int>> a(26),b(26);
    for(int i = 0; i < s.size(); i++) {
        a[(int)s[i]-97].push_back(i);
    }
    for(int i = 0; i < s.size(); i++) {
        b[(int)t[i]-97].push_back(i);
    }

    bool ans=true;
    for(int i = 0; i < 26; i++) {
        if(b[i].size()==0) continue;
        bool y=false;
        for(int j = 0; j < 26; j++) {
            if(b[i]==a[j]) y=true;
        }
        if(!y) ans=false;
    }

    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 6044
N = int(input())
S = [input() for _ in range(N)]
last_a = 0
begin_b = 0

ans = 0
check = 0
for s in S:
    if s[0] == "B":
        begin_b += 1
    if s[-1] == "A":
        last_a += 1
    if s[0] == "B" and s[-1] == "A":
        check += 1
    for i in range(len(s)-1):
        if s[i] == "A" and s[i+1] == "B":
            ans += 1
ans += min(last_a, begin_b)
if last_a == begin_b and check == begin_b and begin_b != 0:
    ans -= 1
print(ans)


Measured memory_bytes: 3700
#include<algorithm>
#include<cassert>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<stack>
#include<string>
#include<deque>
#include<queue>
#include<vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll mod = 1e9+7;
const double PI = acos(-1);  // PI = 3.141593...

int main() {
    map<string, int> m;
    int n;
    cin >> n;
    string cmd;
    string key;
    rep(i, n) {
        cin >> cmd >> key;
        if(cmd == "insert") {
            m[key] = 1;
        }
        if(cmd == "find") {
            if(m.count(key)) {
                cout << "yes" << endl;
            }
            else {
                cout << "no" << endl;
            }
        }

    }

    return 0;
}


Measured memory_bytes: 36932
#include <stdio.h>
#include <string.h>
#define MAX 1005
int calcstr(char x[],char y[]);

int main()
{
  int i,n;
  char x[MAX],y[MAX];
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s%s",x,y);
    printf("%d\n",calcstr(x,y));
  }

  return 0;
}

int calcstr(char x[],char y[])
{
  int i,j,xlen,ylen,max=0,cal[MAX][MAX];
  int k;
  xlen=strlen(x);
  ylen=strlen(y);

  for(i=1;i<=xlen;i++) cal[i][0]=0;
  for(j=1;j<=ylen;j++) cal[0][j]=0;

  for(i=1;i<=xlen;i++){
    for(j=1;j<=ylen;j++){
      if(x[i-1]==y[j-1]) cal[i][j]=cal[i-1][j-1]+1;
      else if(cal[i-1][j]>=cal[i][j-1]) cal[i][j]=cal[i-1][j];
      else cal[i][j]=cal[i][j-1];
    }
  }
  max=cal[i-1][j-1];

  return max;
}

Measured memory_bytes: 4544
from operator import itemgetter

n = int(input())

ablist = [list(map(int, input().split())) for _ in range(n)]
ablist = sorted(ablist, key=itemgetter(1))

wa = 0
for i in ablist :
    wa += i[0]
    if wa > i[1] :
        print("No")
        break
else :
    print("Yes")

Measured memory_bytes: 55268
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))

Ones = A.count(1)
R = max(A)
nums = [0]*(R+1)

# 素因数テーブルの作成
D = [0]*(R+1)
for i in range(2, R+1):
    if D[i]:
        continue
    n = i
    while n < R+1:
        if D[n] == 0:
            D[n] = i
        n += i

# 素因子をカウント
for a in A:
    tmp = a
    while tmp > 1:
        prime_factor = D[tmp]
        nums[prime_factor] += 1
        while tmp%prime_factor == 0:
            tmp //= prime_factor
y = max(nums)
if y < 2:
    print('pairwise coprime')
elif y-Ones < N:
    print('setwise coprime')
else:
    print('not coprime')

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

int main(){
  int n;
  cin >> n;
  set<string> s;
  rep(i,n){
    string a;
    cin >> a;
    s.insert(a);
  }
  cout << s.size() << endl;
  return 0;
}

Measured memory_bytes: 19184
#include<bits/stdc++.h>
#define ll long long int
#define ss second
#define ff first
#define Mem(x,val) memset(x,val,sizeof x)
#define pb push_back
#define all(v) v.begin(),v.end()
#define unik(v)  v.erase(unique(v.begin(),v.end()),v.end())
#define cerr(x) cerr << __LINE__ << " th Line : " << #x << " = " << x << "\n"
using namespace std;
typedef pair<int, int> pi32;
typedef pair<ll, ll> pi64;
typedef vector<int> vi32;
typedef vector<ll> vi64;
typedef vector<pi32> vp32;
typedef vector<pi64> vp64;
const ll mod = 1e9 + 7;
const ll sz = 1e7, inf = 1e9 + 7;


int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
   int a,b,c,d;
   cin>>a>>b>>c>>d;
   int x=(c/b)+(c%b>=1);
   int y=(a/d)+(a%d>=1);
  // cerr(x);cerr(y);
   if(x<=y)cout<<"Yes\n";
   else cout<<"No\n";
   

	return 0;
}


Measured memory_bytes: 3640
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    N, A, B = MI()
    print((N // (A + B)) * A + min(N % (A + B), A))

if __name__ == "__main__":
    main()

Measured memory_bytes: 74704
#include <stdio.h>
#include <string.h>
#define N 50
#define length 101

int main() {
	int time[N];
	char string[N][length];
	char c[length];
	int num,flag,i,sum;
	scanf("%d",&num);
	for(i=0;i<num;i++) {
		scanf("%s %d", &string[i],&time[i]);
	}
	scanf("%s",&c);
	sum=0;
	flag=0;
	for(i=0;i<num;i++) {
		if(flag==1) {
			sum+=time[i];
		}
		if(strcmp(c,string[i])==0) {
			flag=1;
		}
	}
	printf("%d",sum);
	return 0;
}

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

int main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    long long n,sum =0,num,a;
    cin>>n;
    cin>>num;
    for(auto i=1;i<n;i++){
        cin>>a;
        if(num > a){
            sum += num -a;
        }
        else{
            num = a;
        }
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int a,b,n,i,count;
    while(2==scanf("%d %d", &a, &b))
    {
        n = a+b;
        count=0;
        while(n!=0)
        {
            i = n%10;
            n/=10;
            count++;
        }
        cout<<count<<endl;
    }
    return 0;
}

Measured memory_bytes: 1208
//ABC84A
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin >> a.at(i);
	}
	int pa = 0, pb = 0;
	sort(a.begin(),a.end());
	reverse(a.begin(),a.end());
	for(int i=0;i<n;i++){
		if(i%2 == 0){
			pa += a.at(i);
		}else{
			pb += a.at(i);
		}
	}
	cout << pa-pb << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	static PrintStream o = System.out;
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		short thealth = sc.nextShort();
		short tattack = sc.nextShort();
		short ahealth = sc.nextShort();
		short aattack = sc.nextShort();
		while (true) {
			ahealth -= tattack;
			if (ahealth <= 0) {
				o.println("Yes");
				break;
			}
			thealth -= aattack;
			if (thealth <= 0) {
				o.println("No");
				break;
			}
		}
	}
}

Measured memory_bytes: 35596
#include <bits/stdc++.h>
using namespace std;
#define start_routine cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int begtime = clock();
#define end_routine int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define contests_de_diya_kar 0
#define PB push_back
#define MP make_pair
#define int long long
#define MOD ((long long) (1000*1000*1000 + 7))
#define inf (int) 2e15
#define exit(a, b) return cout << a, b;
#define eps (double)1e-8
#define forn(a, b, i) for (int i = a; i < b; i += 1)
#define vi vector<int>
#define vb vector<bool>
#define all(v) v.begin(), v.end()
#define ll long long 
#define pii pair<int, int>
#define mii map<int, int> 
#define print(stuff) cout << stuff << endl
#define len(stuff) stuff.size()

signed main () {
	start_routine;
	// freopen("input.txt", "r", stdin);

	int n, m;
	cin >> n >> m;

	vi query(n + 1, inf);
	int a, b;
	for (int i = 0; i < m; i += 1) {
		cin >> a >> b;
		query[a] = min(query[a], b);
	} 

	int ans = 0;
	int right = 0, left = 0;
	for (int i = 1; i <= n; i += 1) {
		if (query[i] == inf) continue;
		if (i >= right) ans += 1, right = query[i], left = i;
		else {
			if (left <= i) {
				if (right > query[i]) right = query[i], left = i;
			}
		}
	}
	print(ans);
	end_routine;
}


Measured memory_bytes: 1152
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  ll m, k;
  cin >> m >> k;
  if(m==1&&k==1){
    cout << -1 << endl;
    return 0;
  }
  ll n = 1LL << m;
  vector<ll> ans;
  if (k == 0) {
    rep(i, 0, n) {
      ans.pb(i);
      ans.pb(i);
    }
  }
  else {
    ll a = 0;
    rep(i, 0, n) {
      a ^= i;
    }
    ll p = -1;
    rep(i, 0, n) {
      ll b = a;
      b ^= i;
      if (b == k) {
        p = i;
      }
    }
    if (p != -1) {
      rep(i, 0, n) {
        if (i == p)continue;
        ans.pb(i);
      }
      ans.pb(p);
      per(i, 0, n) {
        if (i == p)continue;
        ans.pb(i);
      }
      ans.pb(p);
    }
  }
  if (ans.sz != 0) {
    rep(i, 0, ans.sz) {
      cout << ans[i];
      if (i != ans.sz - 1)cout << " ";
    }
    cout << endl;
  }
  else {
    cout << -1 << endl;
  }
  return 0;
}

Measured memory_bytes: 3952