akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	class FastScanner {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[ptr++];
			else
				return -1;
		}

		private boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		public boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr]))
				ptr++;
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		public int nextInt() {
			long nl = nextLong();
			if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
				throw new NumberFormatException();
			return (int) nl;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}

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

	void sim(long A, long B, long C, long D) {
		int cnt = 0;
		while (A > 0 && cnt++ < 100) {
			A -= B;
			if (A <= C) {
				A += D;
			}
			tr(A);
		}
	}

	void run() {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);
		int T = sc.nextInt();
		for (int t = 0; t < T; ++t) {
			long A = sc.nextLong();
			long B = sc.nextLong();
			long C = sc.nextLong();
			long D = sc.nextLong();
			// sim(A,B,C,D);
			if (A < B) {
				pw.println("No");
				continue;
			}
			if (A % B > C) {
				pw.println("No");
				continue;
			}
			if (D >= B && B - 1 <= C) {
				pw.println("Yes");
				continue;
			}
			long g = gcd(D, B);
			A %= g;
			if (B - D - A > 0) {
				pw.println("No");
				continue;
			}
			if ((B - 1 - A % g) / g * g > C) {
				pw.println("No");
				continue;
			}
			pw.println("Yes");
		}
		pw.close();
	}

	long gcd(long a, long b) {
		if (a > b)
			return gcd(b, a);
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

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

typedef long long LL;
typedef vector<long long> VLL;
typedef vector<string> VS;
typedef vector<pair<LL, LL> > VP;
 
 
#define For(in) for (LLi i = 0; i < (n); i++)
#define FOR(in) for(LLi i=1; i <= (n); i++)
#define pb push_back
#define srt(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define uniq(v) v.erase(unique(v.begin(), v.end()), v.end());
#define no "NO"
#define yes "YES"
#define con continue;


int main()
{
    ios_base::sync_with_stdio(false);
	long long t, q;
	
	//seive();
	LL a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,r=0,u=0,w=0,x=0,y=0,z=0;
	//LL aa[10000];
	LL flag=0, flag1=0, co=0, co1=0, co2=0, co3=0, x1=0, x2=0, y1=0, y2=0, z1=0, z2=0;
	LL ma=0, mi=100000000;
	LL mid=0, temp=0, stop=0, start=0, ans=0;
	double pi= 3.141592653589793;
	double d1=0.0, d2, d3, d4;
	VLL v,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10;
	VS vs, vs1, vs2, vs3, vs4;
	VP vp, vp1,vp2;
	char ch, ch1, ch2[1001];
	string str, str1, str2, str3, str4, str5;
	pair<LL, LL> pa;
	list<LL> li, li1;
	map<LL, LL> mp, mp1;
	set<LL> st;
	map<LL ,LL> :: iterator imll;
	VLL :: iterator ivl, low, up;
	set<LL> :: iterator it;
	VP :: iterator ivp;
	
	cin>>n>>x>>t;
	if(n%x==0)cout<<(n/x)*t<<endl;
	else cout<<((n/x)+1)*t<<endl;
	
	
	
	
	
	
	

	return 0;
 
}



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

using namespace std;
typedef long long ll;

int main() {
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;

    int ab = 0;
    int ans = 1001001000;
    while (!(x == 0 && y == 0)) {
        //printf("%d %d %d : %d\n", x, y, ab, a*x+b*y+c*ab);
        ans = min(ans, a*x + b*y + c*ab);
        x = max(x-1, 0);
        y = max(y-1, 0);
        ab += 2;
    }
    ans = min(ans, c*ab);
    cout << ans << endl;

}


Measured memory_bytes: 256
use proconio::input;

fn main() {
    input!{
        n:usize,
        k:usize,
        a:[i64;n]
    };

    for i in 0..(n-k) {
        if a[i]<a[i+k] {
            println!("Yes");
        }
        else{
            println!("No");
        }
    }


}



Measured memory_bytes: 5568
n = input()
op_cnt = len(n) - 1  
for i in range(2 ** op_cnt):
    op = ["-"] * op_cnt  
    for j in range(op_cnt):
        if ((i >> j) & 1):
            op[op_cnt - 1 - j] = "+"  

    formula = ""*(2+len(n)-1)
    formula+=n[0]
    for w in range(len(n)-1):
        formula+=op[w]+n[w+1]
    if eval(formula) == 7:
        print(formula + "=7")
        break

Measured memory_bytes: 9084
/*
 * hoge.cpp
 *
 *  Created on: 2014/09/30
 *      Author: eiichi
 */
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<map>
#include<list>
using namespace std;

vector<int> split(string s,char c){
	vector<int> v;string tmp;
	for(int i=0;i<s.size();i++){
		if(s[i]==c){
			v.push_back(stoi(tmp));
			tmp ="";
		}
		else tmp += s[i];
	}
	if(tmp!="")v.push_back(stoi(tmp));
	return v;
}

int main(void){
	for(int i=0;;i++){
		int n,x;
		cin >> n >> x;
		if(n==0 && x==0)break;
		int cnt=0;
		for(int i=1;i<=n;i++){
			for(int j=i+1;j<=n;j++){
				for(int k=j+1;k<=n;k++){
					if(i+j+k==x)cnt++;
				}
			}
		}
		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;}
using ll = long long;

int n,m,k;
string s,t;

int main() {
  cin >> k >> n >> m;
  for(int i=n;i<=m;i++)if(i%k==0){
    cout << "OK" << endl;
    return 0;
  }
  cout << "NG" << endl;
  return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,s=0,t;
    cin>>n;
    t=n;
    while(n!=0)
    {
        s+=n%10;
        n=n/10;
    }
    if(t%s==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int N;
int main() {
	cin>>N;

	ll A[87];
	A[0]=2;
	A[1]=1;
	for(int i=2;i<N+1;i++){
		A[i]=A[i-1]+A[i-2];
	}
	cout<<A[N]<<endl;

	return 0;
}


Measured memory_bytes: 256
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N = I()
A = LI()

if N == 1:
    print('Second')
    exit()

if N == 2:
    print('First')
    exit()

from math import gcd

r = 0  # 0:高橋君の番、1:青木君の番
while True:
    if (sum(A)-N) % 2 == 1:
        if r == 0:
            print('First')
        else:
            print('Second')
        break
    else:
        a = 0  # 奇数の要素の個数
        b = 0  # 1の個数
        for i in range(N):
            if A[i] % 2 == 1:
                a += 1
            if A[i] == 1:
                b += 1
        if a != 1 or b > 0:
            if r == 0:
                print('Second')
            else:
                print('First')
            break
        else:
            g = 0
            for i in range(N):
                if A[i] % 2 == 1:
                    g = gcd(g,A[i]-1)
                else:
                    g = gcd(g,A[i])
            for i in range(N):
                A[i] = A[i]//g
            r = 1-r


Measured memory_bytes: 85272
fn main() {
    let v = read_vec::<u32>();
    let k = v[0];
    let x = v[1];
    yn(500 * k >= x);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    a[i] -= i+1
a.sort()
if n == 1:
    print(0)
    exit()
p = a[n//2]
q = a[n//2 - 1]
res = 0
for e in a:
    res += abs(e-p)
ans = 0
for e in a:
    ans += abs(e-q)
print(min(res,ans))


Measured memory_bytes: 25196
import java.util.ArrayList;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int ans = 0;
		int minAbs = 100;
		ArrayList<String> numList = new ArrayList<>();

		for (int i=-100; i<=101; i++) {
			numList.add(String.valueOf(i));
		}
		
		for (int i=1; i<=n; i++) {
			String p = sc.next();
			if(numList.contains(p)) {
				numList.remove(p);
			}
		}

		for (int i=0; i<numList.size(); i++) {
			int abs = Math.abs(x - Integer.parseInt(numList.get(i)));
			if(abs < minAbs) {
				minAbs = abs;
				ans = Integer.parseInt(numList.get(i));
			}
		}

		System.out.println(ans);
		sc.close();
	}

}

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

using namespace std;

const int M = 100000;

int main() {
  int n, umax = 0, vmax = 0, usubmax = 0, vsubmax = 0, umode = 0, vmode = 0;
  cin >> n;
  vector<int> u, v, uc(M, 0), vc(M, 0);
  for(int i = 0; i < n; i++) {
    int m;
    if(i % 2) {
      cin >> m;
      v.push_back(m);
      vc[m - 1]++;
    } else {
      cin >> m;
      u.push_back(m);
      uc[m - 1]++;
    }
  }
  for(int i = 0; i < M; i++) {
    if(umax < uc[i]) {
      umax = uc[i];
      umode = i + 1;
    }
    if(vmax < vc[i]) {
      vmax = vc[i];
      vmode = i + 1;
    }
  }
  if(umode - vmode) {
    cout << n - vmax - umax << endl;
  } else {
    vc[vmode - 1] = 0;
    uc[umode - 1] = 0;
    for(int i = 0; i < M; i++) {
    	if(usubmax < uc[i]) {
      		usubmax = uc[i];
      		umode = i + 1;
    	}
    	if(vsubmax < vc[i]) {
      		vsubmax = vc[i];
      		vmode = i + 1;
    	}
    }
    if(usubmax > vsubmax) {
      cout << n - usubmax - vmax << endl;
    } else {
      cout << n - vsubmax - umax << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
#define MAX 200005

struct unionfind{
  int pa[MAX];
  int ra[MAX];
  void init(){
    for(int i=0;i<MAX;i++){
      pa[i]=i;
      ra[i]=0;
    }
  }

  int find(int x){
    if(pa[x]==x)return x;
    else return pa[x]=find(pa[x]);
  }

  void unite(int x,int y){
    x=find(x),y=find(y);
    if(x==y)return;
    if(ra[x]<ra[y])swap(x,y);
    pa[y]=x;
    if(ra[x]==ra[y])ra[x]++;
  }

  bool same(int x,int y){
    return (find(x)==find(y));
  }
};

unionfind A,B;
set<int> s[MAX];
set<int> t[MAX];
int ans[MAX];

int N,K,L;

void solve(int id){

  int x=A.find(id);
  int y=B.find(id);
  
  vector<int> v;
  if( t[y].size() < s[x].size() ){
    for( int key : t[y] ){
      if(s[x].count(key)>0){
        v.push_back(key);
      }
    }
  }else{
    for( int key : s[x] ){
      if(t[y].count(key)>0){
        v.push_back(key);
      }
    }
  }
  
  for(int key : v ){
    ans[key]=v.size();
    if(t[x].count(key))t[x].erase(key);
    if(t[y].count(key))t[y].erase(key);
  }
}

int main(){
  scanf("%d %d %d",&N,&K,&L);
  A.init();
  B.init();
  for(int i=0;i<K;i++){
    int a,b;
    scanf("%d %d",&a,&b);
    A.unite(a,b);
  }
  for(int i=0;i<L;i++){
    int a,b;
    scanf("%d %d",&a,&b);
    B.unite(a,b);
  }

  for(int i=1;i<=N;i++){
    s[A.find(i)].insert(i);
    t[B.find(i)].insert(i);
  }

  memset(ans,-1,sizeof(ans));
  for(int i=1;i<=N;i++){
    if(ans[i]==-1){
      solve(i);
    }
  }
  for(int i=1;i<=N;i++){
    if(i>1)printf(" ");
    printf("%d",ans[i]);
  }
  printf("\n");
  return 0;
}
// 123 4
// 14 23

//1235 67 4
//1 2 345 67

  /*
  for(int i=1;i<=N;i++){
    cout<<i<<endl;
    for(int x:s[i]){
      cout<<x<<' ';
    }
    cout<<endl;
  }
  for(int i=1;i<=N;i++){
    cout<<i<<endl;
    for(int x:t[i]){
      cout<<x<<' ';
    }
    cout<<endl;
  }
  */


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

int main() {
    int K, N;
    cin >> K >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A.at(i);
    }

    vector<int> d(N);
    for(int i = 0; i < N - 1; i++) {
        d.at(i) = A.at(i + 1) - A.at(i);
    }
    d.at(N - 1) = (K - A.at(N - 1)) + (A.at(0));

    int max_distance = *max_element(d.begin(), d.end());
    int ans = K - max_distance;
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e6+10;
int a[N];
int sum[N];
int n,k;
ll ans;
int cmp(int x,int y){
	return x>y;
}
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>a[i],sum[a[i]]++;
	sort(sum+1,sum+1+n,cmp);
	for(int i=k+1;i<=n;i++) ans+=sum[i];
	cout<<ans;
	return 0;
}

Measured memory_bytes: 5120
#include <iostream>
using namespace std; 
char arr[20];
 char newarr[19];
int main() {
int i=0;
for(i=0;i<19;i++)
{cin>>arr[i];

if(arr[i]!=',')
newarr[i]=arr[i];
else
newarr[i]=' ';
cout<<newarr[i];}
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
    IOS;
    int n;
    cin >> n;
    long long ans = 0;
    long long tempOne = 2;
    long long tempTwo = 1;
        for(int i=1; i<=n; i++){
            ans = tempOne+tempTwo;
            tempOne = tempTwo;
            tempTwo = ans;
        }
        cout << tempOne <<endl;
}


Measured memory_bytes: 3624
#include <stdio.h>
int main()
{
    int arr[1000];
    int n, i;
    scanf("%d", &n);
    for(i=0; i<n; i++)
    {
        scanf("%d", &arr[i]);
    }
    for(i = n-1; i>0; i--)
    {
        printf("%d ", arr[i]);
    }
    printf("%d\n", arr[0]);

    return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    
    int x,y;
    cin>>x>>y;
    int a[]={1,3,1,2,1,2,1,1,2,1,2,1};
    cout<<(a[x-1]==a[y-1] ? "Yes" : "No") <<endl;
    
    return 0;
}


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

int main() {
    int N, D;
    cin >> N >> D;
    vector<vector<int>> X(N, vector<int>(D));
    rep(i, N) {
        rep(j, D) {
            cin >> X[i][j];
        }
    }
    int cnt = 0;
    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            ll dist = 0;
            rep(k, D) {
                dist += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            }
            ll tmp = sqrt(dist);
            tmp* tmp == dist ? cnt += 1 : true;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define dump(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  if(n == 0) {
    cout << 1 << endl;
  } else if(n == 1) {
    cout << 2 << endl;
  } else if(n == 2) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 3164
#abc 114 c

n=input()
n_len=len(n)
nana=["7","5","3"]

def dfs(s):
    #print(s,n)
    if int(s)>int(n):
        return 0
    d=1 if all(s.count(nana[i])>=1 for i in range(3) ) else 0
    for j in range(3):
        d+=dfs(s+nana[j])
    return d

ans=dfs("0")
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	  
	public static void main(String args[]) {
		    Scanner sc = new Scanner(System.in);
		   
		    long x = sc.nextLong();
		    long count = 0;
		    count += 2 * (x/11);
		    if(x % 11 > 6) {
		    	count += 2;
		    }
		    else if(x % 11 != 0) {
		    	count += 1;
		    }
		    
		    System.out.println(count);
		    
		    sc.close(); }
		  }


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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

ll n;
long double ans , x;
string s;

int main()
{
    _FastIO;
    cout.precision(10);
    cin >> n;
    while(n--){
        cin >> x >> s;
        if(s == "JPY"){
            ans += x;
        }
        else{
            ans += (380000.0 * x);
        }
    }
    cout << fixed << ans << endl;
    return 0;
}


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

using namespace std;
const int N = 1010;
int _w;

int h, w, a, b, ans[N][N], cnt[N], rk[N];

bool cmp_cnt( int i, int j ) {
	return cnt[i] > cnt[j];
}

bool check( int x, int y ) {
	int cx = x * a + (h-x) * (w-a);
	int cy = y * b + (w-y) * (h-b);
	if( cx != cy ) return false;
	for( int i = 1; i <= h; ++i )
		for( int j = 1; j <= w; ++j )
			ans[i][j] = 0;
	for( int i = 1; i <= h; ++i )
		if( i <= x ) cnt[i] = a;
		else cnt[i] = w-a;
	for( int i = 1; i <= w; ++i ) {
		int c = i <= y ? b : h-b;
		for( int j = 1; j <= h; ++j )
			rk[j] = j;
		sort(rk+1, rk+h+1, cmp_cnt);
		for( int j = 1; j <= c; ++j )
			if( cnt[rk[j]] == 0 )
				return false;
			else ans[rk[j]][i] = 1, --cnt[rk[j]];
	}
	return true;
}

void output() {
	for( int i = 1; i <= h; ++i, puts("") )
		for( int j = 1; j <= w; ++j )
			putchar( ans[i][j] + '0' );
}

int main() {
	_w = scanf( "%d%d%d%d", &h, &w, &a, &b );
	for( int x = 0; x <= h; ++x )
		for( int y = 0; y <= w; ++y )
			if( check(x, y) )
				return output(), 0;
	return puts("-1"), 0;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;

int main(){
/*
long long n; cin>>n;
long long sum=0;
for(long long i=1;i<=n;i++){
	if(i%3!=0 && i%5!=0) sum+=i; 

}
cout<<sum<<"\n";
*/
int n; cin>>n;
while(n>0){
	if((n%10)==7) { cout<<"Yes"; return 0; }
	n/=10;
}
cout<<"No";
return 0;
}

Measured memory_bytes: 3624
#ABC090-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n,k=IL()
ans=0
for i in range(1,n+1):
    ans+=max(i-k,0)*(n//i)
    ans+=max(0,n%i-k+1)
if k==0:
    ans=n*n
print(ans)

Measured memory_bytes: 39280
N, M = map(int, input().split())
students = [tuple(map(int, input().split())) for _ in range(N)]
checkpoints = [tuple(map(int, input().split())) for _ in range(M)]
for student in students:
  dist_p = 0
  dist_m = 4*10**8
  for idx, checkpoint in enumerate(checkpoints):
    dist_temp = abs(student[0]-checkpoint[0]) + abs(student[1]-checkpoint[1])
    if dist_temp < dist_m:
      dist_p = idx+1
      dist_m = dist_temp
  print(dist_p)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

int main() {
  int n;
  scanf("%d", &n);
  vector<int> p(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &p[i]);
  }
  int min_v = INF, ret = 0;
  for (int i = 0; i < n; ++i) {
    if (min_v > p[i]) ++ret;
    min_v = min(min_v, p[i]);
  }
  printf("%d\n", ret);
  return 0;
}


Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))
b = [0] * n
for i in reversed(range(1, n+1)):
    if i * 2 > n:
        b[i-1] = a[i-1]
    else:
        if sum(b[i-1::i]) % 2 != a[i-1]:
            b[i-1] = 1
l = []
for i in range(n):
    if b[i] == 1:
        l.append(i+1)
print(len(l))
if len(l) > 0:
    print(' '.join(list(map(str, l))))

Measured memory_bytes: 19896
S = input()

if (S[0] == S[1] and S[1] != S[2] and S[2] ==S[3]):
    print('Yes')
elif (S[0] == S[2] and S[2] != S[1] and S[1] == S[3]):
    print('Yes')
elif (S[0] == S[3] and S[3] != S[1] and S[1] == S[2]):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
import Text.Printf
import Control.Monad
import Data.Char
import Data.List
import Debug.Trace

eratosthenes :: ([Int],[Int]) -> [Int]
eratosthenes (tosearch, primes) = 
    if (head tosearch)*(head tosearch)>=(last tosearch) then sort $ tosearch++primes
    else eratosthenes (tosearch', primes')
    where
        primes' = primes ++ [head tosearch]
        tosearch' = filter (\x->(x`mod`(head tosearch))/=0) tosearch

primes :: [Int]
primes = eratosthenes([2..50021], [])

solve :: Int -> IO ()
solve n = do 
    let pmax = last $ takeWhile (<n) primes
    let pmin = head $ filter (>n) primes
    printf "%d %d\n" pmax pmin

main :: IO ()
main = do
    s<-getContents :: IO String 
    mapM_ solve $ map (\x->read x::Int) $ lines $ s

Measured memory_bytes: 21928
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;



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

  ll N, K;
  cin >> N >> K;
  vector<ll> h(N);
  REP(i,N) { cin >> h[i]; }

  ll ans = 0;
  REP(i,N){
    if (h[i]>=K) ans++;
  }
  cout << ans << "\n";
  return 0;
}


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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    
    REP(i,n){
        FOR(j,i+1,n){
            if(j != i+1)cout << " ";
            int32 x = i ^ j;
            REP(b,n){
                if(x >> b & 1){
                    cout << b + 1;
                    break;
                }
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    long long int n,i,x,y,min;
    scanf("%lld",&n);
    min = n;
    for(i=2;i<=sqrt(n);i++)
        {
            if(n%i==0)
            {
               x=i;
               y=n/i;

               if(min>x+y-2)
                min = x+ y-2;

            }

        }
        if(min !=n)
        printf("%lld",min);
        else
        printf("%lld",n-1);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}


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

const int N=200005;



void solve()
{
    string s;
    cin>>s;
    int n=s.length();
    if(s[n-1]=='s')
    {
        cout<<s<<"es";
    }
    else
        cout<<s<<"s";
    cout<<endl;
    
}

int32_t main()
{
    IOS;
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        
        solve();
    }
    return 0;
}



Measured memory_bytes: 3656
n, m = map(int, input().split())

ab = []

for i in range(m):
    ab.append(tuple(map(int, input().split())))

ab.sort(reverse = True)

ans = 0
last = n

for elm in ab:
    a = elm[0]
    b = elm[1]
    if b <= last:
        ans += 1
        last = a

print(ans)

Measured memory_bytes: 17000
#include <iostream>
#include <string>

using namespace std;

int main()
{
  string s;
  cin >> s;
  
  if(s.size()%2 == 1) {
    cout << "No" << endl;
  } else {
    for(int i = 0; i < s.size(); i += 2) {
      if(s[i] != 'h' || s[i+1] != 'i') {
        cout << "No" << endl;
        return 0;
      }
    }
    
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 888
import sys
sys.setrecursionlimit(1000000)


def input():
    return sys.stdin.readline()


n, m = [int(i) for i in input().split()]
e = [[] for _ in range(n)]
for _ in range(m):
    a, b = [int(i) - 1 for i in input().split()]
    e[a].append(b)
    e[b].append(a)

ok = False
tag = [-1] * n


def dfs(i=0, c=0, r=-1):
    global ok, tag
    if tag[i] != -1:
        if tag[i] != c:
            ok = True
        return
    tag[i] = c
    for j in e[i]:
        if j == r:
            continue
        dfs(j, (c + 1) % 2, i)


dfs()

if ok:
    print(n * (n - 1) // 2 - m)
else:
    s = sum(tag)
    print(s * (n - s) - m)


Measured memory_bytes: 238028
s = input()

a =["SUN","MON","TUE","WED","THU","FRI","SAT"]

if(s == a[0]):
  print(7)
elif(s == a[1]):
  print(6)
elif(s == a[2]):
  print(5)
elif(s == a[3]):
  print(4)
elif(s == a[4]):
  print(3)
elif(s == a[5]):
  print(2)
else:
  print(1)
  
  

Measured memory_bytes: 38384
def main():
    X, Y = map(int , input().split())

    yes = False

    for i in range(300):
        for j in range(300):
            if (i + j == X) and (2*i + 4*j == Y):
                yes = True

    if yes:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Measured memory_bytes: 9180
s = input()
SQUARES = [0] * len(s)

i, j = 0, 0
character = s[0]
while True:
    j += 1
    if j == len(s):
        break
    
    if s[j] != character and character == "R":
        count = j - i
        if count % 2 == 0:
            SQUARES[j - 1] += count // 2
            SQUARES[j] += count // 2
        else:
            SQUARES[j - 1] += count // 2 + 1
            SQUARES[j] += count // 2
        i = j
        character = s[i]
    
    elif s[j] != character and character == "L":
        count = j - i
        if count % 2 == 0:
            SQUARES[i - 1] += count // 2
            SQUARES[i] += count // 2
        else:
            SQUARES[i - 1] += count // 2
            SQUARES[i] += count // 2 + 1
        i = j
        character = s[i]

count = j - i
if count % 2 == 0:
    SQUARES[i - 1] += count // 2
    SQUARES[i] += count // 2
else:
    SQUARES[i - 1] += count // 2
    SQUARES[i] += count // 2 + 1

SQUARES = [str(square) for square in SQUARES]
answer = " ".join(SQUARES)
print(answer)


Measured memory_bytes: 10364
#include <iostream>
#include <cstdlib>
#include <algorithm>

using namespace std;

	int A[3];

int asc(const void *a, const void *b) {
	  return *(int *)a - *(int *)b;
}

int solve()
{


	if(A[0] == A[1] && A[1] == A[2]) return 0;
	if(A[0] == A[1]) return abs(A[1] - A[2]);
	if(A[1] == A[2]) return abs(A[0] - A[1]);
	if(A[0] == A[2]) return abs(A[0] - A[1]);

	qsort(A, sizeof(A) / sizeof(int), sizeof(int), asc);

	return abs(A[0] - A[1]) + abs(A[1] - A[2]);
}

int main()
{
	for(int i=0; i<3; ++i) cin >> A[i];
	cout << solve();

	return 0;

}


Measured memory_bytes: 384
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')

N = int(input())

hlist = inpl()

dp = [INF]*N

for i in range(N):
    if i == 0 :
        dp[i] = 0
    elif i < 2:
        dp[i] = dp[i-1]+abs(hlist[i]-hlist[i-1])
    elif i < N:
        dp[i] = min(dp[i-1]+abs(hlist[i]-hlist[i-1]),dp[i-2]+abs(hlist[i]-hlist[i-2]))

print(dp[N-1])


Measured memory_bytes: 15000
# include "cstdio"
# include "iostream" 
 
using namespace std;

const int maxm=300000+10; 

int num[300300];
 
int main(){
	int n;
	string s;
	scanf("%d",&n); 
	cin>>s;
	num[0]=s[0]=='W';
	for(int i=1;i<n;i++) {
		num[i]=num[i-1];
		if (s[i] == 'W') {
			num[i]++;
		}
	}
	int tot=num[n-1];
	int ans=n-tot-(1-num[0]);
	for (int i=1;i<n;i++) {
		int now=num[i-1]+n-i-1-tot+num[i];
		ans=min(ans,now);
	}
	printf("%d",ans);
	return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  ll ans = k;
  rep(i,n-1){
    ans *= (k-1);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(s,e) for(ll i=s;i<e;i++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = 100000000000009;
ll i;

int main(){
    string S;
    cin>>S;
    ll N=S.length();
    bool jud=true;
    for(ll j=0;j<(N+1)/2;j++){
        if(S.at(j)!=S.at(N-1-j)){
            jud=false;
            break;
        }
    }
    for(ll j=0;j<(N-1)/2;j++){
        if(S.at(j)!=S.at((N-1)/2-1-j)){
            jud=false;
            break;
        }
    }
    for(ll j=0;j<(N-1)/2;j++){
        if(S.at((N+1)/2+j)!=S.at(N-1-j)){
            jud=false;
            break;
        }
    }
    if(jud)cout<<"Yes";
    else cout<<"No";
    cout<<endl;
}

Measured memory_bytes: 256
S = input()

if S[0] != 'A':
    # print('A', S[0])
    print('WA')
    exit(0)

substr = S[2:-1]

num_C = substr.count('C')


if num_C != 1:
    # print("substr=", substr)
    # print('num_C', num_C)
    print('WA')
    exit(0)


for i, c in enumerate(S):
    if i == 0:
        continue
    if c == 'C':
        continue
    if c.islower():
        continue
    else:
        # print("notlower=", c)
        print('WA')
        exit(0)

print('AC')


Measured memory_bytes: 3060
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>

int main() {
  size_t N;
  scanf("%zu", &N);

  std::vector<size_t> T(N);
  size_t S = 0;
  for (auto& ti: T) {
    scanf("%zu", &ti);
    S += ti;
  }

  size_t M = 2500;
  std::vector<std::vector<bool>> dp0(M+1, std::vector<bool>(M+1));
  auto dp1 = dp0;
  dp0[0][0] = true;
  for (size_t i = 0; i < N; ++i) {
    for (size_t s = 0; s <= M; ++s) {
      for (size_t t = 0; t <= M; ++t) {
        if (!dp0[s][t]) continue;
        if (t + T[i] <= M)
          dp1[s][t+T[i]] = true;
        if (s + T[i] <= M)
          dp1[s+T[i]][t] = true;
      }
    }
    dp0 = dp1;
  }

  size_t res = M+M;
  for (size_t i = 0; i <= M; ++i)
    for (size_t j = 0; j <= M; ++j) {
      if (!dp0[i][j]) continue;
      size_t k = S - (i+j);
      res = std::min(res, std::max({i, j, k}));
    }

  printf("%zu\n", res);
}



Measured memory_bytes: 4296
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
/*    #ifndef ONLINE_JUDGE
      // for getting input from input.txt
      freopen("input.txt", "r", stdin);
      // for writing output to output.txt
      freopen("output.txt", "w", stdout);
  #endif*/
fast();
//ll  t;cin>>t;while(t--)
{
  ll a[3];
  cin>>a[0]>>a[1]>>a[2];
  sort(a,a+3);
  if(a[0]==5&&a[1]==5&&a[2]==7)
    YES
  else
    NO
  
  

}
return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

var (
	finv, inv, fac [MAX]int
)

func COM(n, k int) int {
	if n < k {
		return 0
	}
	if n < 0 || k < 0 {
		return 0
	}
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD
}

func init() {
	fac[0] = 1
	fac[1] = 1
	finv[0] = 1
	finv[1] = 1
	inv[1] = 1
	for i := 2; i < MAX; i++ {
		fac[i] = fac[i-1] * i % MOD
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD
		finv[i] = finv[i-1] * inv[i] % MOD
	}
}

const (
	MOD = 1000000007
	MAX = 510000
)

func ModAdd(a, b int64) int64 {
	return (a + b) % MOD
}

func ModMul(a, b int64) int64 {
	return a * b % MOD
}

func ModSub(a, b int64) int64 {
	r := (a%MOD - b%MOD) % MOD
	if r < 0 {
		r += MOD
	}
	return r
}

func ModDiv(a, b int64) int64 {
	return a % MOD * ModInv(b) % MOD
}

func ModPow(a, n int64) int64 {
	var r int64 = 1
	for n > 0 {
		if n&1 == 1 {
			r = r * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return r
}

func ModInv(a int64) int64 {
	var b, u, v int64 = MOD, 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= MOD
	if u < 0 {
		u += MOD
	}
	return u
}

type Q struct {
	value int
	index int
	A, B  int
}

type QS []*Q

func (p QS) Len() int           { return len(p) }
func (p QS) Less(i, j int) bool { return p[i].value > p[j].value }
func (pq QS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *QS) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Q)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *QS) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

func FactoredPrimeNumber(num int) map[int]int {
	m := map[int]int{}
	return factor(m, num, 2)
}

func factor(result map[int]int, num, pnum int) map[int]int {
	if pnum*pnum > num {
		if num != 1 {
			result[num] += 1
		}
		return result
	}

	if num%pnum == 0 {
		num /= pnum
		result[pnum]++
	} else {
		pnum++
	}
	return factor(result, num, pnum)
}

func GCD(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return GCD(b, a%b)
}

func LCM(a, b int64) int64 {
	return a * b / GCD(a, b)
}

type P struct {
	B, C int
}

type PS []*P

func (p PS) Len() int           { return len(p) }
func (p PS) Less(i, j int) bool { return p[i].C > p[j].C }
func (pq PS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
}

func main() {
	var N, K int
	var S string
	fmt.Scanf("%d %d\n%s\n", &N, &K, &S)

	R := []rune(S)
	for i := 0; i < N; i++ {
		if i+1 == K {
			R[i] = []rune(strings.ToLower(string(R[i])))[0]
		}
	}
	fmt.Println(string(R))
}

type IntHeap []int

func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] < h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 12544
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#include<array>
#include<string>
#include<sstream>
#include<stack>
#include<queue>
#include<list>
#include<functional>
#define _USE_MATH_DEFINES

#include<math.h>
#include<map>

#define SENTINEL 1000000001

#define min(a,b) (a)>(b)?(b):(a)
#define max(a,b) (a)>(b)?(a):(b)

using namespace std;

/*struct OwnNode
{
	vector<int> to;
	vector<int> to_cost;

	int id;
	bool checked;
	int cost;

	OwnNode(int id):id(id),checked(false),cost(-1){}

	bool operator<(const OwnNode& node)const
	{
		return cost < node.cost;
	}

	bool operator>(const OwnNode& node)const
	{
		return cost > node.cost;
	}

	OwnNode operator-(const OwnNode& node)const
	{
		return cost - node.cost;
	}
};*/

int d[100][100];

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

	for (int i = 0; i < n; i++)for (int j = 0; j < n; j++)
	{
		d[i][j] = 100000000;
	}

	for (int i = 0; i < n; i++)
	{
		d[i][i] = 0;
	}

	for (int i = 0; i < n; i++)
	{
		int id, k;
		cin >> id >> k;
		for (int j = 0; j < k; j++)
		{
			int v, c;
			cin >> v >> c;
			d[id][v] = c;
		}
	}

	for (int k = 0; k < n; k++)
	{
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}

	for (int i = 0; i < n; i++)
	{
		printf("%d %d\n", i, d[0][i]);
	}

	/*vector<OwnNode> nodes;

	for (int i = 0; i < n; i++)
	{
		int id, k;
		cin >> id >> k;

		nodes.push_back(OwnNode(id));

		for (int j = 0; j < k; j++)
		{
			int v, c;
			cin >> v >> c;
			nodes[i].to.push_back(v);
			nodes[i].to_cost.push_back(c);
		}
	}

	priority_queue<OwnNode, vector<OwnNode>, greater<OwnNode>> pq;

	nodes[0].cost = 0;
	pq.push(nodes[0]);

	while (pq.size() != 0)
	{
		OwnNode tn = pq.top();
		pq.pop();

		nodes[tn.id].checked = true;

		for (int i = 0; i != tn.to.size(); i++)
		{
			if (nodes[tn.to[i]].checked)continue;
			if (nodes[tn.to[i]].cost == -1)
			{
				nodes[tn.to[i]].cost = tn.to_cost[i];
			}
			else
			{
				nodes[tn.to[i]].cost = min(nodes[tn.to[i]].cost, tn.to_cost[i] + tn.cost);
			}
			pq.push(nodes[tn.to[i]]);
		}
	}

	for (auto& node : nodes)
	{
		
		printf("%d %d\n", node.id, node.cost);
	}*/

	return 0;
}


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

using namespace std;

#define ll  long long
#define ld  double

#define all(x)  x.begin(),x.end()
#define sz(x)   (int)x.size()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 2e5 + 5;

typedef pair<int,int>   ii;
typedef tuple<int,int,int>  ed;

int cnt[20];

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

    int L;  cin >> L;

    vector<ed>  E;

    for(int i = 19 ; i > 1 ; --i)   {
        E.pb(i - 1,i,0),
        E.pb(i - 1,i,1 << 19 - i);
    }
    int val = 0;

    if (L >> 19 & 1)    {
        E.pb(0,1,0);
        E.pb(0,1,1 << 18);
        val = (1 << 19);
    }
    for(int i = 18 ; i >= 0 ; --i)
        if (L >> i & 1) {
            E.pb(0,19 - i,val);
            val ^= (1 << i);
        }

    cout << 20 << " " << E.size() << "\n";

    for(ed  e : E)  {
        cout << get<0>(e) + 1 << " ";
        cout << get<1>(e) + 1 << " ";
        cout << get<2>(e) << "\n";
    }
    cnt[19] = 1;

    for(int i = 19 ; i > 0 ; --i)
    for(ed  e : E)  if (get<1>(e) == i)
        cnt[get<0>(e)] += cnt[i];

    assert(cnt[0] == L);
}

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

int main() {
	//1週間ごとに5%の利子を借金に加え、さらに借金の 1,000 円未満を切り上げます。
	int n;
	cin >> n;
	int money = 100000;
	for	(int i = 0; i < n; i++){
		money *= 1.05;
		if (money % 1000 > 0)	money = (money / 1000 + 1)*1000;
	}
	cout << money << endl;
	return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    while (cin>>n, n) {
        vector<string> a(n);
        vector<vector<int>> x(1024);
        int f=10000;
        for(int i=0;i<n;++i) {
            cin>>a[i];
            int k=a[i].find_last_of('.');
            if (k>=0) {
                if (k<=f and x[k].size()) {
                    for(int j=x[k].back()+1;j<i;++j) a[j][k]='|';
                }
                x[k].push_back(i);
                a[i][k]='+';
                f=k;
            }
        }
        for(auto& s: a) {
            for(char& c: s) if (c=='.') c=' ';
            cout<<s<<endl;
        }
    }
}

Measured memory_bytes: 1788
#include <iostream>
using namespace std;
#include<bits/stdc++.h>
typedef long long ll;
#define int long long
#define ff first
#define ss second
#define md 1000000007
#define md1 998244353
#define pb push_back
#define in insert
#define mkp make_pair
#define f(i,yha,wha) for(ll i=yha;i<wha;i++)
#define rf(i,wha,yha) for(ll i=wha;i>=yha;i--)
#define f0(n) for(ll i=0;i<n;i++)
#define f1(n) for(ll i=1;i<=n;i++)
#define fg(i,yha,wha,gap) for(ll i=yha;i<wha;i+=gap)
#define mpll map<ll,ll>
#define len(p) (ll)p.size()
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define mem(a,t) memset(a,t,sizeof(a))
#define endl "\n"
#define ar array
#define vl vector<ll>
#define vpll vector<pair<ll,ll>>


void flash()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}

void solve()
{
	ll n;
	cin>>n;
	float ans=2*n*(22/7.0);
	cout<<setprecision(15)<<ans<<endl;
	
}


int32_t main()
{
  flash();
  int t;
  t = 1;
//  cin >> t;
  while (t--)
  {
    solve();
  }
  return 0;
}

Measured memory_bytes: 3804
while True:
  try:
    a=float(input())
    if a <= 48: print "light fly"
    elif 48<a<=51: print "fly"
    elif 51<a<=54: print "bantam"
    elif 54<a<=57: print "feather"
    elif 57<a<=60: print "light"
    elif 60<a<=64: print "light welter"
    elif 64<a<=69: print "welter"
    elif 69<a<=75: print "light middle"
    elif 75<a<=81: print "middle"
    elif 81<a<=91: print "light heavy"
    elif 91<a: print "heavy"
  except EOFError: break

Measured memory_bytes: 4272
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

int main()
{
    vint A(4);
    char op[] = {'+','-'};
    string inp;
    cin >> inp;
    REP(i,4){
        A[i] = inp[i]-'0';
    }
    string ans;
    REP(i,2){
        int calc1 = A[0];
        if(i == 0){
            calc1 += A[1];
        }else{
            calc1 -= A[1];
        }
        REP(j,2){
            int calc2 = calc1;
            if(j == 0){
                calc2 += A[2];
            }else{
                calc2 -= A[2];
            }
            REP(k,2){
                int calc = calc2;
                if(k == 0){
                    calc += A[3];
                }else{
                    calc -= A[3];
                }
                if(calc == 7){
                    cout << A[0] << op[i] << A[1] << op[j] << A[2] << op[k] << A[3] << "=7" << endl;
                    return 0;
                }
            }
        }
    }
}

Measured memory_bytes: 3624
#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)
typedef float fl;
int main(){
int n;
fl sum=0;
  cin>>n;
  vector<pair<fl,string>> a(n);
  REP(i,n){
  cin>>a[i].first>>a[i].second;
    if(a[i].second=="BTC"){a[i].first*=380000.0;}
    sum+=a[i].first;
  }
  cout<<sum<<endl;
return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a.begin(), a.end());
	int max = a.back();
	int r = 0;
	if (max % 2 == 0) {
		for (int i = 0; i < n; i++)
			if (abs(max / 2 - a[i]) < abs(max / 2 - r))
				r = a[i];
	}
	else {
		for (int i = 0; i < n; i++)
			if (abs(max / 2 + 1 - a[i]) < abs(max / 2 + 1 - r))
				r = a[i];
	}
	cout << max << " " << r << endl;
	return 0;
}

Measured memory_bytes: 640