akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define dbl double
#define forn(i,n,k) for(int i=0;i<n;i=i+k)
#define forpn(p,n,k) for(int i=p;i<n;i+=k)
#define for0(n) for(int i=0;i<n;i++)
#define for1(n) for(int i=1;i<=n;i++)
#define all(v) v.begin(),v.end()
using namespace std;
int no_of_bits(long long n)
{
    int count=0;
    while(n>0)
    {
        n=n>>1;
        count++;
    }
    return count;
}
long long gcd(int a,int b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}
bool isPrime(int n) {
    
    if (n == 1) {
        return false;
    }

    int i = 2;
  
    while (i*i <= n) {
        
        if (n % i == 0) {
            
            return false;
        }
        i += 1;
    }
    
    return true;
}
int main()
{   ios::sync_with_stdio(0);
    int t;
    // cin>>t;
    t=1;
    cin.tie(0);
    cout.tie(0);
    while(t--)
    {
        int n,k;
        cin>>n>>k;
        vector<int> v(n+1);
        vector<int> dp(n+1);
        for(int i=1;i<=n;i++){
            cin>>v[i];
        }
        // dp[1]=0;
        for(int i=2;i<=n;i++){dp[i]=dp[i-1]+abs(v[i-1]-v[i]);
            for(int j=1;j<=k;j++){
                if(j<i){
                    dp[i]=min(dp[i-j]+abs(v[i-j]-v[i]),dp[i]);
                }
                else break;
            }
        }
        cout<<dp[n]<<endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstring>
#include<stack>
using namespace std;

int w, h, xs, ys, xg, yg;
int mat[102][102];
int dx[4] = {-1, 0, 0, 1};
int dy[4] = {0, 1, -1, 0};

void init(){
    for(int i = 0; i < 102; i++){
        for(int j = 0; j < 102; j++){
            mat[i][j] = 0;
        }
    }
}

bool bfs(){
    if(mat[xs][ys] == 0 || mat[xg][yg] == 0)    return false;

    int c = mat[xs][ys];
    stack<pair<int,int>> s;
    s.push({xs,ys});
    bool visit[102][102] = {};
    
    while(!s.empty()){
        pair<int,int> now = s.top(); 
        s.pop();
        if(now.first == xg && now.second == yg){
            return true;
        }
        
        visit[now.first][now.second] = true;
        
        for(int i = 0; i < 4; i++){
            int nx = now.first + dx[i];
            int ny = now.second + dy[i];
            
            if(mat[nx][ny] == c && !visit[nx][ny]){
                s.push({nx,ny});
            }
        }
    }
    
    return false;
}


int main(){
    while(1){
        cin >> w >> h;
        if(w + h == 0)  break;
        cin >> ys >> xs >> yg >> xg;
        
        init();
        
        int n;
        cin >> n;
        
        int c, d, x, y;
        while(n-- > 0){
            cin >> c >> d >> y >> x;
            if(d == 0){
                for(int i = 0; i < 2; i++){
                    for(int j = 0; j < 4; j++){
                        mat[x+i][y+j] = c;
                    }
                }
            }else if(d == 1){
                for(int i = 0; i < 4; i++){
                    for(int j = 0; j < 2; j++){
                        mat[x+i][y+j] = c;
                    }
                }
            }
        }

        if(bfs())   cout << "OK" << endl;
        else        cout << "NG" << endl;
    }

    return 0;
}



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

using namespace std;

template<class T, class U>
void ckmin(T &a, U b)
{
	if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
	if (a < b) a = b;
}

#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
#define SZ(x) ((int) ((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define INF 1000000007
#define LLINF 2696969696969696969ll
#define MAXN 100013

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

int N;
ll MOD;
vi edge[MAXN];
ll dp[MAXN], dp1[MAXN];
//dp[x] = # of ways such that you are on

void dfs(int u, int p)
{
	for (int v : edge[u])
	{
		if (v == p) continue;
		dfs(v, u);
	}
	dp[u] = 1;
	for (int v : edge[u])
	{
		if (v == p) continue;
		dp[u] *= (dp[v] + 1); dp[u] %= MOD;
	}
	// cerr << u << ' ' << dp[u][0] << ' '  << dp[u][1] << endl;
}
void dfs1(int u, int p)
{
	vl pref(SZ(edge[u]) + 1), suf(SZ(edge[u]) + 1);
	pref[0] = 1;
	FOR(i, 0, SZ(edge[u]))
	{
		int v = edge[u][i];
		if (v == p)
		{
			pref[i + 1] = pref[i];
			continue;
		}
		pref[i + 1] = pref[i] * (dp[v] + 1); pref[i + 1] %= MOD;
	}
	suf[SZ(edge[u])] = 1;
	FORD(i, SZ(edge[u]), 0)
	{
		int v = edge[u][i];
		if (v == p)
		{
			suf[i] = suf[i + 1];
			continue;
		}
		suf[i] = suf[i + 1] * (dp[v] + 1); suf[i] %= MOD;
	}
	FOR(i, 0, SZ(edge[u]))
	{
		int v = edge[u][i];
		if (v == p) continue;
		dp1[v] = pref[i] * suf[i + 1] % MOD * (dp1[u] + 1) % MOD;
	}
	for (int v : edge[u])
	{
		if (v == p) continue;
		dfs1(v, u);
	}
}

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> N >> MOD;
	FOR(i, 0, N - 1)
	{
		int u, v; cin >> u >> v; u--; v--;
		edge[u].PB(v);
		edge[v].PB(u);
	}
	dfs(0, N);
	dfs1(0, N);
	cout << dp[0] << '\n';
	FOR(i, 1, N)
	{
		cout << dp[i] * (dp1[i] + 1) % MOD << '\n';
	}
	return 0;
}


Measured memory_bytes: 18560
#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 pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;
 
int main() {
    string ans="";
    int op[(1<<3)][3], a, b, c, d;
    cin >> a;
    d = a%10;a/=10;
    c = a%10;a/=10;
    b = a%10;a/=10;
    for(int bit = 0; bit < (1<<3); bit++){
        for(int i = 0; i < 3; i++){
            if(bit & (1<<i))op[bit][i] = 1;
            else op[bit][i]=-1; 
        }
        if(a+op[bit][0]*b+op[bit][1]*c+op[bit][2]*d == 7){
            ans += to_string(a);
            if(op[bit][0] == -1)ans+="-";
            else ans += "+";
            ans += to_string(b);
            if(op[bit][1] == -1)ans+="-";
            else ans += "+";
            ans += to_string(c);
            if(op[bit][2] == -1)ans+="-";
            else ans += "+";
            ans += to_string(d);
            ans += "=7";
            break;
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;


int gcd(int a,int b){
    if(b>0) return gcd(b,a%b);
    else return a;
    }
    
    int lcm(int a,int b){
    return ((a/gcd(a,b))*b);
    }
    
    int main(){
    // Here your code !
            int a,b;
    while(cin>>a>>b){

        cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
    }
}

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

using namespace std;

#define ll long long
#define pb push_back
#define F first
#define S second
#define make0(a) memset(a,0,sizeof(a))
#define make1(a) memset(a,-1,sizeof(a))
#define all(v) begin(v),end(v)
#define allr(v) v.rbegin(),v.rend()
#define pi pair <int,int>
#define pll pair <ll,ll>
#define fast_cin() ios_base::sync_with_stdio(0) 

const int mod = 1e9+7;

void print(int *A, int N)
{
	for(int i=0;i<N;i++)
		cerr << A[i] << " ";
	cerr << endl;
}

int main()
{
	// #ifdef ONLINE_JUDGE 
	// 	freopen("input.txt", "r", stdin); 
	// 	freopen("output.txt", "w", stdout); 
	// #endif

	fast_cin();
	int N;
	cin >> N;
	int A[N+1];
	for(int i=1;i<=N;i++)
		cin >> A[i];
	if(N%2 == 0)
	{

		for(int i=N; i>=1; i-=2)
			cout << A[i] << " ";
		for(int i=1;i<=N;i+=2)
			cout << A[i] << " ";


	}
	else
	{

		for(int i=N; i>=1; i-=2)
			cout << A[i] << ' ';
		for(int i=2;i <= N; i+=2)
			cout << A[i] << " ";

	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 2944
def main
  n = gets.chomp.to_i
  base_temp, ave_temp = gets.split.map(&:to_i)

  min_diff_idx = 0
  min_diff = 10**6
  gets.split.map(&:to_i).each_with_index do |h, i|
    # 各地点の平均気温
    a = base_temp - 0.006 * h
    # A℃とのDiff
    d = (a - ave_temp).abs

    # 最小差なら更新
    if d < min_diff
      min_diff = d
      min_diff_idx = i
    end
  end

  puts min_diff_idx + 1
end

if __FILE__ == $0
  main
end


Measured memory_bytes: 1788
#!/bin/bash
":" //#; docker run --rm -it -v "$(cd $(dirname $0) && pwd)":/vo:ro  node:5.2-slim /bin/bash -c "node /vo/$(basename $0) < /vo/g.inp"; exit $?

"use strict";
let main = (input) => {
    let n = Number.parseInt(input);
    let ans = ":(";
    for(let x=0; x<n+1; x++){
	if(Math.floor(x*1.08)===n) {
	    ans = x;
	    break;
	}
    }
    return ans;
};
console.log(main(require("fs").readFileSync("/dev/stdin", "utf-8").trim()));


Measured memory_bytes: 11596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
vector<int> edge[200005];
int main(){
    int n;
    cin>>n;
    for(int i=2;i<=n;i++){
        int x;cin>>x;
        edge[x].push_back(i);
    }
    for(int i=1;i<=n;i++){
        cout<<edge[i].size()<<endl;
    }
}   

Measured memory_bytes: 14528
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int s;
    cin>>s;
    std::deque<int> deq;
    deq.emplace_back(s);
    int i=1;
    while (1) {
        i++;
        int n=deq.back();
        if (n%2==0) {
            if (find(deq.begin(),deq.end(),n/2)!=deq.end()) {
                cout<<i<<endl;
                break;
            } else {
                deq.emplace_back(n/2);
            }
        } else {
            if (find(deq.begin(),deq.end(),3*n+1)!=deq.end()) {
                cout<<i<<endl;
                break;
            } else {
                deq.emplace_back(3*n+1);
            }
        }
    }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main
{

  final static int[] WEIGHT =
  { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 };

  public static void main(String[] args) throws NumberFormatException, IOException
  {
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    while (input.ready())
    {
      final int num = Integer.parseInt(input.readLine());

      System.out.println(solver(num));
    }

  }

  private static String solver(int num)
  {
    final char[] bitFlag = Integer.toBinaryString(num).toCharArray();
    StringBuilder ret = new StringBuilder();

    int count = 0;
    for (int i = bitFlag.length - 1; i >= 0; i--)
    {
      if (bitFlag[i] == '1')
      {
        ret.append(WEIGHT[count]);
        ret.append(" ");
      }
      count++;
    }
    return ret.toString().trim();
  }

}

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

using namespace std;


void solve(){
    char c; cin>>c;
    if(c>='A' && c<='Z') cout<<'A';
    else cout<<'a';
}


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

    // int T; cin>>T; while(T--)
        solve();
}

Measured memory_bytes: 3580
N = int(input())

A = [int(x) for x in input().split()]

bucket = [0 for _ in range(N)]

if N % 2 == 0:
	even = True
else:
	even = False

Not0 = True

for i in range(N):
	if even:
		if A[i] % 2 == 0:
			print(0)
			Not0 = False
			break
		else:
			if bucket[A[i]] == 2:
				print(0)
				Not0 = False
				break
			else:
				bucket[A[i]] += 1
	else:
		if A[i] % 2 == 1:
			print(0)
			Not0 = False
			break
		else:
			if bucket[A[i]] == 2:
				print(0)
				Not0 = False
				break
			else:
				bucket[A[i]] += 1

if Not0:
	if not even:
		if bucket[0] != 1:
			print(0)
			Not0 = False

if Not0:
	print(2 ** (N // 2) % (10 ** 9 + 7))

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

int main(){
    int H, W, K;
    cin >> H >> W >> K;

    int i,j;
    char c[H][W];
    for( i = 0; i < H; i++ ){
        for( j = 0; j < W; j++ ){
            cin >> c[i][j];
        }
    }

    int ibit, jbit;
    int count = 0;
    int ans = 0;
    for( ibit = 0; ibit < (1<<H); ibit++ ){
        for( jbit = 0; jbit < (1<<W); jbit++ ){
            count = 0;
            for( i = 0; i < H; i++ ){
                for( j = 0; j < W; j++ ){

                    if( ibit & (1<<i) && jbit & (1<<j) && c[i][j] == '#' ){
                        count += 1;
                    }

                }
            }
            if( count == K ) ans += 1;
        }
    }

    cout << ans << endl;

}


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

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

vector<vector<P>> G(100100, vector<P>());

void dfs(int f, vector<int> &dist){
	for(auto x:G[f]){
		if(dist[x.first] == inf){
			dist[x.first] = dist[f] + x.second;
			dfs(x.first, dist);
		}
	}
}

int main(){
	int N, M, l, r, d;
	cin >> N >> M;
	vector<tuple<int,int,int>> edge(M);
	rep(i,M){
		cin >> l >> r >> d;
		--r; --l;
		edge[i] = make_tuple(l, r, d);
		G[r].push_back(make_pair(l,-d));
		G[l].push_back(make_pair(r,d));
	}
	vector<int> dist(N,inf);
	rep(i,N){
		if(dist[i] == inf){dist[i] = 0; dfs(i, dist);}
	}
	bool ans = true;
	rep(i,M){
		if(dist[get<1>(edge[i])] - dist[get<0>(edge[i])] != get<2>(edge[i]))ans = false;
	}
	cout << ((ans) ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 17152
#include<cstring>
#include<iostream>
#include<string>
#include<vector>
#include<fstream>
#include<cmath>
#include<algorithm>
#define ll long long
using namespace std;
ll mmin=10000000000; 
ll mmax=-1;
int main()
{	
 	int i;
 	int n;
 	scanf("%d %d",&n,&i);
	cout<<n-i+1<<endl;
}


Measured memory_bytes: 256
#ifdef DBG1
  #define LOCAL
#endif

#ifdef LOCAL
  #define _GLIBCXX_DEBUG
#endif

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#ifdef DBG1
    #define dbg(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dbg(...)
#endif

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;

void dfs(int x, int y, int n, const vector<pii> &dirs, vector<vector<bool>> &exist, vector<pii> & c0, vector<pii> &c1) {
  if (0 <= x && x < n && 0 <= y && y < n && exist[x][y]) {
    exist[x][y] = false;
    c0.push_back(pii(x, y));
    for (auto & dir : dirs) {
      int x1 = x + dir.first;
      int y1 = y + dir.second;
      dfs(x1, y1, n, dirs, exist, c1, c0);
    }
  }
}

vector<vector<bool>> build(vector<vector<bool>> exist, int d) {
  vector<pii> dir;
  int n = int(exist.size());
  for (int x = 0, y = n; x <= n; ++x) {
    while (y > 0 && x * x + y * y > d) { --y; }
    if (x * x + y * y == d) {
      dir.push_back(pii(x, y));
      if (x != 0) {
        dir.push_back(pii(-x, y));
      }
      if (y != 0) {
        dir.push_back(pii(x, -y));
      }
      if (x != 0 && y != 0) {
        dir.push_back(pii(-x, -y));
      }
    }
  }

  for (auto & d : dir) {
    //dbg("%d %d\n", d.first, d.second);
  }

  vector<vector<bool>> res(n, vector<bool>(n, false));
  for (int x = 0; x < n; ++x) {
    for (int y = 0; y < n; ++y) {
      if (!exist[x][y]) { continue; }
      vector<pii> c0, c1;
      dfs(x, y, n, dir, exist, c0, c1);
      if (c0.size() < c1.size()) {
        c0.swap(c1);
      }
      for (auto & p : c0) {
        res[p.first][p.second] = true;
      }
    }
  }
  return res;
}

bool solve() {
  int n, d1, d2;
  if (scanf("%d%d%d", &n, &d1, &d2) != 3) { return false; }
  vector<vector<bool>> exist(2 * n, vector<bool>(2 * n, true));
  exist = build(exist, d1);
  exist = build(exist, d2);
  int cnt = 0;
  for (int i = 0; i < 2 * n; ++i) {
    for (int j = 0; j < 2 * n; ++j) {
      if (exist[i][j] && cnt < n * n) {
        printf("%d %d\n", i, j);
        cnt++;
      }
    }
  }
  return true;  
}

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

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

int main()
{
  int n;
  cin>>n;
  int a[4]={0};
  
  string s;
  for(int i=0;i<n;i++)
  {
    cin>>s;
   if(s=="AC")
     a[0]++;
   else if(s=="WA")
     a[1]++;
   else if(s=="TLE")
     a[2]++;
   else if(s=="RE")
     a[3]++;  
  }
  cout<<"AC x "<<a[0]<<endl;
  cout<<"WA x "<<a[1]<<endl;
  cout<<"TLE x "<<a[2]<<endl;
  cout<<"RE x "<<a[3]<<endl;
  
  return 0;
}  

Measured memory_bytes: 3616
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = [0]
D = [0]

for i in range(N):
    s = B[i] - A[i]
    if(s > 0):
        C.append(s)
    elif(s < 0):
        D.append(s)

D = sorted(D)

csum = sum(C)
dsum = sum(D)

if(csum + dsum > 0):
    print(-1)
elif(csum == 0):
    print(0)
else:
    ans = len(C) -1
    for i in D:
        csum += i
        ans += 1
        if(csum <= 0):
            break
    print(ans)

Measured memory_bytes: 19068
#include<iostream>
#include<algorithm>
using namespace std;
int t, card[9];

bool is_same_number(int a, int b, int c) {
    if (a == b && b == c) {
        return true;
    }
    return false;
}
bool is_sequence(int a, int b, int c) {
    if (a + 2 == b + 1 && b + 1 == c) {
        return true;
    }
    return false;
}
bool is_good_set(int a, int b, int c) {
    return is_same_number(a, b, c) || is_sequence(a, b, c);
}
bool is_all_good_set() {
    return is_good_set(card[0], card[1], card[2]) && is_good_set(card[3], card[4], card[5])
    && is_good_set(card[6], card[7], card[8]);
}
int win() {
    sort(card, card + 9);
    do {
        if (is_all_good_set()) {
            return 1;
        }
    } while (next_permutation(card, card + 9));
    return 0;
}
int main() {
    cin >> t;
    for (int tt = 0; tt < t; ++tt) {
        for (int i = 0; i < 9; ++i) {
            cin >> card[i];
        }
        char color;
        for (int i = 0; i < 9; ++i) {
            cin >> color;
            if (color == 'G') {
                card[i] += 10;
            } else if (color == 'B') {
                card[i] += 20;
            }
        }
        cout << win() << endl;
    }
    return 0;
}



Measured memory_bytes: 3148
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  int n; cin >> n;
  int h[n];
  REP(i,n) cin >> h[i];
  int max_h = h[0];
  int ans = 1;
  for(int i = 1; i <= n-1; i++){
    if(h[i]>=max_h){
      ans++;
    }
    max_h = max(max_h,h[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	ll ans=1LL;
	cin >>n;
	ll bef;
	rep(i,n){
		cin>>bef;
		ans*=bef/__gcd(ans,bef);
	}
	cout<<ans<<endl;
}

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n;
  cin >> n;
  ll sq = sqrt(n);
  sq++;
  ll ans = 0ll;
  ll mn=0;
  REP(i,sq){
    ll m = i+1ll;
    if(n/m==n%m) {
      ans += m;
      mn = n/m;
    }
  }
  if(mn==0) mn = n/sq+1;
  REP(i,mn-1){
    ll k = i+1;
    ll m = (n-k)/k;
    if(n/m==n%m) {
      ans += m;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<ll, ll>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

/* -- template -- */

int main() {
    int K;
    cin >> K;
    queue<ll>Q;
    rep(i, 9)
        Q.push(i + 1);
    int cnt = 0;
    while(!Q.empty()) {
        ll q_front = Q.front();Q.pop();
        ll q = q_front % 10;
        if(q != 0)Q.push(q_front * 10 + q - 1);
        Q.push(q_front * 10 + q);
        if(q != 9)Q.push(q_front * 10 + q + 1);
        ++cnt;
        if(cnt == K) {
            cout << q_front << endl;
            return 0;
        }
    }
    return 0;
}


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

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, num;
  cin >> a >> b;
  num = a + b;
  if (num < 10) {
    cout << num << endl;
  } else {
    cout << "error" << endl;
  }
  return 0;
}


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

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

bool dp[2][5001][5001] = {};
int ac[5001][5002] = {};

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

    int N, K;
    cin >> N >> K;

    vector<long long> a(N);
    for (int i=0; i<N; ++i) cin >> a[i];

    if (accumulate(a.begin(), a.end(), 0LL) < (long long)K) {
        cout << N << endl;
        return 0;
    }

    dp[0][0][0] = true;
    dp[1][N][0] = true;
    for (int i=0; i<N; ++i) {
        for (int j=0; j<=K; ++j) {
            dp[0][i+1][j] |= dp[0][i][j];
            if (j+a[i] <= K) {
                dp[0][i+1][j+a[i]] |= dp[0][i][j];
            }

            dp[1][N-i-1][j] |= dp[1][N-i][j];
            if (j+a[N-1-i] <= K) {
                dp[1][N-i-1][j+a[N-1-i]] |= dp[1][N-i][j];
            }
        }
    }

    for (int i=0; i<=N; ++i) {
        ac[i][0] = 0;
        for (int j=0; j<=K; ++j) {
            ac[i][j+1] = ac[i][j] + (dp[0][i][j] ? 1 : 0);
        }
    }

    int need = 0;
    for (int i=0; i<N; ++i) {
        if (K <= a[i]) {
            need ++;
            continue;
        }
        for (int j=0; j<=K; ++j) {
            if ( ! dp[1][i+1][j]) continue;
            
            // [K-a[i]-j, K-j)
            int cnt = ac[i][K-j] - ac[i][max(0LL, K-a[i]-j)];
            if (cnt > 0) {
                need ++;
                break;
            }
        }
    }

    cout << N - need << endl;

    return 0;
}

Measured memory_bytes: 146816
import itertools
s = input()
ans = len(s)
a = 0
for key,group in itertools.groupby(s):
  b = len(list(group))
  if key=="S":
    a += b
  elif key=="T":
    if a<=b:
      ans -= a*2
      a = 0
    else:
      ans -= b*2
      a = a-b
print(ans)

Measured memory_bytes: 42460
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define sidha(i,a,b) for(int i=a;i<b;i++)
#define vi vector<int> 
#define pb push_back

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
	int n;cin>>n;
	if(n>=30) 
		cout<<"Yes";
	else	
		cout<<"No";
	return 0;
}

Measured memory_bytes: 3604
#include<iostream>

using namespace std;

int main() {
	int b[3];
	cin >> b[0] >> b[1] >> b[2];
	if (b[0] + b[1] * 2 + b[2] * 3 >= 3)cout << "Open" << endl;
	else cout << "Close" << endl;
	return 0;
}

Measured memory_bytes: 3084
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Iterator;

public class Main {
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.loadAdjList();
		g.printAdjMatrix();
	}
}

class Graph {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	public Graph() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1;
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}
	public void printAdjMatrix() {
		Integer[][] adjMatrix = new Integer[totalVertex][totalVertex];
		//complete the following
		for (int i = 0; i < totalVertex; i++) {
			for (int j = 0; j< totalVertex; j++) {
				if (adjList.get(i).contains(j)) {
					adjMatrix[i][j] = 1;
				}else {
					adjMatrix[i][j] = 0;				
				}
				if (j == totalVertex - 1) {
					System.out.println(adjMatrix[i][j]);
					
				}else {
					System.out.print(adjMatrix[i][j] + " ");
				}
			//System.out.println("\n");
			}
		}
	}
}





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

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

const int INF = 1e9;
const int mod = 1e9+7;

int main()
{
    int n,a;
    cin >> n;
    int flag = 0;
    for(int i = 0; i < n; i++){
        cin >> a;
        if(a % 2 == 1) flag = 1;
    }
    cout << (flag ? "first" : "second") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main() 
  { 
  long long int n,sum=0;
  cin>>n;
  for(long long int i=1;i<=n;i++)
    {
    if(i%3!=0 && i%5!=0)
      {
      sum+=i;
      }
    }
  cout<<sum<<endl;
  
  return 0;
  }

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			long n = scanner.nextLong();
			int sqrt = (int) Math.sqrt(n);
			for (int i = sqrt; i >= 1; i--) {
				if ((n % i) == 0) {
					System.out.println(f(i, n / i));
					return;
				}
			}
		}
	}

	/**
	 * @param a
	 * @param b
	 * @return aとbの10進数の最大桁数
	 */
	private static int f(long a, long b) {
		return Math.max(String.valueOf(a).length(), String.valueOf(b).length());
	}
}


Measured memory_bytes: 22356
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  cin >> n;

  vector<int> a(n);
  REP(i,n) cin >> a[i];
  
  sort(a.begin(),a.end());

  cout << a[n/2]-a[n/2-1] << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,m;
  cin>>n>>m;
  ll step=m*1900+(n-m)*100;
  cout<<step*(1<<m)<<endl;

  return 0;

}


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

struct UnionFind {
  int *data;
  UnionFind(int *_data, int size) : data(_data) {
    for(int i = 0; i < size; i++) data[i] = -1;
  }
  bool unionSet(int x, int y) {
    x = find(x); y = find(y);
    if (x != y) {
      if (data[y] < data[x]) std::swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  int find(int x) {
    return data[x] < 0 ? x : data[x] = find(data[x]);
  }
  int size(int x) {
    return -data[find(x)];
  }
};

int main(int argc, char *argv[])
{
  for(;;) {
    int n;
    cin >> n;
    if(n == 0) break;
    vector<vector<int>> ps;
    vector<int> xss;
    vector<int> yss;
    {
      vector<int> xs;
      vector<int> ys;
      for(int i = 0; i < n; i++) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        ps.push_back({a,d,c,b});
        xs.push_back(a);
        ys.push_back(b);
        xs.push_back(c);
        ys.push_back(d);
      }
      xs.push_back(-1);
      xs.push_back(1000001);
      ys.push_back(-1);
      ys.push_back(1000001);
      sort(xs.begin(), xs.end());
      sort(ys.begin(), ys.end());
      unique_copy(xs.begin(), xs.end(), back_inserter(xss));
      unique_copy(ys.begin(), ys.end(), back_inserter(yss));
    }
    int nx = xss.size()-1;
    int ny = yss.size()-1;
    vector<vector<long long>> rs(ny, vector<long long>(nx, 0L));
    // fill the rectangles!
    for(int i = n - 1; i >= 0; i--) {
      for(int j = 0; j < ny; j++) {
        const int y = yss[j];
        if(ps[i][1] <= y && y < ps[i][3]) {
          for(int k = 0; k < nx; k++) {
            const int x = xss[k];
            if(ps[i][0] <= x && x < ps[i][2]) {
              rs[j][k] |= (1L << i);
            }
          }
        }
      }
    }
    // let's count the number of regions!
    vector<int> ufdata(ny * nx);
    UnionFind uf(&(ufdata[0]), ny * nx);
    for(int j = 0; j < ny; j++) {
      for(int k = 0; k < nx; k++) {
        if(j > 0 && rs[j][k] == rs[j-1][k]) uf.unionSet(j * nx + k, (j-1) * nx + k);
        if(k > 0 && rs[j][k] == rs[j][k-1]) uf.unionSet(j * nx + k, j * nx + (k-1));
      }
    }
    int cnt = 0;
    for(int j = 0; j < ny; j++) {
      for(int k = 0; k < nx; k++) {
        int id = j * nx + k;
        if(uf.find(id) == id) cnt++;
      }
    }
    cout << cnt << endl;
  }
  return 0;
}

  



Measured memory_bytes: 3292
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll h,n,p;
	cin>>h>>n;
	ll sum=0;
	for(ll i=0;i<n;i++){
		cin>>p;
		sum+=p;
	}
	if(h-sum<=0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
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 main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<ll> sum(n+1,0),a(n);
    rep(i,n)cin>>a[i];
    rep(i,n){
        sum[i+1]=sum[i]+a[i];
        sum[i+1]%=MOD;
    }
    ll ans=0;
    for(int i=1;i<n;i++){
        ans+=a[i]*sum[i];
        ans%=MOD;
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 6328
#include <algorithm>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    vector<int> V{ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
    int k;
    cin >> k;
    cout << V[k-1] << endl;


}

















Measured memory_bytes: 256
pub struct Scanner {
    line: Vec<String>,
    idx: usize,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        return Scanner {
            line: vec![],
            idx: 0,
        };
    }
    fn next<T: std::str::FromStr>(&mut self) -> T {
        if self.idx == self.line.len() {
            let mut buffer = String::new();
            std::io::stdin().read_line(&mut buffer).ok();
            let a: Vec<&str> = buffer.trim().split(' ').collect();
            self.line = a.iter().map(|&s| String::from(s)).collect();
            self.idx = 0;
        }
        let ret: T = self.line[self.idx].parse::<T>().ok().expect("Parse error.");
        self.idx += 1;
        ret
    }
    fn next_string(&mut self) -> Vec<char> {
        let s: String = self.next();
        return s.chars().collect::<Vec<char>>();
    }
    fn next_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        let mut v: Vec<T> = Vec::with_capacity(n);
        for _i in 0..n {
            v.push(self.next());
        }
        v
    }
}

fn main(){
    let mut scan = Scanner::new();
    let r:f64 = scan.next();
    println!("{}", 2.0 * r * std::f64::consts::PI);
}


Measured memory_bytes: 2196
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final String dance = scanner.nextLine();

        boolean easy = true;
        for (int i = 0; i < dance.length(); i++) {
            final char c = dance.charAt(i);
            if (i % 2 == 0) {
                easy &= (c != 'L');
            } else {
                easy &= (c != 'R');
            }
        }

        System.out.println(easy ? "Yes" : "No");
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define agewari(a, b) ((ll)a + ((ll)b - 1)) / b
const int MOD = 1000000007;
const long long INF = 1LL << 60;
using Graph = vector<vector<ll>>;

int main()
{
    ll n,k;
    string s;
    cin>>n>>s>>k;
    k--;
    char tmp=s[k];
    rep(i,n){
        if(s[i]!=tmp)s[i]='*';
    }
    cout<<s<<endl;
}

Measured memory_bytes: 3616
MOD = 998244353


def convolution(a, b):
    def butterfly(arr):
        n = len(arr)
        h = (n - 1).bit_length()
        sum_e = (911660635, 509520358, 369330050, 332049552, 983190778, 123842337, 238493703, 975955924, 603855026, 856644456, 131300601,
                 842657263, 730768835, 942482514, 806263778, 151565301, 510815449, 503497456, 743006876, 741047443, 56250497, 0, 0, 0, 0, 0, 0, 0, 0, 0)
        for ph in range(1, h + 1):
            w = 1 << (ph - 1)
            p = 1 << (h - ph)
            now = 1
            for s in range(w):
                offset = s << (h - ph + 1)
                for i in range(p):
                    l = arr[i + offset]
                    r = arr[i + offset + p] * now
                    arr[i + offset] = (l + r) % MOD
                    arr[i + offset + p] = (l - r) % MOD
                now *= sum_e[(~s & -~s).bit_length() - 1]
                now %= MOD

    def butterfly_inv(arr):
        n = len(arr)
        h = (n - 1).bit_length()
        sum_ie = (86583718, 372528824, 373294451, 645684063, 112220581, 692852209, 155456985, 797128860, 90816748, 860285882, 927414960, 354738543,
                  109331171, 293255632, 535113200, 308540755, 121186627, 608385704, 438932459, 359477183, 824071951, 0, 0, 0, 0, 0, 0, 0, 0, 0)
        for ph in range(1, h + 1)[::-1]:
            w = 1 << (ph - 1)
            p = 1 << (h - ph)
            inow = 1
            for s in range(w):
                offset = s << (h - ph + 1)
                for i in range(p):
                    l = arr[i + offset]
                    r = arr[i + offset + p]
                    arr[i + offset] = (l + r) % MOD
                    arr[i + offset + p] = (MOD + l - r) * inow % MOD
                inow *= sum_ie[(~s & -~s).bit_length() - 1]
                inow %= MOD

    n = len(a)
    m = len(b)
    if not n or not m:
        return []
    if min(n, m) <= 50:
        if n < m:
            n, m = m, n
            a, b = b, a
        res = [0] * (n + m - 1)
        for i in range(n):
            for j in range(m):
                res[i + j] += a[i] * b[j]
                res[i + j] %= MOD
        return res
    z = 1 << (n + m - 2).bit_length()
    a += [0] * (z - n)
    b += [0] * (z - m)
    butterfly(a)
    butterfly(b)
    for i in range(z):
        a[i] *= b[i]
        a[i] %= MOD
    butterfly_inv(a)
    a = a[:n + m - 1]
    iz = pow(z, MOD - 2, MOD)
    for i in range(n + m - 1):
        a[i] *= iz
        a[i] %= MOD
    return a


def atcoder_practice2_f():
    import sys
    input = sys.stdin.buffer.readline

    N, M = map(int, input().split())
    A = [int(x) for x in input().split()]
    B = [int(x) for x in input().split()]

    print(*convolution(A, B))


if __name__ == "__main__":
    atcoder_practice2_f()


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

using namespace std;

#define sp << " " <<

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    long long a[n],b[n];
    for(int i=0;i<n;i++)
    {
        cin >> a[i] >> b[i];
    }
    pair <long long,int> dp[n];
    for(int i=0;i<n;i++)
    {
        dp[i].first=a[i]+b[i];
        dp[i].second=i;
    }
    sort(dp,dp+n,greater<pair<long long,int>>());
    long long d=0,p=0;
    for(int i=0;i<n;i++)
    {
        if(i%2==0)
        {
            d+=a[dp[i].second];
        }
        else
        {
            p+=b[dp[i].second];
        }
    }
    cout << d-p;
    return 0;
}


Measured memory_bytes: 3328
import itertools

N = input()

if len(N)<=2:
    print(0)
    exit()
product_list = []
for i in range(3,len(N)+1):
    product_list += list(itertools.product('753',repeat=i))
#print(product_list)
res = 0

for i in product_list:
    num = ''.join(list(i))
    if int(N) < int(num):
        continue
    if num.count('5')>0 and num.count('7')>0 and num.count('3')>0:
        res += 1
print(res)
    

Measured memory_bytes: 12384
import sys
import math

S = input()
N = len(S)-1
ans = 0
for i in range(2 ** N):
    s = S[0]
    for j in range(N):
        if ((i >> j) & 1):
            s += "+"
        s += S[j+1]

    ans += eval(s)

print(ans)


Measured memory_bytes: 3060
/* Problem Description:

*/

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;

#define REP(i,a,b) for (int i = (a); i < (b); i++)
#define RREP(i,a,b) for (int i = (a); i > (b); i--)
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define TRvi(it, c) for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define inf 0x3f3f3f3f
#define EPS 1e-10
#define PI acos(-1.0)
#define scan(x) scanf("%d",x)
#define ll long long
#define mp make_pair
#define pb push_back
#define sqr(x) ((x)*(x))
#define LSOne(x) x&(-x)
#define debug(x) cout << #x << " " << x << endl;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
   //  freopen("in" , "r" , stdin);
   //  freopen("out" , "w" , stdout);
    #endif
    int n, k;
    cin >> n >> k;
    int height[n];
    for (int i = 0; i < n; i++){
      cin >> height[i];
    }

    vector<int> dp(n+1, inf);
    dp[0] = 0;
    for (int i = 0; i < n; i++){
      for (int j = i+1; j <= i+k; j++)
        if (j < n)
          dp[j] = min(dp[j],dp[i]+abs(height[i]-height[j]));
    }

    cout << dp[n-1] << endl;
    return 0;
 }


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <map>
using namespace std;

int main() {
    int N;
    int F[111][11];
    int P[111][11];

   cin >> N;
   for (int i = 0; i < N; i++) {
      for (int j = 0; j < 10; j++) {
         cin >> F[i][j];
      }
   }
   for (int i = 0; i < N; i++) {
      for (int j = 0; j < 11; j++) {
         cin >> P[i][j];
      }
   }

    long long res = -1e15;
    for(int bit = 1; bit < (1<<10);bit++){
        long long profit = 0;
        for(int i = 0; i<N; i++){
            int cnt = 0;
            for(int j=0; j<10; j++){
                if(1 & (bit >> j) && F[i][j]){
                    cnt++;
                }
            }
            profit += P[i][cnt];
        }
        res = max(res, profit);;
    }

    cout << res << endl;
}


Measured memory_bytes: 256
mat = [list(map(int, input().split())) for _ in range(3)]
d = {}
for idx, i in enumerate(mat):
    for idx2, j in enumerate(i):
        d[j] = [idx, idx2]

n = int(input())
mat2 = [[0]*3 for _ in range(3)]

for _ in range(n):
    b = int(input())
    if d.get(b) is None:
        pass
    else:
        i, j = d.get(b)
        mat2[i][j] = 1
        if sum([mat2[i][di] for di in range(3)])== 3:
            print('Yes')
            exit()
        
        if sum([mat2[di][j] for di in range(3)])== 3:
            print('Yes')
            exit()
        
        if sum([mat2[di][di] for di in range(3)])==3:
            print('Yes')
            exit()
        
        if mat2[2][0] + mat2[1][1] + mat2[0][2] == 3:
            print('Yes')
            exit()

print('No')

Measured memory_bytes: 3192
aList = [int(input().strip())]
while(True):
    aList.append(aList[-1] // 2 if aList[-1] % 2 == 0 else 3*aList[-1] + 1)
    if(aList.index(aList[-1]) != len(aList) - 1):
        break
print(len(aList))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,m,c,b,e;
    cin>>n;
    long long a[n];
    for(long long i=0;i<n;i++){
        cin>>a[i];
    }
    cin>>m;
    for(long long i=0;i<m;i++){
        cin>>c>>b>>e;
        if(c==0){
            cout<<*min_element(a+b,a+e)<<endl;
        }
        else{
            cout<<*max_element(a+b,a+e)<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3120
import bisect

N = int(input())
A = sorted([int(i) for i in input().split()])
B = sorted([int(i) for i in input().split()])
C = sorted([int(i) for i in input().split()])

ans = 0

for i in B:
    ans += (bisect.bisect_left(A, i)) * (N-bisect.bisect_right(C, i))
print(ans)

Measured memory_bytes: 23244