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

#define ull unsigned long long
#define ll long long
#define ld long double
#define endl << "\n"
#define sp << " "
#define spp << " " <<
#define allv(v) v.begin(),v.end()
#define lmax 9223372036854775807
#define lmin -9223372036854775807
#define lopi() for(i=0;i<n;++i)
#define loi(a,b) for(i=a;i<b;++i)
#define lopj() for(j=0;j<n;++j)
#define loj(a,b) for(j=a;j<b;++j)
#define ft first
#define sd second
#define pb push_back
#define pf push_pront
#define mod 1000000007
#define lower(str) transform(str.begin(), str.end(), str.begin(), ::tolower);
#define upper(str) transform(str.begin(), str.end(), str.begin(), ::toupper);
#define mset(a,b) memset(a,b,sizeof(a))
#define crap ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI acos(-1)

void divisibilityCheck(ll arr[], ll n) 
{ 
	unordered_set<ll> s; 
	ll max_ele = INT_MIN; 
	for (ll i = 0; i < n; i++) { 
		s.insert(arr[i]); 
		max_ele = max(max_ele, arr[i]); 
	} 
	unordered_set<ll> res; 
	for (ll i = 0; i < n; i++) { 
		if (arr[i] != 0) { 
			for (ll j = arr[i] * 2; j <= max_ele; j += arr[i]) { 
				if (s.find(j) != s.end()) 
					res.insert(j); 
			} 
		} 
	} 
	unordered_map<ll, ll> mp; 
	for (ll i = 0; i < n; i++) 
		mp[arr[i]]++; 
	unordered_map<ll, ll>::iterator it; 
	vector<ll> ans; 
	for (it = mp.begin(); it != mp.end(); it++) { 
		if (it->second >= 2) { 
			if (res.find(it->first) == res.end()) { 
				ll val = it->second; 
				while (val--) 
					ans.push_back(it->first); 
			} 
		} 
		if (res.find(it->first) != res.end()) { 
			ll val = it->second; 
			while (val--) 
				ans.push_back(it->first); 
		} 
	} 
	cout << (n-ans.size()) endl ;
} 

int main(){
//	crap ;
    int timer;
    // cin >>timer;
    timer=1 ;
    while(timer--){
    	ll n,m,i,j,k,a,b ;
    	cin >>n;
    	ll dta[n];
    	for(i=0;i<n;++i)
    		cin >>dta[i] ;
    	divisibilityCheck(dta,n) ;
    }
}


Measured memory_bytes: 32452
'''input
5 1
00010
'''


N, K=map(int,input().split())
Sstr=input()
# print(Sstr)
S=[]

for i in range(N):
	S.append(int(Sstr[i]))

# print(S)
# flip=0
# for i in range(N-1):
# 	flip+=abs(S[i+1]-S[i])
# print(flip)


now=1
cnt=0
Nums=[]
for i in range(N):
	if S[i]==now:
		cnt+=1
	else:
		Nums.append(cnt)
		now=1-now
		cnt=1

if cnt!=0:
	Nums.append(cnt)

if(len(Nums)%2==0):
	Nums.append(0)

Add=2*K+1
ans=0

left=0
right=0
tmp=0

for i in range(0, len(Nums), 2):
	# tmp=0
	Nextleft=i
	Nextright=min(i+Add, len(Nums))
	# for j in range(left, right):
	# 	tmp+=Nums[j]
	while(Nextleft>left):
		tmp-=Nums[left]
		left+=1
	while(Nextright>right):
		tmp+=Nums[right]
		right+=1
	
	ans=max(tmp,ans)

print(ans)

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

int main() {
  int64_t N,ans;
  ans = 1;
  cin >> N;
  int64_t A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    if (A[i] == 0) {
      ans = 0;
    }
  }
  for (int i = 0; i < N; i++) {
    string check;
    //check = to_string(ans) + to_string(A[i]);
    //if (check.size() >= 21) {
      //ans = -1;
      //break;
    //}
    if ((ans / 1000000) * (A[i] / 1000000) > 1000000) {
      ans = -1;
      break;
    }
    
    ans *= A[i];
    if (ans > 1000000000000000000LL) {
      ans = -1;
      break;
    }
  }
  
  
  
  
    
    cout << ans << endl;
}




Measured memory_bytes: 4396
import java.io.*;

class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str;
while((str=br.readLine())!=null){
int x=Integer.parseInt(str);
System.out.println(fact(x));
}
}
private static long fact(int x){
if(x==0){return 1;}
return x*fact(x-1);
}
}

Measured memory_bytes: 16856
function main(arg) {
   var age = arg.split("\n")[0];
   var A   = parseInt(arg.split("\n")[1]);
   var B   = parseInt(arg.split("\n")[2]);
   
   if(age == 2) {
       console.log(A + B);
   } else {
       console.log("Hello World");
   }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

string s;
int main(){
    cin>>s;
    ll gCnt=0;
    ll N=s.length();
    for(auto c:s){
        if(c=='g')gCnt++;
    }
    cout<<gCnt-(N+1)/2<<endl;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


int main(){
	int n;
	cin>>n;
	int k = 1;
	for(k=1;k<=n;k++){
		if(k*(k-1)/2 == n) break;
	}
	if(n == k*(k-1)/2 ){
		cout<<"Yes"<<endl;
		vector<vector<int> > s(k);
		int st = 1;
		cout<<k<<endl;
		for(int i=0;i<k-1;i++){
			for(int  j=0;j<k-1-i;j++){
				s[i].push_back(st);
				s[i+j+1].push_back(st);
				st++;
			}
		}
		for(int i=0;i<k;i++){
			cout<<s[i].size();
			for(int j=0;j<s[i].size();j++){
				cout<<' '<<s[i][j];
			}
			cout<<endl;
		}
	}else{
		cout<<"No"<<endl;
	}


	return 0;
}


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

int main(){
  long a, b, x;
  cin >> a >> b >> x;
  if(a % x == 0){
    cout << ( b - a ) / x + 1 << endl;
  }else{
    cout << ( b - ( a - a % x )) / x << endl;
  }
}

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

#define int long long

using namespace std;

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

    int a, s;
    cin >> a;

    int cnt = 0;
    for (int i = 0; i < a; ++i)
    {
        cin >> s;

        if (i + 1 != s)
        {
            cnt++;
        }
    }

    if (cnt <= 2)
    {
        cout << "YES" << endl;
        return 0;
    }
    cout << "NO" << endl;
}

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

using namespace std;

const int N = 1e5 + 5;
int nxt[26][N];

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

    string s , t;
    cin >> s >> t;

    for (char &c : s) c -= 'a';
    for (char &c : t) c -= 'a';

    memset(nxt , -1 , sizeof nxt);
    for (int i = s.size() - 1 ;i >= 0 ;i--) {
        for (int j = 0 ;j < 26 ;j++)
            nxt[j][i] = nxt[j][i + 1];
        nxt[s[i]][i] = i;
    }

    for (char &c : t) {
        if (nxt[c][0] == -1) {
            cout << -1;
            return 0;
        }
    }

    int p = s.size() - 1;
    long long len = 0;
    for (char &c : t) {
        if (nxt[c][p + 1] != -1) {
            len += nxt[c][p + 1] - p;
            p = nxt[c][p + 1];
        } else {
            len += s.size() - p - 1;
            p = nxt[c][0];
            len += p + 1;
        }
    }

    cout << len;
}

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

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

  bool stepable = true;
  for (int i = 0; i < S.size(); i++) {
    if ((i+1)%2 != 0) {
      if (S[i] == 'R' || S[i] == 'D' || S[i] == 'U') {
        continue;
      } else {
        stepable = false;
      }
    } else {
      if (S[i] == 'L' || S[i] == 'U' || S[i] == 'D') {
        continue;
      } else {
        stepable = false;
      }
    }
  }
  cout << (stepable ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define out(a) cout<<fixed<<setprecision((a))

int main(){
	ll a,b,n;
	cin >> n >> a >> b;
	cout << min(n*a,b) << endl;
	
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<queue>
using namespace std;

bool used[10];
int sum;
int dp[11][10005];
void saiki(int c, int d) {//c?????§??§d
	dp[c][d]++;
	if (c == 10) {
		return;
	}
	for (int e = 0; e < 10; e++) {
		if (!used[e]) {
			used[e] = true;
			saiki(c + 1, d + (c + 1)*e);
			used[e] = false;
		}
	}
}
int main() {
	saiki(0, 0);
	int a, b;
	while (cin >> a >> b) {
		cout << dp[a][b] << endl;
	}
}

Measured memory_bytes: 3108
#include <iostream>
#include <string>
using namespace std;
 
int main (){
  char mp[11][11];
 
  while(cin >> mp[0]) {
 
    for(int i=1;i<10;i++) 
      for(int j=i;j<10;j++) {
    mp[i][j] = ((mp[i-1][j]-'0'+mp[i-1][j-1]-'0')%10)+'0';
    //cout <<mp[i][j] <<" "<< mp[i-1][j] <<" "<<mp[i-1][j-1] << endl;
      }
    cout << mp[9][9]<<endl;
 
  }
 
  return 0;
}

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

string max(string x, string y){
  if(x.size()>=y.size()) return x;
  else return y;
}

int main(){
  string s,t;
  cin>>s>>t;
  
  int dp[3005][3005];
  int dp2[3005][3005][2];
  rep(i,s.size()){
    rep(j,t.size()){
      if(s[i]==t[j]){
        dp[i+1][j+1] = dp[i][j]+1;        
      }else{
        dp[i+1][j+1] = max(max(dp[i][j],dp[i+1][j]),dp[i][j+1]);
      }      
    }
  }
  int i = s.size(), j = t.size();
  string ans;
  while(i>0 && j>0){
    if(dp[i][j]==dp[i-1][j]) i--;
    else if(dp[i][j]==dp[i][j-1]) j--;
    else{
      ans = s[i-1] + ans;
      i--; j--;
    }
  }
  cout << ans << endl;
}

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

int main(){
	int n,r;
	while(cin >> n >> r, n,+r){
		int data[50], tmp[50];
		for(int i=0; i<n; i++){
			data[i]	= n-i;
			tmp[i] = n-i;
		}
		for(int i=0; i<r; i++){
			int p,c;
			cin >> p >> c;
			for(int j=0; j < p+c-1; j++){
				if(j<p-1){
					tmp[j+c] = data[j];
				}else{
					tmp[j-p+1] = data[j];
				}
			}
			for(int j=0; j<n; j++){
				data[j] = tmp[j];	
			}
		}
		cout << data[0] << endl;
	}
}

Measured memory_bytes: 3076
process.stdin.resume();
process.stdin.setEncoding('utf8');
var input_string = '';

process.stdin.on('data', function(chunk) {
    input_string += chunk;
});

process.stdin.on('end', function() {
    const lines = parseInt(input_string);
    var h = parseInt(lines/3600);
    var m = parseInt((lines%3600)/60);
    var s = parseInt((lines%3600)%60);
    console.log(h+':'+m+':'+s);
});


Measured memory_bytes: 15536
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
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; }
typedef long long ll;
typedef pair<int,int> P;

vector<int> to[100005];
vector<int> d(100005);
vector<int> dt(100005);
vector<int> da(100005);
void dfs(int v, int p=-1, int k=0) {
  d[v]=k;
  for (int u : to[v]) {
    if (u == p) continue;
    dfs(u,v,k+1);
  }
}

int main(){
  int n,s,t;
  cin >> n >> s >> t;
  s--,t--;
  rep(i,n-1) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  dfs(s);
  swap(d,dt);
  dfs(t);
  swap(d,da);
  int ans=0;
  rep(i,n){
    if(da[i]>dt[i])chmax(ans,da[i]);
  }
  cout << ans - 1 << endl;
}

Measured memory_bytes: 10752
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

ll gcd(ll n, ll m) {
    if (n < m) swap(n, m);
    while (m != 0) {
        ll r = n % m;
        n = m;
        m = r;
    }
    return n;
}

struct P {
    ll u0, u1, l;
};

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

    ll x, d;
    cin >> x >> d;

    if (d == 0) {
        if (x == 0) {
            cout << 1 << endl;
        } else {
            cout << n + 1 << endl;
        }
        exit(0);
    }

    if (x == 0) {
        ll r = (ll)n * (n - 1) / 2;
        cout << r + 1 << endl;
        exit(0);
    }

    if (x < 0) x *= -1, d *= -1;

    ll g = gcd(abs(x), abs(d));
    x /= g;
    d /= g;

    //ll p = x * d;

    map<int, P> mp;
    ll r = 0, s0 = 0, s1 = 0, t0 = x, t1 = x + d * (n - 1);
    for (int i = 0; i <= n; i++) {
        int t = x * i % abs(d);

        ll u0 = min(s0, s1);
        ll u1 = max(s0, s1);
        //u1 - u0 + 1;
        P &p = mp[t];
        //cout << s0 << ' ' << s1 << endl;
        if (p.l == 0) {
            p.u0 = u0;
            p.u1 = u1;
            p.l = 1;
            r += (u1 - u0) / abs(d) + 1;
        } else {
            if (u1 < p.u0 || u0 > p.u1) {
                r += (u1 - u0) / abs(d) + 1;
            } else if (p.u0 <= u0 && u1 <= p.u1) {
                r += 0;
            } else {
                r += max(u1 - p.u1, 0LL) / abs(d);
                r += max(p.u0 - u0, 0LL) / abs(d);
            }
            p.u0 = min(u0, p.u0);
            p.u1 = max(u1, p.u1);
        }

        if (i < n) {
            s0 += t0;
            s1 += t1;
            t0 += d;
            t1 -= d;
        }
    }

    cout << r << endl;

    //dが0の場合は 0を通る場合は

    return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;

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

    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()),v.end());

    for(int i = 0; i < v.size()-1; i++){
        cout << v[i] << " ";
    }
    cout << v[v.size()-1] << endl;
}


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

int main(){
  int n;
  string S, T, T_cut;
  cin >> S >> T;
  n = S.size();
  T_cut = T.erase(n);
  if (S == T_cut) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 0
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

int N;
vector<int> A;

int solve() {
    // 下から取れる葉の min,max を測る
    vector< pair<int, int> > lim(N + 1);
    pair<int, int> cur = {A[N], A[N]};
    lim[N] = cur;
    for(int i = N - 1; i >= 0; --i) {
        // 最小
        lim[i].first = (lim[i+1].first + 1) / 2 + A[i];
        // 最大
        lim[i].second = (lim[i+1].second) + A[i];
    }
    if(lim[0].first > 1) {
        return -1;
    }

    int ret = 0;
    int border = 1;
    REP(i, N + 1) {
        if(i > 0) { border = border * 2; }
        int add = min(border, lim[i].second);
        ret += add;
        border = add - A[i];
    }

    return ret;
}

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

    cin >> N;
    A.resize(N + 1);
    REP(i, N + 1) {
        cin >> A[i];
    }

    int ans = solve();
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 5556
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (int)(999999999/2)
#define eps 1e-9
#define MAX_N 5000
int w,h;
int fie[30][30];
string data[30];


void bfs(int yy,int xx){
    int dx[]={0,1,0,-1};
    int dy[]={1,0,-1,0};
    queue<pii> que;
    que.push(pii(yy,xx));
    
    bool used[30][30]={};
    used[yy][xx]=true;
    while(que.size()){
        int y=que.front().first,x=que.front().second;
        //        cout<<y<<" "<<x<<endl;
        que.pop();
        
        rep(i,4){
            int ddy=y+dy[i],ddx=x+dx[i];
            if(ddy<0||ddx<0||ddy>=h||ddx>=w||data[ddy][ddx]=='x'||used[ddy][ddx])continue;
            fie[ddy][ddx]=fie[y][x]+1;
            used[ddy][ddx]=true;
            que.push(pii(ddy,ddx));
        }
    }
}

int solve(vector<int> a){
    int ret=0;
    rep(i,a.size()){
        ret*=2;
        ret+=a[i];
    }
    return ret;
}

int main(){
    while(cin>>w>>h&&w&&h){
        int v=0;
        rep(i,h){
            cin>>data[i];
        }
        
        vector<pii> p;
        rep(i,h)rep(j,w)if(data[i][j]=='o'){p.pb(pii(i,j));v++;}
        rep(i,h)rep(j,w)if(data[i][j]=='*'){p.pb(pii(i,j));v++;}
        map<  pair<pii,pii> , int  > pass;
        rep(i,p.size()){
            rep(j,30)rep(k,30)fie[j][k]=INF;
            fie[p[i].first][p[i].second]=0;
            bfs(p[i].first,p[i].second);
            rep(j,p.size()){
                pass[make_pair(p[i],p[j])]=fie[p[j].first][p[j].second];
            }
        }
        vector<int> num;
        rep(i,v-1)num.pb(i+1);
        sort(all(num));
        int mini=INF;
        int dp[1<<11][11];
        rep(i,1<<11)rep(j,11)dp[i][j]=INF;
        dp[1][0]=0;
//        cout<<(1<<(v-1))<<endl;
        for(int i=1;i<v;i++){
            vector<int> num;
            rep(j,i)num.pb(1);
            rep(j,v-i)num.pb(0);
            sort(all(num));
            do{
                int b=solve(num);
                rep(k,v){
                    if(((1<<k)&b)!=0)continue;
                    rep(l,v){
                        if(k==l)continue;
//                        cout<<"dp["<<(b^(1<<k))<<"]["<<k<<"]="<<min(dp[b][l]+pass[make_pair(p[l],p[k])],dp[b^(1<<k)][k])<<endl;
//                        cout<<dp[b][l]<<endl;
//                        cout<<b<<" "<<l<<endl;
                        dp[b^(1<<k)][k]=min(dp[b][l]+pass[make_pair(p[l],p[k])],dp[b^(1<<k)][k]);
                    }
                }
            }while(next_permutation(all(num)));
        }
        
        
//        do{
//            int sum=0;
//            sum+=pass[  make_pair(p[0],p[num[0]])  ];
//            rep(i,v-2){
//                sum+=pass[  make_pair(p[num[i]],p[num[i+1]])  ];
//            }
//            mini=min(mini,sum);
//        }while(next_permutation(all(num)));
        rep(i,v){
            mini=min(dp[(1<<v)-1][i],mini);
        }
        if(mini==INF)cout<<"-1"<<endl;
        else cout<<mini<<endl;
    }
}

Measured memory_bytes: 1340
//Catchharsh
#include<bits/stdc++.h>
#define ll long long int 
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define F first
#define S second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define see(x) cout<<#x<<" = "<<x<<endl
const ll MOD = 1e9+7;
const ll INF = 1011111111;
const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}

int32_t main()
{   
     IOS;
     
     ll n,m,i,j,k;
     string s;
     ld r;
     cin>>r;
     cout<<fixed<<setprecision(16)<<2*PI*r;
     
     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';             
}

Measured memory_bytes: 3844
#include<iostream>
#include<map>
#include<algorithm>
#include <iomanip>
#include <cmath>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <vector>
#include <bitset>
#include <queue>
#include <set>
#include <stack>
#include <string>

using namespace std;

int main() {
	int n, m, c; cin >> n >> m >> c;
	int b[m];
	for (int i = 0; i < m; i++) {
		cin >> b[i];
	}
	int a[n][m];
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int sum = 0;
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
			sum += b[j] * a[i][j];
		}
		if (sum+c > 0) {
			ans++;
		}
	}

	cout << ans << endl;

}

Measured memory_bytes: 256
n,x,y=map(int,input().split())
ans=[0]*n
for i in range(1,n):
    for j in range(i+1,n+1):
        ans[min(j-i,abs(x-i)+abs(y-j)+1,abs(x-j)+abs(y-i)+1)]+=1
for i in range(1,n):
    print(ans[i])

Measured memory_bytes: 3444
n , t = map(int, input().split())
a = [list(map(int,input().split())) for i in range(n)]

l = []
for i in range(n):
    if a[i][1] <= t:
        l.append(a[i])
cost = [l[i][0] for i in range(len(l))]
if len(cost)==0:
    print("TLE")
else:
    print(min(cost))


Measured memory_bytes: 3060
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

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

N,K = LI()
p = LI()

p.sort()
print(sum(p[:K]))

Measured memory_bytes: 67332
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [int(input()) for _ in range(D)]
now = 1
score = 0
contest = [0] * 26

def down(num):
    ret = 0
    for i, z in enumerate(contest):
        if i == num:
            contest[num] = now
            z = now
        ret += c[i] * (now - z if z != 0 else now)
    return ret

for i in range(D):
    score += s[now - 1][t[i] - 1] - down(t[i] - 1)
    now += 1
    print(score)
        

Measured memory_bytes: 9280
# -*- coding: utf-8 -*-
# 入力
N, M = map(int, input().split())
# 演算
cnt = 0
l = list(range(0, N*2, 2)) + list(range(1, M*2, 2))
for i, n in enumerate(l):
  for m in l[i+1::]:
    if (n + m) % 2 == 0:
      cnt += 1
# 出力
print(cnt)

Measured memory_bytes: 3060
#include <iostream>
#include<math.h>
#include<algorithm>
#include<string.h>
typedef long long int ll;
using namespace std;

int main(){
    string s;
    cin>>s;
    int i=s.size(),k=0;
    if(s[i-1]==s[0]){
        k=1;
    }

    if((k+i)%2==1){
        cout<<"First"<<endl;
    }
    else{
        cout<<"Second"<<endl;
    }
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int n,r;
int d(int x){
	int r=0;
	while(x){
		r += x%10;
		x/=10;
	}
	return r;
}
int main(){
	scanf("%d",&n);
	r = 9999;
	for(int i=1; i+i<=n; i++)
		r = min(r, d(i)+d(n-i));
	printf("%d\n",r);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

int main(void)
{
	int n, a;
	scanf("%d", &n);
	deque<int> Q;
	int type = 0;
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a);
		if(type) Q.push_back(a);
		else Q.push_front(a);
		type = !type;
	}

	if(!type) reverse(Q.begin(), Q.end());
	for(auto it: Q) printf("%d ", it);
	printf("\n");
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

const int max_v=1002;
struct edge{int to,cap,rev;};
vector<edge> graph[max_v];
bool used[max_v];

void add_edge(int from,int to,int cap){
    graph[from].push_back(edge{to,cap,int(graph[to].size())});
    graph[to].push_back(edge{from,0,int(graph[from].size()-1)});
}

int ford_fulkerson_dfs(int v,int t,int f){
    if(v==t) return f;
    used[v]=true;
    for(auto &e:graph[v]){
        if(used[e.to] or e.cap<=0) continue;
        int d=ford_fulkerson_dfs(e.to,t,min(f,e.cap));
        if(d>0){
            e.cap-=d;
            graph[e.to][e.rev].cap+=d;
            return d;
        }
    }
    return 0;
}

int ford_fulkerson(int s,int t){
    int flow=0,f;
    while(true){
        fill_n((bool*)used,max_v,false);
        f=ford_fulkerson_dfs(s,t,inf);
        if(f==0) return flow;
        flow+=f;
    }
}

int gcd(int x,int y){
     if(y==0) return x;
     return gcd(y,x%y);
}

void solve(){
    int m,n;
    while(true){
        cin >> m >> n;
        if(m==0 and n==0) break;
        
        for(auto &v:graph) v.clear();
        
        vector<int> b(m),r(n);
        for(int &x:b) cin >> x;
        for(int &x:r) cin >> x;
        
        rep(i,0,m){
            rep(j,0,n){
                if(gcd(b[i],r[j])>1) add_edge(i,m+j,1);
            }
        }
        
        rep(i,0,m) add_edge(m+n,i,1);
        rep(i,0,n) add_edge(m+i,m+n+1,1);
        
        cout << ford_fulkerson(m+n,m+n+1) << endl;
    }
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	solve();
	return 0;
}

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

int main() {
    string s; cin >> s;
    int a = 0, b = 0, c = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if(s[i] == 'a') a++;
        else if(s[i] == 'b') b++;
        else c++;
    }

    if(max({a, b, c}) > (s.size() + 2) / 3) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 512
//D Teleporter
//Doubling
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++) //これでiやjを定義しなくていいらしい
using namespace std;
using ll = long long;

const int D = 60;//ダブリングによる置換の表の行数
const int MAX_N = 200000;//列数
int to[D][MAX_N];

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

  rep(i,n){
    cin >> to[0][i];//1行目は1回移動の先＝A[i]と同じ
    to[0][i]--;//配列の要素番号に合わせてデクリメントしておく
  }
  //表を作っていく
  rep(i,D-1){//左上から行を進める、i+1行目まで作るのでD-1までで止める。
    rep(j,n){//列を進める
      to[i+1][j] = to[i][to[i][j]];//表の性質より
    }
  }

  int v=0;//出発点は0番の街
  for(int i=D-1;i>=0;i--){//大きい行数の方から辿っていく
    ll x = 1ll<<i;//オーバーフロー対策しつつ,ｘはkを構成する2^nの数（64,32など）
    if(x<=k){
      v = to[i][v];//v番目の街からi回移動したとこをｖに保存
      k -= x;//残り移動回数を更新する
    }
  }
  cout << v+1 << endl;//出力は町の番号に戻すので＋１

  return 0;
}


Measured memory_bytes: 50508
n=int(input())
h=list(map(int,input().split()))
for i in reversed(range(n-1)):
  if h[i]>h[i+1]:
    h[i]-=1

for i in range(n-1):
  if h[i]>h[i+1]:
    print('No')
    break
else:
  print('Yes')


Measured memory_bytes: 63984
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
int N;
unsigned long long K;
int a[200010];
int h[200010];
int main() {
	cin >> N >> K;
	
	for (int i = 1; i <= N; i++)
	{
		cin >> a[i];
	}
	int cur = 1;
	int step = 0;
	while (1)
	{
		if (h[cur])
			break;
		h[cur]++;
		cur = a[cur];
		step++;
	}
	int ent = cur;
	cur = 1;
	int step2 = 0;
	while (1)
	{
		if (cur == ent)
			break;
		cur = a[cur];
		step2++;
	}
	if (K < step2)
	{
		int cur = 1;
		while (K--)
		{
			cur = a[cur];
		}
		cout << cur << endl;
		return 0;
	}
	K -= step2;
	K %= step - step2;
	K += step2;
	cur = 1;
	while (K--)
	{
		cur = a[cur];
	}
	cout << cur << endl;
}

Measured memory_bytes: 5140
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b){
    // require:   a > b
    if(a < b) return gcd(b,a);
    if(b == 0) return a;
    return gcd(b, a%b);
}

int main(){
    ll a, b;
    cin >> a >> b;
    ll gc = gcd(a,b);
    if(gc == 1){
        cout << 1 << endl;
        return 0;
    }
    vector<ll> cd;

    for(int i=1;i<=sqrt(gc);i++){
        if(gc % i == 0){
            cd.push_back(i);
            cd.push_back(gc/i);
        }
    }
    sort(cd.begin(), cd.end());
    int ans = 0;
    for(int i=0;i<cd.size();i++){
        bool f = true;
        for(int j = 1; j < i; j++){
            if(cd[i] % cd[j] == 0)
                f = false;
        }
        ans += (f?1:0);
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
// In the name of God //
 
#include <bits/stdc++.h>
#define ll long long
#define all(x) (x).begin(), (x).end()
#define pii pair <int, int>
using namespace std;
const int N = 1e6 + 5;
const int mod = 1e9 + 7;


void solve() {
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] != t[i]) {
            ans++;
        }
    }
    cout << ans;
}


int main()  {
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int tt = 1;
    // cin >> tt;
    for (int tc = 1; tc <= tt; ++tc) {
        solve();
    } 
}                                   

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

const int MAXP = 1.5e7;
int criba[MAXP+1];
void crearcriba(){
	int w[] = {4,2,4,2,4,6,2,6};
	for(int p = 25; p <= MAXP; p += 10) criba[p] = 5;
	for(int p = 9; p <= MAXP; p += 6) criba[p] = 3;
	for(int p = 4; p <= MAXP; p += 2) criba[p] = 2;
	for(int p = 7, cur = 0; p*p <= MAXP; p += w[cur++&7]) if(!criba[p]) for(int j =  p*p; j <= MAXP; j+=(p<<1)) if(!criba[j]) criba[j] = p;
}

map<ll,ll> fact(ll n){
	map<ll,ll> r;
	while(criba[n]){
		r[criba[n]]++;
		n /= criba[n];
	}
	if(n > 1) r[n]++;
	return r;
}

ll sumDiv(ll n){
	ll r = 1;
	auto f = fact(n);
	for(auto i:f){
		r *= i.second + 1ll;
	}
	return r;
}

int main(void){
	ll r = 0, n;
	crearcriba();
	cin>>n;
	for(ll i = 1; i <= n; i++){
		r += sumDiv(i) * i;
	}
	cout<<r<<'\n';
	return 0;
}


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

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

template <typename T> constexpr T inf;
template <> constexpr int inf<int> = 1e9;
template <> constexpr ll inf<ll> = 1e18;
template <> constexpr double inf<double> = 1e18;

int LIS(vector<int> x) {
    vector<int> dp(x.size() + 1, inf<int>);
    for(auto y : x) {
        *lower_bound(begin(dp), end(dp), y) = y;
    }
    return lower_bound(begin(dp), end(dp), inf<int>) - begin(dp);
}

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    if(A > N || B > N) {
        cout << -1 << endl;
        return 0;
    }
    vector<int> ans;
    if(A == 1) {
        for(int i = 0; i < N; ++i) {
            ans.push_back(N - i);
        }
    } else if(B == 1) {
        for(int i = 0; i < N; ++i) {
            ans.push_back(i + 1);
        }
    } else {
        int nowA = N - A + 1;
        int nowB = B - 1;
        int putB = 0;
        while(nowA <= N) {
            ans.push_back(nowA++);
            for(int minus = 0; minus <= B - 2 && putB != N - A && (int)ans.size() != N; ++minus) {
                ans.push_back(nowB - minus);
                putB++;
            }
            nowB = min(nowB + B - 1, N - A);
        }

        // check
        auto tmp = ans, rev_tmp = ans;
        auto aa = LIS(tmp);
        sort(begin(tmp), end(tmp));
        tmp.erase(unique(begin(tmp), end(tmp)), end(tmp)); // permutation ?
        reverse(begin(rev_tmp), end(rev_tmp));
        auto bb = LIS(rev_tmp);
        //for(auto x : ans) {
        //    cout << x << ' ';
        //}
        //cout << endl;
        if(aa != A || bb != B || (int)tmp.size() != N || nowA != N + 1 || putB != N - A) {
            ans.clear();
        }
    }
    if(ans.empty()) {
        cout << -1 << endl;
    } else {
        for(int i = 0; i < N; ++i) {
            cout << ans[i] << " \n"[i + 1 == N];
        }
    }
}

Measured memory_bytes: 6256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<ll> a(n);
	for( ll &i : a ){
		cin >> i;
	}
	sort(a.begin(), a.end());
	ll x = a.back();
	a.pop_back();
	ll dif = INF;
	ll ans = 0;
	ll trgt1 = x/2;
	ll trgt2 = ( x%2 == 0 ) ? (x/2) : (x/2 + 1);
	for( ll i : a ){
		if( abs(trgt1-i) + abs(trgt2-i) < dif ){
			dif = abs(trgt1-i) + abs(trgt2-i);
			ans = i;
		}
	}	
	cout << x << " " << ans << endl;
	return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    string s; cin >> s;
    int ans = 0;
    string pre = "";
    for (int i = 0; i < s.size(); i++) {
        string r;
        r += s[i];
        if (r != pre) {
            ans++;
            pre = s[i];
        }
        else {
            if (i+1 == s.size()) {
                break;
            }
            else {
                ans++;
                pre = s[i] + s[i+1];
                i++;
            }
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 720
#include<iostream>
using namespace std;
int main(){
    int trump[4][13],n,num;
    char l;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>l>>num;
        if(l=='S') trump[0][num-1]='X';
        if(l=='H') trump[1][num-1]='X';
        if(l=='C') trump[2][num-1]='X';
        if(l=='D') trump[3][num-1]='X';
    }
    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
            if(trump[i][j]!='X' && i==0){
                l='S';
                cout<<l<<' '<<j+1<<endl;
            }
            else if(trump[i][j]!='X' && i==1){
                l='H';
                cout<<l<<' '<<j+1<<endl;
            } 
            else if(trump[i][j]!='X' && i==2){
                l='C';
                cout<<l<<' '<<j+1<<endl;
            } 
            else if(trump[i][j]!='X' && i==3){
                l='D';
                cout<<l<<' '<<j+1<<endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3080
#include <iostream>


int main() {

    int A, B, C;
    std::cin >> A >> B >> C;

    int dst = std::max( std::max(A, B), C);
    std::cerr << "dst = " << dst << std::endl;

    int diff_a = dst - A;
    int diff_b = dst - B;
    int diff_c = dst - C;

    int d = 0;
    d += diff_a / 2;
    d += diff_b / 2;
    d += diff_c / 2;
    std::cerr << "d = " << d << std::endl;

    int sa = diff_a % 2;
    int sb = diff_b % 2;
    int sc = diff_c % 2;
    int s = sa + sb + sc;
    std::cerr << "s = " << s << std::endl;

    int add = 0;
    if (s % 2 == 1) add = 2;

    std::cout << d + s/2 + add << std::endl;


    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

int main()
{
  int k;
  cin>>k;
  set<int> st;
  int i=1,x=7;
  while(true)
  {
    if(x%k==0) 
    {
      cout<<i<<endl;
      return 0;
    }
    x%=k;
    i++;
    if(st.find(x)!=st.end())
    {
      cout<<-1;
      return 0;
    }
    st.insert(x);
    x=x*10+7;
  }
}

Measured memory_bytes: 50396
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N;
    string S;
    cin >> N >> S;
    int cnt = 0;
    for(auto c:S)if(c == '#')cnt++;
    int mincnt = cnt;
    for(int i = N-1;i >= 0;i--){
        if(S[i] == '.')cnt++;
        else cnt--;

        mincnt = min(mincnt, cnt);
    }
    
    
    cout << mincnt << endl;

}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N;
int a[100010];

int main () {
  cin >> N;
  for (auto i = 0; i < N; ++i) {
    cin >> a[i];
  }
  int one = 0;
  int two = 0;
  int four = 0;
  for (auto i = 0; i < N; ++i) {
    if (a[i] % 4 == 0) {
      four++;
    } else if (a[i] % 2 == 0) {
      two++;
    } else {
      one++;
    }
  }
  // cerr << one << " " << two << " " << four << endl;
  if (two > 0) one++;
  if (one > four+1) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
   
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
    int ans=0;
    int cnt=0;
    for (int i=0;i<s.size();i++){
        if(s[i]=='R') cnt++;
        else{
            ans=max(ans,cnt);
            cnt=0;
        }
    }
    ans=max(ans,cnt);
    cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 3636
#pragma region header
#include <bits/stdc++.h>
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 rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
bool isprime(int n) { //素数判定
    if(n==1)return false;
    if(n==2)return true;
    for(int i = 2;i<=sqrt(n);i++) {
        if(n%i==0) return false;
    }
    return true;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int n;cin >> n;
    vi a(n);
    int g;
    set<int> st;
    bool ok = true;
    rep(i, n) {
        cin >> a[i];
        if(i==0)g=a[i];
        else g=gcd(g,a[i]);
        if(ok) if(a[i]!=1) ok=false;
    }
    if(ok) {
        cout << "pairwise coprime\n";
        return 0;
    }
    if(g!=1) {
        cout << "not coprime\n";
        return 0;
    }
    rep(i, n) {
        for(int j = 1;j<=(int)(sqrt(a[i]));j++) {
            if(a[i]%j==0) {
                if(st.count(j)||st.count(a[i]/j)) {
                    cout << "setwise coprime\n";
                    return 0;
                }
                if(j!=1)st.insert(j);
                if(a[i]/j!=1)st.insert(a[i]/j);
            }
        }
    }
    cout << "pairwise coprime\n";
    return 0;
}
// 3 
// 1 1 1


Measured memory_bytes: 11208
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long y = sc.nextLong();
		long s = 0;
		for(long l = x; l <= y; l *= 2)
		{
			s++;
		}
		System.out.println(s);
		
  	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <cassert>
using namespace std;

int n, k;
string T[16];
vector<string> comb[16];
string pre[16];
int dp[1 << 16][16][6];

string now, ans;

void dfs(int bit, int p, int r) {
	if(dp[bit][p][r]) return;
	dp[bit][p][r] = 1;
	if(bit == (1 << n) - 1) {
		if(ans > now) ans = now;
		return;
	}

	string s = pre[p] + comb[p][r];
	int pos[26] = { 0 };
	for(int i = 0; i < s.size(); i++) {
		pos[s[i] - 'A'] = i;
	}

	for(int i = 0; i < n; i++) {
		if(bit >> i & 1) continue;
		bool ok = true;
		for(int j = 0; j < k - 1; j++) {
			if(pos[T[i][j] - 'A'] > pos[T[i][j + 1] - 'A']) {
				ok = false;
				break;
			}
		}
		if(!ok) continue;
		string rem;
		for(int j = 0; j < n; j++) {
			if(T[i].find(s[j]) == string::npos) rem += s[j];
		}
		int idx = find(comb[i].begin(), comb[i].end(), rem) - comb[i].begin();
		now += 'A' + i;
		dfs(bit | (1 << i), i, idx);
		now.pop_back();
	}
}

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

	while(cin >> n >> k) {
		for(int i = 0; i < n; i++) {
			cin >> T[i];
			pre[i] = T[i];
			reverse(pre[i].begin(), pre[i].end());
		}

		for(int i = 0; i < n; i++) {
			string t;
			for(int j = 0; j < n; j++) {
				if(T[i].find('A' + j) == string::npos) t += 'A' + j;
			}
			comb[i].clear();
			do {
				comb[i].push_back(t);
			} while(next_permutation(t.begin(), t.end()));
		}

		memset(dp, 0, sizeof dp);
		ans = "zzzzzzzzzzzzzzzzz";
		now = "";

		for(int i = 0; i < n; i++) {
			for(int j = 0; j < comb[i].size(); j++) {
				now += 'A' + i;
				dfs(1 << i, i, j);
				now.pop_back();
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 27808
if __name__ =="__main__":
    kyori = []
    for x in range(5):
        kyori.append(input())
    
    k = input()

    max_length=int(kyori[4])-int(kyori[0])

    if max_length <= int(k):
        print("Yay!")
    else:
        print(":(")

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int a=10;
int main(){
  int n;
  bool t=false;
  cin >> n ;
  for(int i=0;i<=n;i+=4){
    for(int j=0;j+i<=n;j+=7){
      if(i==0&&j==0) continue;
      if(n%(i+j)==0){
        t=true;
        break;
      }
    }
    if(t) break;
  }
  if(t) cout << "Yes\n";
  else cout << "No\n";
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

const MOD = 1000000007

func ModAdd(a, b int64) int64 {
	return (a + b) % MOD
}

func ModMul(a, b int64) int64 {
	return a * b % MOD
}

func ModSub(a, b int64) int64 {
	r := (a%MOD - b%MOD) % MOD
	if r < 0 {
		r += MOD
	}
	return r
}

func ModDiv(a, b int64) int64 {
	return a % MOD * ModInv(b) % MOD
}

func ModPow(a, n int64) int64 {
	var r int64 = 1
	for n > 0 {
		if n&1 == 1 {
			r = r * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return r
}

func ModInv(a int64) int64 {
	var b, u, v int64 = MOD, 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= MOD
	if u < 0 {
		u += MOD
	}
	return u
}

type Q struct {
	idx, value int
	index      int
}

type QS []*Q

func (p QS) Len() int           { return len(p) }
func (p QS) Less(i, j int) bool { return p[i].value > p[j].value }
func (pq QS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *QS) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Q)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *QS) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}
func main() {
	var N int
	fmt.Scanf("%d\n", &N)
	m := map[int]int{}
	for i := 0; i < N-1; i++ {
		var a int
		fmt.Scanf("%d", &a)
		m[a]++
	}
	for i := 1; i <= N; i++ {
		fmt.Println(m[i])
	}
}


Measured memory_bytes: 15016
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.util.stream.Stream;

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

        ArrayList<Integer> list = new ArrayList<Integer>();
        list.add(a);
        list.add(b);
        list.add(c);

        Collections.sort(list);

        for(int i=0; i<list.size(); i++){
            if(i != list.size() - 1) {
                System.out.print(list.get(i) + " ");
            } else {
                System.out.println(list.get(i));
            }
        }
    }
}



Measured memory_bytes: 26348
seq = gets.split(" ")

# Operator => Proc
# (this is for extensibility)
OPERATOR_TO_PROC = {
  '+' => ->n1,n2{n1 + n2},
  '-' => ->n1,n2{n1 - n2},
  '*' => ->n1,n2{n1 * n2}
}

# Available operators
OPERATORS = OPERATOR_TO_PROC.keys

# Initial stack
stack = []

seq.each{|elm|
  # elm is a number
  if elm.match(/^(\d+)$/)
    num = elm.to_i
    stack.push(num)
  # elm is an operator
  elsif OPERATORS.include?(elm)
    op = elm
    n2 = stack.pop
    n1 = stack.pop
    # Get result
    res = OPERATOR_TO_PROC[op].call(n1, n2)
    stack.push(res)
  end
}

# Get answer
answer = stack[0]
puts(answer)



Measured memory_bytes: 6876
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,n,m,minv=0,maxv=INT_MAX,l,r;
	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++)
	{
		scanf("%d %d",&l,&r);
		maxv=min(maxv,r);
		minv=max(minv,l);
	}
	printf("%d",max(maxv-minv+1,0));
	return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define REP(i,n) for(int i=0;i<n;i++)
#define pb push_back


// vectorの中身をcout << vs;で表示
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v)
{
    o << "{";
    for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i];
    o << "}";
    return o;
}

int main(void) {
	// cin, coutの結びつきを解除し、速くする
	cin.tie(0);
   	ios::sync_with_stdio(false);

	int a, b; cin >> a >> b;
	cout << (a - 1) * (b - 1) << endl;
}



Measured memory_bytes: 256