akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long 
using namespace std;

ll gcdab(ll a,ll b) 
{
 	if(b==0)return a;
    return gcdab(b,a%b);
  
}
int main()
{
  ll n;
  cin>>n;
 ll arr[n];
  for(ll i=0;i<n;i++)
  	cin>>arr[i];
  
  ll ans =arr[0];
  
  for(ll i=1;i<n;i++)
  {
   	ans= ans/gcdab(ans,arr[i]);
    ans=ans*arr[i];
    
    
    
  }
  
  cout<<ans<<endl;
  
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;

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

	string ab = a + b;
	int iab = stoi(ab);

	for (int i = 1; i <= 1000; i++) {
		if (i * i == iab) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


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

using namespace std;
using ll = long long;

struct LazySegmentTree{
private:
    int n; //葉の数
    vector<ll> node, lazy; //普通のセグ木の配列と遅延配列

public:
    LazySegmentTree(){}
    LazySegmentTree(vector<ll> v){
        int sz = v.size();
        int height = ceil(log2(sz));
        n = pow(2, height);
        node.resize(2*n-1, 0);
        lazy.resize(2*n-1, 0);

        for(int i = 0; i < sz; i++) node[i+(n-1)] = v[i];
        for(int i = n-2; i >= 0; i--) node[i] = node[(i<<1) + 1] + node[(i<<1) + 2];
    }

    void eval(int k, int l, int r){
        if(lazy[k] != 0){
            node[k] += lazy[k];

            if(r-l > 1){
                lazy[(k<<1)+1] += lazy[k]/2;
                lazy[(k<<1)+2] += lazy[k]/2;
            }
        }
        lazy[k] = 0;
    }

    ll getsum(int a, int b, int k=0, int l=0, int r=-1){
        if(r < 0) r = n;
        //区間に交わりが無い -> 0を返す
        if(b <= l || r <= a) return 0;

        eval(k, l, r);
        //区間を全て覆う -> その区間和を返す
        if(a <= l && r <= b) return node[k];
        //区間に一部交わりがある
        else{
            ll vl = getsum(a, b, (k<<1)+1, l, (l+r)/2);
            ll vr = getsum(a, b, (k<<1)+2, (l+r)/2, r);
            return vl+vr;
        }
    }
    void update(int a, int b, ll v, int k=0, int l=0, int r=-1){
        if(r < 0) r = n;
        //[a,b)にvを足すクエリ
        eval(k, l, r);
        if(b <= l || r <= a) return;
        else if(a <= l && r <= b){
            lazy[k] += (r-l)*v;
            eval(k, l, r); //アクセス後はlazy[k]=0のはずなので、(r-l)*vを足した後に評価が必要
        }
        else{
            update(a, b, v, (k<<1)+1, l, (l+r)/2);
            update(a, b, v, (k<<1)+2, (l+r)/2, r);
            node[k] = node[(k<<1)+1] + node[(k<<1)+2];
        }
    }
};

int main(void){
    int n, q; cin >> n >> q;
    vector<ll> A(n, 0);
    LazySegmentTree lst(A);
    for(int i = 0; i < q; i++){
        int cmd; cin >> cmd;
        if(cmd == 0){
            int s, t; ll x; cin >> s >> t >> x;
            lst.update(s-1, t, x);
        }
        else{
            int s, t; cin >> s >> t;
            cout << lst.getsum(s-1, t) << endl;
        }
    }
}


Measured memory_bytes: 8948
//A > Bのとき難しいなあと思っていたら、A < Bやんけ！
#include <stdio.h>

double pi = 3.14159265358979;

int main() {
	double a, b;
	scanf("%lf%lf", &a, &b);
	printf("%.14f\n", 4 / 3.0 * pi * b * b * b);
	return 0;
}


Measured memory_bytes: 2768
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eps 1e-9
#define maxp 99940000
#define mod 1000000007
#define pi 3.141592653589793238
#define sin(s) scanf("%lld",&s);
#define sout(s) printf("%lld\n",s);
#define in(s) cin>>s
#define in2(a,b) cin>>a>>b
#define in3(a,b,c) cin>>a>>b>>c
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl '\n'
#define sp ' '
#define gear_change ios_base::sync_with_stdio(false),cin.tie(0)
#define nfl(i,n) for(i=0;i<n;i++)
#define sfl(i,s,e) for(i=s;i<e;i++)
#define ufl(i,n) for(i=n-1;i>=0;i--)
ll power(ll x,ll y){
    ll ret=1;
    while(y>0){
        if(y&1)
            ret=(ret*x);
        y/=2;
        x=(x*x);
    }
    return ret;
}
string rot(string s){
	string ret="";
	ll i;
	for(i=1;s[i];i++){
		ret+=s[i];
	}
	ret+=s[0];
	return ret;
}
void solve(){
	ll arr[3]={0};
	ll a,b,c;
	cin>>a>>b>>c;
	arr[0]=abs(a-b);
	arr[1]=abs(b-c);
	arr[2]=abs(c-a);
	sort(arr,arr+3);
	cout<<arr[0]+arr[1]<<endl;
}	
int main(){
	gear_change;
	ll test=1;
	// in(test);
	while(test--){
		solve();
	}
}	


Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;

int main(){
  ll n, m, c, a, b[100+1]={0}, cnt=0, sum;
  scanf("%lld%lld%lld", &n, &m, &c);
  for(int i=0; i<m; i++){
    scanf("%lld", &b[i]);
  }
  for(int i=0; i<n; i++){
    sum=0;
    for(int j=0; j<m; j++){
      scanf("%lld", &a);
      sum += a*b[j];
    }
    if( sum+c > 0 ){ cnt++; }
  }
  printf("%lld", cnt);
  return 0;
}


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

int N, M, Q;
vector<int> a, b, c, d;
vector<int> A;
int ans;

void dfs(int idx, int pre) {
    if (idx == N) {
        int res = 0;
        for (int i = 0; i < Q; ++i) {
            if (A.at(b.at(i)) - A.at(a.at(i)) == c.at(i)) {
                res += d.at(i);
            }
        }
        ans = max(ans, res);
    } else {
        for (int i = pre; i <= M; ++i) {
            A.at(idx) = i;
            dfs(idx + 1, i);
        }
    }
}

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

    cin >> N >> M >> Q;
    a.resize(Q);
    b.resize(Q);
    c.resize(Q);
    d.resize(Q);
    A.resize(N);
    for (int i = 0; i < Q; ++i) {
        cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);
        a.at(i)--;
        b.at(i)--;
    }
    ans = 0;
    dfs(0, 1);
    cout << ans << endl;

    return 0;
}

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

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = Integer.parseInt(s.next());
		int[] l = new int[n];
		for (int i = 0; i < n; i++) {
			l[i] = Integer.parseInt(s.next());
		}

		int[] sl = Arrays.stream(l)
				.sorted()
				.toArray();

		int sum = 0;
		for (int i = 0; i < n - 1; i++) {
			sum += sl[i];
		}

		String ans = null;

		if (sum > sl[n - 1]) {
			ans = "Yes";
		} else {
			ans = "No";
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 27856
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<iosfwd>
#include<sstream>
using namespace std;
int main(void){
    vector<int> city(5); 
    for(int i=0; i<5; i++){
        cin >> city[i];

    }
    int k;
    int jg=0;
    cin >> k;

  
    if(city[4]-city[0]<=k) cout << "Yay!" << endl;
    if(city[4]-city[0]>k) cout << ":(" << endl;

    return 0;
}

Measured memory_bytes: 888
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int n=0,xi,yi,m,lj=0,car_position[2]={10,10},gem_position[21][21]={0},i,j,pocket=0;
    char dj = '\0';
    int a[2];
    while (1) {
        
        scanf("%d",&n);
        
        if (n == 0) {
            break;
        }
        
        for (i=0; i<n; i++) {
            //gem position
            scanf("%d %d",&xi,&yi);
            gem_position[yi][xi] = 1;
        }
        //???????????°
        //printf("meirei");
        scanf("%d",&m);
        
        for (i = 0; i < m; i++) {
            
            scanf(" %c %d",&dj,&lj);
            //a[0] ??£??????????????????????????????a[1]???y???x??????
            //char?????¨????????£????????¨???''dekakomu
            if (dj == 'N') {
                a[0] = 1;
                a[1] = 1;
            } else if (dj == 'S') {
                a[0] = -1;
                a[1] = 1;
            } else if (dj == 'E') {
                a[0] = 1;
                a[1] = 0;
            } else if (dj == 'W'){//W
                a[0] = -1;
                a[1] = 0;
            }
            //???????????? ?????¢?????°?????? car_position[0] = x car_position[1] = y
            for (j = 0; j < lj; j++) {
                car_position[a[1]] += a[0]*1;
                
                if (gem_position[car_position[1]][car_position[0]] == 1) {
                    gem_position[car_position[1]][car_position[0]] = 0;
                    //printf("get\n");
                    pocket++;
                }
                
            }
            
        }
        
        
        if (n == pocket) {
            printf("Yes\n");
        } else {
            printf("No\n");
        }
        
        pocket = 0;
        for (i = 0; i < 21; i++) {
            for (j = 0; j<21; j++) {
                gem_position[i][j] = 0;
            }
        }
        
        car_position[0] = 10;
        car_position[1] = 10;
        
    }
    return 0;
}

Measured memory_bytes: 584
#!python3


iim = lambda: map(int, input().rstrip().split())

def resolve():
    N = list(map(int, input()))
    K = int(input())
    size = len(N)

    if size < K:
        print(0)
        return

    dp = [[[0]*(size+1) for j in range(2)] for i in range(size+1)]

    dp[0][0][0] = 1
    for i in range(size):
        for k in range(min(i+1, K+1)):
            dp0, dp1 = dp[i], dp[i+1]

            dp1[1][k+1] += 9 * dp0[1][k]
            dp1[1][k]   +=     dp0[1][k]

            x, y = N[i], dp0[0][k]
            if x == 0:
                dp1[0][k] += y
            else:
                dp1[1][k] += y
                dp1[0][k+1] += y
                dp1[1][k+1] += (x-1) * y
        #print(dp1)

    print(dp[-1][0][K] + dp[-1][1][K])

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3188
N = int(input())
D = [list(map(int, input().split())) for _ in range(N)]

for i in range(N-2):
    if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
        print("Yes")
        exit()
print("No")

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

using namespace std;

int main(void)
{
	int i;
	vector<int>n(3);
	for (i = 0; i < 3; i++)
	{
		cin >> n[i];
	}
	sort(n.begin(), n.end());
	if (n[0] == 5 && n[1] == 5 && n[2] == 7)
	{
		cout << "YES\n";
	}
	else
	{
		cout << "NO\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for (int i = a; i < n; i++)
using namespace std;
using pii = pair<int, int>;
const int MOD = 1000000007;
const int INF = 1LL << 30;

int N;
int A[200010];

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N;
  rep(i, 0, N) cin >> A[i];
  rep(i, 0, N) {
    if (A[i] <= i) continue;
    cout << -1 << endl;
    return 0;
  }
  int ans = 0;
  int last = N-1;
  while (last > 0) {
    ans += A[last];
    while (A[last-1]+1 == A[last]) last--;
    if (A[last]-A[last-1] > 1) {
      cout << -1 << endl;
      return 0;
    }
    last--;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
/// Kazuki Hoshino


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
//#define endl '\n'
typedef tree<
int,
null_type,less<int>,
rb_tree_tag,tree_order_statistics_node_update>
ordered_set;
int n,k,a[100005],hb,ans,t=1,sum;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

cin >> n >> k;
for(int i=1;i<=n;i++){
   cin >> a[i];
   sum+=a[i];
}
if(k==0){
   cout << sum << endl;
   return 0;
}
for(int j=0;j<60;j++){
   if((t<<j)&k){
      hb = max(hb,j);
   }
}
int curk=0;
hb = 60;
for(int j=hb;j>=0;j--){
   int cnt = 0;
   for(int i=1;i<=n;i++){
      if((t<<j)&a[i]){
         cnt++;
      }
   }
   if(cnt>n-cnt){
      ans+= (t<<j)*cnt;
   }
   else {
      if(k>=curk+(t<<j)){
         curk+= (t<<j);
         ans+= (t<<j)*(n-cnt);
      }
      else {
         ans+= (t<<j)*(cnt);
      }
   }
}
/*
for(int j=hb+1;j<65;j++){
   for(int i=1;i<=n;i++){
      if((t<<j)&a[i]){
         ans+= (t<<j);
      }
   }
}
*/

cout << ans << endl;

return 0;}
///....



Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		int k = Integer.parseInt(br.readLine());
		for(int i = 0; i < k; i++){
			String[] tmpArray = br.readLine().split(" ");
			int x = Integer.parseInt(tmpArray[0]);
			int y = Integer.parseInt(tmpArray[1]);
			
			System.out.println(solveColor(x, y, n));
		}
	}
	
	static int solveColor(int x , int y, int n){
		//????????????????????¶????????????????????????
		if(n - y <= n/2){
			y = n - y + 1;
//			System.out.println("y fix "+x+" "+y);
		}
		//????????????????????¶????????????????????????
		if(n - x <= n/2){
			x = n - x + 1;
//			System.out.println("x fix "+x+" "+y);

		}
		//x??§?¨??????????y??§?¨??????§?????????????????¢?????????
		if(x < y){
			int tmp = x;
			x = y;
			y = tmp;
		}
		
//		System.out.println("fixed data "+x +" "+ y);
		if(y % 3 == 1){
			return 1;
		}
		else if(y % 3 == 2){
			return 2;
		}
		else if(y % 3 == 0){
			return 3;
		}
		
		
		return -1;
	}

}

Measured memory_bytes: 26052
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>

using namespace std;

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

    using ll = long long;

    vector<ll> w(n), s(n), v(n);

    for (int i = 0; i < n; i++) {
        cin >> w[i] >> s[i] >> v[i];
    }

    vector<int> index(n);
    iota(index.begin(), index.end(), 0);

    sort(index.begin(), index.end(), [&](int i, int j) {
        return w[i] + s[i] < w[j] + s[j];
    });

    int W = 20001;

    vector<vector<ll>> dp(n + 1, vector<ll>(W + 1));

    for (int i = 0; i < n; i++) {
        int k = index[i];

        for (int j = 1; j <= W; j++) {
            dp[i + 1][j] = max(dp[i + 1][j - 1], dp[i][j]);

            if (j - w[k] >= 0 && j - w[k] <= s[k]) {
                dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w[k]] + v[k]);
            }
        }
    }

    cout << dp[n][W] << endl;
}


Measured memory_bytes: 160640
import java.io.*;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
       String input=null;
       String upper=null;
      try{
    	  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    	  input=br.readLine();
    	  upper=input.toUpperCase();
    	  System.out.println(upper);
      }catch(Exception e){
    	  e.printStackTrace();
      }
	}

}

Measured memory_bytes: 16856
#include <iostream>
#include <vector>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <algorithm>

using namespace std;
using ll = long long;

int main(){
    string s;
    cin>>s;
    int c;
    int i = 0;
    int cnt = 0;
    while(s[i] != '\0'){
        c = s[i] - 48;
        cnt = (cnt + c)%9;
        i++;
    }
    if(cnt == 0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}  


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

using namespace std;

int main() {
	string name;
	string s="";
	int i ;
  	cin>>name;
	for(i=0;name[i]!='\0';++i) {
		if (name[i] == '0')s.push_back('0');
		else if (name[i] == '1')s.push_back('1');
		else if(name[i]=='B'&&s.size()>0)s.pop_back();
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
x,y,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p = sorted(p, reverse=True)
q = sorted(q, reverse=True)

pq = sorted(p[:x] + q[:y])
r = sorted(r)
ans=0
j = r.pop()
for i in pq:
  if i < j:
    ans += j
    j = 0
    if r:
      j = r.pop()
  else:
    ans += i
    
print(ans)

Measured memory_bytes: 29664
double x[100],y[100],t,u,a,b,s;n,i,j,k,c;main(m){for(;scanf("%d",&n),i=j=n;printf("%d\n",m)){for(m=1;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;--i;)for(j=i-1;j--;)if((u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(s=1,t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(a=x[i]+cos(t+s*u),b=y[i]+sin(t+s*u),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}}

Measured memory_bytes: 0
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
static int func(int i, int n, int* c, int* s, int* f)
{
	int j;
	int time = 0;;

	if (i == n - 1){
		return time;
	}

	for (j = i; j < n - 1; ++j){
		/* wait */
		--time;	//@@
		time = time + f[j] - (time%f[j]);
		if (time < s[j]) time = s[j];

		/* move */
		time = time + c[j];
	}
	return time;
}
int main(void)
{
	int n;
	int c[501], s[501], f[501];
	int i, j;

	scanf("%d", &n);
	for (i = 0; i < n - 1; ++i){
		scanf("%d%d%d", c + i, s + i, f + i);
	}

	for (i = 0; i < n; ++i){
		printf("%d\n", func(i, n, c, s, f));
	}
	return 0;
}


Measured memory_bytes: 128
N, Q = map(int, input().split())
S = input()
lrs = [list(map(int, input().split())) for _ in range(Q)]

cs = [0] * N
s = 0
for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        s += 1
    cs[i+1] = s 

for l, r in lrs:
    print(cs[r-1] - cs[l-1])


Measured memory_bytes: 30664
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    String a = sc.next();
    String b = sc.next();
    String c = sc.next();
    
    String aLast = a.substring(a.length() - 1);
    String bFirst = b.substring(0, 1);
    String bLast = b.substring(b.length() - 1);
    String cFirst = c.substring(0, 1);
    
    if (aLast.equals(bFirst) && bLast.equals(cFirst)) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
}

Measured memory_bytes: 23252
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

const long long wallet = 1E15;

int n ,m;
int s, t;
long long in[100000], out[100000];
long long u[100000], v[100000], a[100000], b[100000];
long long ans[100000];

vector<int> edge_index[100000];

int dijkstra(int start, long long *cost, long long *w){
   for(int i=0; i<n; i++)
      cost[i] = wallet;

   priority_queue<pair<long long, int>, vector<pair<long long, int> >, greater<pair<long long, int> > > pq;

   cost[start] = 0;
   pq.push(make_pair(0, start));

   while(!pq.empty()){
      auto p = pq.top();
      pq.pop();

      if(cost[p.second] < p.first)
         continue;
//      cout << p.second <<"(" << cost[p.second]<<"):"<<endl;
      for(int item : edge_index[p.second]){
         int dist;
         if(u[item] == p.second)
            dist = v[item];
         else
            dist = u[item];

         if(p.first + w[item] < cost[dist]){
            cost[dist] = p.first + w[item];
            pq.push(make_pair(cost[dist], dist));
         }
//         cout << dist <<":"<<p.first+w[item]<<endl;
      }
   }

}

int main(){
   cin >> n >> m >> s >> t;

   for(int i=0; i<m; i++){
      cin >> u[i] >> v[i] >> a[i] >> b[i];
      u[i]--;
      v[i]--;

      edge_index[u[i]].push_back(i);
      edge_index[v[i]].push_back(i);
//      cout << u[i] <<" --  "<<i<<endl;;
//      cout << v[i] <<" --  "<<i<<endl;;
   }

   dijkstra(s-1, in, a);
   dijkstra(t-1, out, b);

   long long bef_ans = 0;
   for(int i=n-1; i>=0; i--){
      ans[i] = max(bef_ans, wallet - in[i] - out[i]);
      bef_ans = ans[i];
   }

   for(int i=0; i<n; i++){
      cout << ans[i] << endl;
//      cout << in[i] << " " << out[i] << endl;
   }

   return 0;
}


Measured memory_bytes: 12924
#include<bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define fr first
#define sc second
#define ll long long int
#define bit(idx) idx&(-idx)
#define bin(x, a) bitset<a>(x)
#define all(A) A.begin(), A.end()
#define debug(x) cout << #x << " = " << x << endl;
using namespace std;

const long double PI = 3.1415926535897932384626;

int main(){
	ios_base::sync_with_stdio(NULL); cin.tie(); cout.tie();
	long double r; cin >> r;
	cout << (long double) 2* r * PI << endl;
}
/**

*/

Measured memory_bytes: 3812
#include <cstdio>

using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    if (n % 2 == 0) {
        printf("0.5000000000");
    } else {
        float result = ((float)n + 1) / 2 / (float)n;
        printf("%f", result);
    }
    return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> d(n);
	rep(i,n) cin >> d[i];
	
	ll res = 0;
	rep(i,n){
		for(int j = i+1; j < n; j++){
			res += d[i] * d[j];
		}
	}
	
	cout << res << endl;
	return 0;
}

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

#define ll long long
#define inf 1e18
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << #y << "=" << y << endl
#define sp(x, y) fixed << setprecision(y) << x;
#define em emplace_back
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
#define nl '\n'

typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

const int maxn = 1e6;
const int mod = 1e9 + 7;

void solve()
{
    ll n, m, k, i, j;
    cin >> n >> m >> k;
    vl a(n), b(m);
    fo(i, n) cin >> a[i];
    fo(i, m) cin >> b[i];
    vl ca(n + 1), cb(m + 1);
    Fo(i, 0, n) ca[i + 1] = ca[i] + a[i];
    Fo(i, 0, m) cb[i + 1] = cb[i] + b[i];
    ll ans = 0;
    fo(i, n + 1)
    {
        ll temp = k - ca[i];
        if (temp < 0)
            continue;
        ll rem = lower_bound(cb.begin(), cb.end(), temp) - cb.begin();
        if (rem > m || cb[rem] > temp)
            rem--;
        ans = max(ans, i + rem);
    }
    cout << ans;
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ll test = 1;
    //cin >> test;
    while (test--)
    {
        solve();
    }
    return 0;
}

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

using namespace std;

int cnt[100005];

int main()
{
    string s;

    cin >> s;

    int sLen = s.length();

    int e = -1;
    int l = 0;
    int b = 0;
    bool is = false;

    while (e < sLen - 1)
    {
        if (l <= 2 || cnt[s[b] - 'a'] >= (l + 1) / 2)
        {
            e++;
            l++;
            cnt[s[e] - 'a']++;
            
            if (l >= 2 && cnt[s[e] - 'a'] > l / 2)
            {
                is = true;
                break;
            }
        }
        else
        {
            cnt[s[b] - 'a']--;
            b++;
            l--;
        }
    }

    if(is == true)
    {
        cout << b + 1 << ' ' << e + 1 << endl;
    }
    else
    {
        cout << "-1 -1" << endl;
    }

    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val r = sc.nextInt
  val g = sc.nextInt
  val b  = sc.nextInt
  val n  = sc.nextInt

  val temp =
    (0 to n / r).map{i =>
      (0 to n / g).count{j =>
        val bk = n - i * r - j * g
        bk % b == 0 && bk >= 0
      }
    }.sum

  println(temp)

}

Measured memory_bytes: 63304
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

// const ll LLINF = (1LL<<60);
// const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

const double EPS = 1e-8;
const double INF = 1e12;
const double PI = atan(1)*4;

//point
typedef complex<double> P;
namespace std {
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a)<real(b) : imag(a)<imag(b);
	}
	bool cmp_y(const P &a, const P &b){
		return imag(a) != imag(b) ? imag(a)<imag(b) : real(a)<real(b);
	}
}
double cross(const P& a, const P& b) {
	return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
	return real(conj(a)*b);
}
// line
struct L : public vector<P> {
	L(const P& a, const P& b) {
		push_back(a); push_back(b);
	}
};
// polygon
typedef vector<P> G;

G convex_hull(G ps) {
  int n = ps.size(), k = 0;
  sort(ps.begin(), ps.end(), cmp_y);
  G r(2*n);
  for(int i = 0; i < n; i++){
    while(k>1 && cross(r[k-1]-r[k-2],ps[i]-r[k-2]) < -EPS)k--;
    r[k++] = ps[i];
  }
  for(int i = n-2, t = k; i >= 0; i--){
    while(k>t && cross(r[k-1]-r[k-2],ps[i]-r[k-2]) < -EPS)k--;
    r[k++] = ps[i];
  }
  r.resize(k-1);
  return r;
}

int x[105], y[105];
map<PII, int> mp;
double ans[105];
signed main(void)
{
  // cout << PI << endl;
  int n;
  cin >> n;
  G ps;
  REP(i, n) {
    cin >> x[i] >> y[i];
    ps.PB(P(x[i], y[i]));
    mp[{x[i], y[i]}] = i;
  }

  G poly = convex_hull(ps);
  // cout << poly << endl;
  REP(i, poly.size()) {
    // cout << poly[(i==0?poly.size()-1:i-1)] << " " << poly[i] << " " << poly[(i==poly.size()-1?0:i+1)] << endl;
    P p = poly[(i==0?poly.size()-1:i-1)] - poly[i];
    P q = poly[(i==poly.size()-1?0:i+1)] - poly[i];
    // cout << p << " " << q << endl;
    double theta = PI - acos(dot(p, q)/abs(p)/abs(q));
    // cout << dot(p, q) << " " << abs(p) << " " << abs(q) << " theta:" << theta << endl;
    ans[mp[{poly[i].real(), poly[i].imag()}]] = theta/2/PI;
  }

  REP(i, n) cout << fixed << setprecision(9) << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    while(b < c){
        if(a < b){
            printf("Yes\n");
            break;
        }
        else{
            printf("No\n");
            break;
        }
    }
    while(b >= c){
        printf("No\n");
        break;
    }
    return 0;
}



Measured memory_bytes: 2148
from collections import deque
h,w = map(int, input().split())
maze = [list(input()) for _ in range(h)]
def repaint(maze,sx,sy):
  maze[sy][sx] = 1 
  que = deque([(sx,sy)])
  dxdy = [(1,0),(0,1),(-1,0),(0,-1)]
  while que:
    x,y = que.popleft()
    for dx,dy in dxdy:
      if 0<=x+dx<w and 0<=y+dy<h and maze[y+dy][x+dx] == ".":
        maze[y+dy][x+dx] = maze[y][x] + 1
        que.append((x+dx,y+dy))
  return True
white = 0
for x in maze:
  white += x.count(".")
repaint(maze,0,0)
if maze[h-1][w-1] == ".":
  print(-1)
else:
  print(white-maze[h-1][w-1])

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

#define MAX_N 101000
#define SWAP( a, b ) do { int tmp; tmp = a; a = b; b = tmp; } while( 0 )

int isPrime[ MAX_N + 1 ] = { 0, 0, 1 };

void insertionSort( int *, int );
void quickSort( int *, int );
int median( int, int, int );

int main( void ) {
	int i, j, N, P, cnt, p[ 22 ], sum[ 253 ];

	for ( i = 3; i <= MAX_N; i += 2 )
		isPrime[ i ] = 1;

	for ( i = 3; i * i <= MAX_N; i += 2 )
		if ( isPrime[ i ] )
			for ( j = i * 2; j <= MAX_N; j += i )
				isPrime[ j ] = 0;

	for ( ; scanf( "%d %d", &N, &P ), N != -1; printf( "%d\n", sum[ P - 1 ] ) ) {
		cnt = 0;
		for ( i = N + 1; cnt < 22; i++ )
			if ( isPrime[ i ] )
				p[ cnt++ ] = i;

		cnt = 0;
		for ( i = 0; i < 22; i++ )
			for ( j = i; j < 22; j++ )
				sum[ cnt++ ] = p[ i ] + p[ j ];

		quickSort( sum, 253 );
	}

	return 0;
}

void insertionSort( int *data, int n ) {
	int i, j, tmp;

	for ( i = 1; i < n; i++ ) {
		tmp = data[ i ];

		if ( data[ i - 1 ] > tmp ) {
			j = i;
			do {
				data[ j ] = data[ j - 1 ];

				j--;
			} while ( j && data[ j - 1 ] > tmp );

			data[ j ] = tmp;
		}
	}
}

void quickSort( int *data, int n ) {
	int low[ 30 ] = { 0 }, high[ 30 ] = { n - 1 }, sp = 1;

	while ( sp-- ) {
		int l = low[ sp ], r = high[ sp ];

		if ( l < r ) {
			int i = l, j = r, pivot = median( data[ i ], data[ ( i + j ) / 2 ], data[ j ] );

			while ( 1 ) {
				for ( ; data[ i ] < pivot; i++ ) ;
				for ( ; pivot < data [ j ]; j-- ) ;
				if ( i >= j )
					break;

				SWAP( data[ i ], data[ j ] );

				i++;
				j--;
			}

			if ( i - l < 20 )
				insertionSort( data + l, i - l );
			else {
				low[ sp ] = l;
				high[ sp ] = i - 1;
				sp++;
			}

			if ( r - j < 20 )
				insertionSort( data + j + 1, r - j );
			else {
				low[ sp ] = j + 1;
				high[ sp ] = r;
				sp++;
			}
		}
	}
}

int median( int x, int y, int z ) {
	if ( x < y )
		if ( y < z )
			return y;
		else if ( z < x )
			return x;
		else
			return z;
	else if ( z < y )
		return y;
	else if ( x < z )
		return x;
	else
		return z;
}

Measured memory_bytes: 988
s = list(input())
a, b, c = 0, 0, 0
for i in s:
    if i == "a":
        a += 1
    if i == "b":
        b += 1
    if i == "c":
        c += 1

if a >= 1 and b >= 1 and c >= 1:
    print("Yes")
else:
    print("No")


  

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

int main() {
  ll x;
  cin >> x;
  for(ll a = -1000; a < 1000; ++a){
    for(ll b = -1000; b < 1000; ++b){
      if(pow(a, 5) - pow(b, 5) == x){
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 4032
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e18;
long long int MOD = 1000000007;

#define MAX_V 11000

int V;
vector<int> G[MAX_V]; // グラフの隣接リスト表現
vector<int> rG[MAX_V];// 辺の向きを逆にしたグラフ
vector<int> vs;       // 帰りがけ順の並び
bool used[MAX_V];     // すでに調べたか
int cmp[MAX_V];       // 属する強連結成分のトポロジカル順序

struct edge{
	int from, to;
	long long int cost;
};

// from から to への辺を張る関数
void add_edge(int from, int to){
	G[from].push_back(to);
	rG[to].push_back(from);
}

void dfs(int v){
	used[v] = true;
	for(int i = 0; i < G[v].size(); i++){
		if(!used[G[v][i]]){
			dfs(G[v][i]);
		}
	}
	vs.push_back(v);
}

void rdfs(int v, int k){
	used[v] = true;
	cmp[v] = k;
	for(int i = 0; i < rG[v].size(); i++){
		if(!used[rG[v][i]]){
			rdfs(rG[v][i], k);
		}
	}
}

// 強連結成分分解を行う関数、返り値は強連結成分の個数
int scc(){
	memset(used, 0, sizeof(used));
	vs.clear();
	for(int v = 0; v < V; v++){
		if(!used[v]){
			dfs(v);
		}
	}
	memset(used, 0, sizeof(used));
	int k = 0;
	for(int i = vs.size() - 1; i >= 0; i--){
		if(!used[vs[i]]){
			rdfs(vs[i], k++);
		}
	}
	return k;
}

int main(){
	
	int E, r;
	cin >> V >> E >> r;
	
	vector<edge> es;
	for(int i = 0; i < E; i++){
		edge e;
		cin >> e.from >> e.to >> e.cost;
		es.push_back(e);
	}
	long long int ans, S = 0;
	
	while(true){
		long long int prev[V], mincost[V], maxcost[V] = {};
		for(int i = 0; i < V; i++){
			G[i].clear();
			rG[i].clear();
			mincost[i] = INF;
		}
		for(int i = 0; i < es.size(); i++){
			edge e = es[i];
			if(mincost[e.to] > e.cost){
				prev[e.to] = e.from;
				mincost[e.to] = e.cost;
			}
		}
		ans = S;
		for(int i = 0; i < V; i++){
			if(i != r){
				add_edge(prev[i], i);
				ans += mincost[i];
			}
		}
		int ret = scc();
		if(ret == V){
			break;
		}
		for(int i = 0; i < V; i++){
			if(i != r && cmp[i] == cmp[prev[i]]){
				maxcost[cmp[i]] = max(maxcost[cmp[i]], mincost[i]);
				S += mincost[i];
			}
		}
		vector<edge> es_;
		for(int i = 0; i < es.size(); i++){
			edge e = es[i];
			if(cmp[e.to] == cmp[prev[e.to]]){
				e.cost -= mincost[e.to];
			}
			e.from = cmp[e.from];
			e.to = cmp[e.to];
			if(e.from != e.to){
				es_.push_back(e);
			}
		}
		es = es_;
		V = ret;
		r = cmp[r];
	}
	
	cout << ans << endl;
	
	return 0;
}



Measured memory_bytes: 3756
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<stdbool.h>
#include<math.h>
#include<time.h>
#define ll long long
#define min(a,b) ((a)>(b)?(b):(a))
#define max(a,b) ((a)>(b)?(a):(b))
#define maax(a,b,c) max((a), max((b), (c)))
int n, w, v[111][2];
ll x[111][111111];

ll nyaan(int i, int j){
    if(j <= 0) return 0;
    if(i >= n) return 0;
    if(x[i][j] >= 0) return x[i][j];
    if(j < v[i][0]) return x[i][j] = nyaan(i+1, j);
    return x[i][j] = max(nyaan(i+1, j), v[i][1] + nyaan(i+1, j - v[i][0]));
}

int main(){
    scanf("%d%d", &n, &w);
    for(int i=0; i<n; i++){
        scanf("%d%d", &v[i][0], &v[i][1]);
    }
    for(int i=0;i<111;i++){
        for(int j=0; j<111111; j++){
            x[i][j] = -1;
        }
    }
    printf("%lld\n",nyaan(0,w));
}

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

const int M=2005;
char g[M][M];

int dp[M][M][4];

int n,m;

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)
		scanf("%s",g[i]);
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
		{
			if(g[i][j]=='#') continue;
			dp[i][j][0]=i==0?1:(dp[i-1][j][0]+1);
			dp[i][j][1]=j==0?1:(dp[i][j-1][1]+1);
		}
	for(int i=n-1;i>=0;i--)
		for(int j=m-1;j>=0;j--)
		{
			if(g[i][j]=='#') continue;
			dp[i][j][2]=i==n-1?1:(dp[i+1][j][2]+1);
			dp[i][j][3]=j==m-1?1:(dp[i][j+1][3]+1);
		}
	int ans=0;
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
		{
			if(g[i][j]=='#') continue;
			ans=max(ans,dp[i][j][0]+dp[i][j][1]+dp[i][j][2]+dp[i][j][3]-3);
		}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 66944
N=int(input())
a=list(map(int,input().split()))
ans=0
L={}
R={}
for i in range(N):
    if a[i]+i in L:
         k=L.get(a[i]+i)
         del L[a[i]+i]
         L[a[i]+i]=k+1
    else:
        L[a[i]+i]=1
    if i-a[i]>0:
        if i-a[i] in R:
             k=R.get(i-a[i])
             del R[i-a[i]]
             R[i-a[i]]=k+1
        else:
            R[i-a[i]]=1
for x in L.keys():
    if x in R:
        ans+=L.get(x)*R.get(x)
print(ans)


Measured memory_bytes: 43892
# Problem: https://atcoder.jp/contests/abc047/tasks/abc047_b
# Python 2nd Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(Width, Height, op_count, x_list, y_list, op_list):
    result = 0
    x_label_max = Width
    x_label_min = 0
    y_label_max = Height
    y_label_min = 0
    for j in range(0, op_count):
        real_ope = op_list[j]
        if real_ope == 1:
            x_label_min = max(x_list[j], x_label_min)
        if real_ope == 2:
            x_label_max = min(x_list[j], x_label_max)
        if real_ope == 3:
            y_label_min = max(y_list[j], y_label_min)
        if real_ope == 4:
            y_label_max = min(y_list[j], y_label_max)
    resultWidth = x_label_max - x_label_min
    resultHeight = y_label_max - y_label_min
    if resultWidth < 0:
        resultWidth = 0
    if resultHeight < 0:
        resultHeight = 0
    result = resultWidth * resultHeight
    return result


if __name__ == "__main__":
    W, H, N = MI()
    x_list = list()
    y_list = list()
    op_list = list()
    for _ in range(0, N, +1):
        tmp_x, tmp_y, tmp_op = MI()
        x_list.append(tmp_x)
        y_list.append(tmp_y)
        op_list.append(tmp_op)
    print("{}".format(solver(W, H, N, x_list, y_list, op_list)))


Measured memory_bytes: 9288
N = int(input())
alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
alphanum = dict()
for i in range(26): alphanum[alphabet[i]] = i

fact = [0] * (N + 1)
for i in range(1, N + 1): fact[i] = fact[i-1] + i

wordtype = dict()
for _ in range(N):
    s = input()
    s_num = [0] * 26
    for i in range(len(s)):
        s_num[alphanum[s[i]]] += 1
    s_str = ""
    for i in range(26):
        s_str += alphabet[i] + str(s_num[i])
    
    if s_str in wordtype: wordtype[s_str] += 1
    else: wordtype[s_str] = 1

ans = 0
for key in wordtype:
    ans += fact[wordtype[key] - 1]

print(ans)


Measured memory_bytes: 25960
#include <cstdio>
#include <utility>
#include <string>
using namespace std;

#ifdef __linux
#define _U(s) s##_unlocked
#else
#define _U(s) _##s##_nolock
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
#define gcu _U(getchar)
#define pcu _U(putchar)
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;for(char c;c=gcu(),c!=' '&&c!='\n'&&c!=EOF;)s+=c;return s;}
#define _S
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;if((c=gcu())=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
#ifdef _S
_SCAN(string &o) {int c{gcu()};if(c==EOF)return false;else{ungetc(c,stdin);string t=move(in);o=t;return true;}}
#endif
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:(ungetc(c,stdin),o=in,true);}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _S
_OUT(string &s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
	_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
	_HT _OUT(H &&h, T... t){out(h);out(t...);}
	template <typename... T> _OUTL(T... t){out(t...);outl();}
	struct range{
		int e,b=0,s=1;range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
		struct it{int v,s; it(int _v,int _s):v(_v),s(_s){} operator int()const{return v;} operator int&(){return v;}int operator*()const{return v;}
			it& operator++(){v+=s;return *this;} }; it begin(){return {b,s};} it end(){return {e,s};}};
#define times(i,n) for(int i=n;i;i--)

struct O {
	string s;
	bool q;
};

O strip (string::iterator &i, string::iterator e) {
	O o;
	if (*i == '\"') {
		o.q = true;
		i++;
		while (*i != '\"')
			o.s.push_back(*i++);
		i++;
	} else {
		o.q = false;
		while (*i != '\"' && i != e)
			o.s.push_back(*i++);
	}
	return o;
}

int main() {
	for (;;) {
		string s1 = in, s2 = in;
		if (s1 == ".")
			return 0;
		[&] {
			bool f {};
			for (auto i1 {begin(s1)}, i2 {begin(s2)}; i1 != end(s1) || i2 != end(s2);) {
				O o1 {strip(i1, end(s1))}, o2 {strip(i2, end(s2))};
				if (o1.q && o2.q && o1.s != o2.s) {
					if (f) {
						outl("DIFFERENT");
						return;
					} else
						f = true;
				} else if (o1.s != o2.s || o1.q != o2.q) {
					outl("DIFFERENT");
					return;
				}
			}
			outl(f ? "CLOSE" : "IDENTICAL");
		}();
	}
}


Measured memory_bytes: 2708
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)-1
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(b<a) { a=b; return 1; } return 0; }

int main(){
  int n; cin >> n;
  vi a(n); rep(i,n) cin >> a[i];
  int ans = 0;
  for(int i = 1; i <= n; i++){
    if(i % 2 == 1 && a[i-1] % 2 == 1) ans++;
  }
  cout << ans;
  return 0;
}


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

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

    long long m = 100;
    int counter = 0;

    while (m < x) {
        m *= 1.01;
        counter++;
    }

    cout << counter << endl;

    return 0;
}


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

int main()
{
ll k , n ;
cin >> k >> n ;
vector<ll> a(n);
rep(i, n){
  cin >> a[i];
}
ans=a[n-1]-a[0];
rep(i,n-1)ans=min(ans,k-a[i+1]+a[i]);
cout << ans << endl;
return 0;
}

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
s_dash = input()
t = input()
len_s = len(s_dash)
len_t = len(t)

candidates = set()

for i in range(len_s-len_t+1):
    part_s = s_dash[i:i+len_t+1]
    flag = True
    for j,k in zip(part_s,t):
        if j == "?" or j==k:
            continue
        else:
            flag = False
            break
    if flag:
        candidates.add(s_dash[0:i].replace("?","a")+t+s_dash[i+len_t::].replace("?","a"))
ret = "UNRESTORABLE"
if len(candidates)>0:
    ret = min(candidates)
print(ret)

Measured memory_bytes: 3064
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#define N 100050
using namespace std;
typedef long long ll;
ll n,c,x,v,a[N],b[N],ans=0,p[N],q[N];
template<class _T>inline void read(_T &x)
{
	x=0;
	char ch=getchar();
	int f=0;
	while (!isdigit(ch)) {if (ch=='-') f=1;ch=getchar();}
	while (isdigit(ch)) x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	if (f) x=-x;
}
int main()
{
	read(n),read(c);
	for (int i=1;i<=n;i++) read(x),read(v),a[i]=x,b[i]=b[i-1]+v;
	for (int i=1;i<=n;i++) p[i]=max(p[i-1],b[i]-a[i]);
	for (int i=n;i>=1;i--) q[i]=max(q[i+1],b[n]-b[i-1]-(c-a[i]));
	for (int i=1;i<=n;i++) ans=max(ans,max(b[i]-a[i],b[i]-a[i]-a[i]+q[i+1]));
	for (int i=n;i>=1;i--) ans=max(ans,max(b[n]-b[i-1]-(c-a[i])*2+p[i-1],b[n]-b[i-1]-(c-a[i])));
	printf("%lld\n",ans);
}

Measured memory_bytes: 3328
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    const tmp = readln.split.to!(long[]);
    const N = tmp[0], M = tmp[1];
    auto xs = readln.split.to!(long[]).sort!((a,b) => a < b).array;
    const d = iota(M-1).map!(i => xs[i+1] - xs[i]).array.sort!((a,b) => a < b).array;
    // 1個消す -> 1個増える
    //最低1個使う
    // n個消す -> n個増える
    // n+1個
    // 全部でN個 -> N-1個消せる
    if ((M-1)-(N-1) <= 0) {
        writeln(0);
    } else {
        d[0..$-(N-1)].sum.writeln;
    }
}


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

#define ll long long 

int main() {
    ios::sync_with_stdio(0); 

    int x;
    cin >> x;

    ll ans = 0;
    ans += (x / 500) * 1000;
    ans += ((x % 500 ) / 5 ) * 5;

    cout << ans << endl;


    return 0; 
}



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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    
    ll n; cin>>n;
    vector<tuple<string,ll,ll>> a;
    for(ll i=1;i<=n;i++){
        string s;
        ll p;
        cin>>s>>p;
        p=-p;
        a.emplace_back(s,p,i);
    }
    sort(all(a));

    rep(i,n){
        cout<< get<2>(a[i]) <<endl;
    }
    return 0;
}

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

long long int gcd(long long int a, long long int b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}

int main(){
  long long int N,X,GCD;
  cin>>N>>X;
  vector<long long int> vec(N);
  vector<long long int> vec2(N);
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
    vec2.at(i) = abs(X-vec.at(i));
  }
  if(N==1){
    cout<<vec2.at(0)<<endl;
  }
  else{
    GCD = gcd(vec2.at(0),vec2.at(1));
    for(int i=2;i<N;i++){
      GCD = gcd(GCD,vec2.at(i));
    }
    cout<<GCD<<endl;
  }
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_que<int> pque;//これは大きい順
//typedef priority_que<int, vector<int>, greater<int>> pque;//これは小さい順


int main(){
	ll a,b;
	cin >> a >> b;
	ll x = gcd(a,b);
	ll res = a*b/x;
	cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>

using namespace std;

int main(){
	int N,A,B,all,countall=0,countB=0;
	string str;
	cin>>N>>A>>B;
	all=A+B;
	cin>>str;
	for(int i=0;i<N;i++){
		if(str[i]=='a'){
			if(all>countall){
				countall++;
				cout<<"Yes"<<endl;
			}
			else{
				cout<<"No"<<endl;
			}
		}
		if(str[i]=='b'){
			if(all>countall){
				if(B>countB){
					countall++;
					countB++;
					cout<<"Yes"<<endl;
				}
				else
					cout<<"No"<<endl;
			}
			else{
				cout<<"No"<<endl;
			}
		}
		if(str[i]=='c')
			cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 896
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cmath>
#include <climits>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
#include <functional>
#include <algorithm>

using namespace std;

#define cin_desync()                      \
	do {                                  \
		ios_base::sync_with_stdio(false); \
		cin.tie(0);                       \
	} while (0)                           \

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}

#else
#define trace(...)
#endif // ifndef ONLINE_JUDGE

typedef long double ld;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

int main()
{
    int K, A, B;
    cin >> K >> A >> B;

    if (A + 2 >= B || (A - 1) + 2 > K) {
        cout << (K + 1) << endl;
    } else {
        ll rem = K - (A - 1);
        ll res = A + (rem / 2) * (B - A) + (rem % 2);
        cout << res << endl;
    }
}


Measured memory_bytes: 256