akhauriyash/Code-Regression huggingface dataset:
using System;

public class hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]); var wmax = int.Parse(line[1]);
        var vaL = new int[n + 1]; var w = new int[n + 1];
        var dp = new int[n + 1, wmax + 1];
        readData(vaL, w);
        for (int i = 0; i < n; i++)
            for (int j = 0; j <= wmax; j++)
                if (j < w[i]) dp[i + 1, j] = dp[i, j];
                else dp[i + 1, j] = Math.Max(dp[i, j], dp[i + 1, j - w[i]] + vaL[i]);
        Console.WriteLine(dp[n, wmax]);
    }
    public static void readData(int[] vaL, int[] w)
    {
        for (int i = 0; i < vaL.Length - 1; i++)
        {
            string[] line2 = Console.ReadLine().Trim().Split(' ');
            vaL[i] = int.Parse(line2[0]);
            w[i] = int.Parse(line2[1]);
        }
    }
}

Measured memory_bytes: 13108
# 文字列 A, B, C が与えられます。これがしりとりになっているか判定してください。つまり、
# A の最後の文字と B の最初の文字が同じ
# B の最後の文字と C の最初の文字が同じ
# この 2 つが正しいか判定してください。
# 両方とも正しいならば YES、そうでないならば NO を出力してください。

input = gets.chomp.split
a = input[0]
b = input[1]
c = input[2]

if a[a.length - 1] == b[0] && b[b.length - 1] == c[0]
    puts "YES"
else
    puts "NO"
end

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

int main(){
	
	int n, k;
	cin >> n >> k;
	
	int ans = n;
	//k進数へ変換
	int cnt =0;
	while(ans >= k){
		ans /= k;
		cnt ++;
	}
	
	cout << cnt+1 << endl;

}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define li long long int 
int main(){
    int a,b,c,k,sum=0;
    cin >> a >> b >> c >> k;
    if(k<=a)
        cout << k << endl;
    else if(k<=a+b)
        cout << a << endl;
    else 
        cout << a - (k-a-b) << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <stdio.h>

#define N 100000
#define Q 50000
#define S 1000000000
#define T 1000000000

int BSearch(int,int,int*);

int main(){
  int i,n[N],q[Q],non,noq,ans=0;

  scanf("%d",&non);
  for(i=0;i<non;i++){
    scanf("%d",&n[i]);
  }
  scanf("%d",&noq);
  for(i=0;i<noq;i++){
    scanf("%d",&q[i]);
  }

  for(i=0;i<noq;i++){
    ans += BSearch(q[i],non,n);
  }

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

int BSearch(int voq,int non,int* n){
  int i,l=0,m,r=non;
  while(l < r){
    m = (l+r)/2;
    if(voq == n[m]){
      return 1;
    }
    else if(voq<n[m]){
      r=m;
    }
    else if(voq>n[m]){
      l=m+1;
    }
  }
  return 0;
}


		  



Measured memory_bytes: 2324
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const double eps = 1e-8;

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

int main() {
    string s;
    cin >> s;
    int a = 0, b = 1;
    for (char c: s) {
        int d = c - '0';
        tie(a, b) = make_tuple(min(b+10-d, a+d), min(b+9-d, a+d+1));
    }
    cout << a << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0;i<n;i++) {
    cin >> vec.at(i);
  }
  sort (vec.begin(),vec.end());
  int x = 0;
  for (int i=0;i<n-1;i++) {
    if (vec.at(i) == vec.at(i+1)) {
      x++;
    }
    else {}
  }
  cout << vec.size()-x << endl;
}
    
  


Measured memory_bytes: 256
h,w = gets.split.map(&:to_i)
used = Array.new(h).map{Array.new(w,false)}
s = h.times.map{gets.chomp}
ans = 0
h.times do |i|
    w.times do |j|
        next if used[i][j]
        q = [[i,j]]
        used[i][j] = true
        a = b = 0
        if s[i][j] == "."
            a += 1
        else
            b += 1
        end
        while q.any?
            x,y = q.shift
            if x != 0 && s[x][y] != s[x-1][y] && !used[x-1][y]
                q.push([x-1,y])
                used[x-1][y] = true
                if s[x-1][y] == "."
                    a += 1
                else
                    b += 1
                end
            end
            if x != h-1 && s[x][y] != s[x+1][y] && !used[x+1][y]
                q.push([x+1,y])
                used[x+1][y] = true
                if s[x+1][y] == "."
                    a += 1
                else
                    b += 1
                end
            end
            if y != 0 && s[x][y] != s[x][y-1] && !used[x][y-1]
                q.push([x,y-1])
                used[x][y-1] = true
                if s[x][y-1] == "."
                    a += 1
                else
                    b += 1
                end
            end
            if y != w-1 && s[x][y] != s[x][y+1] && !used[x][y+1]
                q.push([x,y+1])
                used[x][y+1] = true
                if s[x][y+1] == "."
                    a += 1
                else
                    b += 1
                end
            end
        end
        ans += a*b
    end
end
puts ans

Measured memory_bytes: 3836
import java.util.Scanner;
public class Main {
	public static void main(String args[]) {
	Scanner sc=new Scanner(System.in);
	int A=sc.nextInt();
	int B=sc.nextInt();
	int C=sc.nextInt();
	int K=sc.nextInt();
	int max=0;
	if(K>=A) {
		max+=A;
		K-=A;
		if(K>=B) {
			K-=B;
			if(K>=C) {
				max-=C;
			}
			else{
				max-=K;
			}
		}
		else {
		}
	}
	else {
		max+=K;
	}
	System.out.println(max);
	}
	
}


Measured memory_bytes: 35912
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using P = pair<int, int>;

int main(){
    int n, h;
    cin >> n >> h;
    vector<P> sword(n);
    for(int i = 0; i < n; i++) cin >> sword[i].second >> sword[i].first;
    sort(sword.begin(), sword.end());

    int amax_i = 0;
    for(int i = 1; i < n; i++){
        if(sword[amax_i].second < sword[i].second) amax_i = i;
    }

    int sum = 0;
    int ans = 0;
    for(int i = n-1; i >= 0; i--){
        if(sum >= h) break;
        if(sword[i].first >= sword[amax_i].second){
            ans++;
            sum += sword[i].first;
        }
    }

    if(sum < h) ans += (h-sum+sword[amax_i].second-1)/sword[amax_i].second;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<60);

void failed(){
    cout<<"No"<<endl;
    exit(0);
}

void solve(vector<string> &s){
    vec pn(0), p(0), mn(0), m(0);
    rep(i,N){
        ll need = 0, plus = 0;
        for(char c : s[i]){
            plus += (c == '(' ? 1 : -1);
            need = max(need, -plus);
        }
        if(plus >= 0){
            pn.push_back(need);
            p.push_back(plus);
        }else{
            mn.push_back(need);
            m.push_back(plus);
        }
    }
    vec op(p.size()), om(m.size());
    int nump = p.size(), numm = m.size();
    rep(i,nump) op[i] = i;
    rep(i,numm) om[i] = i;
    sort(ALL(op), [&](int x, int y){return pn[x] < pn[y];});
    sort(ALL(om), [&](int x, int y){
        return mn[x] + m[x] > mn[y] + m[y];
    });
    ll adv = 0, id = 0;
    while(id != nump && pn[op[id]] <= adv){
        adv += p[op[id]];
        ++id;
    }
    if(id != nump) failed();
    id = 0;
    while(id != numm && mn[om[id]] <= adv){
        adv += m[om[id]];
        ++id;
    }
    if(id!=numm) failed();
    return;
}
int main() {
    cin>>N;
    vector<string> s(N);
    rep(i,N) cin>>s[i];
    ll num = 0;
    rep(i,N){
        for(char c : s[i]) num += (c == '(' ? 1 : -1);
    }
    if(num != 0)failed();
    solve(s);
    rep(i,N) {
        reverse(ALL(s[i]));
        int n = s[i].size();
        rep(j, n){
            s[i][j] = "()"[s[i][j] == '('];
        }
    }
    solve(s);
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 62316
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int mod = 1000000007;

vi pos, neg;
int n,k;

LL _pow(LL a, LL b) {
  if(!b) return 1;
  if(b == 1) return a;
  if(b == 2) return a * a % mod;
  if(b & 1) {
    return a * _pow(a,b-1) % mod;
  }
  return _pow(_pow(a,b/2),2);
}

LL solve() {
  LL ans = 1;
  if(k == n) {
    rep(i,0,pos.size()) ans = ans * pos[i] % mod;
    rep(i,0,neg.size()) ans = ans * -neg[i] % mod;
    if (ans < 0) ans += mod;
    return ans;
  }
  if (pos.size() == 0 && (k&1)) {
    rep(i,0,k) ans = ans * -neg[i] % mod;
    if (ans < 0) ans += mod;
    return ans;
  }

  int sign = 1;
  LL pp = -1,nn = -1;
  rep(i,0,k) {
    if(pos.size() && neg.size()) {
      if(pos.back() >  neg.back()) {
        ans = ans * pos.back() % mod;
        pp = pos.back();
        pos.pop_back();
      } else {
        ans = ans * neg.back() % mod;
        nn = neg.back();
        sign *= -1;
        neg.pop_back();
      }
    } else if(pos.size()) {
      ans = ans * pos.back() % mod;
      pp = pos.back();
      pos.pop_back();
    } else {
      ans = ans * neg.back() % mod;
      nn = neg.back();
      sign *= -1;
      neg.pop_back();
    }
  }
  if(sign == 1) {
    return ans;
  }
  if(pos.size() && neg.size()) {
    if(pp == -1 || (pos.back() * pp >= neg.back() * nn)) {
      ans = ans * _pow(nn, mod - 2) % mod;
      ans = ans * pos.back() % mod;
    } else {
      ans = ans * _pow(pp, mod - 2) % mod;
      ans = ans * neg.back() % mod;
    }
  } else if(pos.size()) {
    ans = ans * _pow(nn, mod - 2) % mod;
    ans = ans * pos.back() % mod;
  } else {
    ans = ans * _pow(pp, mod - 2) % mod;
    ans = ans * neg.back() % mod;
  }
  return ans;
}

int main() {
  S2(n,k);
  rep(i,0,n) {
    int x;
    S(x);
    if(x >= 0) pos.pb(x);
    else neg.pb(-x);
  }
  sort(all(pos));
  sort(all(neg));
  cout << solve() << "\n";
  return 0;
}


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

int main(){
  int N;
  string S,T;
  cin >> N >> S;
  T=S;
  sort(T.begin(),T.end());
  int count=0;
  for(int i=0;i<S.size();i++){
    if(S.at(i)!=T.at(i)){
      count++;
    }
  }
  cout << count/2 << endl;
} 

Measured memory_bytes: 3920
from collections import defaultdict,deque
class dfs:
    def __init__(self,n,a,b,c,d):
        self.N = n
        self.A = a
        self.B = b
        self.C = c
        self.D = d
        self.ans = self.N * self.D
        self.memory = defaultdict(int)
        self.Q = deque([[self.N,0]])
    def dfs(self):
        while self.Q:
            num,cost = self.Q.popleft()
            if self.memory[num] > cost :
                pass
            else:
                if num == 0:
                    self.ans = min(self.ans,cost)
                elif num == 1:
                    self.ans = min(self.ans,cost+self.D)
                else:
                    for step,a_cost in [[2,self.A],[3,self.B],[5,self.C]]:
                        if num % step != 0:
                            temp_num = (num//step)+1
                            temp_cost = cost + (((num//step)+1)*step - num) * self.D + a_cost
                            self.memo_check_append(temp_num,temp_cost)
                        temp_num = num//step
                        temp_cost = cost + (num - (num//step)*step) * self.D + a_cost
                        self.memo_check_append(temp_num,temp_cost)
                    self.ans = min(self.ans,cost + num * self.D)
        return self.ans
    def memo_check_append(self,n,c):
        if self.memory[n] > c or self.memory[n] == 0:
            self.Q.append([n,c])
            self.memory[n] = c

N = int(input())
for _ in range(N):
  N,A,B,C,D = map(int,input().split())
  T = dfs(N,A,B,C,D)
  print(T.dfs())


Measured memory_bytes: 143808
//code from https://www.luogu.com.cn/blog/flashblog/solution-at2046
#include<bits/stdc++.h>
#define R register int
#define G if(++ip==ie)if(fread(ip=buf,1,SZ,stdin))
using namespace std;
const int SZ=1<<19,N=1e5+9,M=2*N;
char buf[SZ],*ie=buf+SZ,*ip=ie-1;
inline int in(){
    G;while(*ip<'-')G;
    R x=*ip&15;G;
    while(*ip>'-'){x*=10;x+=*ip&15;G;}
    return x;
}
int he[N],ne[M],to[M],f[N],a[N],b[N];
int Getf(R x){
    return x==f[x]?x:f[x]=Getf(f[x]);
}
void Dfs(R x,R op){
    a[x]=op;
    for(R y,i=he[x];i;i=ne[i])
        if((y=to[i])!=f[x])
            f[y]=x,Dfs(y,-op),a[x]+=a[y];
}
int main(){
    R n=in(),m=in(),rt=1,re=1,p=0,ans=0;
    for(R i=1;i<=n;++i)f[i]=i;
    for(R p=0,i=1;i<=m;++i){
        R x=in(),y=in();
        if(Getf(x)!=Getf(y))f[f[x]]=f[y];
        else{rt=x,re=y;continue;}//把多的边单独拿出来
        ne[++p]=he[x];to[he[x]=p]=y;
        ne[++p]=he[y];to[he[y]=p]=x;
    }
    f[rt]=0;Dfs(rt,1);
    if(n==m){//基环树
        for(R x=re;x;x=f[x])b[++p]=a[x];
        if(p&1){//奇环
            if(a[rt]&1)return puts("-1"),0;
            for(R x=re;x;x=f[x])a[x]-=a[rt]>>1;
        }
        else{//偶环
            if(a[rt])return puts("-1"),0;
            sort(b+1,b+p+1);
            for(R x=re;x;x=f[x])a[x]-=b[p>>1];
        }
    }//树
    else if(a[rt])return puts("-1"),0;
    for(R i=1;i<=n;++i)ans+=abs(a[i]);
    return cout<<ans<<endl,0;
}

Measured memory_bytes: 14948
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;
/*
i) N=2M

*/
int main(){
    ll N;
    cin >> N;
    vector<Pll> v;
    //set<Pll> memo;
    if(N%2==0){
        REP(i,1,N+1){
            REP(j,i+1,N+1){
                if(i+j==N+1)continue;
                v.push_back(Pll(i,j));
            }
        }
    }else{
        REP(i,1,N){
            REP(j,i+1,N){
                if(i+j==N)continue;
                v.push_back(Pll(i,j));
            }
            v.push_back(Pll(i,N));
        }
    }
    cout << v.size() << endl;
    for(auto& p:v){
        cout << p.fi << " " << p.se << endl;
    }
}

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

int a[210];
int main(void) {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	int ans = 0;
	while(1) {
		bool odd = false;
		for (int i = 0; i < N; i++) {
			if (a[i] % 2 == 1) {
				odd = true;
			}
		}
		if (odd) break;
		ans++;
		for (int i = 0; i < N; i++) {
			a[i] /= 2;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <ctype.h>
#include <string>
#include <algorithm>
using namespace std;

int main(void){
  string input;
  string output;
  getline(cin, input);

  for (int i = 0; i < input.length() ; i++) {
    string convert;
    convert = input[i];
    if (isupper(input[i])) {
      transform(convert.begin(), convert.end(), convert.begin(), ::tolower);
    } else if (islower(input[i])) {
      transform(convert.begin(), convert.end(), convert.begin(), ::toupper);
    }
    output += convert;
  }
  cout << output << endl;
  return 0;
}

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

using llong = long long;
const int nARRYSIZ = 3000017;

llong fnStrToLL(string sKey)
{
  int nBase = 1;
  llong nKey = 0;
  for (int i = sKey.size() - 1; i >= 0; i--)
  {
    int nElm;
    switch (sKey[i])
    {
      case  'A': nElm = 1;
                 break;
      case  'C': nElm = 2;
                 break;
      case  'G': nElm = 3;
                 break;
      case  'T': nElm = 4;
                 break;
      default:   nElm = 0;
    }
    nKey += nBase * nElm;
    nBase *= 5;
  }
  return nKey;
}

int fnHash1st(llong nKey) { return (nKey % nARRYSIZ); }
int fnHash2nd(llong nKey) { return (1 + (nKey % (nARRYSIZ - 1))); }

void fnDic(vector<string>& rvsDic)
{
  int nCmdCnt;
  cin >> nCmdCnt;

  for (int i = 0; i < nCmdCnt; i++)
  {
    string sCmd, sKey;
    cin >> sCmd >> sKey;
    llong nKey = fnStrToLL(sKey);

    for (int nCnt = 0; ;nCnt++)
    {
      int ix = (fnHash1st(nKey) + nCnt * fnHash2nd(nKey)) % nARRYSIZ;
      if (rvsDic[ix] == sKey)
      {
        if (sCmd[0] == 'i')
          continue;
        else if (sCmd[0] == 'f')
        {
          cout << "yes" << endl;
          break;
        }
      }
      else if (rvsDic[ix].size() == 0)
      {
        if (sCmd[0] == 'i')
        {
          rvsDic[ix] = sKey;
          break;
        }
        else if (sCmd[0] == 'f')
        {
          cout << "no" << endl;
          break;
        }
      }
    }
  }
}

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

  vector<string> vsDic(nARRYSIZ);
  fnDic(vsDic);
  
  return 0;
}



Measured memory_bytes: 53076
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n,a,b,c;
  cin>>n>>a>>b>>c;
  cout<<n+c-(a+b)<<endl;
  return 0;
}



Measured memory_bytes: 3084
using System;
class c
{
  static void Main()
  {
    string[] s=Console.ReadLine().Split(' ');
    int ans=0;
    if(s[1]=="+")ans=(int.Parse(s[0])+int.Parse(s[2]));
    else ans=(int.Parse(s[0])-int.Parse(s[2]));
    Console.WriteLine(ans);
  }
}


Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <algorithm>
#include<functional>
using namespace std;
void number(int *P,int *Q,int num,int *x,int *y){
  int array[] = {1,2,3,4,5,6,7,8};
  int s = 0;
  do{
    for(int i = 0;i<num;i++){
      if(P[i] != array[i]) break;
      if(i == num-1){
        *x = s;
      }
    }
    for(int i = 0;i<num;i++){
      if(Q[i] != array[i]) break;
      if(i == num-1){
        *y = s;
      }
    }
    s++;
  }while(next_permutation(array,array+num));
  return;
}
int main(){
  int tem,A,B,N;
  int P[8], Q[8];
  cin >> N;
  for(int i = 0;i<N;i++) cin >> P[i];
  for(int i = 0;i<N;i++) cin >> Q[i];
  number(P,Q,N,&A,&B);
  if(A < B){
    tem = A;
    A = B;
    B = tem;
  }
  cout << A-B << endl;
}

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

int n;
vector<P> ps;

int gcd(int a, int b) {
    while (b > 0) {
        int t = a % b;
        a = b;
        b = t;
    }
    return a;
}

int cnt(const map<P, int>& mp) {
    int ret = 0;
    for (auto& i : mp)
        ret += i.second * (i.second - 1) / 2;

    return ret;
}

P getpair(int i, int j) {
    int dx = ps[j].first - ps[i].first;
    int dy = ps[j].second - ps[i].second;
    int g = gcd(abs(dx), abs(dy));
    dx /= g;
    dy /= g;
    if (dx > 0 || dx == 0 && dy >= 0)
        return P(dx, dy);
    else
        return P(-dx, -dy);
}

int dfs(int s, map<P, int>& mp) {
    if (s == 0) return cnt(mp);
    int fir = -1;
    for (int i = 0; i < n; ++i) {
        if ((s >> i) & 1) {
            fir = i;
            s ^= 1 << i;
            break;
        }
    }
    int ma = 0;
    for (int i = 0; i < n; ++i) {
        if ((s >> i) & 1) {
            P p = getpair(i, fir);
            ++mp[p];
            ma = max(ma, dfs(s ^ (1 << i), mp));
            --mp[p];
        }
    }
    return ma;
}

int main() {
    cin >> n;
    ps = vector<P>(n);
    for (int i = 0; i < n; ++i) {
        cin >> ps[i].first >> ps[i].second;
    }
    map<P, int> mp;
    cout << dfs((1 << n) - 1, mp) << "\n";
    return 0;
}



Measured memory_bytes: 3120
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
     Scanner scanner = new Scanner(System.in);
     int n = scanner.nextInt();
     int a[] = new int[n];
     for(int i=0;i<n;i++){
         a[i]= scanner.nextInt();
     }    
     for(int j=n-1;j>=0;j--){
         System.out.print(a[j]);
         if(j==0)break;
         System.out.print(" ");
     }
     System.out.println();
    }      
}

Measured memory_bytes: 26376
// B.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>

using namespace std;
int main()
{
    int n;

    cin >> n;
    int sum = 0;
    for (int i = 1; i <= n; i++) {
        if (i % 2 == 0)continue;
        int kosuu = 0;
        for (int j = 1; j <= i; j++) {
            if (i % j == 0)kosuu++;
        }
        if (kosuu == 8)sum++;
    }
    cout << sum << endl;

    return 0;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 3616
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
map<int, vector<int>> mc;
int a[N];
int check(vector<int>& v1, vector<int>& v2)
{
	int ptr = 0;
	int ans = 0;
	for (auto& x : v1)
	{
		while (ptr < v2.size() && v2[ptr] < x) ptr++;
		if (ptr < v2.size()) ans++;
	}
	return ans;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, t;
	scanf("%d%*d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i]);
		mc[a[i]].push_back(i);
	}
	int maxv = 0;
	int ans = 0;
	for (int i = n; i >= 1; i--)
	{
		maxv = max(maxv, a[i]);
		ans = max(ans, maxv - a[i]);
	}
	if (ans == 0)
	{
		puts("0"), exit(0);
	}
	int res = 0;
	for (auto& p : mc)
	{
		int x = p.first;
		vector<int>& v = p.second;
		if (mc.count(x + ans))
		{
			res += check(v, mc[x + ans]);
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 11520
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"YES"<<endl
#define cno cout<<"NO"<<endl
#define sp <<" "<<
#define cst(x) cout<<fixed<<setprecision(x)
#define pi 3.14159265359
#define mod 1000000007
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using Graphi = vector<vi>;
using que_a = priority_queue<int, vector<int>, greater<int> >;
using que_d = priority_queue<int>;
using pint = pair<int,int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
struct edge {
    int to; 
    int weight;
    edge(int t, int w) : to(t),weight(w) {}
};

vector<ll> a;
int n;
ll k;
ll INF = ll(1e18)+1;

ll binary_search(ll key, ll number) {
    ll left = -1;
    ll right = (int)a.size(); 
    ll ans;
    if(a.at(key) < 0){
        while (right - left > 1) {
            ll mid = (right + left) / 2;
            if (a.at(key)*a.at(mid) < number) right = mid;
            else left = mid;
        }
        ans =  n - right;
    }
    else{
        while (right - left > 1) {
            ll mid = (right + left) / 2;
            if (a.at(key)*a.at(mid) < number) left = mid;
            else right = mid;
        }
        ans =  right;
    }
    if(a.at(key)*a.at(key) < number) ans--;
    return ans;
}
ll binary_search_final() {
    ll left = -INF;//満たす
    ll right = INF;//満たさない
    while (right - left > 1) {
        ll mid = left + (right - left) / 2;
        ll cnt = 0;
        rep(i,n){
            cnt += binary_search(i,mid);
        }
        cnt /= 2;
        if (cnt < k) left = mid;
        else right = mid;
    }
    return left;
}

int main(){

    cin >> n >> k;
    a.resize(n);
    rep(i,n){
        cin >> a.at(i);
    }
    sort(all(a));

    cout << binary_search_final() << endl;

    return 0;

}

Measured memory_bytes: 1792
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    String s = sc.next();

    int count = 0;
    for (int i = 0; i < s.length(); i++) {
      if (s.charAt(i) == 'o')
        count++;
    }

    if ((15 - s.length ()) + count >= 8) {
      os.println("YES");
    } else {
      os.println("NO");
    }
  }
}

Measured memory_bytes: 21332
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>
 
// #include <unordered_set>
// #include <unordered_map>
 
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
 
#define pb push_back
#define mp make_pair
 
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
 
typedef std::pair<int, int> P;
typedef long long ll;
typedef long double ld;
 
const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = INF * 1ll * INF;
const ld DINF = 1e200;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
using namespace std;
 
// #define int long long


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cin高速化



    string s,t;

    cin>>s>>t;

    if(s[0]==t[2]&&t[1]==s[1]&&s[2]==t[0]){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }




    return 0;
 
}

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

def f(n):
  if n % 2 == 0:
    return n/2
  else:
    return 3*n + 1

s = I()
a = {s}


for i in range(2,1000001):
  ai = f(s)
  if ai in a:
    print(i)
    exit()
  s = ai
  a.add(ai)


Measured memory_bytes: 12272
import math

N = int(input())

def f(a,b):
    if len(str(a)) < len(str(b)):
        return len(str(b))
    else:
        return len(str(a))

ans = 100000000000
for i in range(1,int(math.sqrt(N)+1)):
    if N % i == 0:
        ans = min(ans,f(i,N//i))
print(ans)
        

Measured memory_bytes: 9084
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;

int main()
{
	int m, f, b;

	cin >> m >> f >> b;

	if (b > m + f)
	{
		cout << "NA" << endl;
	}
	else
	{
		if (m - b > 0)
		{
			cout << "0" << endl;
		}
		else
		{
			cout << b - m << endl;
		}
	}
}


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

int main()
{
    int k,x;
    cin>>k>>x;
    if(k==1)
        cout<<x<<endl;
    else
    {
        for(int i=(x-k)+1;i<(x+k);i++)
        {
           if(i==(x+k)-1)
            cout<<i<<endl;
           else
            cout<<i<<" ";
        }
    }
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using pq = priority_queue<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -MOD * MOD;
const long double pi = 3.141592653589793;
int main() { // 問題文はしっかり読め!!!
	string s, t;
	cin >> s >> t;
	t.erase(t.size()-1);
	if (s == t) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
int main(void)
{
	int a,b,i,sum;
	
	while(scanf("%d %d",&a,&b)!=EOF) {
		sum=a+b;

		i=0;
		while(sum>0)	{
			sum=sum/10;
			i++;
		}
		printf("%d\n",i);
	}
	return 0;
}

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

int main() {
	string s,t;
	cin>>s>>t;
	vector<vector<pair<int,char>>> dp(s.size()+1,vector<pair<int,char>>(t.size()+1));
	for(int i=0;i<t.size()+1;i++)
	dp[0][i]=make_pair(0,'0');
	for(int i=0;i<s.size()+1;i++)
	dp[i][0]=make_pair(0,'0');
	for(int i=1;i<=s.size();i++){
		for(int j=1;j<=t.size();j++){
			if(s[i-1]==t[j-1]){
				dp[i][j].first=dp[i-1][j-1].first+1;
				dp[i][j].second='p';
			}
			else if(dp[i-1][j].first>=dp[i][j-1].first){
				dp[i][j].first=dp[i-1][j].first;
				dp[i][j].second='t';
			}
			else{
				dp[i][j].first=dp[i][j-1].first;
				dp[i][j].second='l';
			}
		}
	}
	string z;
	int i=s.size();
	int j=t.size();
	while(j!=0&&i!=0){
		if(dp[i][j].second=='p'){
			z+=s[i-1];
			i--;
			j--;
		}
		else if(dp[i][j].second=='t'){
			i--;
		}
		else if(dp[i][j].second=='l'){
			j--;
		}
	}
	for(int i=z.size()-1;i>=0;i--){
		cout<<z[i];
	}
	return 0;
}

Measured memory_bytes: 70784
package main
import(
  "fmt"
)
func main(){
  var n, i int
  var x string
  flag:=0
  count:=0
  fmt.Scan(&n)
  s:=make([]string, n)
  t:=make([]int, n)
  for i=0;i<n;i++{
    fmt.Scan(&s[i], &t[i])
  }
  fmt.Scan(&x)
  for i=0;i<n;i++{
    if s[i]==x{
      flag++
    }else if flag!=0{
      count+=t[i]
    }
  }
  fmt.Println(count)
}


Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;

int main() {
  int N, K;
  cin >> N >> K;
  int ans = 1;
  rep(i, N) ans = min(ans*2, ans+K);
  cout << ans << endl;
}

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

using namespace std;

int main() {
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end()); 
    sort(t.begin(), t.end(), greater<int>()); 
    if (s < t) cout << "Yes" << endl;
    else cout << "No" << endl;
        
}

Measured memory_bytes: 256
while True:
    try:
        Map = []
        Base = []
        End = []
        for i in range(8):
            Map.append(list(map(str,input())))
        for i in range(8):
            if Base == []:
                
                for j in range(8):
                    if Map[i][j] == '1':
                        Base = [j,i]
                        break
            else:
                break
        for i in range(7,-1,-1):
            if End == []:
                for j in range(7,-1,-1):
                    if Map[i][j] == '1':
                        End = [j,i]
                        break
            else:
                break
        Yoko = End[0] - Base[0]
        Tate = End[1] - Base[1]
        if Tate == 1 and Yoko == 1:
            print("A")
        elif Yoko == 0 and Tate == 3:
            print("B")
        elif Tate == 0 and Yoko == 3:
            print("C")
        elif Yoko == -1 and Tate == 2:
            print("D")
        elif Yoko == 2 and Tate == 1:
            print("E")
        elif Yoko == 1 and Tate == 2:
            print("F")
        elif Tate == 1 and Yoko == 0:
            print("G")
        kara = input()
            
    except EOFError:
        break

Measured memory_bytes: 7372
// ! スタック

// C言語はシングルクォーテーションではchar（文字列リテラル）
// ダブルクォーテーションでは囲まれた文字列が格納されたアドレスを表す

// ==========
// 入力例
// ==========
// 1 2 + 3 4 - *

// ==========
// 出力例
// ==========
// -3
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int top = 0;
int S[1000];

void push(int x) { S[++top] = x; }

int pop() { return S[top--]; }

int main() {
  char s[100];
  int a, b;

  while (scanf("%s", s) != EOF) {
    if (s[0] == '+') {
      a = pop();
      b = pop();
      push(a + b);
    } else if (s[0] == '-') {
      b = pop();  // b, a が反対なのは 20 - 5 が 5 - 20 =
                  // -15のように反転してしまうから
      a = pop();
      push(a - b);
    } else if (s[0] == '*') {
      a = pop();
      b = pop();
      push(a * b);
    } else {
      push(atoi(s));
    }
  }
  printf("%d\n", pop());

  return 0;
}


Measured memory_bytes: 2764
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))

n = onem()

a = input()

if n >= 3200:
    print(a)
else:
    print("red")

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define pll pair<ll, ll>
#define vint vector<int >
#define vll vector<ll >
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int x;
    cin >> x;
    if(x >= 30){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
    return 0;
}

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

char str[30005];
int nxt[30005][10];

int main()
{
	int n;
	scanf("%d",&n);
	scanf("%s",&str);
	for(int i=0;i<10;i++) nxt[n][i]=n;
	for(int i=n-1;i>=0;i--)
	{
		for(int j=0;j<10;j++) nxt[i][j]=nxt[i+1][j];
		int a=str[i]-'0';
		nxt[i][a]=i;
	}   //写一个序列自动机 
	int ret=0;
	for(int i=0;i<10;i++)
	{
		for(int j=0;j<10;j++)
		{
			for(int k=0;k<10;k++)
			{
				int now=nxt[0][i];
				now++;
				now=nxt[min(now,n)][j];
				now++;
				now=nxt[min(now,n)][k];
				if(now<n) ret++;
			}
		}
	}
	printf("%d\n",ret);
	return 0;
}

Measured memory_bytes: 1408
#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=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
 
int main(){
  //input
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  string s , t ;
  cin  >> s >> t ;
  int sum=0;
  rep(i,3)
    if(s[i]==t[i]) sum++;
  cout<<sum<<endl;
}
  



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;

int N, K;
int X[100010];
int Y[100010];
char C[100010];

int mas[1000][2000];
int syaku[2000];

signed main()
{
	cin >> N >> K;
	REP(i, N) cin >> X[i] >> Y[i] >> C[i];

	REP(i, N)
	{
		int x = X[i];
		int y = Y[i];
		x %= (K * 2);
		y %= (K * 2);
		if (x >= K)
		{
			x -= K;
			if (y >= K)
			{
				y -= K;
			}
			else
			{
				y += K;
			}
		}
		if (C[i] == 'W')
		{
			if (y >= K)
			{
				y -= K;
			}
			else
			{
				y += K;
			}
		}
		mas[x][y]++;
	}

	for (int y = 0; y < K * 2; y++)
	{
		int cnt = 0;
		for (int i = 0; i < K; i++)
		{
			int p = i;
			int q = y;
			cnt += mas[p][q];
		}
		syaku[y] = cnt;
	}

	int max = 0;
	for (int x = 0; x < K; x++)
	{
		int ans = 0;
		for (int i = 0; i < K; i++)
		{
			ans += syaku[i];
		}
		max = MAX(max, ans);

		for (int i = 1; i < K * 2; i++)
		{
			ans -= syaku[i - 1];
			int k = ((i - 1) + K) % (K * 2);
			ans += syaku[k];
			max = MAX(ans, max);
		}

		for (int y = 0; y < K * 2; y++)
		{
			int cnt = 0;
			syaku[y] -= mas[x][y];

			int yy = (y + K) % (K * 2);

			syaku[y] += mas[x][yy];
		}
	}

	cout << max << endl;
}





Measured memory_bytes: 17536
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
H = list(map(int,input().split()))

ans = 0
x = [H]

while len(x) > 0:
    A = x.pop()
    minA = min(A)
    k = A.index(minA)
    for i in range(len(A)):
        A[i] -= minA
    ans += minA
    if A[0:k] != []:
        x.append(A[0:k])
    if A[k+1:] != []:
        x.append(A[k+1:])

print(ans)

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;

ll memo[100];
ll lucas(int n)
{
    if(memo[n]) return memo[n];
    return memo[n] = lucas(n-1) + lucas(n-2);
}

int N;

void solve()
{
    cin >> N;
    memo[0] = 2;
    memo[1] = 1;
    cout << lucas(N) << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<algorithm>
#define NAX 100000
using namespace std;
int n,c[NAX],T[NAX+1];
int greedy(int);
void douteki(int);

int main(){
  int i,g,j,k,flag=0;
  
  k=1;
  while(1){
    flag=0;
    cin >> n;
    if(n == 0 )break;
    
    
    for(i=0;i<n;i++){
      cin >> c[i];
      if(i == 0 && c[i] != 1)flag=1; 
    }
    
    /**/
    if(n == 1 && c[i-1] == 1){
      cout << "Case #" << k << ": OK" << endl;
      k++;
      continue;
    }
    /*Èº©n=1, c=PÌCannot use greedy algorithmÆÈÁÄµÜÁÄ¢½ÌÅãÌæ¤ÉÂ¯½µ½çÊÁ½*/
    
    
    if(flag == 1){ /*ªÈ¢n_Åfâ1~ð¥¦È¢ÌÅ Cannot pay some amount*/
      cout << "Case #" << k << ": Cannot pay some amount" << endl;
      k++;
      continue;
    }
    else{
      
      //     for(j=1;j<=100;j++){    
      //    douteki(n);                                                             
      ///   cout << "greedy(" << j << ") =" << greedy(j) << endl;                       
      //   cout << "douteki("<< j << ")="<< T[j] << endl;
      //   }
   
      
      douteki(n); 
      for(j=1;j<=100000;j++){
	  if(greedy(j) > T[j]){
	    flag=3;
	    break;
	  }
      } 
      
      
    }                                                                      
    if(flag == 0){
      cout << "Case #" << k << ": OK" << endl;
      k++;
    }else{
      cout << "Case #" << k << ": Cannot use greedy algorithm" << endl;
      k++;
    }
    
    
  }
  
  
}




int greedy(int a){ /*æÃ~@*/
    int ans=0;
  for(int i = n-1;i>=0;i-- ){
    if(a >= c[i]){
      ans += a/c[i];
      a = a%c[i];
    }
  }
  return ans;
  
}


void douteki(int re){/*®Ivæ@ðp¢½RCÌÅ¬ðßévO*/
  for(int j = 0; j <= NAX ; j++)T[j]=10000;
  T[0] = 0;
  for(int i = 0; i < re ; i++){
    for(int j=c[i];j<=NAX;j++){
      T[j]= min(T[j],T[j-c[i]]+1);
    }
  }
  
}

Measured memory_bytes: 1260
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, B, K;
    cin >> A >> B >> K;
    ll tmp = 0;
    ll ans = 0;
    PER(i, 100, 0) {
        if (A % i == 0 && B % i == 0) {
            tmp++;
            if (tmp == K) {
                ans = i;
                break;
            }
        }
    }
    cout << ans << endl;
}


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

int a[10000];
int main()
{
    int n,k;
    cin >> n >> k;
    for(int i=0;i<n;i++){
        cin >> a[i]; 
    }
    sort(a,a+n);
    long long ans =0;
    for(int i=0;i<k;i++){
        ans += a[i];
    }
    cout << ans ;
}

Measured memory_bytes: 3560
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long int
#define double /*long*/ double
#define endl '\n'
#define vll vector<ll>
#define vvl vector<vll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vppll vector<pll,pll>
#define mp make_pair
#define pb push_back
#define mapll map<ll,ll>
#define fir first
#define sec second
#define _cin ios_base::sync_with_stdio(0);  cin.tie(0);
#define fo(i,b) for(i=0;i<b;i++)
#define repa(i,a,b) for(i=a;i<b;i++)
#define repb(i,a,b) for(i=a;i>=b;i--)
#define all(x) (x).begin(), (x).end()
#define s(v) (ll)v.size()
#define watch(x) cerr << (#x) << " is " << (x) << endl
#define Time cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n"
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
const long long int MAX = (ll)(1e18+1);
const long long int MIN = (ll)(-1e18-1);
const long long int mod = (ll)(1e9+7);
using namespace std;  // order_of_key(k) -> Number of elements strictly smaller than k
using namespace __gnu_pbds; // order_of_key() ; *( find_by_order() ) -> kth element in set;

ll max(ll a,ll b,ll c) {return max(max(a, b), c);}
ll min( ll a, ll b, ll c) { return min(min(a, b), c);}
ll max(ll a,ll b) {return (a>b) ? a : b;}
ll min(ll a,ll b) {return (a<b) ? a : b;}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power_mod(ll a, ll n, ll mod_){ ll p=1; while(n){ if(n%2){ p=(p*a)%mod_;} n/=2; a=(a*a)%mod_;} return p%mod_;}                 
                          /*Code Begins*/




int main(){
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
    _cin;
    cout << setprecision(15);
    ll mn = MAX, mx = MIN;
    ll n, m, t,  k, i, j,  sum=0,  prev, flag=0, cnt=0;
    ll x=0, y=0, fx, diff, tot=0, l , r;
    int TC=1;
    // cin >> TC;
while(TC--){
    cin >> n;
    double x = 2.0*acos(-1)*n;
    cout << x ;


}

    Time;
    return 0;
}


Measured memory_bytes: 3820
#include <bits/stdc++.h>
using namespace std;
#include <algorithm>
 
int main() {
 
  int long long a,b,t=0,i,j;
  int long long ans=0;
  
  cin >> a >> b;

  if (a<b)
  {
    for ( i = 0; i < b; i++)
    {
      cout << a ;
    }
    cout<<endl;
  }else
  {
    for ( i = 0; i < a; i++)
    {
      cout << b ;
    }
    cout<<endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+7;
vector<int> g[maxn];
int co[maxn];
int ans[maxn];
int use[maxn]; 
vector<int> r;
vector<int> b;
void dfs(int now,int x){
	co[now]=x;
	for(int i=0;i<g[now].size();i++){
		int u=g[now][i];
		if(co[u]==0)  dfs(u,x*-1);
	}
}

int main(){
	int n;
	cin>>n;
	int t=n-1;
	while(t--){
		int a,b;
		cin>>a>>b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	dfs(1,1);
	for(int i=1;i<=n;i++){
		if(co[i]==1) r.push_back(i);
		if(co[i]==-1) b.push_back(i);
	}
	if(r.size()>b.size())	swap(r,b);
	if(r.size()>n/3){
		int i=0;
		for(int k=0;3*k+1<=n;k++){
			ans[r[i++]]=3*k+1;
			use[3*k+1]=1;
		}
		i=0;
		for(int k=0;3*k+2<=n;k++){
			ans[b[i++]]=3*k+2;
			use[3*k+2]=1;
		}
		int k=1;
		for(int i=1;i<=n;i++){
			if(ans[i]==0){
				ans[i]=3*k;k++;
			}
		}
	}
	else{
		int k=1;
		for(int i=0;i<r.size();i++){
			ans[r[i]]=3*k;
			use[3*k]=1;
			k++;
		}
		k=1;
		for(int i=1;i<=n;i++){
			if(ans[i]==0){
				while(use[k]==1){
					k++;
				}
				ans[i]=k;
				use[k]=1;
			}
		}
	}
	for(int i=1;i<=n;i++) cout<<ans[i]<<" ";
	return 0;
}















Measured memory_bytes: 20596