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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pdd;

#define INF 0x7f7f7f
#define mem(a,b) memset(a , b , sizeof(a))
#define FOR(i, x, n) for(int i = x;i <= n; i++)
// const ll mod = 1e9 + 7;
// const int maxn = 1e5 + 10;
// const double eps = 1e-6;

const int maxn = 2e5 + 10;
int a[maxn], vis[maxn];
int ans, pos;
vector<int> v;

void dfs(int u)
{
    ans++;
    vis[u] = ans;
    v.push_back(u);
    if(!vis[a[u]])
        dfs(a[u]);
    else
    {
        pos = vis[a[u]];
        v.push_back(a[u]);
        return ;
    }
}

void solve()
{
    ll n, k;
    cin >> n >> k;
    for(int i = 1;i <= n; i++)
        cin >> a[i];
    dfs(1);
    if(k < v.size())
        cout << v[k] << endl;
    else
    {
        k -= v.size();
        ll len = v.size() - pos;
        cout << v[pos + k % len] << endl;
    }
}

signed main()
{
    ios_base::sync_with_stdio(false);
    //cin.tie(nullptr);
    //cout.tie(nullptr);
#ifdef FZT_ACM_LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#else
    ios::sync_with_stdio(false);
    int T = 1;
    //cin >> T;
    while(T--)
        solve();
#endif
    return 0;
}


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	string S, T;
	cin >> S >> T;
	T.pop_back();
	if (S == T) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define double long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
#define ceil(a,b) (a+b-1)/b
#define endl "\n"
 const int N=100005;
 const int inf=1e17;
 const double eps=1e-9;
int pow1(int a,int b){
    int res=1;
    while(b>0){
        if(b&1){
        	res=res*a;
		}
        a=a*a;
        b>>=1;
    }
    return res;
}
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	int n,d,a;
    cin>>n>>d>>a;
    pair<int,int> p[n];
    for(int x=0;x<n;x++){
        cin>>p[x].F>>p[x].S;
    }
    sort(p,p+n);
    map<int,int>m;
    int ans=0;
    int sum=0;
    for(int x=0;x<n;x++){
        // cout<<p[x].F<<" pos "<<endl;
        auto itr=m.lower_bound(p[x].F);
        // cout<<itr->second<<" pos1 "<<endl;
        if(itr==m.end()||itr->first<p[x].F){
            int pw=p[x].S;
            if(pw%a==0){
                // if(x==0){
                //     cout<<p[x].F+2*d;
                // }
                ans+=pw/a;
                sum+=pw;
                m[p[x].F+2*d]=sum;
            }else{
                ans+=pw/a+1;
                sum+=(pw/a+1)*a;
                m[p[x].F+2*d]=sum;
            }
        }else{
            if(itr==m.begin()){
                // if(x==1){
                //     cout<<"F1";
                // }
                int pw=p[x].S-sum;
                // cout<<pw<<" pw ";
                if(pw<=0){
                    continue;
                }else{
                  if(pw%a==0){
                    ans+=pw/a;
                    sum+=pw;
                    m[p[x].F+2*d]=sum;
                }else{
                    ans+=pw/a+1;
                    sum+=(pw/a+1)*a;
                    m[p[x].F+2*d]=sum;
                }  
                }
            }else{
                // int c=itr->second;
                itr--;
                int c=sum-itr->second;
                // cout<<c<<" c ";
                int pw=p[x].S-c;
                // cout<<pw<<" pw ";
                if(pw<=0){
                    continue;
                }else{
                  if(pw%a==0){
                    ans+=pw/a;
                    sum+=pw;
                    m[p[x].F+2*d]=sum;
                }else{
                    ans+=pw/a+1;
                    sum+=(pw/a+1)*a;
                    m[p[x].F+2*d]=sum;
                }  
                }
            }
        }
        // cout<<ans<<" ans "<<endl;
    }
    cout<<ans;










	
return 0;
}


Measured memory_bytes: 15872
// ABC142 B.rs

macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let (n, k) = get!(usize, usize);
    let hs = get!( usize;; );
    let candidates: Vec<&usize> = hs.iter().filter(|&x| x >= &k).collect();
    let ans = candidates.len();

    println!("{}", ans);
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

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

int H,W,K;
string c[100];
string s[100];

void solve() {
  int cnt = 0;
  rep(i,(1<<H)) {
    rep(j,(1<<W)) {
      rep(k,H) s[k] = c[k];
      rep(y,H) {
	rep(x,W) {
	  if( ( (i>>y) & 1 ) || ( (j>>x) & 1) ) {
	    s[y][x] = '?';
	  }
	}
      }
      int ok = 0;
      rep(y,H) {
	rep(x,W) {
	  if( s[y][x] == '#' ) ++ok;
	}
      }
      if( ok == K ) ++cnt;
    }
  }
  cout << cnt << endl;
}

int main() {
  cin >> H >> W >> K;
  rep(i,H) cin >> c[i];
  solve();
  return 0;
}


Measured memory_bytes: 3632
n = int(input())
l = list(map(int, input().split()))
l.sort()
c = 0
for i in range(0,n):
  for j in range(i,n):
    for k in range(j,n):
      if l[i] != l[j] and l[j] != l[k] and l[i] + l[j] > l[k]:
        c += 1
print(c)

Measured memory_bytes: 9208
package main

import "fmt"

func main() {
	var K, S int
	fmt.Scanf("%d %d", &K, &S)

	cnt := 0
	for x := 0; x <= K; x++ {
		for y := 0; y <= K; y++ {
			z := S - (x + y)
			if z >= 0 && z <= K {
				cnt++
			}
		}
	}

	fmt.Println(cnt)
}

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

using namespace std;

#define endl '\n'
#define ll long long
#define mod 1000000007

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    while(t--){
        solve();
    } 
    return 0;
}

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

namespace ABC
{
    class ProgramC
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(" ");
            var n = int.Parse(inputs[0]);
            var k = int.Parse(inputs[1]);

            var a = Console.ReadLine().Split(" ").Select(x => int.Parse(x)).ToList();

            for (var i = k; i < n; i++)
            {
                var result = a[i] > a[i - k];
                Console.WriteLine(result ? "Yes" : "No");
            }
        }
    }
}


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

int main() {
    int N;
    cin >> N;
    int *a = new int[N]{0};
    int *counter = new int[N]{0};

    for(int i=1; i<N; i++){
        cin >> a[i];
        counter[ a[i]-1 ]++;
    }
    for(int i=0; i<N; i++){
        cout << counter[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 5168
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int a,b,c,x,y;
    long ans=10000000000;
    scanf("%d %d %d %d %d",&a,&b,&c,&x,&y);
    int X,Y;
    for(int i=0;i<=max(x,y);i++){
        if((x-i)<0){
            X=0;
        }else{
            X=x-i;
        }
        if((y-i)<0){
            Y=0;
        }else{
            Y=y-i;
        }
        if(((a*X+b*Y)+(2*c*i))<ans){
            ans=(a*X+b*Y)+(2*c*i);
        }
        
    }
    printf("%ld",ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std; 
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long int
#define ld long double
#define fi first 
#define se second 
#define mp make_pair
#define pb push_back
#define ull unsigned long long int
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll> 
#define pld pair<ld,ld> 
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define mo 1000000007
ll gcd(ll a ,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll poww(ll a,ll n){if(n==0)return 1;ll p=poww(a,n/2);p=(p*p)%mo;if(n%2)p=(a*p)%mo;return p;}
////////////////////////////////////////////////////

void solve()
{
	int n , m ; cin>>n>>m; 
	double a[n]; 
	lp(i,0,n)
	cin>>a[i];
	sort(a,a+n); 
	
	double sum = 0; 
	lp(i,0,n)
	sum+=a[i]; 
	
	double val = sum; 
	val/=(4.0); 
	val/=m;
	int f = 1; 
	for(int i =0 ; i<m;i++)
	{
		if(a[n-1-i]<val)
		f =0; 
	}
	if(f)
	cout<<"Yes"<<endl; 
	else
	cout<<"No"<<endl; 
}

int main()
{ ios; 

 int t; t=1;
 while(t--)
	solve(); 
	return 0 ; 
}

Measured memory_bytes: 256
l, r = map(int, input().split())
ans = 2019
if r - l + 1 >= 2019:
    ans = 0
else:
    for i in range(l, r + 1):
        for k in range(i + 1, r + 1):
            if ans > (i * k) % 2019:
                ans = (i * k) % 2019
            else:
                continue
print(ans)


Measured memory_bytes: 9176
#include <stdio.h>
#include <stdlib.h>
#define N 20
#define Q 200

int A[2000];
int m[2000];
int n;

int res(int,int);

int main(){
  int q,i;

  scanf("%d",&n); 
  if(n>N){
    printf("error\n");
    exit(1);
  }
  
  for(i=0 ; i<n ; i++){
    scanf("%d",&A[i]);
  }
  
  scanf("%d",&q);
  if(q>Q){
    printf("error\n");
    exit(2);
  }
  
  for(i=0 ; i<q ; i++){
    scanf("%d",&m[i]);
  }
  
  for(i=0 ; i<q ; i++){
    if(res(0,m[i])==1)printf("yes\n");
  if(res(0,m[i])==0)printf("no\n");
  }
  return 0;
    }

     
int res(int i,int m){
  int result;
  
  if(m == 0)return 1;
  if(i >= n)return 0;
  result = res(i+1,m)||res(i+1,m-A[i]);
  return result;
}

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

#define sz(a) (int)(a).size()
#define pb push_back
#define all(a) (a).begin(), (a).end()

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;

int main()
{

    //ifstream cin("input.txt");

    string s;
    cin >> s;
    for (int i = 0; i < 4; ++i) {
        cout << s[i];
    }
    cout << " ";
    for (int i = 4; i < sz(s); ++i) {
        cout << s[i];
    }
    cout << "\n";

}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <functional>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// --------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int H,W;
  cin >> W >> H;
  vector<vector<int>> G(H,vector<int>(W,0));
  int N;
  cin >> N;
  int mny=0,mxy=H;
  int mnx=0,mxx=W;
  for(int i=0; i<N; i++){
    int x,y,id;
    cin >> x >> y >> id;
    if(id == 1){
      chmax(mnx,x);
    }else if(id == 2){
      chmin(mxx,x);
    }else if(id == 3){
      chmax(mny,y);
    }else{
      chmin(mxy,y);
    }
  }
  // cout << mnx << " " << mxx << " " << mny << " " << mxy << "\n";
  if(mnx<=mxx && mny<=mxy){
    cout << (mxx-mnx)*(mxy-mny) << "\n";
  }else{
    cout << 0 << "\n";
  }
  return 0;
}


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

using namespace std;

int main(void){
  string str;
  int add=0;
  
  cin >> str;
  
  for(int i=0 ; i < 3 ; i++){
    if(str[i] == 'o') add++;
  }
  
  cout << 700 + add * 100 << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt() + sc.nextInt();
        int[] nums = {1, 2, 3};

        switch (a) {
            case 3:
                System.out.println(3);
                break;
            case 4:
                System.out.println(2);
                break;
            case 5:
                System.out.println(1);
                break;
            default:
                return;
        }
    }
}



Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i,m=0;
	cin>>n;
	int ara[n];
	for(i=0;i<n;i++){
		cin>>ara[i];
	}
	int dp[n],dp1[n];
	dp[0]=ara[0];
	for(i=1;i<n;i++){
		dp[i]=__gcd(dp[i-1],ara[i]);
	}
	dp1[n-1]=ara[n-1];
	for(i=n-2;i>=0;i--){
		dp1[i]=__gcd(dp1[i+1],ara[i]);
	}
	/*if(n==2){
		cout<<max(ara[0],ara[1])<<endl;
		return 0;
	}*/
	m=max(m,dp1[1]);
	m=max(m,dp[n-2]);
	for(i=1;i<n-1;i++){
		m=max(__gcd(dp[i-1],dp1[i+1]),m);

	}
	cout<<m<<endl;
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve() {
	int n; cin >> n;
	vector<ll> v(n);
	for (auto &i : v)cin >> i;
	int cur = v[0];
	ll ans = 0;
	for (ll i : v) {
		ans += max(0ll, cur - i);
		cur = max(cur * 1ll, i);
	}
	cout << ans;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// int t; cin >> t;
	// while (t--)
	solve();

}

Measured memory_bytes: 4732
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

const int MAX = 200;

// stack
class Stack
{
  public:
    Stack() : top(0), S()
    {
    }
    void push(int x)
    {
        if (isFull())
        {
            cerr << "overflow" << endl;
        }
        S[++top] = x;
    }
    int pop()
    {
        if (isEmpty())
        {
            cerr << "underflow" << endl;
            return -1;
        }
        return S[top--];
    }
    bool isEmpty()
    {
        return top == 0;
    }
    bool isFull()
    {
        return top >= MAX - 1;
    }

  private:
    // トップの値はスタックの要素数と等しい
    int top;
    int S[100];
};

// スタックの実装
int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    Stack stack;
    string s;
    int a, b;

    while (cin >> s)
    {
        switch (s[0])
        {
        case '+':
            a = stack.pop();
            b = stack.pop();
            stack.push(a + b);
            break;
        case '-':
            b = stack.pop();
            a = stack.pop();
            stack.push(a - b);
            break;
        case '*':
            a = stack.pop();
            b = stack.pop();
            stack.push(a * b);
            break;
        default:
            stack.push(atoi(s.c_str()));
        }
    }
    cout << stack.pop() << endl;

    return 0;
}


Measured memory_bytes: 3232
#include<stdio.h>
int main(void){
    int i,cnt[200],n,m;
    cnt[0]=0;
    cnt[1]=0;
    cnt[2]=1;
    for (i=3;i<200;i++){
        cnt[i]=cnt[i-1]+i-1;
    }
    scanf("%d %d",&n,&m);
    printf("%d\n",cnt[n]+cnt[m]);
    return 0;
}                                                                                                                       

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {

    ll l,r; cin >>l>>r;

    ll res = 2019;
    for (ll i = l ; i <= min(l+5000, r); i++) {
        for (ll j = i + 1; j <= min(l+5000, r); j++) {
            if (res > ((i*j) % 2019)) {
                res = (i*j) % 2019;
            } 
        }
    }

    cout << res << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		int train = a * n;
		int taxi = b;
		
		if(train < taxi) {
			System.out.println(train);
		} else {
			System.out.println(taxi);
		}
		
		sc.close();
	}

}

Measured memory_bytes: 21716
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long double N;
  cin >> N;
  cout << fixed << SP(20) << M_PI * 2 * N << endl;

  return 0;
}


Measured memory_bytes: 3804
a,b,c,d = gets.chomp.split(" ").map(&:to_i)

l = c.lcm(d)

puts (b - (a-1)) - ( ((b/c) - ((a-1)/c))  + ((b/d) - ((a-1)/d))  ) + ( (b/l) - ((a-1)/l) )

Measured memory_bytes: 3836
#include <iostream>
#include <vector>
#include <string>
#include <queue>
using namespace std;
int h, w, n;
string field[1000];
bool visited[10][1000][1000];
struct state {
	int i, j, d;
};

bool out(int i, int j) {
	return i < 0 || h <= i || j < 0 || w <= j;
}

int search(int i, int j, int num) {
	if(num == n + 1) return 0;
	int sum = 0;
	queue<state> q;
	q.push({ i, j, 0 });
	while(!q.empty()) {
		state s = q.front(); q.pop();
		if(out(s.i, s.j) || field[s.i][s.j] == 'X' || visited[num][s.i][s.j]) continue;
		if(field[s.i][s.j] == '0' + num) {
			sum += s.d;
			break;
		}
		visited[num][s.i][s.j] = true;
		int dir[] = { 1, 0, -1, 0, 1 };
		for(int k = 0; k < 4; k++) {
			if(!visited[num][s.i + dir[k]][s.j + dir[k + 1]])
				q.push({ s.i + dir[k], s.j + dir[k + 1], s.d + 1 });
		}
	}
	for(int ii = 0; ii < h; ii++) {
		for(int jj = 0; jj < w; jj++) {
			if(field[ii][jj] == '0' + num) {
				sum += search(ii, jj, num + 1);
			}
		}
	}
	return sum;
}


int main() {
	cin >> h >> w >> n;
	for(int i = 0; i < h; i++) {
		cin >> field[i];
	}
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) {
			if(field[i][j] == 'S') {
				cout << search(i, j, 1) << endl;
				return 0;
			}
		}
	}

}

Measured memory_bytes: 11064
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define deb(x) cout << #x << " is " << x << "\n";

using namespace std;
using namespace __gnu_pbds;

const double PI = 2 * acos(0.0);
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, m, p;
    string s;
    cin >>n >>m;
    vector<int> arr(n, 0);
    int ans1 = 0, ans2 = 0;
    while(m--){
        cin >>p >>s;
        if(s == "WA" && arr[p-1] != INT_MAX)
            arr[p-1]--;
        else if(s == "AC" && arr[p-1] != INT_MAX){
            ans1 += arr[p-1];
            ans2++;
            arr[p-1] = INT_MAX;
        }
    }
    cout <<ans2 <<" " <<abs(ans1);
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;

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

  if (x < 4) {
    cout << 1 << endl;
    return 0;
  }

  int sub = 1000;
  int ans;
  for (int b = 2; b <= 31; b++) {
    int p = 2;
    while (pow(b, p) <= x) {
      if (x - pow(b, p) < sub) {
        sub = x - pow(b, p);
        ans = pow(b, p);
      }
      p++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <boost/integer/common_factor_rt.hpp>
using namespace std;

struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> using iodef_rng_t = typename enable_if<decltype(declval<C>().begin(), true_type{})::value && !is_same<C, string>::value>::type;
template<class C, class = iodef_rng_t<C>> istream& operator>>(istream& in, C& c) { for (auto& v : c) { in >> v; } return in; }
template<class C, class = iodef_rng_t<C>> ostream& operator<<(ostream& out, const C& c) { int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
template<class T> void trace_(const char* s, const T& v) { cerr << s << "=" << v; }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { for (; *s != ','; ++s) { cerr << *s; } cerr << "=" << v << ","; trace_(++s, vs...); }
#define TRACE(...) (cerr << "\033[2m\033[33m", trace_(#__VA_ARGS__, __VA_ARGS__), cerr << "\033[0m\n")
#else
#define TRACE(...)
#endif

int main() {
    int64_t A, B, C, D;
    cin >> A >> B >> C >> D;
    A--;
    using boost::integer::lcm;
    int64_t ans = (B - B/C - B/D + B/lcm(C, D)) - (A - A/C - A/D + A/lcm(C, D));
    cout << ans << '\n';
}


Measured memory_bytes: 256
import java.util.Scanner;
        
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int x = sc.nextInt();
        int answer = 0;

        if (x < 600) {
            answer = 8;
        } else if (x < 800) {
            answer = 7;
        } else if (x < 1000) {
            answer = 6;
        } else if (x < 1200) {
            answer = 5;
        } else if (x < 1400) {
            answer = 4;
        } else if (x < 1600) {
            answer = 3;
        } else if (x < 1800) {
            answer = 2;
        } else if (x < 2000) {
            answer = 1;
        }
        
        System.out.println(answer);
    }
}

Measured memory_bytes: 35868
#include "bits/stdc++.h"

using namespace std;



int main(){

	long long n,k;
	cin >>n>>k;
	int i=1;
	while (n / k >= 1){
		n /= k;
		i++;
	}

	cout << i << endl;
	cin >> n;
	return 0;

	
}



Measured memory_bytes: 256
import numpy as np
n, m, x = map(int,  input().split())
c=[]
a=[]
for _ in range(n):
    y = list(map(int, input().split()))
    c.append(y[0])
    a.append(y[1:])
    
def dfs(i, sum_c, sum_a):
    if i==n:
        if sum(sum_a>=x) == m:
            return sum_c
        else:
            return 10**12
    s1=dfs(i+1, sum_c+c[i], sum_a+np.array(a[i]))
    s2=dfs(i+1, sum_c, sum_a)
    return min(s1, s2)
  
ans=dfs(0, 0, np.array([0]*m))
if ans==10**12:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 27200
#include <stdio.h>
int main(void){
char s[20];
  int count;
  int kazoe=0;
  int max=0;
  scanf("%s",&s);
  for(count=0;s[count]!='\0';count++){
  if(s[count]=='A'||s[count]=='C'||s[count]=='G'||s[count]=='T'){kazoe++;}
    else if(kazoe>=max){max=kazoe;kazoe=0;}
    else{kazoe=0;}
  }
  if(kazoe>=max){max=kazoe;kazoe=0;}
  printf("%d",max);
return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string name;
  cin >> name;
  
  int S = name.length();
  
  string nick;
  
  int v1;
  
  if(S != 3){
    v1 = rand() % (S - 3);
  }else{
  	v1 = 0;
  }
  
  for(int i = 0; i < 3; i++) {
	nick += name.at(v1 + i);
  }
  
  cout << nick;
  
}

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

#define ll long long
#define ld long double

#define x first
#define y second
#define pb push_back
#define mp make_pair

#define all(a) (a).begin(), (a).end()

const int N = 1e5 + 7;

vector<int> g[N];
bool q[N];

void go(int v) {
    q[v] = 1;
    for (auto u : g[v]) {
        if (!q[u]) go(u);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    while (m--) {
        int x, y, z;
        cin >> x >> y >> z;
        x--;
        y--;
        g[x].pb(y);
        g[y].pb(x);
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (!q[i]) {
            ans++;
            go(i);
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 8960
S = gets.chomp

ans = [true, false].repeated_permutation(S.length - 1).inject(0) do |sum, cs|
  s = S.split(//).join('_')
  cs.each_with_index{|c, i| s[2*i + 1] = "+" if c}
  sum + eval(s.delete('_'))
end
puts ans

Measured memory_bytes: 1916
#include <iostream>
using namespace std;
int main(void){
    int n;
    double a, b, c, d, s1, s2, s3, D;
    
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a >> b >> c >> d;
        s1 = -b/a;
        s2 = -d/a;
        s3 = c/a;
        D = b*b*c*c-4*a*c*c*c-4*b*b*b*d-27*a*a*d*d+18*a*b*c*d;
        if(D >= 0){
        if(s1 > 0 && s2 > 0 && s3 > 0)  cout << 3 << " " << 0 << endl;
        else if(s1 < 0 && s2 < 0 && s3 > 0) cout << 0 << " " << 3 << endl;
        else if(s1 == 0 && s2 == 0 && s3 == 0)  cout << 0 << " " << 0 << endl;
        else if(d == 0){
            if(s1 < 0 && c == 0) cout << 0 << " " << 1 <<endl;
            else if(s1 > 0 && c == 0) cout << 1 << " " << 0 <<endl;
            else if(s1 > 0 && s3 > 0) cout << 2 << " " << 0 << endl;
            else if(s1 < 0 && s3 > 0) cout << 0 << " " << 2 << endl;
            else cout << 1 << " " << 1 << endl; 
        }
        else{
            if(a > 0 && d > 0)  cout << 2 << " " << 1 << endl;
            else if(a < 0 && d < 0)  cout << 2 << " " << 1 << endl;
            else if(a > 0 && d < 0)  cout << 1 << " " << 2 << endl;
            else if(a < 0 && d > 0)  cout << 1 << " " << 2 << endl;
            else cout << 1 << " " << 1 << endl; 
        }
        }
        else{
        if(s1 > 0 && s2 > 0 && s3 > 0)  cout << 1 << " " << 0 << endl;
        else if(s1 < 0 && s2 < 0 && s3 > 0) cout << 0 << " " << 1 << endl;
        else if(s1 == 0 && s2 == 0 && s3 == 0)  cout << 0 << " " << 0 << endl;
        else{
            if(a > 0 && d > 0)  cout << 0 << " " << 1 << endl;
            else if(a < 0 && d < 0)  cout << 0 << " " << 1 << endl;
            else if(a > 0 && d < 0)  cout << 1 << " " << 0 << endl;
            else if(a < 0 && d > 0)  cout << 1 << " " << 0 << endl;
            else cout << 0 << " " << 0 << endl; 
        }    
        }
        
        
    }
    return 0;
    
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 10000000000000000
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 namespace std;

int n,m;
int dp[100010];
bool ok[100010];

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

    cin>>n>>m;
    rep(i,m){
        int a; cin>>a;
        ok[a]=true;
    }

    dp[0]=1;
    rep(i,n){
        if(!ok[i+1])dp[i+1]=(dp[i]+dp[i+1])%mod;
        if(!ok[i+2])dp[i+2]=(dp[i]+dp[i+2])%mod;
    }
    cout<<dp[n]<<endl;

}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define maxn 100005
using namespace std;

long long n,a[maxn],f[maxn][2];
int main()
{
	cin>>n;
	for(long long i=1;i<=n;++i) scanf("%lld",&a[i]);
	f[1][0]=a[1],f[1][1]=-a[1];
	for(int i=2;i<=n;++i)
	{
		f[i][0]=max(f[i-1][0]+a[i],f[i-1][1]-a[i]);
		f[i][1]=max(f[i-1][0]-a[i],f[i-1][1]+a[i]);
	}
	cout<<max(f[n][0],f[n-1][1]-a[n]);
	return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>

typedef enum _cardtype_e
{
    SPADE = 0,
    HEART,
    CLUB,
    DIAMOND,
    CARDTYPE_MAX
} cardtype_e;
const char cardchars[CARDTYPE_MAX] = {[SPADE] = 'S', [HEART] = 'H', [CLUB] = 'C', [DIAMOND] = 'D'};
#define char_to_cardtype(c) ((c == 'S') ? SPADE : (c == 'H') ? HEART : (c == 'C') ? CLUB : DIAMOND)

int main(int argc, char *argv[])
{
    int cards[CARDTYPE_MAX][13] = {};
    int n;
    scanf("%d\n", &n);
    for (int i = 0; i < n; ++i)
    {
        char c;
        int number;
        scanf("%c %d\n", &c, &number);
        cards[char_to_cardtype(c)][number - 1] = 1;
    }
    for (cardtype_e cardtype = SPADE; cardtype < CARDTYPE_MAX; ++cardtype)
    {
        for (int number = 0; number < 13; ++number)
        {
            if (!cards[cardtype][number])
            {
                printf("%c %d\n", cardchars[cardtype], number + 1);
            }
        }
    }
    return 0;
}



Measured memory_bytes: 2120
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void input(vector<int> &);
int getnum(vector<int> &, int);
int main() {
	int N;
	cin >> N;
	vector<int> A(N), B(N), C(N);
	input(A);
	input(B);
	input(C);
	vector<long long> dp(N);
	dp.back() = getnum(C, B.back());
	for (int i = N - 2; i >= 0; --i) {
		dp[i] = getnum(C, B[i]) + dp[i + 1];
	}
	long long ans = 0;
	for (int i = 0; i < N; ++i) {
		vector<int>::iterator it = upper_bound(B.begin(), B.end(), A[i]);
		if (it != B.end()) {
			ans += dp[it - B.begin()];
		}
	}
	cout << ans << endl;
}

int getnum(vector<int> &line, int num) {
	vector<int>::iterator it = upper_bound(line.begin(), line.end(), num);
	if (it == line.end()) {
		return 0;
	}
	else {
		return line.end() - it;
	}
}

void input(vector<int> &line) {
	for (int i = 0; i < line.size(); ++i) {
		cin >> line[i];
	}
	sort(line.begin(), line.end());
}

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

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define SORT(v, n) sort(v, v+n);
#define SSORT(v, n) sort(v, v+n, greater<int>())

int main(){
	int a,b,c,d,e,k;
	cin >> a >> b >> c >> d >> e >> k;


	if(abs(a-e) > k) cout << ":(" << endl;
	else cout << "Yay!" << endl;
	

}

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

using namespace std;

long long int x, money;

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

	cin >> x;
	money = 100;
	int year = 0;
	while (x > money) {
		long long int add = money * (0.01);
		money += add;
		year++;
	}
	cout << year;

	return 0;
}

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

int n;
int v[100010];
int a[100010];
int b[100010];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    if (i & 1) a[v[i]]++;
    else b[v[i]]++;
  }
  int c = 0, d = 0;
  for (int i = 1; i <= 100000; i++) {
    if (a[i] > a[c]) c = i;
    if (b[i] > b[d]) d = i;
  }
  if (c != d) {
    cout << ((n+1)/2-a[c]) + (n/2-b[d]) << endl;
  } else {
    int c2 = 0, d2 = 0;
    for (int i = 1; i <= 100000; i++) {
      if (i == d) continue;
      if (a[i] >= a[c2]) c2 = i;
    }
    int ans1 = ((n+1)/2-a[c2]) + (n/2-b[d]);
    for (int i = 1; i <= 100000; i++) {
      if (i == c) continue;
      if (b[i] >= b[d2]) d2 = i;
    }
    int ans2 = ((n+1)/2-a[c]) + (n/2-b[d2]);
    cout << min(ans1, ans2) << endl;
  }

  return 0;
}

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

NGlist = [0] * N
grouplist = [0]*N
ans = 0
for i in range(N):
    NGlist[i] = [0] * N
    grouplist[i] = [0] * N


for k in range(N):
    n = int(input())
    for j in range(n):
        x, y = map(int, input().split())
        if y == 0:
            NGlist[k][x-1] = 1
            NGlist[x - 1][k] = 1
        if y == 1:
            grouplist[k][x-1] = 1

for num in range(2 ** N):
    # print("num=")
    # print(num)
    group = set()
    newmember = set()
    for h in range(N):
        if h not in group and num % 2 == 1:
            group.add(h)
            newmember.add(h)
        num //= 2

    while (len(newmember) != 0):
        for s in list(newmember):
            for p in range(N):
                if grouplist[s][p] == 1 and p not in group:
                    group.add(p)
                    newmember.add(p)
                newmember.discard(s)

    len_group = len(group)
        # print(group)
    flag = 0
    if ans >= len_group:
       flag = 1
    
    # print(group)
    for m in group:
        for t in group:
            if NGlist[m][t] == 1:
                flag = 1
                break
        if flag == 1:
            break
    if flag == 0 and ans < len_group:
        ans = len_group

print(ans)


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define VIN(v) for(auto&elem_: (v) )cin>>elem_
#define VOUT(v, sep) for(_loop_int idx=0; idx<(_loop_int)v.size(); idx++) {cout<<v[idx]; if(idx<v.size()-1) cout<<sep;} cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(debugidx,v.size())cout<<" "<<v[debugidx];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(debugidx,n)cout<<" "<<v[debugidx];cout<<endl

const ll MOD = 1000000007ll;
const int IINF = numeric_limits<int>::max()/2-1;
const ll LINF = numeric_limits<ll>::max()/2-1;

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


string s;
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin>>s;
    int n = s.size();
    int n2 = (n-1)/2;
    bool flg = true;
    REP(i,n2){
        if(s[i] != s[n2-1-i]){
            flg = false;
            break;
        }
        if(s[i] != s[n-1-i]){
            flg = false;
            break;
        }
    }
    string ans = flg ? "Yes":"No";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n,d,human=1;
  cin >> n >> d;
  int x = 2*d+1;
  int y=1;
  while(n>x*y){
    human++;
    y++;
  }
  cout << human << endl;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;

template <typename T>
bool chmax(T& a, const T& b) {
	if (a < b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}

template <typename T>
bool chmin(T& a, const T& b) {
	if (a > b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}


int main() {
	int N, X;
	int sum = 0,minsum=pow(10,9);
	vector<int>point;
	cin >> N;
	point.resize(N);
	rep(i, N)cin >> point[i];
	sort(all(point));
	//int mid = (*point.begin() + point.back()) / 2;
	REP(mid, point.back()) {
		sum = 0;
		for (int s : point) {
			sum += s * s - 2 * s * mid + mid * mid;
		}
		minsum = min(sum, minsum);
	}
	cout << minsum << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define T 1
#define F 0
int solve(int,int,int,int *);
int main(){
  int i,n,q;
  scanf("%d",&n);
  int A[n];
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  scanf("%d",&q);
  int M[q];
  for(i=0;i<q;i++) scanf("%d",&M[i]);
  for(i=0;i<q;i++){   
    if(solve(0,M[i],n,A) == T) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}
int solve(int i,int m,int n,int *A){
  if(m==0) return T;
  if(i>=n) return F;
  int res = solve(i+1,m,n,A)||solve(i+1,m-A[i],n,A);
  return res;
}


Measured memory_bytes: 2108
while True:
  n =int(input())
  if n==0:
    break
  A=[]
  for i in range(n):
    id,m1,s1,m2,s2,m3,s3,m4,s4=map(int, input().split())
    time=(m1+m2+m3+m4)*60+s1+s2+s3+s4
    A.append((time,id))
  A.sort()
  print(A[0][1])
  print(A[1][1])
  print(A[n-2][1])


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

using ll = long long;
#define int long long

// [a -> b-1]
#define reps(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
// [0 -> a-1]
#define rep(i, a) reps(i, 0, (a))
// [a-1 -> b]
#define rreps(i, a, b) for (int i = (int)((a)-1); i >= (int)(b); i--)
// [a-1 -> 0]
#define rrep(i, a) rreps(i, a, 0)
#define all(v) (v).begin(), (v).end()
// next_permutation(all(v))
#define PERM(v) next_permutation(all(v))
/*sort(all(v));
 * (v).erase(unique(all(v)), v.end())*/
#define UNIQUE(v)\
	sort(all(v));\
	(v).erase(unique(all(v)), v.end())
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
// b is [a, c)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
// c is [a, e) && d is [b, f)
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(15)
#define YES(f) cout << ((f) ? YES_STR : NO_STR) << endl;

using namespace std;

vector<vector<char>> v(10);

string solve() {
	string s; cin >> s;
	string res;
	char c = 0;
	int p = 0;
	rep(i, s.size()) {
		if (s[i] == '0') {
			if (c) res += c;
			p = c = 0;
		} else {
			c = v[s[i]-'0'][p];
			p = (p + 1) % v[s[i]-'0'].size();
		}
	}
	return res;
}

signed main() {
	int n; cin >> n;
	v[1] = vector<char>{'.', ',', '!', '?', ' '};
	v[2] = vector<char>{'a', 'b', 'c'};
	v[3] = vector<char>{'d', 'e', 'f'};
	v[4] = vector<char>{'g', 'h', 'i'};
	v[5] = vector<char>{'j', 'k', 'l'};
	v[6] = vector<char>{'m', 'n', 'o'};
	v[7] = vector<char>{'p', 'q', 'r', 's'};
	v[8] = vector<char>{'t', 'u', 'v'};
	v[9] = vector<char>{'w', 'x', 'y', 'z'};
	while (n--) cout << solve() << endl;
}




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

int main(){
    string ans = "No";
    int n, k;
    cin >> n >> k;
    vector<int> point(n);
    
    for (int i = 0; i < n; i++) {
        cin >> point[i];
    }
    
    for (int i = k; i < n; i++) {
        if (point[i] > point[i - k]) {
            ans = "Yes";
        } else {
            ans = "No";
        }
        cout << ans << endl;
    }
    
    return 0;
}


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

#define REP(i, s,  n) for(int i = s;i < (n);i++)
#define VSORT(v) sort(v.begin(), v.end());
#define int64 long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> PP;

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

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

int c[3][3];

signed main(){
	int a[3] = { INF, INF, INF }, b[3] = { INF, INF, INF };
	REP(i, 0, 3) {
		REP(j, 0, 3) {
			cin >> c[i][j];
			if(a[i] > c[i][j])	a[i] = c[i][j];
//			if(b[j] > c[i][j])	b[j] = c[i][j]; 
		}
	}
	REP(i, 0, 3) {
		REP(j, 0, 3) {
		    if(i == 0)  b[j] = c[i][j] - a[i];
		    else if(c[i][j] != a[i] + b[j]) {
//			    cout << "a[" << i << "] = " << a[i];
//			    cout << "  b[" << j << "] = " << b[j];
//			    cout << "  c[" << i << "][" << j << "] = " << c[i][j] << endl;
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	
	return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    string reus = "";
    for(int i=0;i<n;i++)
    {
        reus = reus + "ACL";
    }
    cout<<reus<<endl;
    return 0;
}

Measured memory_bytes: 3572
use proconio::input;

fn main() {
    input! {
        n: usize,
        d: [(i32, i32); n]
    }

    let mut d = d.iter().map(|(a, b)| { a == b });

    let mut a = d.next().unwrap();
    let mut b = d.next().unwrap();
    let mut c = d.next().unwrap();
    loop {
        if a  && b && c {
            println!("Yes");
            return;
        }
        a = b;
        b = c;
        match d.next() {
            Some(x) => c = x,
            None => {
                println!("No");
                return;
            }
        }
    }
}


Measured memory_bytes: 2124
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
using namespace std;

const long long MOD = 1000000007;

int main(){
    string s;
    cin >> s;
    if(s[0]==s[1] || s[1]==s[2] || s[2]==s[3]){
        cout << "Bad" << endl;
    }else{
        cout << "Good" << endl;
    }
    
    return 0;
}


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

#define ll long long int

ll MOD;
ll dp[3002][3002][2];

ll f(vector<ll>& a, ll i, ll s, bool flag) {
    if(s == 0) {
        return (ll)(a.size() + 1 - i);
    }
    if(s < 0 || i == a.size())
        return 0ll;
    if(dp[i][s][flag] != -1)
        return dp[i][s][flag];
    ll ans = 0;
    if(!flag) {
        ans += f(a, i + 1, s, flag);
        ans += (ll)(i + 1) * f(a, i + 1, s - a[i], !flag);
    }
    else {
        ans += f(a, i + 1, s, flag);
        ans += f(a, i + 1, s - a[i], flag);
    }
    return dp[i][s][flag] = ans % MOD;
}

int main() {
  MOD = 998244353;
  ll n, s;
  memset(dp, -1, sizeof dp);
  cin >> n >> s;
  vector<ll> a(n);
  for(ll i = 0; i < n; i++)
    cin >> a[i];
  cout << f(a, 0, s, 0);
}

Measured memory_bytes: 141312