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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

void solve() {
  string s; int k; cin >> s >> k;
  set<string> ss;
  vector<string> vs; 
  for (int i = 0; i < (int)s.size(); ++i) {
    vs.emplace_back();
    for (string &e: vs) {
      if (e.size() > k) continue;
      e += s[i];
      ss.insert(e);
    }
  }
  for (const string &s: ss) {
    if (--k) continue;
    cout << s;
    break;
  }
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}




Measured memory_bytes: 5156
#include <bits/stdc++.h>
#define R register
#define ll long long
#define mp make_pair
#define pii pair<int, int>
using namespace std;
const int N = 110000;

int n, m, num[N];
string s;

template <class T>
inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch)) w = ch == '-', ch = getchar();
    while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}

int main() {
    int x, ans = 0, tot = 0;
    read(n), read(m);
    while (m--) {
        read(x), cin >> s;
        if (s == "AC") {
            if (num[x] >= 0) ans += num[x], ++tot;
            num[x] = -N;
        }
        else
            ++num[x];
    }
    cout << tot << ' ' << ans << endl;
    return 0;
}

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

const long long int INF = 1e17;
long long int N, M, L, Q;
long long int fuel[305][305];
long long int dist[305][305];
long long int s[105000], t[105000];
long long int A[100000], B[100000], C[100000];

void input() {
    cin >> N >> M >> L;
    for(int i = 1; i <= M; i++) cin >> A[i] >> B[i] >> C[i];
    cin >> Q;
    for(int i = 1; i <= Q; i++) cin >> s[i] >> t[i];
}

void solve() {
    input();
    for(int i = 1; i <= N; i++) {
        for(int j = 1; j <= N; j++) {
            fuel[i][j] = INF;
            dist[i][j] = INF;
        }
        fuel[i][i] = 0;
        dist[i][i] = 0;
    }
    for(int i = 1; i <= M; i++) {
        fuel[A[i]][B[i]] = fuel[B[i]][A[i]] = C[i];
    }
    for(int i = 1; i <= N; i++) {
        for(int j = 1; j <= N; j++) {
            for(int k = 1; k <= N; k++) {
                if (fuel[j][i] + fuel[i][k] < fuel[j][k]) {
                    fuel[j][k] = fuel[j][i] + fuel[i][k];
                }
            }
        }
    }
    for(int i = 1; i <= N; i++) {
        for(int j = 1; j <= N; j++) {
            if(i == j) continue;
            if(fuel[i][j] <= L) {
                dist[i][j] = 1;
            }
        }
    }
    for(int i = 1; i <= N; i++) {
        for(int j = 1; j <= N; j++) {
            for(int k = 1; k <= N; k++) {
                if (dist[j][i] + dist[i][k] < dist[j][k]) {
                    dist[j][k] = dist[j][i] + dist[i][k];
                }
            }
        }
    }
    for(int i = 1; i <= Q; i++) {
        if(dist[t[i]][s[i]] < INF) cout << dist[t[i]][s[i]] - 1 << "\n";
        else cout << -1 << "\n";
    }
    return;
}

int main() {
    solve();
    return 0;
}

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

int main(){
 int N,M,p = 0;
 cin >> N >> M >> p;

 int d[M+1];
 d[0] = p;

 for(int i=1; i<=M; i++){
  cin >> d[i];
 }

 sort(d, d+M+1);

 int money = N-1;
 for(int i=0; i<M+1; i++){
  int q = d[i];
  int r1 = d[(i-1+M+1)%(M+1)];
  int r2 = d[(i+1)%(M+1)];
  int c1 = ((p-q+N)%N)*2+(r1-p+N)%N;
  int c2 = ((q-p+N)%N)*2+(p-r2+N)%N;
  money = min(money, min(c1,c2));
 }
 cout << money*100 << endl;
 return 0;
}
           

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

int64_t n;
int64_t c[200000];
vector<int> edges[200000];
int64_t cnt[200000], offset;
int64_t block[200000];

void dfs(int v, int p=-1){
    int memo = cnt[c[v]] + offset;
    ++offset;
    for(auto to: edges[v]){
        if(to == p) continue;
        cnt[c[v]] = -offset;
        dfs(to, v);
        int64_t b = cnt[c[v]]+offset;
        block[c[v]] += b * (b + 1) / 2;
    }
    cnt[c[v]] = memo - offset;
}

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

    cin >> n;
    for(int i=0;i<n;++i){ cin >> c[i]; --c[i]; }
    for(int i=1;i<n;++i){
        int a, b;
        cin >> a >> b;
        edges[a-1].push_back(b-1);
        edges[b-1].push_back(a-1);
    }
    dfs(0);
    for(int i=0;i<n;++i){
        int64_t b = cnt[i] + offset;
        block[i] += b * (b+1) / 2;
    }

    for(int i=0;i<n;++i){
        cout << n * (n+1) / 2 - block[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 34800
def sol(inp=input):
    n=int(inp())
    ws=list(map(int,inp().split()))
    s1=0
    s2=sum(ws)
    res=s2
    for w in ws:
        s1+=w
        s2-=w
        res=min(res,abs(s1-s2))
    return str(res)
print(sol())

Measured memory_bytes: 38384
def judge(word):
    l = len(word)
    for i in range(l//2):
        if word[i] != word[l-1-i]:
            return 0
            break
    else:
        return 1
        
word = input()
n = len(word)
j1 = judge(word)
j2 = judge(word[:(n-1)//2])
j3 = judge(word[(n+3)//2 - 1:])

if j1 == j2 == j3 == 1:
    print('Yes')
else:
    print('No')

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

int selectionsort(int A[],int N){
    int minj,sw=0;
    for (int i=0;i<N-1;i++){
        minj = i;
        for (int j=i;j<N;j++){
            if (A[minj]>A[j]) minj = j;
        }
        swap(A[i],A[minj]);
        if (i!=minj) sw++;
    }
    return sw;
}

int main(){
    int N,A[101],sw=0;
    
    cin >> N;
    for (int i=0;i<N;i++) cin >> A[i];

    sw = selectionsort(A,N);

    for (int i=0;i<N;i++){
        if (i>0) cout << " ";
        cout << A[i];
    }
    cout << endl << sw << endl;

    return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>

using namespace std;

using P = pair<int, int>;
using i64 = int64_t;
i64 mod = 1000000007;

int max_n = 1e5;

void bfs(std::vector<std::vector<int>>& g, std::vector<bool>& v, int x, std::vector<i64>& cnt, int dep) {
    if (v[x] == true) return;
    v[x] = true;
    if (x > max_n) ++cnt[1];
    else ++cnt[0];

    for (int i : g[x]) {
        //cout << i << endl;
        bfs(g, v, i, cnt, dep + 1);
    }
}

int main(int argc, char **argv) {
    int n;
    cin >> n;
    std::vector<std::vector<int>> g(max_n*2 + 10, std::vector<int>());
    std::vector<bool> visit(max_n*2 + 10, false);

    for (int i=0; i<n; ++i) {
        int x, y;
        cin >> x >> y;
        g[x].push_back(y + max_n);
        g[y + max_n].push_back(x);
    }
    i64 ans{0};
    for (int i = 0; i < max_n*2+1; ++i) {
        std::vector<i64> cnt(2, 0);
        bfs(g, visit, i, cnt, 0);

        ans += (cnt[0] * cnt[1]);
    }

    cout << (ans - n) << endl;

    return 0;
}


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

int main() {
    int n, k;
    cin >> n >> k;
    int M;
    cin >> M;
    int g = M;
    for (int i=1; i<n; i++) {
        int num; cin >> num;
        M = max(M, num);
        g = __gcd(g, num);
    }
    if (k % g == 0 && k <= M) {
        cout << "POSSIBLE" << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
}

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

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i, k , n) for(int i = k; i <= n; i++)
typedef long long ll;

const char nl = '\n' ;
const ll MOD = 1e9 + 7;


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

   int n, m; cin >> n >> m;
   int ans = 1e9;
   rep(i, n)
   {
      int a; cin >> a;
      ans = min(a, ans);
      m-= a;
   }
   cout << n + m/ans << nl;

   return 0;
}


Measured memory_bytes: 3636
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	mp := map[rune]int{}
	for _, v := range s {
		mp[v]++
	}
	for _, v := range mp {
		if v != 2 {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 512
#include<atcoder/all>
#include<bits/stdc++.h>

using namespace std;
using namespace atcoder;

int main(){
    
    int N,M;
    cin >> N >> M;
    
    dsu ds(N);
    
    for (int i = 0; i < M; i++) {
        int A,B;
        cin >> A >> B;
        ds.merge(A-1,B-1);
    }
    
    vector<vector<int>> uf = ds.groups();
    
    int ans = uf.size();
    ans = ans - 1;
    
    cout << ans << endl;
    
}

Measured memory_bytes: 9100
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n,x,y,b,p,result;
  cin >> n;
  for(int i = 0; i < n;i++){
    cin >> x >> y >> b >> p;
    cout << min(x*b+y*p, (x*max(b,5)+y*max(p,2))*4/5) << endl;
  }

  return 0;
}

Measured memory_bytes: 1164
x1, y1, x2, y2 = map(int, input().split())
x = abs(x2 - x1)
y = abs(y2 - y1)
for _ in range(y):
    print("U", end="")
for _ in range(x):
    print("R", end="")
for _ in range(y):
    print("D", end="")
for _ in range(x):
    print("L", end="")
print("L", end="")
for _ in range(y + 1):
    print("U", end="")
for _ in range(x + 1):
    print("R", end="")
print("D", end="")
print("R", end="")
for _ in range(y + 1):
    print("D", end="")
for _ in range(x + 1):
    print("L", end="")
print("U")


Measured memory_bytes: 4468
/* ex4_1
   Acro  */

#include <stdio.h> 
int main(){
    int tree_num,see_num,ans;
    scanf("%d %d",&tree_num,&see_num);
    if (tree_num % (2 * see_num + 1) == 0){
        /* 割り切れるとき */
        ans = tree_num / (2 * see_num + 1);
    }
    else{
        /* 型変換をして切り捨て */
        ans = tree_num / (2 * see_num + 1) + 1;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
    #define lb lower_bound 
    #define ub upper_bound
    #define pii pair<pair<int,int>,pair<int,int> >
	#define se second
	#define endl "\n"
	#define pi pair<int, int>
	#define vi vector<int> 
	#define vvi vector<vi>
    #define bs   binary_search
	#define rep(i,a,b) for(int i=a;i<b;i++)
	#define rep1(i,a,b) for(int i=a;i<=b;i++)	
    #define all(c) (c).begin(),(c).end()
    #define sz(x)       (int)x.size() 
	#define PI 3.14159265358979323846
    
	const int N =1e6;
    
     int mod= 1e9+7;
     
     int dx[4]={0,0,+1,-1};
     int dy[4]={+1,-1,0,0};
   
     void solve(){
        
         int n;
         cin>>n;
         int yo=n*n*n;
         cout<<yo<<endl;
         
         
     }
   
   
   
   
      int32_t main() {
	    cool;
	    int t=1;
        //cin>>t;
	    while(t--)
	       solve();
	       
	       
	       return 0;	   
	   }


Measured memory_bytes: 256
/*+lmake
 * STD = c++14
 * DEFINE += MDEBUG
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
#ifdef DEBUG
     #define debug(args...)            {dbg,args; cerr<<endl;}
#else
    #define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;

void solve(long long A, long long B, long long C, long long X, long long Y){
	LL ans=std::numeric_limits<LL>::max();
	for(LL i=0; i<=max(X,Y); ++i) {
		LL now=2*i*C+max(X-i,0LL)*A+max(Y-i,0LL)*B;
		ans=min(ans,now);
	}	
	cout<<ans<<endl;
}

int main(){	
	long long X;
	long long A;
	long long C;
	long long Y;
	long long B;
	scanf("%lld",&A);
	scanf("%lld",&B);
	scanf("%lld",&C);
	scanf("%lld",&X);
	scanf("%lld",&Y);
	solve(A, B, C, X, Y);
	return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,a[3][100005]={};
	cin>>n;
	FOR(i,0,3){
		FOR(j,0,n){
			cin>>a[i][j];
		}
		sort(a[i],a[i]+n);
	}
	LL ans=0;
	FOR(i,0,n){
		int t=a[1][i];
		int ov=lower_bound(a[0],a[0]+n,t)-a[0];
		int un=n-(upper_bound(a[2],a[2]+n,t)-a[2]);
		ans+=1LL*ov*un;
	}
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int N;

int division_count(int n){
    int cnt = 0;

    for(int j = 1; j <= N; j++){
        if(n % j == 0) cnt++;
    }
    
    return cnt;
}

int solve(){
    int ans = 0;
    for(int i = 1; i <= N; i++)
        if(i % 2 == 1 && division_count(i) == 8) ans++;
    return ans;
}

int main(){
    cin >> N;
    // printf("%d\n",division_count(N));
    cout << solve() << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int i,n;
	int str[100];

	scanf("%d", &n);

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

	for (i = n - 1 ; 0 <= i; i--) {
		if (i != (n - 1)) printf(" ");
		printf("%d", str[i]);
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>

using namespace std;

int power_of_two (int x) {
  while (x % 2 == 0) x /= 2;
  return x == 1;
}

const int MAX_N = 2e5 + 5;

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

  int n;
  cin >> n;

  if (power_of_two(n)) {
    cout << "No" << endl;
    exit(0);
  }

  cout << "Yes" << '\n';
  cout << 1 << " " << 2 << '\n';
  cout << 2 << " " << 3 << '\n';
  cout << 1 << " " << n + 3 << '\n';
  cout << n + 3 << " " << n + 2 << '\n';
  cout << n + 2 << " " << n + 1 << '\n';
  for (int i = 4; i + 1 <= n; i += 2) {
    int u = i;
    int v = i + 1;

    cout << 1 << " " << u << '\n';
    cout << u << " " << v << '\n';
    cout << 1 << " " << n + v << '\n';
    cout << n + v << " " << n + u << '\n';
  }

  if (n % 2 == 0) {
    int p = n & -n;
    int q = n + n - p;

    cout << n << " " << p << '\n';
    cout << n + n << " " << q + 1 << '\n';
  }
}


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

using namespace std;

int main(){

	int city[4]={0};
	for(int i=0;i<3;i++){
		int a,b;
		cin >> a >> b;
		city[a-1]++;
		city[b-1]++;
	}
	int odd=0,even=0;
	for(int i=0;i<4;i++){
		if(city[i]%2==0)
			even++;
		else
			odd++;
	}
	if(even==2 and odd==2 and (city[0]!=0 and city[1]!=0 and city[2]!=0 and city[3]!=0))
		cout << "YES";
	else
		cout << "NO";
}

Measured memory_bytes: 256
// Ver19.02
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int n;
  scanf("%d", &n);
  char w[n][11];
  for (int i = 0; i < n; i++)
  {
    scanf("%s", w[i]);
  }
  for (int i = 0; i < n - 1; i++)
  {
    if (w[i][strlen(w[i]) - 1] != w[i + 1][0])
    {
      puts("No");
      return 0;
    }
  }
  for (int i = 0; i < n; i++)
  {
    for (int j = i + 1; j < n; j++)
    {
      if (strcmp(w[i], w[j]) == 0)
      {
        puts("No");
        return 0;
      }
    }
  }
  puts("Yes");

  return 0;
}


Measured memory_bytes: 128
# Aizu Problem 0037: Path on a Grid
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")

DIRS = ['R', 'D', 'L', 'U']
DX = [0, 1, 0, -1]
DY = [1, 0, -1, 0]

board = [[[False for _ in range(4)] for __ in range(6)] for ___ in range(6)]
for i in range(9):
    l = 4 + i % 2
    walls = input().strip()
    for j in range(4 + i % 2):
        n = int(walls[j])
        if n == 1:
            if i % 2 == 0:
                board[i//2][j+1][1] = True
                board[i//2+1][j+1][3] = True
            else:
                board[i//2+1][j][0] = True
                board[i//2+1][j+1][2] = True
    
out = ""
direc = 0
nx, ny = 0, 1
while True:
    if (nx == 1 and ny == 0 and direc == 2) or \
       (nx == 0 and ny == 0 and direc == 2):
        break
    x = nx + DX[direc]
    y = ny + DY[direc]
    if not board[nx][ny][(direc+1)%4]:
        direc = (direc + 1) % 4
        nx += DX[direc]
        ny += DY[direc]
    elif board[nx][ny][direc]:
        out += DIRS[direc]
        direc = (direc - 1 + 4) % 4
    else:
        out += DIRS[direc]
        nx = x
        ny = y
print(out)

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

int main () {
	int a, b;
	cin >> a >> b;
	if (a == b)
		cout << "Draw" << endl;
	else if (a == 1)
		cout << "Alice" << endl;
	else if (b == 1)
		cout << "Bob" << endl;
	else if (a>b)
		cout << "Alice" << endl;
	else if (b>a)
		cout << "Bob" << endl;
	

return 0;
}

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

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

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define Rep(i, n) For(i, 0, (n))
#define Rrep(i, n) for(int i = (n - 1); i >= 0; i--)
#define Itr(i, c) for(typeof(c.begin()) i = c.begin(); i != c.end(); i++)
#define pb push_back

const int inf = 999999999;
const int mod = 1000000007;

int main(){
	int a, b; cin >> a >> b;
	if(a % 2 == 0 || b % 2 == 0){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
// 2016-12-12
#include <iostream>
#include <cmath>
using namespace std;

int main() {
	int n, m, t, a;
	cin >> n >> m >> t;
	int s = 0, u = 0;
	for (int i = 0; i < n; i++) {
		cin >> a;
		s += max(0, (a - m) - u);
		u = a + m;
	}
	s += max(0, t - u);
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long h, w;
  cin >> h >> w;
  
  if (h == 1 || w == 1) 
    cout << 1 << '\n';
  else 
    cout << (h * w + 1LL)/2 << '\n';
  return 0;
}


Measured memory_bytes: 256
import sys
from fractions import gcd
input = sys.stdin.readline

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

l_gcd = []
r_gcd = []

for i, a in enumerate(A):
    if i == 0:
        l_gcd.append(a)
    else:
        l_gcd.append(gcd(l_gcd[i-1], a))
for i, a in enumerate(reversed(A)):
    if i == 0:
        r_gcd.append(a)
    else:
        r_gcd.append(gcd(r_gcd[i-1], a))
ans = 1
for i in range(N):
    if i == 0:
        ans = max(ans, r_gcd[N-2])
    elif i == N-1:
        ans = max(ans, l_gcd[i-1])
    else:
        ans = max(ans, gcd(l_gcd[i-1], r_gcd[N-2-i]))
print(ans)


Measured memory_bytes: 16148
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
long num_two(long a_n){
    long count=0;
    if(a_n%2!=0){
        return 0;
    }
    while(a_n!=1){
        a_n/=2;
        count++;
        if(a_n%2!=0){
            return count;
        }
    }
    return count;
}
int main(void){
    int num;
    long *a_n;
    long sumcount=0;

    scanf("%d",&num);
    a_n=(long *)malloc(sizeof(long)*num);
    int i;
    for(i=0;i<num;i++){
        scanf("%ld",&a_n[i]);
        sumcount+=num_two(a_n[i]);
        //printf("%ld:\n",sumcount);
    }
    printf("%ld",sumcount);

    free(a_n);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){

	int n, x, i, j, k;
	int count;

	while(1){
		scanf("%d %d", &n, &x);
		if(n==0 && x==0)break;
		count=0;
		for(i=1;i<=n;i++){
			for(j=i+1;j<=n;j++){
				for(k=j+1;k<=n;k++){
					if(i+j+k==x)count+=1;
				}
			}
		}
		printf("%d\n", count);
	}

    return 0;
}

Measured memory_bytes: 600
//D問題を尺取り法で実装する

#include <iostream>
#include <vector>
//#include<bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;

int main(){
  int N,K,ans;
  string S;//1011100001010101など
  cin >> N >> K >> S;
  vector<int> Nums;
  int cnt = 0,number = 1;//numberは着目する符号
  for (int n = 0; n < N; n++){
    if(S[n] ==  '0' + number){
      cnt++;
    }else{
      Nums.push_back(cnt);
      number ^= 1;
      cnt = 1;
    }
  }
  if(cnt != 0)Nums.push_back(cnt);
  if(number == 0)Nums.push_back(0);

  //累積和を作る
  //1 2 3 4 5 6 7 sum
  // 1 2 3 4 5 6  Nums
  vector<int> sum(Nums.size()+1);
  for(int i = 0; i < Nums.size(); i++){
    sum[i + 1] = sum[i] + Nums[i];
  }

  int maxSum = -1,tmpSum = 0;
  for (int i = 0; i < Nums.size(); i += 2){
    int left = i;
    int right = min(i + 2 * K + 1,(int)Nums.size());
    tmpSum = sum[right] - sum[left];
    maxSum = max(tmpSum,maxSum);
  } 

  //for (int i = 0; i < Nums.size();i++)
    //cout << Nums[i] << endl; 
  cout << maxSum << endl;
}

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

 using namespace std;

 int main()
 {
     int R;
     float pi,Circum;
     pi=3.141592653589793238462643383279502884197169399375105820974944592307816406286;
     cin>>R;
     Circum=2*pi*R;
     cout<<Circum;
     return 0;

 }




Measured memory_bytes: 3764
#include <stdio.h>
#include <string.h>
int main(){
  char s[3];

  scanf("%s", s);

  if(strlen(s) == 2){
    printf("%s", s);
  }else if(strlen(s) == 3){
    for(int cnt = 2; cnt >= 0; cnt--){
      printf("%c", s[cnt]);
    }
  }
  
  printf("\n");


}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

using namespace std;
using ll = long long;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

bool isAllVisit(const vector<bool>& visit) {
    for (auto&& v : visit) {
        if (!v)return false;
    }
    return true;
}

int solve(int v, const vector<vector<int>>& graph, vector<bool> visit) {
    if (visit[v])return 0;
    visit[v] = true;
    if (isAllVisit(visit))return 1;
    int cnt = 0;
    for (auto&& g : graph[v]) {
        cnt += solve(g, graph, visit);
    }
    return cnt;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << fixed << setprecision(20);

    int N, M;
    cin >> N >> M;
    vector<vector<int>> graph(N);

    REP(i, M) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        graph[a].emplace_back(b);
        graph[b].emplace_back(a);
    }

    vector<bool> visit(N, false);
    cout << solve(0, graph, visit);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i < int(n); i++)

using ll = long long;
using namespace std;

const ll MOD = 1e9+7;

ll modpow(ll a, ll n, ll p) {
    ll res = 1;
    while (n) {
        if (n & 1) res = res * a % p;
        a = a * a % p;
        n >>= 1;
    }
    return res;
}

int main(){
    string s; cin >> s;
    ll n = s.length();
	
    ll ans = 0, count = 0;
    rep(i,n){
        if(s[i] == '1'){
            ans += modpow(2,count,MOD) * modpow(3,n-1-i,MOD) % MOD;
            count++;
        }
    }
  	ans += modpow(2,count,MOD);
    cout << ans % MOD << endl;
}

Measured memory_bytes: 3768
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
using namespace std;

int main (){
	int N;cin >> N;
	vector<int> a(N);for(int i=0;i<N;++i)cin>>a[i];
	//sort(a.begin(),a.end());
	
	vector<long long> sum(N+1);
	sum[0]=0;
	for(int i=0;i<N;i++)sum[i+1]+=sum[i]+a[i];
	long long ans=LLONG_MAX;
	for(int i=1;i<N;i++)
	{
		long long b=sum[i];
		long long c=sum[N]-sum[i];
		//cout<<b<<','<<c<<endl;
		if(ans>abs(b-c))ans=abs(b-c);
	}
	
	cout<<ans<<endl;
   return 0;
	
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<char> d(k);
  rep(i, k) cin >> d.at(i);
  while(true){
    ostringstream oss;
    oss << n;
    bool check=true;
    rep(i, oss.str().size()){
      rep(j, k)if(oss.str()[i] == d.at(j))check=false; 
    }
    if(check)break;
    n++;
  }
  cout << n;
}


Measured memory_bytes: 256
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;
ll X,Y;
ll ltmp;
string stmp;
double dtmp;
ll llmin(ll a,ll b){
    if(a>=b) return b;
    return a;
}
ll llmax(ll a,ll b){
    if(a<=b) return b;
    return a;
}

vector<ll> inv,fact,invfact;
void setupCombination(ll n_max,ll mod){
    fact.resize(n_max+1);
    inv.resize(n_max+1);
    invfact.resize(n_max+1);
    fact[0]=inv[0]=invfact[0]=1;
    inv[1]=1;
    for(ll i=0;i<n_max;i++){
        fact[i+1]=fact[i]*(i+1)%mod;
        if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
        invfact[i+1]=invfact[i]*inv[i+1]%mod;
    }
}
ll getCombination(ll n,ll k,ll mod){
    if(n<0||k<0||k>n)return 0;
    return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod;
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    setupCombination(base10_6+10,MOD);

    cin >> X;
    cin >> Y;

    if( (X+Y)%3!=0 ){
        cout << 0 << endl;
    }else{
        ll total = X+Y;
        ll stage = total/3;
        ll left = X-stage;
        cout << getCombination(stage,left,MOD) << endl;
    }

}

Measured memory_bytes: 26604
def dfs(index, last, string, memo):
    mod = 10 ** 9 + 7
    if string in memo[index]:
        return memo[index][string]
    if index == last:
        return 1

    ret = 0
    for s in "ACGT":
        if check(string + s):
            ret = (ret + dfs(index + 1, last, string[1:] + s, memo)) % mod
    memo[index][string] = ret
    return ret


def check(string):
    for i in range(4):
        s_list = list(string)
        if i >= 1:
            s_list[i-1], s_list[i] = s_list[i], s_list[i-1]
        if "".join(s_list).count("AGC") >= 1:
            return False
    return True


def main():
    n = int(input())
    memo = [{} for _ in range(n+1)]

    ans = dfs(0, n, "TTT", memo)
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3872
import java.util.Scanner;

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

    if(D == 25){
      System.out.println("Christmas");
    }else if(D == 24){
      System.out.println("Christmas Eve");
    }else if(D == 23){
      System.out.println("Christmas Eve Eve");
    }else if(D == 22){
      System.out.println("Christmas Eve Eve Eve");
    }
  }
}


Measured memory_bytes: 23252
using System;
class Program {
  static void Main(string[] args) {
    int N = int.Parse(Console.ReadLine());
    int[] A = new int[N];
    for (int i = 0; i < N; ++i) {
      A[i] = int.Parse(Console.ReadLine());
    }

    Array.Sort(A);
    int prev = -1;
    int ans = 0;
    for (int i = 0; i < N; ++i) {
      if (prev != A[i]) ++ans;
      prev = A[i];
    }

    Console.WriteLine(ans);
  }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<=n;i++)
using namespace std;
int gcd(int p,int q){
	int z;
	while(q!=0){
		z=p%q;
		p=q;
		q=z;
	}
	return p;
}
int main(){
	/*int p,q,r;
	cin>>p>>q>>r;
	int z=gcd(p,q);
	int ans=gcd(z,r);
	cout<<ans<<endl;
	*/
	int k,g=0;
	cin>>k;
	rep(a,1,k){
		rep(b,1,k){
			rep(c,1,k){
				g+=gcd(a,gcd(b,c));
			}
		}
	}
	cout<<g<<endl;
	
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <list>
#include <queue>
#define llint long long
#define inf 1e18

using namespace std;

llint n, m, s, t;
vector<llint> G[100005];
llint distS[100005], distT[100005];
llint cntS[100005], cntT[100005];

void bfs(llint S, llint dist[])
{
	for(int i = 1; i <= n; i++) dist[i] = inf;
	dist[S] = 0;
	
	queue<llint> Q;
	Q.push(S);
	
	llint v;
	while(Q.size()){
		v = Q.front();
		Q.pop();
		for(int i = 0 ;i < G[v].size(); i++){
			llint u = G[v][i];
			if(dist[u] < inf) continue;
			Q.push(u);
			dist[u] = dist[v] + 1;
		}
	}
}

int main(void)
{
	cin >> n >> m >> s >> t;
	llint u, v;
	for(int i = 1; i <= m; i++){
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	
	bfs(s, distS);
	bfs(t, distT);
	llint d = distS[t];
	
	for(int i = 1; i <= n; i++){
		if(distS[i] < inf/2) cntS[distS[i]]++;
		if(distT[i] < inf/2) cntT[distT[i]]++;
	}
	
	llint ans = 0;
	for(int i = 0; i <= d-2; i++){
		ans += cntS[i]*cntT[d-2-i];
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 12040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int, int>;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main() {
int a, b, s, l;
cin >> a >> b;
    s = a * b;
    l = 2 * (a + b);
cout << s << " " << l << endl;
}


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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define MOD 1000000007

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

int main()
{
    ll n, ans=0;
    cin >> n;
    while(n--)
    {
        
        ll x,y;
        cin >> x >> y;
        ans+=y-x+1;
    }
    cout << ans;
}


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

typedef long long ll;

using namespace std;

int n;
ll x[111], y[111];
set<pair<ll,ll>> s;

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> x[i] >> y[i];
        s.insert({x[i],y[i]});
    }
    int z = 0;
    for (int a = 1; a <= n; a++) {
        for (int b = 1; b <= n; b++) {
            if (a == b) continue;
            ll p = x[a]-x[b];
            ll q = y[a]-y[b];
            int c = 0;
            for (int i = 1; i <= n; i++) {
                if (s.count({x[i]-p,y[i]-q})) c++;
            }
            z = max(z,c);
        }
    }
    cout << n-z << "\n";
}

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

int main() {
	int a,b,k; cin >> a >> b;
	
	if ((a+b)%2!=0) {
		cout << "IMPOSSIBLE" << endl;
	} else {
		cout << (a+b)/2 << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> P;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


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

int N,M; cin >> N >> M;
map<int, vi> mp;
rep(i,N) {
    int a,b; cin >> a >> b;
    mp[a].push_back(b);
}
priority_queue<int> que;
ll ans = 0;
rrep(i,M) {
    for(auto x : mp[i]) que.push(x);
    if(que.empty()) continue;
    ans += que.top();
    que.pop();
}

cout << ans << endl;
return 0;
}

Measured memory_bytes: 10880
/* Coached by rainboy */
#include <stdio.h>

#define H 100
#define W 8
#define MD 1000000007

int main() {
	static int ff[W + 1], dp[H + 1][W];
	int h, w, k, i, j;

	scanf("%d%d%d", &h, &w, &k), k--;
	ff[0] = ff[1] = 1;
	for (i = 2; i <= w; i++)
		ff[i] = (ff[i - 1] + ff[i - 2]) % MD;
	dp[0][0] = 1;
	for (i = 0; i < h; i++)
		for (j = 0; j < w; j++) {
			long long x = dp[i][j];

			dp[i + 1][j] = (dp[i + 1][j]
					+ x * ff[j] % MD * ff[w - 1 - j]) % MD;
			if (j > 0)
				dp[i + 1][j - 1] = (dp[i + 1][j - 1]
						+ x * ff[j - 1] % MD * ff[w - 1 - j]) % MD;
			if (j + 1 < w)
				dp[i + 1][j + 1] = (dp[i + 1][j + 1]
						+ x * ff[j] % MD * ff[w - 1 - j - 1]) % MD;
		}
	printf("%d\n", dp[h][k]);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(){

   int a, b;

   cin >> a >> b;

   if(a < b){
      cout << "a < b" << endl;
   }
   else if(a > b){
      cout << "a > b" << endl;
   }
   else{
      cout << "a == b" << endl;
   }

   return 0;
}


Measured memory_bytes: 3092
#include<stdio.h>
int main(void){
  int W,H,x,y,r;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  if((x-r<0||x+r>W)||(y-r<0||y+r>H)){
    printf("No\n");
  }
  if((y-r>=0&&y+r<=H)&&(x-r>=0&&x+r<=W)){
    printf("Yes\n");
  }
  return 0;
 }



Measured memory_bytes: 2104
from collections import deque

d = deque(input())
Q = int(input())

qs = [list(map(str, input().split())) for _ in range(Q)]

vector = True
for q in qs:
    if q[0] == "1":
        vector = not vector
    else:
        if q[1] == "1":
            if vector:
                d.appendleft(q[2])
            else:
                 d.append(q[2])
        else:
            if vector:
                d.append(q[2])
            else:
                 d.appendleft(q[2])

if not vector:
    d.reverse()

ans = ''.join(d)
print(ans)


Measured memory_bytes: 44532
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int arr[n+1],i;
    for(i=1;i<=n;i++)
    cin >> arr[i];

    int dp[n+5];
    memset(dp,-1,sizeof(dp));
    dp[1]=0;
    for(i=1;i<=n;i++)
    {
        dp[i+2]=dp[i+2]==-1?(dp[i]+abs(arr[i+2]-arr[i])):min(dp[i+2],dp[i]+abs(arr[i+2]-arr[i]));
        dp[i+1]=dp[i+1]==-1?(dp[i]+abs(arr[i+1]-arr[i])):min(dp[i+1],dp[i]+abs(arr[i+1]-arr[i]));
    }

    cout<<dp[n]<<endl;

    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
int main()
{
  int  n;
  char s[10];
  scanf("%d",&n);
  getchar();
  int a=0,w=0,t=0,r=0;
  while(n--)
  {
    scanf("%s",s);
    getchar();
    if(s[1]=='C')
    {
      a++;
    }
    else if(s[1]=='A')
            {
              w++;
            }
            else if(s[1]=='E')
            {
              r++;
            }
    else if(s[1]=='L')
    {
      t++;
    }
    else ;
  }
  printf("AC x %d\n",a);
  printf("WA x %d\n",w);
  printf("TLE x %d\n",t);
  printf("RE x %d\n",r);
a=w=t=r=0;
}

Measured memory_bytes: 1700
import collections
n, c = (int(i) for i in input().split())
d = [[int(i) for i in input().split()] for i in range(c)]
t = [[int(i)-1 for i in input().split()] for i in range(n)]

l = [[],[],[]]
for i in range(n):
    for j in range(n):
        l[(i+j)%3].append(t[j][i])

l = list(map(lambda x: collections.Counter(x), l))

min_cost = n*n*10**5
for i in range(c):
    for j in range(c):
        if j == i:continue
        for k in range(c):
            if k==j or k==i:continue
            cost = 0
            for idx, done in enumerate([i,j,k]):
                for pre, cnt in l[idx].items():
                    cost += d[pre][done] * cnt
            min_cost = min(min_cost, cost)
            
print(min_cost)

Measured memory_bytes: 56156
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
class a{
    public static void Main(){
        string[] str = Console.ReadLine().Split(' ');
        int n = int.Parse(str[0]);
        int x = int.Parse(str[1]);
        int t = int.Parse(str[2]);
        int ans = 0;
        while(n > 0){
            n -= x;
            ans += t;
        }
        Console.WriteLine(ans);
    }
}


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

typedef long long ll;

int N;
int S[100001];

int main() {
    cin>>N;
    for(int i=0;i<N;i++) cin>>S[i];

    ll res = 0;
    for(int i=1;i<N;i++) {
        int l=i, r=N-1-i;
        if(l>=r) break;
        ll val=0;
        if((N-1)%i) {
            while(i<r) {
                val+=S[l]+S[r];
                res=max(res,val);
                l+=i,r-=i;
            }
        } else {
            while(l<r) {
                val+=S[l]+S[r];
                res=max(res,val);
                l+=i,r-=i;
            }
        }
    }
    cout<<res;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}


int main() {
    int n;
    string s;
    cin >> n >> s;
    
    if(s.substr(0,s.length()/2) == s.substr(s.length()/2,s.length())){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}





Measured memory_bytes: 256
import java.util.Scanner;

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

	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] s = sc.next().toCharArray();
		int[] a = new int[n];
		int[] sz = new int[n];
		for (int i = 0; i < n; ++i) {
			a[i] = s[i] - '0';
		}
		for (int i = 0; i < n; ++i) {
			if (a[i] == 1) {
				sz[i] = (i > 0 ? sz[i - 1] : 0) + a[i];
			}
		}

		int[] f = new int[n];
		for (int i = 2; i < n; ++i) {
			f[i] = f[i - 1];
			if (a[i] == 0)
				continue;
			if (a[i - 1] == 0 && a[i - 2] == 1) {
				for (int d = 0; d < 3 && sz[i - 2] - d > 0; ++d) {
					f[i] = Math.max(f[i],
							(sz[i - 2] - d) + (i - 2 - (sz[i - 2] - d) >= 0 ? f[i - 2 - (sz[i - 2] - d)] : 0));
				}
			}
			if (i - sz[i] - 1 >= 0 && a[i - sz[i] - 1] == 1) {
				f[i] = Math.max(f[i], sz[i] + (i - 2 - sz[i] >= 0 ? f[i - sz[i] - 2] : 0));
			}
		}
		System.out.println(f[n - 1]);
	}

}


Measured memory_bytes: 36980
# n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy
import itertools

mod  = 1000000007

N, M=map(int, input().split())

broken = [0 for _ in range(N + 2)]

for i in range(M):
    n = int(input())
    broken[n] = True

dp = [0 for _ in range(N + 2)]
dp[N] = 1
for i in range(0, N)[::-1]:
    if broken[i]:
        dp[i] = 0
        continue
    dp[i] = (dp[i + 1] + dp[i + 2]) % mod

print(dp[0])

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

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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	ll n,x,d;
	cin >> n >> x >> d;
	if(d == 0){
		cout << (x == 0 ? 1 : n + 1) << '\n';
	}
	else{
		if(d < 0){d = -d;x = -x;}
		ll g = __gcd(abs(x), abs(d));
		map<int, vector<pll>> m;
		for(ll k = 0; k <= n; ++k){
			int mod = (x * k) % d;
			m[mod].push_back({(x * k - mod)/d + k * (k - 1)/2, (x * k - mod)/d + k * (2*n - k - 1)/2});
		}
		ll ans = 0;
		const ll inf = LLONG_MAX;
		for(auto &p: m){
			vector<pll> & v = p.second;
			sort(v.begin(), v.end());
			ll rmost = -inf;
			for(int i = 0;i < v.size(); ++i){
				if(rmost < v[i].first){
					ans += v[i].second - v[i].first + 1;
					rmost = v[i].second;
				}
				else if(v[i].first <= rmost && rmost <= v[i].second){
					ans += v[i].second - rmost;	
					rmost = v[i].second;
				}
			}
		}
		cout << ans << '\n';
	}
}


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

int main(){
    string str;
    cin >> str;
    int bakket[26] = {0};
    for(int i = 0; i < str.size(); i++){
        bakket[str[i] - 'a']++;
    }
    int i;
    for(i = 0; i < 26; i++){
        if(bakket[i] == 0){
            cout << char(i + 'a') << endl;
            break;
        }
    }
    if(i == 26) cout << "None" << endl;

}

Measured memory_bytes: 512
from sys import stdin
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
point = 0
point2 = 0
for i in s:
    if i == "(":
        point += 1
    else:
        if point:
            point -= 1
        else:
            point2 += 1
print("("*point2+s+")"*point)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;

namespace B1
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			var n = int.Parse(Console.ReadLine());
			var dn = new List<int>(n);
			for (var i = 0; i < n; i++) { dn.Add(int.Parse(Console.ReadLine())); }

			Console.WriteLine(dn.Distinct().Count());
		}
	}
}

Measured memory_bytes: 13152
#include <iostream>
#include <cstring>
#include <deque>
#include <algorithm>

using namespace std;

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

int main(void){
	int w,h;
	
	while(cin >> w >> h){
		if((w|h) == 0) break;
		int f[w+2][h+2], sx, sy, ex, ey;
		bool reachable[w+2][h+2];
		memset(f,-1,sizeof(f));
		memset(reachable, false, sizeof(reachable));
		
		cin >> sx >> sy;
		cin >> ex >> ey;
		
		int n;
		cin >> n;
		int color,d,px,py, hh, ww;
		for(int i=0;i<n;i++){
			cin >> color >> d >> px >> py;
			if(d == 0){
				hh=2;
				ww=4;
			}else{
				hh=4;
				ww=2;
			}
			for(int p=0;p<hh;p++){
				for(int q=0;q<ww;q++){
					f[px+q][py+p] = color;
				}
			}
		}
		
		deque<pair<int,int> > q;
		reachable[sx][sy] = true;
		q.push_back(make_pair(sx,sy));
		
		while(!q.empty()){
			pair<int,int> pii = q.front();
			q.pop_front();
			reachable[pii.first][pii.second] = true;
			for(int i=0;i<4;i++){
				if(f[pii.first][pii.second] == f[pii.first+dx[i]][pii.second+dy[i]] &&
				reachable[pii.first+dx[i]][pii.second+dy[i]] == false){
					reachable[pii.first+dx[i]][pii.second+dy[i]] = true;
					q.push_back(make_pair(pii.first+dx[i], pii.second+dy[i]));
				}
			}
		}
		
		if(reachable[ex][ey]){
			cout << "OK" << endl;
		}else{
			cout << "NG" << endl;
		}
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000

using vi = vector<int>;


int main() {

	double a, b;

	cin >> a >> b;

	cout << a/b << endl;

	return 0;
}

Measured memory_bytes: 256