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

#include <set>
#include <iterator>
using namespace std;
// using namespace __gnu_pbds;


#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()

#define ll long long int
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) for(int i=0;i<v.size();i++) cout << v[i] << " " ;

#define f_in(st) freopen(st,"r",stdin)
#define f_out(st) freopen(st,"w",stdout)

#define INF (ll)1e17
#define matrix vector<vector<ll> >

#define fr(i, a, b) for(i=a; i<=b; i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define ASST(x, l, r) assert( x <= r && x >= l )
#define maxbits 9
#define maxmask (1ll<<maxbits)
// typedef tree<pll, null_type, less<pll>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
const int  N=(ll)2e3 +10, M=(ll)1e9+1 ;
const int mod =(ll)1e9+7 , MAX=(ll)1e6+10;
string fir="Monocarp",sec="Bicarp";

void work(){
	string s1,s2;
	cin >> s1 >> s2;
	for(ll i=0;i<s1.length();i++){
		if(s1[i]!=s2[i]){
			cout << "No\n";
			return;
		}

	}

	cout << "Yes";
	return;
		
	
}

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

	

	// to avoid printing in Scientific Notation like 2.14748e+09 and instead print: 2147483648.000000
	cout << fixed ;
	
	// precomp();
	ll t,z;
	// cin >> t;
	t=1;
	// z=t;
	while(t--){
			// cout << "Case #" << z-t << ": " << "\n";
	        work();
	
	}

	return 0;
}
	

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

public class Main {
	static int n;
	static int[][] a;
	static int maxC = 0;
	
	static void dfs(int h, int w, int c) {
		c += a[h][w];
		
		if (w == n - 1 && h == 1) {
			maxC = Math.max(maxC, c);
		}
		
		if (h < 1) {
			dfs(h + 1, w, c);
		}
		
		if (w < n - 1) {
			dfs(h, w + 1, c);
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		
		a = new int[2][n];
		Arrays.setAll(a[0], i -> sc.nextInt());
		Arrays.setAll(a[1], i -> sc.nextInt());
		
		dfs(0, 0, 0);
		
		System.out.println(maxC);
	}
}


Measured memory_bytes: 28628
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x) cout<<#x<<" = "<<(x)<<endl;
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int a,b,c; cin >> a >> b >> c;
  COUT(a*b/2);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define pb push_back
#define mkp make_pair
#define fi first
#define se second
#define re register
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define per(i,n,m) for(int i=m;i>=n;i--)
#define rrep(i,m,n) for(register int i=m;i<=n;i++)
#define rper(i,n,m) for(register int i=m;i>=n;i--)
#define ull unsigned  long long
using namespace std;
const int INF =1e9+10;
const int N = 5e6 + 10;
ll h,w,node[N],n,cnt,zero,ans[20];
signed main(){
    scanf("%lld%lld%lld",&h,&w,&n);
    zero=(h-2)*(w-2);
    rep(i,1,n){
        ll a,b;
        scanf("%lld%lld",&a,&b);
        for (int i=-2;i<=0;i++){
            for (int j=-2;j<=0;j++){
                if(a+i>=1 && a+i <=h-2 && b+j>=1 &&b+j <=w-2){
                    node[cnt++]=INF*(a+i)+(b+j);
                }
            }
        }
    }
    sort(node,node+cnt);
    for (int i=0,tmp=1;i<cnt;i++){
        if(node[i]==node[i+1]) tmp++;
        else {
            ans[tmp]++;
            zero--;
            tmp = 1;
        }
    }
    pl(zero);
    puts("");
    rep(i,1,9)printf("%lld\n",ans[i]);
    return 0;
}


Measured memory_bytes: 10832
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int C = sc.nextInt();
    int B[] = new int[M];
    for(int j=0; j<M; j++){
      B[j] = sc.nextInt();
    }
    int r=0;
    for(int i=0; i<N; i++){
      int s=C;
      for(int b: B){
        int a = sc.nextInt();
        s += a*b;
      }
      if(s>0){
        r++;
      }
    }
    System.out.println(r);
  }
}

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

#define F first
#define S second

using namespace std;
typedef long double ld;
typedef long long ll;

const int max_n = 200011, max_m = 500011, inf = 1000111222;
const ll inff = 1000111222333444;

int dp[2][max_n];
int n;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    string s;
    cin >> s;
    n = s.length();
    int cnt =0 ;
    dp[0][0] = 1;
    dp[1][1] = 1;
    for (int i = 1; i < s.length(); ++i) {
        if (s[i] != s[i - 1]) {
            dp[0][i] = max(dp[0][i - 1], dp[1][i - 1]) + 1;
            if (i > 1) dp[1][i] = max(dp[1][i], max(dp[0][i - 2], dp[1][i - 2]) + 1);
        } else {
            dp[0][i] = dp[1][i - 1] + 1;
            dp[1][i] = max(dp[0][i - 2], dp[1][i - 2]) + 1;
        }
        // cout << dp[0][i] << " " << dp[1][i] << endl;
    }
    cout << max(dp[0][n - 1], dp[1][n - 1]) << endl;
    return 0;
}


Measured memory_bytes: 2180
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n + 1];
        int[] b = new int[n];
        for (int i = 0; i <= n; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            b[i] = sc.nextInt();
        }
        long sum = 0;
        for (int i = 0; i < n; i++) {
            int left = Math.min(a[i], b[i]);
            sum += left;
            a[i] -= left;
            b[i] -= left;
            int right = Math.min(a[i + 1], b[i]);
            sum += right;
            a[i + 1] -= right;
            b[i] -= right;
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 66772
#include <stdio.h>
int main(void){
    int a, b, d, r;
    double f;
    scanf("%d %d", &a, &b);
    d = a / b;
    r = a % b;
    f = (double) a / b;
    printf("%d %d %.5lf\n", d, r, f);
    return 0;
}


Measured memory_bytes: 2100
#include"bits/stdc++.h"
using namespace std;

void Main() {
  int X, Y;
  cin >> X >> Y;
  cout << X + Y / 2 << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

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

typedef long long int ll;


int dp[100010];
int arr[100010];
int n;

int go(int val){
    if(val == 0)    return 0;
    if(dp[val] != -1)   return dp[val];
    int pos = 0;
    for(int i = 0; i < n; i++){
        if(val >= arr[i]){
            int tval = go(val-arr[i]);
            if(tval == 0){
                pos = 1;
            }
        }
    }
    return dp[val] = pos;
}
int main(){
    memset(dp,-1,sizeof dp);
    int k;
    scanf("%d %d",&n,&k);
    for(int i = 0; i < n; i++){
        scanf("%d",arr+i);
    }
    int ans = go(k);
    if(ans == 0){
        printf("Second\n");
    }
    else{
        printf("First\n");
    }
    //printf("%.10f\n",ans);
}


Measured memory_bytes: 5376
#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <set>
#include <limits.h>

#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define MOD 1000000007

using ll = long long;

using namespace std;

ll pow_mod(ll a, ll b, ll p) {
	if (b == 0)return 1;
	else if (b % 2 == 0)return (pow_mod(a*a, b / 2, p) % p);
	else return (pow_mod(a, b - 1, p)*a%p);
}

ll sum_digit(ll N) {
	int ans = 0;
	for (; N != 0;) {
		ans += N % 10;
		N /= 10;
	}
	return ans;
}

ll gcd(ll a,ll b) {
	if (!b)return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

int N, M,X;

int A[110] = { INT_MAX };

ll ans;

int main(){
	scanf("%d %d %d", &N, &M, &X);
	rep(i, M)scanf("%d", &A[i]);
	int cnt = 0;
	rep(i,M){
		if (A[i] < X&&X < A[i + 1]) {
			cnt = i + 1;
		}
	}
	ans = min(cnt, M - cnt);
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int M = input.nextInt();
		int[] votes = new int[N];
		double sum = 0;
		int cnt = 0;
		for (int i = 0; i < N; i++) {
			votes[i]=input.nextInt();
			sum+=votes[i];
		}
		double LOWER = sum/M/4;
		for (int i = 0; i < N; i++) {
			if (votes[i]>=LOWER) cnt++;
		}
		if (cnt>=M) System.out.println("Yes");
		else System.out.println("No");
		//System.out.println(sum);
	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int r,D,X,a;
  a=0;
  cin>>r>>D>>X;
  for(int i=0; i<10; i++){
    cout<<r*X-D<<endl;
    X =r*X-D;
  }
}

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

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

  map<string, int> U;
  for (int i = 0; i < N; i++) {
    string u;
    cin >> u;

    U[u] = 1;
  }

  bool open = false;

  int M;
  cin >> M;
  for (int i = 0; i < M; i++) {
    string t;
    cin >> t;

    if (U[t] == 0) {
      cout << "Unknown ";
    } else {
      if (open) {
	cout << "Closed by ";
      } else {
	cout << "Opened by ";
      }
      open = !open;
    }

    cout << t << endl;
  }

  return 0;
}

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

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

Measured memory_bytes: 256
import sys
from collections import defaultdict
from collections import deque

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n, q = LI()
    g = defaultdict(list)
    for i in range(n-1):
        a, b = LI()
        g[a].append(b)
    c = [0 for i in range(n+1)]
    for i in range(q):
        p, x = LI()
        c[p] += x


    d = deque([1])
    while len(d) > 0:
        root = d.pop()
        chs = g[root]
        for ch in chs:
            c[ch] += c[root]
            d.append(ch)

    c = [str(i) for i in c]
    print(' '.join(c[1:]))


if __name__ == '__main__':
    main()

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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

using ll = long long;

int main() {
    int n, c, d[30][30], cc[500][500], dd[3][30] = { 0 };
    cin >> n >> c;
    for (int i = 0; i < c; ++i) {
        for (int j = 0; j < c; ++j) {
            cin >> d[i][j];
        }
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cin >> cc[i][j];
            cc[i][j]--;
        }
    }

    for (int k = 0; k < c; ++k) {
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                dd[(i + j) % 3][k] += d[cc[i][j]][k];
            }
        }
    }

    int ans = INF;
    for(int i = 0; i < c; ++i) { // mod 0
        for (int j = 0; j < c; ++j) { // mod 1
            if (i == j)
                continue;
            for (int k = 0; k < c; ++k) { // mod 2
                if (k == i || k == j)
                    continue;
                ans = min(ans, dd[0][i] + dd[1][j] + dd[2][k]);
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep1(i, n) for(int i=1; i<=(int)(n); i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> wi;
typedef vector<string> vs;

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

  string s;
  cin >> s;
  vs a(26);
  int n=(int)s.size();
  char c[n];
  int m=0;
  rep(i, n){
    bool t=true;
    rep(j, i)if(c[j]==s[i])t=false;
    if(t){
      c[m]=s[i];
      m++;
    }
  }
  bool ans=true;
  rep(i, n)if(c[i]!=s[i]){
    ans=false;
    break;
  }

  cout << (ans ? "yes" : "no") << endl;

  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define FAST_IO ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

int main()
{
    FAST_IO;

    int a, b, k;
    scanf("%d %d %d", &a, &b, &k);
    int div = min(a,b);
    int j = 0;
    for ( ; j < k && div > 0; div--) {
        if (a % div == 0 && b % div == 0)
            j++;
    }
    printf("%d\n", div+1);
    return 0;
}

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

int main () {
  int N, M;
  std::cin >> N >> M;
  
  // Nコの島について, どうやって繋ぐかを考える.
  std::vector<std::vector<long long> > number(N,std::vector<long long>(0))    ;
  int sub, subsub;
  std::set<int> iterator;
  for (int i = 0; i < M; i++) {
    std::cin >> sub >> subsub;
    iterator.insert(sub);
    number[sub-1].push_back(subsub);
  }

  // iteratorに関して, for文を回す.
  for (auto x : iterator) {
    // std::cout << x << " start: ";
    int min = 100001;
    for (int i = 0; i < number[x-1].size(); i++) {
      // std::cout << number[x-1][i] << " ";
      if (min > number[x-1][i]) {
        min = number[x-1][i];  
      }  
    }
    number[x-1][0] = min;
    // std::cout << min << std::endl;
  }
  
  // カウントする
  int answer = 1;
  auto itr = iterator.begin();
  sub = *itr;
  subsub = number[*itr-1][0];
  // std::cout << sub << " " << subsub << std::endl;
  for (auto x : iterator) {
    
    // 初期化条件
    if (x != sub) {
      if (subsub > x) {
        sub = x;
        subsub = (subsub > number[x-1][0]) ? number[x-1][0]: subsub; 
      }  
      else {
        answer++;
        sub = x;
        subsub = number[x-1][0];    
      }
    }    
  }
  std::cout << answer << std::endl;
}

Measured memory_bytes: 10368
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque




def main():
    width, high = map(int, input().split())
    cost_w = [int(input()) for i in range(width)]
    cost_h = [int(input()) for i in range(high)]

    cost_w.sort()
    cost_h.sort()
    check_high, check_width = 0, 0
    width_ind = 0
    ans = 0
    for i in range(high):

        now_high = cost_h[i]
        while width_ind < width:
            if now_high < cost_w[width_ind]:
                break
            ans += (high + 1 - check_high) * cost_w[width_ind]
            check_width += 1
            width_ind += 1

        ans += (width + 1 - check_width) * cost_h[i]
        check_high += 1

    ans += sum(cost_w[width_ind:])

    print(ans)







if __name__ == '__main__':
    main()



Measured memory_bytes: 62164
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        long N = scanner.nextLong();
        long K = scanner.nextLong();
        if( N < K ){
            long mi = Math.min(N, K-N);
            System.out.println(mi);
            return;
        }
        if(N % K == 0){
            System.out.println(0);
            return;
        }
        N = N % K;
        System.out.println(Math.min(N, K-N));
        // while(K != 0){
        //     N = N % K;
        //     long temp = N;
        //     N = K;
        //     K = temp;
        // }
        // System.out.println(N);
    }
}

Measured memory_bytes: 23252
using System;
using System.Linq;

class A
{
	static void Main()
	{
		var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
		long a = h[0], b = h[1], c = h[2];
		Console.WriteLine(c <= b + 1 ? b + c : 2 * b + 1 + Math.Min(c - b - 1, a));
	}
}


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

int main() {
    int N; cin >> N;
    vector<vector<int>> A(N, vector<int>(N, -1));
    rep(i, 0, N) rep(j, 0, N - 1) {
        cin >> A[i][j];
        A[i][j]--;
    }
    int cnt = 0;
    vector<int> pt(N), dp(N);
    while(cnt < N * (N - 1) / 2) {
        bool update = false;
        rep(i, 0, N) {
            int o = A[i][pt[i]];
            if(o == -1) continue;
            if(i == A[o][pt[o]]) {
                update = true;
                cnt++;
                pt[i]++, pt[o]++;
                int ndp = max(dp[i], dp[o]) + 1;
                dp[i] = dp[o] = ndp;
            }
        }
        if(!update) break;
    }
    int ans = 0;
    rep(i, 0, N) ans = max(ans, dp[i]);
    if(cnt == N * (N - 1) / 2) cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 6272
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

type robot struct {
	a, b int
}

type robots []robot

func (rs robots) Len() int           { return len(rs) }
func (rs robots) Swap(i, j int)      { rs[i], rs[j] = rs[j], rs[i] }
func (rs robots) Less(i, j int) bool { return rs[i].b < rs[j].b }

func solve() {
	n := getInt()
	rs := make(robots, n)
	for i := range rs {
		x, l := getInt(), getInt()
		rs[i].a = x - l
		rs[i].b = x + l
	}
	sort.Sort(rs)

	ans := n
	now := -inf
	for _, r := range rs {
		if r.a < now {
			ans--
		} else {
			now = r.b
		}
	}

	fmt.Fprintln(wr, ans)
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 5120
#include <stdio.h>

int N, A[202020]; bool v[202020];

bool chk(int m)
{
	for (int i=1;i<2*N;i++) v[i] = A[i] >= m;
	if (v[N] == A[N-1] || v[N] == A[N+1]) return v[N];

	int l = N, r = N;
	while (l > 1 && v[l-1] != v[l]) l--;
	while (r < 2*N-1 && v[r+1] != v[r]) r++;
	if ((l + r) >= N * 2) return v[l];
	return v[r];
}

int main()
{
	scanf("%d", &N);
	for (int i=1;i<2*N;i++) scanf("%d", &A[i]);

	int l = 1, r = 2*N-1;
	while (l + 1 < r){
		int m = (l + r) / 2;
		if (chk(m)) l = m;
		else r = m;
	}
	printf("%d\n", l);

	return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
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;}
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);}

typedef struct{
    ll aa;
    ll bb;
}frequent;

/*nCk*/
ll nckused[1000][1000];
ll nckreached[1000][1000];
ll comb(ll n,ll k){
    if(n>1000) return (k==0 || k==n)?1:comb(n-1,k-1)+comb(n-1,k);
    if(nckreached[n][k]==1) return nckused[n][k];
    nckreached[n][k] = 1;
    nckused[n][k] = (n==1 || (k==0 || k==n) )?1:comb(n-1,k-1)+comb(n-1,k);
    return (n==1 || (k==0 || k==n) )?1:comb(n-1,k-1)+comb(n-1,k);
}

int main(void){
    // char ;
    ll n,k,ans=0;
    scanf("%lld%lld",&n,&k);
    // ll [n];
    if(k%2){
        ans+=POW(n/k,3);
    }else{
        ans+=POW(n/k,3)+POW( (n+k/2)/k ,3 );
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a,b;
	cin>>a>>b;
	for(int i=0;i<3;i++)
	if(a[i]!=b[2-i]){cout<<"NO"<<endl;return 0;}
	cout<<"YES"<<endl;
	return 0;
}

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

int main () {
  double n, ans = 0;
  cin >> n;
  
  double a;
  string b;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (b == "JPY") {
      ans += a;
    }
    else {
      ans += a*380000.0;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main()
{
  long N;
  cin >> N;
  vector<int> A(N);
  REP(i,N-1){
    ll a;
    cin >> a;
    a--;
    A.at(i) = a;
  }
  vector<int> Ans(N);
  REP(i,N-1){
    Ans.at(A.at(i))++;
  }
  REP(i,N){
    cout << Ans.at(i) << endl;
  }
}

Measured memory_bytes: 4788
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>


#define rep(i,p,q) for(ll i = p;i < q;++i)
#define ll long long

using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll npk(ll n, ll k) {
	ll ret = 1;
	if (n < k || n < 0)return 0;
	rep(i, 0, k) {
		ret *= (n - i);
		ret %= MOD;
	}
	if (ret < 0) ret = 0;
	return ret;
}

//134 B
int main(void) {
	ll n, d;
	cin >> n >> d;
	if(n % (2*d+1) == 0) cout << n / (2 * d + 1) << endl;
	else cout << n / (2 * d + 1) + 1 << endl;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<ll> a(3 * N);
  rep(i, 3 * N)
  {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  ll ans = 0;
  int count = 0;
  for (int i = N; i < 3 * N; i++)
  {
    if (count % 2 == 0)
    {
      ans += a[i];
    }
    count++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2560
#include <iostream>

using namespace std;

int main(void){
  int a,b,x;
  cin>>a>>b>>x;
  if(a > x){
    cout<<"NO"<<endl;
  } else if (a <= x && x <= a + b){
    cout<<"YES"<<endl;
  } else {
    cout<<"NO"<<endl;
  }
}


Measured memory_bytes: 256
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v):
    print(["Yes", "No"][not v])


# エントリーポイント
def main():
    N, R = input([int, 2])
    print(R if 10 <= N else R + (100 * (10 - N)))


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


Measured memory_bytes: 3692
n=int(input())
a=list(map(int,input().split()))
a.sort()
a=a[::-1]
a+=0,0,0
l=[]
i=0
c=0
while i<=n-1:
    if a[i]==a[i+1]==a[i+2]==a[i+3] and c==0:
        print(a[i]*a[i+1])
        break
    elif a[i]==a[i+1]==a[i+2]==a[i+3] and c==1:
        l.append(a[i])
        i=n
    elif a[i]==a[i+1]==a[i+2]:
        l.append(a[i])
        i+=3
        c+=1
    elif a[i]==a[i+1]:
        l.append(a[i])
        i+=2
        c+=1
    else:
        i+=1
    if c==2:
        i=n
else:
    if len(l)<=1:
        print(0)
    else:
        l.sort()
        l=l[::-1]
        print(l[0]*l[1])

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

using namespace std;
#define ll long long
#define stuff ios::sync_with_stdio(0);cin.tie(0)
#define INF 1e9+5

ll abso(ll x)
{
    return (x>0)?x:-1*x;
}

int main()
{
    stuff;
    ll n,k;
    cin>>n>>k;
    ll h[n],dp[n];

    for(ll i=0;i<n;i++)
        dp[i]=INF;

    for(ll i=0;i<n;i++)
        cin>>h[i];
    dp[0]=0;
    //cout<<"yes"<<dp[4]<<endl;
    for(ll i=0;i<n;++i)
    {
        for(ll j=i+1;j<=i+k;++j)
        {
            if(j<n)
            {
                dp[j]=min(dp[j],dp[i]+abso(h[i]-h[j]));
                //cout<<dp[j]<<endl;
            }
        }
    }
    cout<<dp[n-1]<<"\n";

    return 0;
}


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


#define ll long long
#define mod 1000000007


int solve(vector<int>& v,int n,int k){


    ll dp[n+2][k+2];

    for(int j=0;j<=k;j++){
        dp[1][j]=(j>v[1])?0:1;
    }

    for(int i=2;i<=n;i++){
       for(int j=0;j<=k;j++){
           if(j==0){
              dp[i][j]=dp[i-1][j];
           }
           else{
               dp[i][j]=( mod + dp[i][j-1]+dp[i-1][j]-((j-v[i]-1>=0)?dp[i-1][j-v[i]-1] :0))% mod;
           }
       }
    }
    return dp[n][k];
}




int main() {
  
  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif
  int n,k;
  cin>>n>>k;
  vector<int> v(n+1);
  for(int i=1;i<=n;i++){
    cin>>v[i];
  }
  cout<<solve(v,n,k);
  return 0;
}    

Measured memory_bytes: 81560
n, m = map(int, input().split())
step = [True] * n
r = [0,1]
MOD = 10**9 + 7
for _ in range(m):
    broken = int(input())
    step[broken - 1] = False
for i, tf in enumerate(step):
    if tf:
        r += [(r[i] + r[i+1]) % MOD]
    else:
        r += [0]
print(r[-1])

Measured memory_bytes: 13372
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn main() {
    let n : usize = get_one();
    let v : Vec<i32> = get_vec();
    let mut ans = true;
    for x in v {
        if x % 2 == 0 && x % 3 != 0 && x % 5 != 0 {
            //println!("{}", x);
            ans = false;
            break;
        }
    }
    println!("{}", if ans {"APPROVED"} else {"DENIED"});
}


Measured memory_bytes: 4352
//R<3S
#include <bits/stdc++.h>
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define hell 1000000007
#define PI 3.14159265358979323844
#define mp make_pair
#define pb push_back
#define fi first 
#define se second
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))  
#define REVERSE(v) reverse(ALL(v))
#define endl "\n"
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define initarr(a,n,x) for (int i=0;i<n;++i) a[i]=x
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define sz(a) (int)a.size()
#define sl(a) (int)a.length()
#define invect(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.pb(tmp);commands}
#define inset(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.insert(tmp);commands}
#define ll long long
#define ld long double 
#define pii std::pair<int, int> 
#define pll std::pair<ll, ll>  
#define vi vector<int>  
#define vvi vector<vi > 
#define vii vector<pii >
#define mii map<int,int>
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl


using namespace std;

void solve()
  {

    string s,temp;
    cin>>s;
    int q;
    cin>>q;
    int t,f;char c;int curr=0;
    deque<char> dq;
    rep(i,sz(s))dq.pb(s[i]);
    while(q--)
    {
      cin>>t;
      if(t==1)curr++;
      if(t==2)
      {
        cin>>f>>c;
        if(curr%2==0)
        {
          if(f==1)
          {
            dq.push_front(c);
          }
          else
          {
            dq.pb(c);
          }
        }
        else 
        {
          if(f==2)
          {
            dq.push_front(c);
          }
          else
          {
            dq.pb(c);
          }
        }
      }
    }
    string ans;
    while(!dq.empty()){
      ans += dq.front();
      dq.pop_front();
    }
    if(curr%2==0)cout<<ans;
    else{REVERSE(ans);cout<<ans;}

  }



int main()
{
   FAST
   // #ifndef ONLINE_JUDGE
   //   freopen("input.txt","r",stdin);
   //   freopen("output.txt","w",stdout);
   // #endif
   int t;
   t=1;
   //cin>>t;
   while(t--)
  {
      solve();
  }


   return 0;
}


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

int main() {
    int N,M;
    cin >> N >> M;

    vector<int> v(2*M);
    for(int i=0;i<2*M;i++){
        cin >> v.at(i);
    }

    for(int i=0;i<N;i++){
        //iの数を数える
        int cnt=0;
        for(int j=0;j<2*M;j++){
            if(v.at(j) == i+1){
                cnt++;
            }
        }
        cout << cnt << endl;
    }

}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	D = inputInt()
	C = inputList()
	S = []
	for i in range(D):
		s = inputList()
		S.append(s)

	ans1 = []
	ans2 = []
	for i in range(D):
		bestSco1 = 0
		bestSco2 = 0
		bestI1 = 1
		bestI2 = 1

		for j,val in enumerate(S[i]):
			if j == 0:
				tmpAns = ans1 + [j+1]
				tmpSco = findScore(tmpAns, S, C)
				if bestSco1 < tmpSco:
					bestSco2 = bestSco1
					bestI2 = bestI1
					bestSco1 = tmpSco
					bestI1 = j+1
			else:
				tmpAns1 = ans1 + [j+1]
				tmpAns2 = ans2 + [j+1]
				tmpSco1 = findScore(tmpAns1, S, C)
				tmpSco2 = findScore(tmpAns2, S, C)
				if bestSco1 < tmpSco1:
					bestSco2 = bestSco1
					bestI2 = bestI1
					bestSco1 = tmpSco1
					bestI1 = j+1
				if bestSco1 < tmpSco2:
					bestSco2 = bestSco1
					bestI2 = bestI1
					bestSco1 = tmpSco2
					bestI1 = j+1
		ans1.append(bestI1)
		ans2.append(bestI2)

	for i in ans1:
		print(i)


def findScore(ans, S, C):
	scezhu = [inf for i in range(26)]
	sco = 0
	for i,val in enumerate(ans):
		tmp = S[i][val-1]
		scezhu[val-1] = i
		mins = 0
		for j,vol in enumerate(C):
			if scezhu[j] == inf:
				mins = mins + (vol * (i+1))
			else:
				mins = mins + (vol * ((i+1)-(scezhu[j]+1)))
		tmp -= mins
		sco += tmp
	return sco

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


Measured memory_bytes: 85200
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] an = new int[100000+1];
        for (int i = 0; i < n; i++) {
            an[sc.nextInt()] += 1;
        }

        int max = 0;
        for (int i = 0; i < 100000+1-2; i++) {
            max = Math.max(max, an[i] + an[i+1] + an[i+2]);
        }

        System.out.println(max);
    }

}

Measured memory_bytes: 50460
package main

import "fmt"

func main() {
	// Code for A - Takahashikun, The Strider
	var X int
	fmt.Scanf("%d", &X)

	var k int = 1
	for {
		if (k*X)%360 == 0 {
			break
		}
		k++
	}
	fmt.Println(k)
}


Measured memory_bytes: 1832
# def f(n):
#     if n < 2:
#         return 1
#     else:
#         return n * f(n - 2)

# for i in range(2, 150, 2):
#     print(i, f(i))

N = int(input())

if N % 2 == 1:
    print(0)
    exit()

k = 10
cnt = 0
while k <= N:
    cnt += N // k
    k *= 5

print(cnt)


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

int main() 
{
    int x1,x2,x3,x4,x5;
    cin >> x1 >> x2 >> x3 >> x4 >> x5;
    if (x1 == 0) {
        cout << 1;
    }else if (x2 == 0){
        cout << 2;
    }else if (x3 == 0){
        cout << 3;
    }else if (x4 == 0){
        cout << 4;
    }else{
        cout << 5;
    }
    
}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll MOD=1e9+7;
const ll N=2e5+5;
const ld pi=3.14159265359;
const ll INF=(1LL<<63);
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(a) (ll)a.size()

ll ans;
string s;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>s;
	REP(i,SZ(s)/2){
		if(s[i]!=s[SZ(s)-i-1])ans++;
	}
	cout<<ans<<"\n";
	return 0;
}




Measured memory_bytes: 256
import java.util.*;
class Main{
    Scanner sc=new Scanner(System.in);
    void main(){
	double r=sc.nextDouble();
	double seki=r*r*3.1415926535897932;
	double syu=r*2*3.1415926535897932;
	System.out.printf("%.6f %.6f", seki,syu );
	System.out.println();
	
    }
    public static void main(String[]ag){
	new Main().main();
    }
}

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


int main() {
    int N; cin >> N;
    vector<int> bars(N); for (int i = 0; i < N; i++) cin >> bars[i];
    sort(bars.begin(), bars.end());

    int ans = 0;
    for (int i = 0; i < N - 2; i ++) {
        for (int j = i + 1; j < N - 1; j++) {
            for (int k = j + 1; k < N; k ++) {
                int first = bars[i];
                int second = bars[j];
                int third = bars[k];
                if (first + second <= third) break;
                ans ++;
            }
        }
    }

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


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>

using namespace std;

long long result = 0;
long long num[51];
long long pati[51];

void burger(int n, long long x)
{
	if (x >= num[n] - 1)
		result += pati[n];
	else if (x >= num[n - 1] + 3)
	{
		result += pati[n - 1];
		result++;
		burger(n - 1, x - num[n - 1] - 2);
	}
	else if (x == num[n - 1] + 2)
	{
		result += pati[--n];
		result++;
	}
	else if (x == num[n - 1] + 1)
	{
		result += pati[--n];
	}
	else if (x > 1)
	{
		burger(--n, --x);
	}
}

int main()
{
	int n;
	long long x;
	
	num[0] = 1;
	for (int i = 1; i < 51; i++)
		num[i] = num[i - 1] * 2 + 3;
	pati[0] = 1;
	for (int i = 1; i < 51; i++)
		pati[i] = pati[i - 1] * 2 + 1;

	cin >> n >> x;
	burger(n, x);
	printf("%lld", result);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string a;
	cin >> a;
	int w1 = a.find('C');
	int l = a.size();
	int k = 0;
    if(w1 != -1)
	    {
	    	for(int i = w1;i < l;i++)
	    	    {
	    	    	if(a[i] == 'F')
						{
							cout << "Yes" << endl;
							return 0; 
						}
				}
		} 
	cout << "No" << endl; 
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <map>
#include <queue>
using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

int n, m, u, v;
int a[100050], fa[100050], pos[100050];

int find(int x){
	if(fa[x] == x) return x;
	else return fa[x] = find(fa[x]);
}
 
int main(){
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= n; i ++){
		scanf("%d", &a[i]);
		fa[i] = i;
	}
	for(int i = 1; i <= m; i ++){
		int u, v;
		scanf("%d %d", &u, &v);
		fa[find(u)] = find(v);
	}
	int res = 0;
	for(int i = 1; i <= n; i++){
		if(find(i) == find(a[i])) res++;
	}
	printf("%d\n", res);
	return 0;
}


Measured memory_bytes: 1024
answer = [1, 9, 30, 76, 141, 267, 400, 624, 885, 1249, 1590, 2208, 2689, 3411, 4248, 5248, 6081, 7485, 8530, 10248, 11889, 13687, 15228, 17988, 20053, 22569, 25242, 28588, 31053, 35463, 38284, 42540, 46581, 50893, 55362, 61824, 65857, 71247, 76884, 84388, 89349, 97881, 103342, 111528, 120141, 128047, 134580, 146316, 154177, 164817, 174438, 185836, 194157, 207927, 218812, 233268, 245277, 257857, 268182, 288216, 299257, 313635, 330204, 347836, 362973, 383709, 397042, 416448, 434025, 456967, 471948, 499740, 515581, 536073, 559758, 583960, 604833, 633651, 652216, 683712, 709065, 734233, 754734, 793188, 818917, 846603, 874512, 909496, 933081, 977145, 1006126, 1041504, 1073385, 1106467, 1138536, 1187112, 1215145, 1255101, 1295142, 1342852, 1373253, 1422195, 1453816, 1502376, 1553361, 1595437, 1629570, 1691292, 1726717, 1782111, 1827492, 1887772, 1925853, 1986837, 2033674, 2089776, 2145333, 2197483, 2246640, 2332104, 2379085, 2434833, 2490534, 2554600, 2609625, 2693919, 2742052, 2813988, 2875245, 2952085, 3003306, 3096024, 3157249, 3224511, 3306240, 3388576, 3444609, 3533637, 3591322, 3693924, 3767085, 3842623, 3912324, 4027884, 4102093, 4181949, 4270422, 4361548, 4427853, 4548003, 4616104, 4718640, 4812789, 4918561, 5003286, 5131848, 5205481, 5299011, 5392008, 5521384, 5610705, 5739009, 5818390, 5930196, 6052893, 6156139, 6239472, 6402720, 6493681, 6623853, 6741078, 6864016, 6953457, 7094451, 7215016, 7359936, 7475145, 7593865, 7689630, 7886244, 7984165, 8130747, 8253888, 8403448, 8523897, 8684853, 8802826, 8949612, 9105537, 9267595, 9376656, 9574704, 9686065, 9827097, 9997134, 10174780, 10290813, 10493367, 10611772, 10813692]
n = int(input())
print(answer[n - 1])

Measured memory_bytes: 9388
import sys
input=lambda: sys.stdin.readline().rstrip()
x=int(input())
A=[int(i) for i in range(201)]
Ans=[]
for a in A:
  for b in A:
    if a**5+b**5==x and not Ans:
      Ans=[a,-b]
    if a**5-b**5==x and not Ans:
      Ans=[a,b]
print(*Ans)


Measured memory_bytes: 9116
S = list(input())
size = len(S)

sum = []
for i in range(size):
    if S[i] == 'B':
        sum.append(1)
    else:
    	sum.append(0)
    
    if not i == 0:
        sum[i] += sum[i - 1]

count = 0
for i in range(size):
    if (S[i] == 'W'):
        count += sum[i]

print(count)

Measured memory_bytes: 12836
# coding: utf-8
# Your code here!
H,N=map(int,input().split())

cost=[]
for _ in range(N):
    A,B=map(int,input().split())
    cost.append([A/B,A,B])
"""
mx=0
mi=10**12
ind=-1
for index,item in enumerate(cost):
    mx=max(mx,item[0])
    if mx==item[0] and mi>item[1]:
        ind=index

ans=0
temp=cost[ind][1]
ans+=H//(temp)*cost[ind][2]

H-=temp*(H//temp-1)
"""

dp=[10**12]*H
dp[0]=0
sans=10**12
for item in cost:
    for i in range(len(dp)):
        if dp[i]!=10**12:
            if i+item[1]>=H:
                sans=min(sans,dp[i]+item[2])
            else:
                dp[i+item[1]]=min(item[2]+dp[i],dp[i+item[1]])
    
print(sans)
    



Measured memory_bytes: 42348
#include <bits/stdc++.h>
using namespace std;
#define PUTS(x) cout << (x) << endl;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)

struct Node {
    int parentIndex = -1; // -1 は根を表す
    int componentSize = 1; // 各木の根の場合に連結成分サイズ情報を保持
    int friendCount = 0; // 直接の友達の個数
    int ans = 0;
};

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    auto nodes = vector<Node>(n);

    // Union-Find で根ノートを見つけながら指し直す
    function<int(const int)> rootIndex = [&](const int targetIndex) {
        auto &targetNode = nodes[targetIndex];
        auto parentIndex = targetNode.parentIndex;
        if (parentIndex == -1) { // これが根ノードの場合
            return targetIndex;
        } else { // 親ノードがある場合
            auto result = rootIndex(parentIndex);
            targetNode.parentIndex = result; // 根の直属の子として挿し直す
            return result;
        }
    };

    // 友達関係の処理
    rep(i, m) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        nodes[x].friendCount++;
        nodes[y].friendCount++;
        auto rx = rootIndex(x);
        auto ry = rootIndex(y);
        if (rx != ry) { // xとyが異なる木に属するとき
            auto originalSizeX = nodes[rx].componentSize; // 連結前のxの属する連結成分の大きさ
            nodes[rx].parentIndex = ry; // xの属する木の根を，yの属する木の根の直属の子とする
            nodes[ry].componentSize += originalSizeX; // yの属する木の根に書き込まれたサイズ情報を更新
        }
    }

    // 各ノードについて，「友達の友達」の個数を数える
    rep(i, n) {
        // 自分が属する連結成分の大きさから，自分自身と直接の友達の数を引く
        nodes[i].ans = nodes[rootIndex(i)].componentSize - 1 - nodes[i].friendCount;
    }

    // ブロック関係の処理
    rep(i, k) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        auto rx = rootIndex(x);
        auto ry = rootIndex(y);
        if (rx == ry) { // xとyが同じ連結成分に属するときはそれぞれの答を減じる
            nodes[x].ans--;
            nodes[y].ans--;
        }
    }

    rep(i, n) {
        cout << nodes[i].ans << (i == n - 1 ? "\n" : " ");
    }
}


Measured memory_bytes: 3584
using System;
using System.Linq;
using System.Collections.Generic;
class c
{
    static void Main()
    {
        var hw = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var grid = new string[hw[0]];
        for (int i = 0; i < hw[0]; i++) grid[i] = Console.ReadLine();
        var skipH = new List<int>();
        var skipW = new List<int>();
        for (int i = 0; i < hw[0]; i++)
        {
            if (!grid[i].Contains('#')) skipH.Add(i);
        }
        for (int i = 0; i < hw[1]; i++)
        {
            for (int j = 0; j < hw[0]; j++)
            {
                if (grid[j][i] == '#') break;
                else if (j == hw[0] - 1) skipW.Add(i);
            }
        }
        for (int i = 0; i < hw[0]; i++)
        {
            for (int j = 0; j < hw[1]; j++)
            {
                if (!skipH.Contains(i) && !skipW.Contains(j)) Console.Write(grid[i][j]);
            }
            if (!skipH.Contains(i)) Console.WriteLine();
        }
    }
}

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

using namespace std;

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

  if(s[0] == 'a' || s[0] == 'e' || s[0] == 'i' || s[0] == 'o' || s[0] == 'u') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<utility>
using namespace std;
pair<int,bool>a[1<<17];int n,m,x,y,c;
main()
{
	cin>>n>>m;for(int i=0;i<n;i++)a[i]=make_pair(1,!i);
	for(int i=0;i<m;i++)
	{
		cin>>x>>y;x--,y--;
		a[y].first++,a[x].first--;
		if(a[x].second)a[y].second=1;
		if(a[x].first==0)
		{
			a[x].second=0;
		}
	}
	for(int i=0;i<n;i++)c+=a[i].second;
	cout<<c<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const ll MOD2=998244353;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

const ll MX=200001;
ll fac[MX],inv[MX],finv[MX];
void COMinit(){
  fac[0]=fac[1]=1;
  inv[1]=1;
  finv[0]=finv[1]=1;
  FOR(i,2,MX){
    fac[i]=fac[i-1]*i%MOD2;
    inv[i]=(MOD2-inv[MOD2%i]*(MOD2/i)%MOD2)%MOD2;
    finv[i]=finv[i-1]*inv[i]%MOD2;
  }
}
ll powmod(ll x,ll y){
  if(y==0){
    return 1;
  }
  else if(y%2==0){
    ll t=powmod(x,y/2);
    return (t*t)%MOD2;
  }
  else{
    return powmod(x,y-1)*x%MOD2;
  }
}

ll choose(ll x,ll y){
  if(min(x,y)<0){
    return 0;
  }
  if(x<y){
    return 0;
  }
  else{
    return (fac[x]*finv[y])%MOD2*finv[x-y]%MOD2;
  }
}

int main() {
  COMinit();
  ll n,m,k;
  cin >> n >> m >> k;
  ll ans=0;
  rep(i,k+1){
    ans +=((choose(n-1,i)*m%MOD2)*powmod(m-1,n-1-i))%MOD2;
    ans %=MOD2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 8316
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
typedef long long int ll;
using namespace std;
using Graph = vector<vector<int> >;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int A,B;
cin>>A>>B;
int answer=-1;
if(A<10 && A>0 && B<10&& B>0){
    answer=A*B;
}
cout<<answer<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 892
import string

N = int(input())
S = list(input())
alphabet = list(string.ascii_uppercase)
ans = list()
for target in S:
	# アルファベットをN個ずらす
	# index out of rangeを防ぐために26で割ったあまりを求める
	ans.append(alphabet[(alphabet.index(target)+N)%26])
print(''.join(ans))

Measured memory_bytes: 3832
package main

import (
	"fmt"
)

func main() {
	var n string
	fmt.Scan(&n)
	ans := "Yes"
	switch{
	case n[0]=='7':
	case n[1]=='7':
	case n[2]=='7':
	default:
		ans = "No"
	}

	fmt.Println(ans)

}

Measured memory_bytes: 1756
#include <iostream>
#include <cstdio>
void N_to_k(int n,int k)
{
	int x,y;
	static int s;
	while(n)
	{
		x=n%k;
		++s;
		n/=k;
	}
	printf("%d",s);
}
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	N_to_k(n,k);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define INF 999999999
using namespace std;
int main() {
  int a, kai[31];
  kai[0] = 1;
  kai[1] = 1;
  kai[2] = 2;
  for (int i = 3; i < 31; i++) {
    kai[i] = kai[i - 1] + kai[i - 2] + kai[i - 3];
  }
  rep(i, 31) kai[i] = (kai[i] + 3649) / 3650;
  while (cin >> a, a)
    cout << kai[a] << endl;
  return 0;
}

Measured memory_bytes: 3016
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;

int main(){
    ll n,a,sum=0,mini=99999;
    cin>>n;
    lol(i,n){
	cin>>a;
	sum+=a;
	mini=min(mini,sum/(i+1));
    }
    cout<<mini<<endl;
    return 0;
}


Measured memory_bytes: 3124