akhauriyash/Code-Regression huggingface dataset:
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T>
struct Edge {
	int to;
	T cost;
	Edge() {}
	Edge(int to, T cost) : to(to), cost(cost) {}
	bool operator>(const Edge &r) const { return this->cost > r.cost; }
};

template<class T>
vector<T> Dijkstra(const vector<vector<Edge<T>>> &edges, const int st) {

	const int V = (int)edges.size();
	const T inf = numeric_limits<T>::max() / 2;
	vector<T> cost(V, inf);
	cost[st] = 0;

	priority_queue<Edge<T>, vector<Edge<T>>, greater<Edge<T>>> pq;
	pq.emplace(st, cost[st]);

	while (!pq.empty()) {

		Edge<T> now(pq.top().to, pq.top().cost);
		pq.pop();

		if (cost[now.to] < now.cost) continue;
		for (const Edge<T> &e : edges[now.to]) {
			T tmp_cost = now.cost + e.cost;
			if (cost[e.to] > tmp_cost) {
				cost[e.to] = tmp_cost;
				pq.emplace(e.to, cost[e.to]);
			}
		}
	}

	return cost; // min cost to vertex idx from st
}

template<class T>
inline bool chmax(T &a, const T b) { return a < b && (a = b, true); }

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	int t, a;
	cin >> t >> a;
	t--, a--;

	vector<vector<Edge<int>>> edges(N);
	for (int i = 0; i < N - 1; i++) {
		int u, v;
		cin >> u >> v;
		u--, v--;
		edges[u].emplace_back(v, 1);
		edges[v].emplace_back(u, 1);
	}

	auto d_t = Dijkstra(edges, t);
	auto d_a = Dijkstra(edges, a);

	DMP(d_t, d_a);

	int max_d = 0, max_d2 = 0;

	auto dfs = [&](auto &&f, int now, int prev) -> void {
	
		chmax(max_d, d_a[now] - 1);

		for (const auto &e : edges[now]) {
			if (e.to == prev) continue;

			if (d_t[e.to] < d_a[e.to]) {
				chmax(max_d, d_a[e.to] - 1);
				DMP(max_d);
				f(f, e.to, now);
			}
			else if (d_t[e.to] == d_a[e.to]) chmax(max_d2, d_t[e.to]);

		}

	};
	dfs(dfs, t, -1);

	DMP(max_d, max_d2);
	cout << max(max_d,  max_d2) << "\n";

	return 0;
}

Measured memory_bytes: 8320
#include <iostream>

using namespace std;

int main()
{
    string s1, s2;
    cin >> s1 >> s2;
    
    if(s1 == s2.substr(0, s2.length() - 1))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
        
    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<math.h>
using namespace std;

int main(){
  double x, ans;
  cin >> x;
  ans = 100;
  int cnt = 0;
  while(1){
    ans = ans*1.01;
    ans = floor(ans);
    //cout << ans << endl;
    cnt++;
    if(ans >= x){
      break;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3724
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	pair<int, int>arr[210];
	int a, b;
	cin >> a;
	for (int i = 0; i < a; i++) { int autumn, eel; cin >> autumn >> eel; arr[i] = make_pair(autumn, eel); }
	cin >> b;
	for (int i = a; i < a + b; i++) { int autumn, eel; cin >> autumn >> eel; arr[i] = make_pair(autumn, eel); }
	sort(arr, arr + (a + b));
	for (int i = 0; i < a + b; i++) {
		if (i != 0) {
			if (arr[i] == arr[i - 1])continue;
			cout << ' ';
		}
		cout << arr[i].first << ':';
		if (arr[i].second < 10)cout << 0;
		cout << arr[i].second;
	}
	cout << endl;
}

Measured memory_bytes: 3072
#include <iostream>

using namespace std;

int m[2][10000], n;
int dp[2][10000];

bool OK(int i, int j){
    return (0 <= i && i < 2 && 0 <= j && j < n);
}

int dfs(int i, int j){
    if(i == 1 && j == n) return m[i][j];
    if(dp[i][j] != -1)return dp[i][j];
    int res = 0;
    if( OK(i + 1, j) ){
        res = max( res, dfs(i + 1, j) );
    }
    if( OK(i, j + 1) ){
        res = max( res, dfs(i, j + 1) );
    }
    return (dp[i][j] = res + m[i][j]);
}

int main()
{
    cin >> n;
    for(int i = 0 ; i < n ; i++){
        dp[0][i] = dp[1][i] = -1;
        cin >> m[0][i];
    }
    for(int i = 0 ; i < n ; i++){
        cin >> m[1][i];
    }
    cout << dfs(0, 0);
    return 0;
}

















Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int n, m = 100000;
	int i;
	
	scanf("%d", &n);
	
	for(i = 0; n > i; i++){
		m*=1.05;	
		if(m%1000 != 0){
			m = ((int)(m/1000)) * 1000;
			m+=1000;
		}
	}
	printf("%d\n", m);
	return 0;
}

Measured memory_bytes: 1020
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int N = in.nextInt();
			int M = in.nextInt();
			int X = in.nextInt();
			int[] A = new int[M];
			for(int i = 0; i < M; i++) {
				A[i] = in.nextInt();
			}
			int totalN = 0;
			int total0 = 0;
			for(int i = 0; i <= N; i++) {
				for(int j = 0; j < A.length; j++) {
					if(A[j] == i) {
						if(i < X) {
							total0++;
						}else {
							totalN++;
						}
					}
				}
			}
			out.println(Math.min(total0, totalN));
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}


Measured memory_bytes: 21460
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>

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

using namespace std;
typedef long long ll;

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

    ll cnt = 0;
    ll res = 1;

    while(res < n) {
        res *= 3;
        cnt++;
    }

    cout << cnt << endl;
    

    return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <iostream>
#include <vector>
#include <functional>
#include <string>
#include <cmath>  //sqrt 
#include <iomanip> //setprecision
using namespace std;

int main(){
    int n ; cin >> n;
    int m;
    int count=0;
    int odd=0;
    while(n){
        m=n;
        count=0;
        while(m){
            count++;
            m /= 10;
        };
        if(count%2==1) odd++;
        n--;
    };
    cout << odd << endl;
    return 0;
}

Measured memory_bytes: 3024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
int main()
{
  int b,r,g,c,s,t;
  while(true)
    {
      cin>>b>>r>>g>>c>>s>>t;
      if(t==0)
	break;
      int out=100-(t*3)+(s*3)+(c*2)+(g*7)+((r+b)*15)+((r*3+b*5)*16);
      cout<<out<<endl;	
    }
}

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

int main(){
    ll n, k; cin >> n >> k;
    vector<vector<ll>> black(2*k+1,vector<ll>(2*k+1,0)), white(2*k+1,vector<ll>(2*k+1,0)), save;
    rep(i,n){
        ll x, y; char c; cin >> x >> y >> c;
        if(c == 'B') black[x%(2*k)+1][y%(2*k)+1]++;
        if(c == 'W') white[x%(2*k)+1][y%(2*k)+1]++;
    }
    rep(i,2*k+1) rep(j,2*k) { black[i][j+1] += black[i][j]; white[i][j+1] += white[i][j]; }
    rep(i,2*k) rep(j,2*k+1) { black[i+1][j] += black[i][j]; white[i+1][j] += white[i][j]; }
    ll ans = 0;
    rep(i,k) rep(j,k){
        ll change = 0;
        change += black[i+k][j+k]-black[i][j+k]-black[i+k][j]+black[i][j];
        change += black[2*k][2*k]-black[2*k][j+k]-black[i+k][2*k]+black[i+k][j+k];
        change += black[2*k][j]-black[2*k][0]-black[i+k][j]+black[i+k][0];
        change += black[i][2*k]-black[0][2*k]-black[i][j+k]+black[0][j+k];
        change += black[i][j]-black[0][j]-black[i][0]+black[0][0];
        change += white[i+k][j]-white[i][j]-white[i+k][0]+white[i][0];
        change += white[i][j+k]-white[i][j]-white[0][j+k]+white[0][j];
        change += white[2*k][j+k]-white[i+k][j+k]-white[2*k][j]+white[i+k][j];
        change += white[i+k][2*k]-white[i+k][j+k]-white[i][2*k]+white[i][j+k];
        if(change > ans) ans = change;
    }
    save = black; black = white; white = save;
    rep(i,k) rep(j,k){
        ll change = 0;
        change += black[i+k][j+k]-black[i][j+k]-black[i+k][j]+black[i][j];
        change += black[2*k][2*k]-black[2*k][j+k]-black[i+k][2*k]+black[i+k][j+k];
        change += black[2*k][j]-black[2*k][0]-black[i+k][j]+black[i+k][0];
        change += black[i][2*k]-black[0][2*k]-black[i][j+k]+black[0][j+k];
        change += black[i][j]-black[0][j]-black[i][0]+black[0][0];
        change += white[i+k][j]-white[i][j]-white[i+k][0]+white[i][0];
        change += white[i][j+k]-white[i][j]-white[0][j+k]+white[0][j];
        change += white[2*k][j+k]-white[i+k][j+k]-white[2*k][j]+white[i+k][j];
        change += white[i+k][2*k]-white[i+k][j+k]-white[i][2*k]+white[i][j+k];
        if(change > ans) ans = change;
    }
    cout << ans << endl;
}

Measured memory_bytes: 97664
#include <iostream>

using namespace std;

int main()
{
	string s;

	cin >> s;

	bool isgood = true;
	if (s[0] == s[1])
		isgood = false;
	if (s[1] == s[2])
		isgood = false;
	if (s[2] == s[3])
		isgood = false;

	if (isgood) {
		cout << "Good" << endl;
	}
	else {
		cout << "Bad" << endl;
	}

}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <cctype>
#include <functional>
#include <string>
#include <cstring>
#include <sstream>
#include <deque>
using namespace std;

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

const int inf1=2e9+9;
const ll inf2=8e18+9;
const ll mol=998244353;
const int maxn=1e5+9;
const ll maxx=1e12+9;

string s;

int main()
{
    cin>>s;
    cout<<s[0]<<s[1]<<s[2]<<endl;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
int main(){
    int n;
    char c;
    while(cin>>c){
        cout<<char(c+1)<<endl;
    }
  return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long
#define pb push_back 
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<ll>
#define vll vector<long long>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl;
#define cno cout << "No" << endl;
#define mod 1000000007
#define mod2 998244353
#define INT_MAX1 900000000
//////////////////////////////////////////////////////////////////////////////////////////////

int n;
int dp[100001];
bool v[100001];
int h[100001];

int s1(int i)
{
    if(i==n-1)
        return 0;
    if(i==n-2)
        return abs(h[i]-h[i+1]);
    if(v[i])
        return dp[i];
    v[i] = 1;
    return dp[i] = min(abs(h[i]-h[i+1])+s1(i+1),abs(h[i]-h[i+2])+s1(i+2));
}

void solve()
{
    cin >> n;
    inp(h,n);
    cout << s1(0) << endl;
}
 
int32_t main()
{
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

Measured memory_bytes: 3456
N, W = map(int, input().split())
wv = [tuple(map(int, input().split())) for _ in range(N)]

dp = [[0 for _ in range(W+1)] for _ in range(N+1)]

for i in range(N):
    for sum_w in range(W+1):
        if sum_w >= wv[i][0]:
            dp[i+1][sum_w] = max(dp[i][sum_w], dp[i][sum_w - wv[i][0]] + wv[i][1])
        else:
            dp[i+1][sum_w] = dp[i][sum_w]

print(dp[-1][-1])

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

using namespace std;

typedef long long int ll;

const ll mod = 1e9 + 7;
const ll MAXN = 1e5 + 5;

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

  ll n, k;
  cin >> n >> k;
  vector < ll > a(n + 1);
  for(int i = 1; i <= n; i++) cin >> a[i];

  vector < bool > dp(k + 1, false);
  for(int i = 1; i <= k; i++){
    for(int j = 1; j <= n; j++){
      if(i - a[j] >= 0) dp[i] = dp[i] | (!dp[i - a[j]]);
    }
  }

  if(dp[k]) cout << "First" << endl;
  else cout << "Second" << endl;
}


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

public class Program {
    public static void Main() {
        var arr = ReadLib.ReadAsIntArray();
        var n = arr[0];
        var k = arr[1];

        long score = (long)(k * Math.Pow(k-1, n-1));

        Console.WriteLine(score);
    }
}

static class ReadLib {
    public static long ReadAsLong() {
        return long.Parse(Console.ReadLine());
    }

    public static int ReadAsInt() {
        return int.Parse(Console.ReadLine());
    }

    public static int[] ReadAsIntArray() {
        return Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
    }

}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
 
using namespace std;
 
int32_t main ()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);

	int n,k;
	cin>>n>>k;
	vector<int> v(n+1);
	vector<string> ans;

	v[0]=1;
	for(int i=1;i<=n;i++)
		cin>>v[i];

	for(int i=1;i<=n;i++){
		if(i-1<k){
			continue;
		}
		else{
			if(v[i]>v[i-k])
				ans.push_back("Yes");
			else ans.push_back("No");
		}
	}	

	for(int i=0;(unsigned)i<ans.size();i++)
	{
	 	cout<<ans[i]<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 13064
#include<bits/stdc++.h>
    #define ll long long
    #define db double
    #define mod 1000000007
    #define pb push_back
    #define pp pair<ll,ll>
    #define rep(i,a,b) for(ll i=a;i<b;i++)
    #define repe(i,a,b) for(ll i=a;i<=b;i++)
    #define repr(i,a,b) for(ll i=b;i>=a;i--)
    #define maxn 100005
    #define ss second
    #define ff first
    #define lb lower_bound
    using namespace std;
    void solve()
    {
        map<ll,ll> mp;
        ll n;
        cin >> n;
        ll ans=0;
        repe(i,1,n)
        {
            ll x;
            cin >> x;
            if(mp.count(i-x))
            {
                ans += mp[i-x];
            }
            mp[x+i]++;
        }
        cout << ans;
    }
    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        ll t=1;
        //cin >> t;
        while(t--)
        solve();
        return 0;
    }

Measured memory_bytes: 16016
while true
    n = gets.to_i
    break if n == 0

    conversion = {}
    n.times{
        a, b = gets.chomp.split
        conversion[a] = b
    }
    m = gets.to_i
    m.times{
        a = gets.chomp
        if b = conversion[a]
            print b
        else
            print a
        end
    }
    puts
end


Measured memory_bytes: 6844
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        for(int i = 0; i <= n; i++) {
            for(int j = 0; j + i <= n; j++) {
                for(int k = 0; k + j + i <= n; k++) {
                    int sum = i * 1000 + j * 5000 + k * 10000;
                    if(sum == y && i + j + k == n) {
                        System.out.println(k + " " + j + " " + i);
                        return;
                    }
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}


Measured memory_bytes: 22868
import java.util.*;

public class Main {
    public static void main(String[] args) {
            Scanner scan = new Scanner(System.in);
            int n = scan.nextInt();
            int max = -1000000, min = 1000000, input;
            long sum = 0;

            for(int i = 0; i < n; i++) {
                input = scan.nextInt();
                if(input > max) max = input;
                if(input < min) min = input;
                sum += input;
            }
                System.out.println(min + " " + max + " " + sum);
    }
}

Measured memory_bytes: 41156
#include <stdio.h>
#include <string.h>

int main(void) {
    char str[201]={'\0'}, tmp[201]={'\0'};
    int m, h, i, j;

    while (1) {
        scanf("%s", str);
        if (!strcmp(str, "-")) break;
        scanf("%d", &m);
        while (m>0) {
            scanf("%d", &h);
            for (i=h; str[i]!='\0'; i++) tmp[i-h]=str[i];
            for (j=0;j<h; j++) tmp[i-h+j]=str[j];
            for (i=0; tmp[i]!='\0'; i++) str[i]=tmp[i];
	        m--;
        }
        printf("%s\n", str);
        for (i=0; i<sizeof(str); i++) str[i]='\0', tmp[i]='\0';
    }
    return 0;
}



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

using namespace std;

int main(){
    int a, b, c, d, e;
    int N = 5;
    cin >> a >> b >> c >> d >> e;
    vector<int> Time = { a, b, c, d, e};
    vector<int> nextTime(N);

    int BastTime = 99999999;      // 大きい値を適当に入れる

    for(int i = 0; i < N; i++){
        if(Time.at(i) % 10 == 0)    nextTime.at(i) = Time.at(i);
        else nextTime.at(i) = Time.at(i) - Time.at(i) % 10 + 10;

        //nextTime[i] = (Time.at(i) + 9) / 10 * 10;
    }

    #ifdef DEBUG
        for(int i = 0; i < nextTime.size(); i++){
            cout << nextTime.at(i) << " ";
        }cout << endl;
    #endif
    
    // 最後に注文するものを全通り計算
    for(int i = 0; i < N; i++){
        int SumTime = 0;
        for(int j = 0; j < N; j++){
            if(i == j){
                // 最後の処理
                SumTime += Time.at(j);
            }
            else{
                // 最後以外の処理
                SumTime += nextTime.at(j);
            }
            
        }
        BastTime = min(BastTime, SumTime);
    }
    cout << BastTime << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long INF = 1000000000000000;
vector<long long> dijkstra(vector<vector<pair<int, int>>> &E, int s){
    int V = E.size();
    vector<long long> d(V, INF);
    priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> Q;
    Q.push(make_pair(0, s));
    while (!Q.empty()){
        long long c = Q.top().first;
        int v = Q.top().second;
        Q.pop();
        if (d[v] == INF){
            d[v] = c;
            for (int i = 0; i < E[v].size(); i++){
                Q.push(make_pair(c + E[v][i].first, E[v][i].second));
            }
        }
    }
    return d;
}
int main(){
    int n;
    cin >> n;
    vector<vector<pair<int, int>>> E(n);
    for (int i = 0; i < n; i++){
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++){
            int v, c;
            cin >> v >> c;
            E[u].push_back(make_pair(c, v));
        }
    }
    vector<long long> d = dijkstra(E, 0);
    for (int i = 0; i < n; i++){
        cout << i << ' ' << d[i] << endl;
    }
}


Measured memory_bytes: 15940
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define MOD 1000000007 
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN


ll po(ll x,ll n){
    if(n==0) return 1;
    else if(n%2 == 0) return po((x*x)%MOD,n/2);
    else return (x*po((x*x)%MOD,(n-1)/2))%MOD;
}



void init(){
    
}

void solve( ll  tst ){
    ld r;
    cin>>r;
    ld pi = 6.28318530717958623200;
    printf("%0.6Lf", pi*r);
    return;
}

int main(){
    FAST;
    init();
    //cout<<"init"<<endl;
    ll t = 1;
    //cin>>t;
    for (ll i=1;i<=t;i++ ) solve(i);
    return 0;
} 


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

int main()
{
	int n,k;
	cin >> n >> k;
	vector<int> h(n);
	for (int q = 0; q < n; q++)
	{
		cin >> h[q];
	}
	int dp[n];
	dp[0] = 0;
	for (int q = 1; q < n; q++)
	{
		dp[q] = dp[q-1] + abs(h[q] - h[q-1]);
		for (int w = 2; w <= k && q-w>= 0; w++)
		{
			dp[q] = min(dp[q], dp[q-w] + abs(h[q] - h[q-w]));
		}
	}
	cout << dp[n-1] << "\n";
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;


int main(){
  string s,t;
  cin >> s >> t;
  rep(i, s.size()){
    if(s == t){
      cout << "Yes" << endl;
      return 0;
    }
    s = s[s.size()-1] + s.substr(0, s.size()-1);
  }
  cout << "No" << endl;
  return 0;
}



Measured memory_bytes: 504
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
 
int main() {
    int H,W;
    cin >> H >> W;
    
    char A[H][W] ;
    
  for(int i=0 ; i<H ; i++){
      for (int j=0 ; j<W ;j++){
          cin >> A[i][j] ;
      }
  }
    
    for(int i=0 ; i<H+2 ; i++){
        for(int j=0 ; j<W+2 ;j++){
            if( i==0 || i==H+1 || j==0 || j==W+1){
                cout << "#";
            }
            else{
                cout << A[i-1][j-1] ;
            }
        }
        cout <<endl;
    }
    
}

Measured memory_bytes: 256
def d_make_them_even(H, W, A):
    board = [row for row in A]
    ans = []
    for h in range(H):
        for w in range(W):
            if board[h][w] % 2 == 1:
                for nh, nw in zip((0, 1), (1, 0)):
                    if 0 <= h + nh <= H - 1 and 0 <= w + nw <= W - 1:
                        board[h + nh][w + nw] += 1
                        board[h][w] -= 1
                        ans.append('{0} {1} {2} {3}'.format(h + 1, w + 1, h + nh + 1, w + nw + 1))
                        break
    ans.insert(0, str(len(ans)))
    ans = '\n'.join(ans)
    return ans

H, W = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(H)]
print(d_make_them_even(H, W, A))

Measured memory_bytes: 16220
const inf = Number.MAX_SAFE_INTEGER;
function Main(input){
	input = input.split("\n");
	var mem = input[0].split(" ").map(Number);
	var k = mem[1];
	var arr = input[1].split(" ").map(Number);
	var dp = new Array(mem[0]).fill(0);
	var l = 0;
	for(var i=1;i<arr.length;i++){
		var min = inf;
		for(var j=i-1;j!=-1&&l<k;l++,j--){
			var n = dp[j]+Math.abs(arr[j]-arr[i]);
		//	console.log(n,i,j)
			if(n<min) min = n;
		}
		dp[i] = min;
		l = 0;
	}
	console.log(dp[dp.length-1]);
//	console.log(dp)
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 27584
#include<bits/stdc++.h>
 
using namespace std;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()
 
int GCD(int a,int b){ return b ? GCD(b,a%b) : a ;}
int LCM(int a,int b){ return a*b / GCD(a,b) ;}
 
typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;

int main(){
   int r,g,b,n;
   cin >> r >> g >> b >> n;
   int ans = 0;
   for(int i=0;i<=n;i++){
      if(i*r > n)continue;
      for(int j=0;j<=n;j++){
         if(i*r+j*g > n)continue;
            if((n - (i*r+j*g)) % b == 0)ans++;         
      }
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 764
from collections.abc import Iterable

n = int(input())
nodes = {}
for _ in range(n):
    key, left, right = map(int, input().split())
    nodes[key] = (left, right)
keys = set(nodes.keys())
for left, right in nodes.values():
    keys -= {left, right}
root = keys.pop()


def flatten(arr):
    for a in arr:
        if isinstance(a, Iterable) and not isinstance(a, (str, bytes)):
            yield from flatten(a)
        else:
            yield a


def pre_tw(key):
    left, right = nodes[key]
    if left == -1 and right == -1:
        return [key]
    elif left == -1:
        return [key, pre_tw(right)]
    elif right == -1:
        return [key, pre_tw(left)]
    else:
        return [key, pre_tw(left), pre_tw(right)]


def in_tw(key):
    left, right = nodes[key]
    if left == -1 and right == -1:
        return [key]
    elif left == -1:
        return [key, in_tw(right)]
    elif right == -1:
        return [in_tw(left), key]
    else:
        return [in_tw(left), key, in_tw(right)]


def post_tw(key):
    left, right = nodes[key]
    if left == -1 and right == -1:
        return [key]
    elif left == -1:
        return [post_tw(right), key]
    elif right == -1:
        return [post_tw(left), key]
    else:
        return [post_tw(left), post_tw(right), key]


print("Preorder")
for a in flatten(pre_tw(root)):
    print(" {}".format(a), end="")
print()

print("Inorder")
for a in flatten(in_tw(root)):
    print(" {}".format(a), end="")
print()

print("Postorder")
for a in flatten(post_tw(root)):
    print(" {}".format(a), end="")
print()



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

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                           \
    {                                      \
        for (int i = 0; i < V.size(); i++) \
        {                                  \
            cout << V[i] << " ";           \
        }                                  \
        cout << endl;                      \
    }

typedef long long ll; //64bit型
using namespace std;

const long long INF = 1LL << 60; //無限大の値
static const int N = 100;

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

    list<int> L;
    string com;

    for (int i = 0; i < n; i++)
    {
        cin >> com;
        if (com[0] == 'i')
        {
            cin >> d;
            L.push_front(d);
        }
        else if (com[6] == 'L')
        {
            L.pop_back();
        }
        else if (com[6] == 'F')
        {
            L.pop_front();
        }
        else if (com[0] == 'd')
        {
            cin >> d;
            for (list<int>::iterator it = L.begin(); it != L.end(); it++)
            {
                if (*it == d)
                {
                    L.erase(it);
                    break;
                }
            }
        }
    }
    int i = 0;
    for (list<int>::iterator it = L.begin(); it != L.end(); it++)
    {
        if (i++)
            printf(" ");
        cout << *it;
    }
    cout << endl;

    return 0;
}



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

int main(){
  int h,w;
  cin>>h>>w;
  vector <string> s(h);
  rep(i,h){
    cin>>s[i];
  }
  vector< vector<int>> l(h+2,vector<int>(w+2,0));
  vector< vector<int>>  r(h+2,vector<int>(w+2,0));
  vector< vector<int>>  u(h+2,vector<int>(w+2,0));
  vector< vector<int>>  d(h+2,vector<int>(w+2,0));
  for (int i=1;i<=h;i++){
    for (int j=1;j<=w;j++){
      if (s[i-1][j-1]=='#')continue;
    //  int temp=l[i-1][j]+1;
      l[i][j]=l[i][j-1]+1;
    }
  }
  for (int i=h;i>0;i--){
    for (int j=w;j>0;j--){
      if (s[i-1][j-1]=='#')continue;
      r[i][j]=r[i][j+1]+1;
    }
  }

    for (int j=1;j<=w;j++){
      for (int i=1;i<=h;i++){
      if (s[i-1][j-1]=='#')continue;
      u[i][j]=u[i-1][j]+1;
    }
  }

    for (int j=w;j>0;j--){
      for (int i=h;i>0;i--){
      if (s[i-1][j-1]=='#')continue;
      d[i][j]=d[i+1][j]+1;
    }
  }
  int ans=0;
  for (int i=1;i<h+1;i++){
    for (int j=1;j<w+1;j++){
     
      ans=max(ans,l[i][j]+r[i][j]+u[i][j]+d[i][j]-3);
    }
  }
  cout<<ans;



  }


Measured memory_bytes: 67200
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
struct info {int cnt[2]; ll inv; } ans[MAXN];
info operator + (info a, info b) {
	info ans;
	ans.cnt[0] = a.cnt[0] + b.cnt[0];
	ans.cnt[1] = a.cnt[1] + b.cnt[1];
	ans.inv = a.inv + b.inv + 1ll * a.cnt[1] * b.cnt[0];
	return ans;
}
bool operator == (info a, info b) {
	return a.cnt[0] == b.cnt[0] && a.cnt[1] == b.cnt[1] && a.inv == b.inv;
}
bool operator < (info a, info b) {
	return 1ll * a.cnt[1] * b.cnt[0] < 1ll * a.cnt[0] * b.cnt[1];
}
struct hinfo {int pos; info val; };
bool operator < (hinfo a, hinfo b) {
	if (a.val < b.val) return false;
	else if (b.val < a.val) return true;
	else return a.pos < b.pos;
}
int n, f[MAXN], p[MAXN], v[MAXN];
priority_queue <hinfo> Heap;
int F(int x) {
	if (f[x] == x) return x;
	else return f[x] = F(f[x]);
}
int main() {
	read(n);
	for (int i = 2; i <= n; i++)
		read(p[i]);
	for (int i = 1; i <= n; i++) {
		read(v[i]), f[i] = i;
		ans[i].cnt[v[i]]++;
	}
	for (int i = 2; i <= n; i++)
		Heap.push((hinfo) {i, ans[i]});
	while (!Heap.empty()) {
		hinfo tmp = Heap.top(); Heap.pop();
		if (tmp.val == ans[tmp.pos]) {
			int x = tmp.pos, y = F(p[x]); f[x] = y;
			ans[y] = ans[y] + ans[x];
			if (y != 1) Heap.push((hinfo) {y, ans[y]});
		}
	}
	writeln(ans[1].inv);
	return 0;
}

Measured memory_bytes: 13936
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
#define BLACK 0
#define WHITE 1

vector < int > d[100001];

void bfs(int n){
  
  int count[2]={};

  map< int , bool > visited;
  queue< pair<int,int> > q;

  q.push( make_pair( 1, BLACK ));
  visited[1]=true;
  
  q.push( make_pair( n, WHITE ));
  visited[n]=true;
  
  while(!q.empty()){
    P np = q.front();
    int pos=np.first;
    int color=np.second;
    q.pop();

    for(int i=0;i<(int)d[pos].size();i++){
      int to=d[pos][i];
      if(visited[to])continue;
      visited[to]=true;
      count[ color ]++;
      q.push( make_pair( to, color ) );
    }
    
  }
  if(count[BLACK]>count[WHITE])cout<<"Fennec"<<endl;
  else cout<<"Snuke"<<endl;

}



int main(){
  int n,a,b;
  cin>>n;
  
  for(int i=0;i<n-1;i++){
    cin>>a>>b;
    d[a].push_back(b);
    d[b].push_back(a);
  }
  bfs(n);
  
  
  return 0;
}


Measured memory_bytes: 10368
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atc_0033
{
    class Program
    {
        static void Main(string[] args)
        {

            var s = Console.ReadLine();

            double A = double.Parse(s.Split(' ')[0]);
            double B = double.Parse(s.Split(' ')[1]);
            double C = double.Parse(s.Split(' ')[1]);

            double result = A * B / 2;
          
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 27588
N=int(input())
L_list = list(map(int,input().split()))

import bisect

L_list = sorted(L_list)
 
ans = 0
for a_index in range(0, N):
    for b_index in range(a_index+1, N):
        a = L_list[a_index]
        b = L_list[b_index]
        c_right_index = bisect.bisect_left(L_list, a+b)
        if c_right_index > b_index:
            ans += c_right_index - b_index - 1
        else:
            pass

print(ans)

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();

        // a
        int x = a - 1;

        // 約数の個数
        int y = 0;

        while (x < b) {
            x++;
            if (c % x == 0) {
                y++;
            }
        }
        
        System.out.println(y);
    }
}



Measured memory_bytes: 26248
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
int n;
char s[110];
bool check(int l,int r)
{
	while(l<r){
		if(s[l]!=s[r])return false;
		l++;
		r--;
	}
	return true;
}
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	if(check(1,n)&&check(1,(n-1)/2)&&check((n+3)/2,n))
		printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
<?php
$steps = str_split(trim(fgets(STDIN)));
$r = ['R', 'U', 'D'];
$l = ['L', 'U', 'D'];
$result = 'Yes';
foreach ($steps as $idx => $step) {
    if ($idx % 2 == 0) {
        if (!in_array($step, $r)) {
            $result = 'No'; break;
        }
    } else {
        if (!in_array($step, $l)) {
            $result = 'No'; break;
        }
    }
}
echo $result,PHP_EOL;

Measured memory_bytes: 4604
n=int(input())
h=list(map(int,input().split()))
ans=[float("inf")]*n
ans[0]=0
ans[1]=abs(h[0]-h[1])
for i in range(2,n):
    ans[i]=min(ans[i-2]+abs(h[i]-h[i-2]),ans[i-1]+abs(h[i]-h[i-1]))
print(ans[n-1])

Measured memory_bytes: 13928
#include <complex>
#include <cmath>
#include <iostream>
using namespace std;
typedef complex<double> xy_t;

double dot_product(xy_t a,xy_t b) {
  return (conj(a)*b).real();
}

double cross_product(xy_t a, xy_t b) {
  return (conj(a)*b).imag();
}

xy_t projection(xy_t p,xy_t b) {
  return b * dot_product(p,b)/norm(b);
}

xy_t A[4];
double re,im;
double S[3];

int main() {
  while(true) {
    for (int i=0;i<4;i++) {
      if (scanf("%lf%lf",&re,&im) == EOF) {
	goto STOP;
      }
      xy_t P(re,im);
      A[i] = P;
    }
    for (int i=0;i<3;i++) {
      S[i] = cross_product(A[i%3]-A[3],A[(i+1)%3]-A[3]);
    }
    if ((S[0] > 0 && S[1] > 0 && S[2] > 0) || (S[0] < 0 && S[1] < 0 && S[2] < 0)) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
 STOP: return 0;
}

Measured memory_bytes: 1188
from itertools import combinations

import numpy as np


def run():
    n, k = map(int, input().split())
    a_list = list(map(int, input().split()))

    history = [0 for _ in a_list]

    history[0] = 1

    current_a = 1
    loop_num = 0
    history_flag = True
    while True:
        next_a = a_list[current_a - 1]

        if history[next_a - 1] != 0 and history_flag:
            pre_visit = history[next_a - 1]
            current_visit = loop_num + 2

            same_loop_num = (current_visit - pre_visit)

            loop_num += same_loop_num * ((k - loop_num) // same_loop_num - 1)
            history_flag = False
            # print('hit')
            # print(loop_num)
            # print(same_loop_num)

        history[next_a - 1] = loop_num + 2
        current_a = next_a

        loop_num += 1
        if loop_num == k:
            print(current_a)
            exit()
        if loop_num > k:
            print('error')
            print(loop_num)
            print(k)
            raise ValueError()


if __name__ == '__main__':
    run()


Measured memory_bytes: 50960
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <deque>
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}


#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000

const ll MOD=998244353;

main(){
    int n=in();
    vecll v;
    rep(i,n)v.pb(in());
    sort(all(v));
    int l=0,r=n;
    while(l<r-1){
        int mid=(l+r)/2;
        ll tmp=0;
        rep(i,mid){
            tmp+=v[i];
        }
        bool flag=true;
        rep2(i,mid,n-1){
            if(tmp*2<v[i])flag=false;
            else tmp+=v[i];
        }
        (flag?r:l)=mid;
    }
    cout<<n-l;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}



  








      

 
int main() {
    string S;
    cin >> S;
    deque<char> dS(S.size());
    for (int i = 0; i < S.size(); ++i) dS[i] = S[i];

    int Q; cin >> Q;
    int rev = 0;
    for (int i = 0; i < Q; ++i) {
        int type; cin >> type;
        if (type == 2) {
            int f; char c;
            cin >> f >> c; --f;
            if (rev) f = 1 - f; // 反転状態だったら、フラグを反転
            if (f == 0) dS.push_front(c);
            else dS.push_back(c);
        }
        else rev = 1 - rev;
    }
    if (rev) reverse(dS.begin(), dS.end());
    for (auto c : dS) cout << c;
    cout << endl;
}

Measured memory_bytes: 4008
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,A;
  bool x=true;
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>A;
    if(A%2==0&&A%3!=0&&A%5!=0){
      x=false;
      break;
    }
  }
  if(x)cout<<"APPROVED"<<endl;
  else cout<<"DENIED"<<endl;
}

Measured memory_bytes: 256
n, m = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
ok = [True] * n
for _ in range(m):
    a, b = [int(i) - 1 for i in input().split()]
    if h[a] > h[b]:
        ok[b] = False
    elif h[b] > h[a]:
        ok[a] = False
    else:
        ok[a] = False
        ok[b] = False
print(ok.count(True))

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

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> high(N+1,0);
    for(int j=0; j<N; j++){
      cin >> high.at(j+1);
    }
    vector<int> count(N+1,0);
    for(int i=1; i<=M; i++){
        int a,b;
        cin >> a >> b ;
        if(high.at(a)>high.at(b)){
            count.at(b)--;
        }
        else if(high.at(a)==high.at(b)){
            count.at(a)--;
            count.at(b)--;
        }
        else if(high.at(a)<high.at(b)){
            count.at(a)--;
        }
    }
        int ans;
        for(int l=1; l<=N; l++){
            if(count.at(l)==0){
                ans++;
            }
        }
    cout << ans << endl;
    
    }

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

#define reb(i,b,n) for(int i=(int)(b); i<(int)(n); i++)
#define rep(i,n) reb(i,0,n)
#define rreb(i,b,n) for(int i = b-1; i >= n; i--)
#define rrep(i,n) reb(i,n,0)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define reach(it,v) for(__typeof((v).rbegin()) it=(v).rbegin();it!=(v).rend();it++)
#define vall(x) (x).begin(), (x).end()
#define rvall(x) (x).rbegin(), (x).rend()
#define vsort(v) sort(vall(v))
#define rvsort(v) sort(rvall(v))
#define len(array) (sizeof (array) / sizeof *(array))
#define aall(x) x, x+len(x)
#define asort(x) sort(aall(x))
#define rasort(a, type) sort(aall(a), greater<type>())
#define afill(a, v) fill(aall(a), v)
#define afill2(a, v, type) fill((type *)a, (type *)(a + len(a)), v)
#define sz(x) (int)(x).size()
#define mp(a, b) make_pair(a, b)
#define fi first
#define se second
#define pb push_back
#define _USE_MATH_DEFINES
#define priArr(table, n) rep(i,n){cout<<table[i]<<' ';}cout<<'\n';
#define priAr2(table,W,H) rep(y,H){rep(x,W)cout<<table[y][x]<<' ';cout<<'\n';}
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = ["<<(x)<<"]"<<endl;

using namespace std;
using std::stringstream;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline std::string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class F, class T> inline void convert(const F &f, T &t){stringstream ss;ss<<f;ss>>t;}
template<class T> inline T sqr(T x) {return x*x;}

typedef long long ll; typedef unsigned long long ull;
typedef pair <int, int> P; typedef pair <int, P> PP;
typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<string> vs;
typedef vector<ll> vl; typedef vector<P > vP; typedef vector<char> vc;
typedef long double ld;

const static int INF = 0x3f3f3f3f;
const static ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const static double EPS = 1e-9;
const static ll MOD = 1000000007LL;

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

int main(int argc, char *argv[])
{
    int R;
    cin >> R;

    cout << 2 * R * M_PI << endl;
    return 0;
}


Measured memory_bytes: 3784
#include<stdio.h>
#include<iostream>
#include<algorithm>
#define M 100005
#define P 1000000007
using namespace std;
int mark[M]={0};
int n,a[M];
int F[M],F_[M];
int fast(int x){
	int re=1,t=P-2;
	while(t){
		if(t&1)re=1ll*re*x%P;
		x=1ll*x*x%P;
		t>>=1;
	}
	return re;
}
int solve(int p1,int p2){
	if(p1<p2)return 0;
//	printf("%d %d %d %d %d %d\n",p1,p2,F[p1],F_[p2],F_[p1-p2],1ll*F[p1]*F_[p2]%P*F_[p1-p2]%P);
	return 1ll*F[p1]*F_[p2]%P*F_[p1-p2]%P;
}
int main(){
	int i,k,j;
	scanf("%d",&n);
	int x,y;
	F[1]=1;F_[1]=1;
	F[0]=1;F_[0]=1;
	for(i=2;i<=n+1;i++)F[i]=1ll*F[i-1]*i%P,F_[i]=fast(F[i]);
	for(i=1;i<=n+1;i++){
		scanf("%d",&a[i]);
	}
	int res=0;
	for(i=1;i<=n+1;i++){
		if(mark[a[i]])x=mark[a[i]],y=i;
		else mark[a[i]]=i,res++;
	}
	printf("%d\n",res);
	for(i=2;i<=n+1;i++){
		res=(solve(n+1,i)-solve(n-y+x,i-1))%P+P;
		res%=P;
		printf("%d\n",res);
	}
	return 0;
}

Measured memory_bytes: 2816
#include<iostream>

using namespace std;

int main(){
    int n; cin >> n;
    int min,i,t_1[n],t_2[n];
    int w[n]; 
    for(i = 0; i < n; i++){
        cin >> w[i];
        t_1[i] = 0;
        t_2[i] = 0;
    }
    t_1[0] = 0; t_2[0] = 0;
    for(i = 1; i < n; i++){
        t_1[i] = t_1[i-1] + w[i-1];
        t_2[i] = t_2[i-1] + w[n-i];
    }
    min = abs(t_1[1] - t_2[n-1]);
    for(i = 1; i < n; i++){
        if(min > abs(t_1[i] - t_2[n-i])){
            min = abs(t_1[i] - t_2[n-i]);
        }
    }
    cout << min << endl;

    return 0;
}

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

int main()
{
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    if(a+b<2*c)
    {
        cout << a*x+b*y << endl;
    }
    else
    {
        int num=min(x,y);
        int ans=num*2*c;
        x-=num,y-=num;
        if(a<c*2)
        {
            ans+=a*x;
        }
        else
            ans+=c*2*x;
        if(b<c*2)
            ans+=b*y;
        else
            ans+=c*2*y;
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 256
def main():
    N = input()
    listCulcNum = list(map(int, input().split()))

    answer = 1
    maxNum = 10 ** 18

    if(0 in listCulcNum):
        print(0)
        return

    for culcNum in listCulcNum:
        answer = answer * culcNum

        if(answer > maxNum):
            answer = -1
            break

    print(answer)

if __name__ == "__main__":
    main()

Measured memory_bytes: 21632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.next().length();
		String a = "";
		for (int i = 0; i < n; i++) {
			a += "x";
		}
		System.out.println(a);
		
		
	}
}




Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
const ll INF = 1ll << 60;
int n;
ll a[maxx], ans[maxx];

void Init() {
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%lld", &a[i]);
}

int main() {
	Init();
	ll sum = 0ll; // sum = ans[1]
	for(int i = n; i >= 1; i--) {
		if(i & 1) sum += a[i];
		else sum -= a[i];
	}
	printf("%lld ", sum);
	ans[1] = sum;
	for(int i = 2; i <= n - 1; i++) {
		ans[i] = a[i - 1] * 2 - ans[i - 1];
		printf("%lld ", ans[i]);
	}
	printf("%lld\n", a[n] * 2 - sum);
	return 0;
}

/*
ans1 + ans2 = 2 * a1
ans2 + ans3 = 2 * a2
ans3 + ans4 = 2 * a3
ans4 + ans5 = 2 * a4
ans5 + ans1 = 2 * a5

ans1 + ans5 - ans5 - ans4 + ans4 + ans3 - ans3 - ans2 + ans2 + ans1 = 2 * ans1 = 2 * (a5 - a4 + a3 - a2 + a1)
ans1 = a5 - a4 + a3 - a2 + a1
*/

Measured memory_bytes: 2816