akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i = 0;i < n;i++)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()

template<class T> bool chmax(T& a,T b){ if(a < b){ a = b; return true; }else return false; }
template<class T> bool chmin(T& a,T b){ if(a > b){ a = b; return true; }else return false; }
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;
using vpi = vector<Pi>;
using vpl = vector<Pl>;
 
void lyn(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}
 
#define debug(arr) cout << #arr << " = " << arr << '\n'
#define debug2(a,b) cout << "[" << #a << "," << #b << "] = " << "[" << a << "," << b << "]" << '\n'
template<class T> ostream &operator << (ostream& out, const vector<T>& arr) {
	cout << "{"; for (int i = 0; i < arr.size(); i++)cout << (!i ? "" : ", ") << arr[i]; cout << "}";
	return out;
}
template<class T> ostream &operator << (ostream& out, const vector<vector<T> >& arr) {
	cout << "{\n"; for (auto& vec : arr)cout << "  " << vec << ",\n"; cout << "}";
	return out;
}
template<class S,class T> ostream &operator << (ostream& out, const pair<S,T>& p){
  cout << "{" << p.first << "," << p.second << "}" << '\n';
  return out;
}
template<class T> istream &operator >> (istream& in, vector<T>& arr) {
	for (auto& i : arr)cin >> i; return in;
}

int main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(20);
  
  int x;cin >> x;
  cout << !x << '\n';
  
  return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;
typedef tuple<int, int, int> T;

int n, q;
T kouji[200000];
int d[200000];
set<int> dict;
int stop[200000];

signed main() {
	int i;
	
	cin >> n >> q;
	rep(i, n) {
		int s, t, x;
		cin >> s >> t >> x;
		kouji[i] = T(x, s, t);
	}
	rep(i, q) cin >> d[i];
	sort(kouji, kouji + n);
	
	rep(i, q) dict.insert(d[i]);
	rep(i, q) stop[i] = -1;
	
	rep(i, n) {
		int x = get<0>(kouji[i]);
		int s = get<1>(kouji[i]);
		int t = get<2>(kouji[i]);
		
		//cout << "------------------" << endl;
		//cout << x << ", " << s << ", " << t << endl;
		//cout << "(s - x, t - x) = " << s - x << ", " << t - x << endl;
		
		set<int>::iterator it1 = dict.lower_bound(s - x);
		set<int>::iterator it2 = dict.lower_bound(t - x);
		for(set<int>::iterator it = it1; it != it2; it++) {
			int hogeD = *it;
			int index = lower_bound(d, d + q, hogeD) - d;
			stop[index] = x;
			//cout << "(hogeD, index) = " << hogeD << ", " << index << endl;
		}
		dict.erase(it1, it2);
	}
	
	rep(i, q) {
		cout << stop[i] << endl;
	}
	return 0;
}

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

int main() {
  ll MOD = 1000000007;
  ll N,K;
  ll Ans=0;
  cin>>N>>K;
  rep2(i,K,N+2){
Ans+=i*(N-i+1)+1;
Ans%=MOD;
  }
  cout<<Ans<<endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    int H[N];
    for(int i = 0; i < N; i++) {
        cin >> H[i];
    }
    for(int i = 1; i < N; i++) {
        if(H[i - 1] > H[i]) {
            cout << "No\n";
            return 0;
        } else {
            if(H[i] != H[i - 1]) {
                H[i] = H[i] - 1;
            }
        }
    }
    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 640
/**
*    created: 07.07.2020 21:23:05
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n; cin >> n;
    int ans = 0;
    vector<int> s(n);
    int sum = 0;
    rep(i,n) {
        cin >> s[i];
        sum += s[i];
    }
    if (sum % 10 != 0) {
        cout << sum << endl;
        return 0;
    }
    sort(all(s));
    rep(i,n) {
        if (s[i] % 10 != 0) {
            sum -= s[i];
            cout << sum << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(itr,c) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
int main(){
	ll x;
	cin>>x;
	ll sum=100;
	for(int i=1;;i++){
		sum=sum/100+sum;
		if(sum>=x){
			cout<<i;
			break;
		}
	}
	re 0;
}

Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	static final double tubo = 3.305785;

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

		line = br.readLine();
		int a = Integer.parseInt(line.substring(0, line.indexOf(' ')));
		int b = Integer.parseInt(line.substring(line.indexOf(' ') + 1));
		double area = a * b;

		System.out.println(area / tubo);
	}
}

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

using namespace std;

int main(){
  	int n,m,t = 0,x;
  	cin>>n>>m;
  	for(int i=0;i<m;i++){
      	cin>>x;
      	t += x;
    }
  	if(t>n)
      	cout<<"-1"<<endl;
  	else 
      	cout<<n-t;
 	return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define F first
#define S second
//const ll mod=1e9+7;
void solve(){
    int n,m,x;
    cin>>n>>m>>x;
    vector<int>cost(n);
    vector< vector<int> >v;
    v.assign(n,vector<int> (m,0));
    for(int i=0;i<n;i++){
    	cin>>cost[i];
    	for(int j=0;j<m;j++){
    		cin>>v[i][j];
    	}
    }
    int ans=1e9;
    int l=(1<<n);
    for(int i=0;i<l;i++){
    	int ct=0;
    	vector<int>f(m);
    	for(int j=0;j<n;j++){
    		if((i>>j)&1){
    			ct+=cost[j];
    			for(int k=0;k<m;k++){
    				f[k]+=v[j][k];
    			}
    		}
    	}
    	bool ok=true;
    	for(auto &y: f){
    		ok&=(y>=x);
    	}
    	if(ok){
    		//cout<<ans<<"\n";
    		ans=min(ans,ct);
    	}
    }
    if(ans==1e9){
    	cout<<"-1";
    }
    else
    cout<<ans;
}
int main(){
    IOS;
    /*int t;
    cin>>t;
    while(t--){
        solve();
    }*/
    solve();
    return 0;
}

Measured memory_bytes: 3660
use std::cmp;
use std::io::Read;

fn main() {
    let mut buff = String::new();
    std::io::stdin().read_to_string(&mut buff).unwrap();
    let mut iter = buff.split_whitespace();

    let _n: i32 = iter.next().unwrap().parse().unwrap();
    let s: String = iter.next().unwrap().parse().unwrap();

    let mut mx: i32 = 0;
    for i in 1..s.len() {
        let t = &s[0..i];
        let u = &s[i..s.len()];
        let mut cnt: i32 = 0;
        for c in ('a' as u8)..('z' as u8 + 1) {
            if t.contains(c as char) && u.contains(c as char) {
                cnt = cnt + 1;
            }
            mx = cmp::max(mx, cnt);
        }
    }
    println!("{}", mx);

    ()
}


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

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }


/*
--------------------------------------------

	type

--------------------------------------------
*/
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

/*
--------------------------------------------

	container

--------------------------------------------
*/
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

/*
--------------------------------------------

	repetition

--------------------------------------------
*/
#define REP(n) for(int i=0; i<n; i++)
#define REPj(n) for(int j=0; j<n; j++)
#define REPinit(a,n) for(int i=a; i<n; i++)
#define REPinitj(a,n) for(int j=a; j<n; j++)

//algorithm
//#define SORT(c) sort((c).begin(),(c).end())

/*
--------------------------------------------

	constant

--------------------------------------------
*/
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

/*
--------------------------------------------

	Optimizer

--------------------------------------------
*/
//#pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/*
--------------------------------------------
 
	Utility Algorithm

-------------------------------------------- 
*/

template <typename T>
void swapAlgorithm(T& a, T& b) {
    T tmp = a;
    a = b;
    b = tmp;
}
 
template <typename T1>
T1 euclideanAlgorithm(T1 a, T1 b) {
    T1 a_tmp = a;
    T1 b_tmp = b;
 
    if (a_tmp > b_tmp) {
        swapAlgorithm<T1>(a_tmp, b_tmp);
    }
 
    T1 r = a_tmp % b_tmp;
    while (r != 0) {
        a_tmp = b_tmp;
        b_tmp = r;
        r = a_tmp % b_tmp;
    }
    return b_tmp;    
}

template <typename T2>
T2 getLCM(T2 a, T2 b) {
    return (a * b)/(euclideanAlgorithm(a, b));
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int main(int argc, char const *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int N;
    cin >> N;
    cout << (48 - N) << endl;
    return 0;
}


Measured memory_bytes: 256
def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()
a,b=map(int,input().split())
if is_integer(int(str(a)+str(b))**0.5)==True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define N	 100
int a, b,c, d;
void solve(){
	cin>>a>>b>>c>>d;
	cout<<min(a,b)+min(c,d)<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}



Measured memory_bytes: 256
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
asum=0
bsum=0
pointer=0
while pointer<m and bsum+b[pointer]<=k:
	bsum+=b[pointer]
	pointer+=1
ans=pointer
for i in range(n):
	asum+=a[i]
	while asum+bsum>k and pointer>=0:
		pointer-=1
		bsum-=b[pointer]
	if asum+bsum>k:
		break
	ans=max(ans,(i+1)+pointer)
print(ans)

Measured memory_bytes: 117936
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] s = S.split("");
        StringBuilder ans = new StringBuilder();
        for(int i=0; i<s.length; i++) {
            if(i % 2 == 0) ans.append(s[i]);
        }
        System.out.println(String.valueOf(ans));
     }
}


Measured memory_bytes: 31860
using System.Collections.Generic;
using static System.Console;

namespace AOJ.ALDS 
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var input = ReadLine().Split(' ');
            var stack= new Stack();
            var result = 0;

            foreach (var i in input)
            {
                switch (i)
                {
                    case "+":
                        result = stack.pop() + stack.pop();
                        stack.push(result);
                        break;
                    case "-":
                        var b = stack.pop();
                        var a = stack.pop();
                        result = a - b;
                        stack.push(result);
                        break;
                    case "*":
                        result = stack.pop() * stack.pop();
                        stack.push(result);
                        break;
                    default:
                        stack.push(int.Parse(i));
                        break;
                }
            }
            WriteLine(result);
        }
    }

    public class Stack
    {
        private readonly List<int> _buffer;

        private int top
        {
            get
            {
                return _buffer.Count - 1;
            }
            set { top = value; }
        }

        public Stack(){_buffer=new List<int>();}
        public Stack(int capacity){_buffer=new List<int>(capacity);}

        
        public void push(int x)
        {
            // append x to stack
            _buffer.Add(x);
        }

        public int pop()
        {
            // get data from top of the stack
            var tmp = _buffer[top];
            _buffer.Remove(tmp);
            return tmp;
        }
    }
}


Measured memory_bytes: 17912
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> as(n+1);
  for(Int i=1;i<=n;i++) cin>>as[i];

  vector<Int> bs(n+1,0),cs;
  for(Int i=n;i>=1;i--){
    Int sum=as[i];
    for(Int j=i+i;j<=n;j+=i) sum+=bs[j];
    bs[i]=sum%2;
    if(bs[i]) cs.emplace_back(i);
  }

  Int m=cs.size();
  cout<<m<<endl;
  for(Int i=0;i<m;i++){
    if(i) cout<<" ";
    cout<<cs[i];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 5108
#include <iostream>
#include <vector>
using namespace std;
#define MAX 100001

vector <int> A(MAX);

void add(int i,int x){
   A[i]=A[i]+x;
}

int getsum(int s,int t){
    int sum=0;
    for(int i=s;i<t+1;i++){
        sum=sum+A[i];
    }
    
    return sum;
}

int main(){
    int n,q;
    int com,x,y;
    cin>>n>>q;
    
    for(int i=0;i<n;i++){
        A[i]=0;
    }
    for(int i=0;i<q;i++){
        cin>>com>>x>>y;
        if(com==0) add(x,y);
        else if(com==1)cout<<getsum(x,y)<<endl;
    }
    
    return 0;
    
}




Measured memory_bytes: 3092
#include<stdio.h>
int main(void)
{
	int a,b;
	scanf("%d %d\n",&a,&b);
	if(a>b)printf("a > b\n");
	else if(a<b)printf("a < b\n");
	else if(a==b)printf("a == b\n");
	return 0;
}

Measured memory_bytes: 1728
n,m = map(int,input().split())
x = list(map(int,input().split()))
if n >= m:
    print(0)
else:
    x = sorted(x)
    length = []
    for i in range(1,m):
        length.append(x[i]-x[i-1])
    length = sorted(length)
    print(sum(length[:m-n]))


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

using Lint=long long;

Lint get(Lint l,Lint r){ return r-l+1; }

int main()
{
   Lint a,b; cin>>a>>b;
   if(a==b){ cout<<1<<endl; return 0; }

   const int LOG=60;
   Lint m=0,n=0;
   for(int i=LOG-1;i>=0;i--){
      if((a>>i&1)!=(b>>i&1)){
         m=1LL<<i; n=1LL<<i;
         bool flag=false;
         for(int j=i-1;j>=0;j--){
            if(b>>j&1) flag=true;
            if(flag) n|=1LL<<j;
         }
         break;
      }else{
         if(a>>i&1){
            a-=1LL<<i;
            b-=1LL<<i;
         }
      }
   }
   Lint ans=get(a,m-1);
   if(n<m+a){
      ans+=get(m,n);
      ans+=get(m+a,2*m-1);
   }else{
      ans+=get(m,2*m-1);
   }
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 256
n = int(input())
s1 = input()
s2 = input()

# 圧縮
S1 = s1[0]
S2 = s2[0]
for i in range(1,n):
    if s1[i-1] != s1[i]:
        S1 += s1[i]
    if s2[i-1] != s2[i]:
        S2 += s2[i]

ans = 0
MOD = 1000000007
if S1[0] == S2[0]:
    ans = 3
else:
    ans = 6

for i in range(1, len(S1)):
    if S1[i] == S2[i]:
        if S1[i-1] == S2[i-1]:
            ans *= 2
        else:
            ans *= 1
    else:
        if S1[i-1] == S2[i-1]:
            ans *= 2
        else:
            ans *= 3
    ans %= MOD

ans %= MOD
print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
int main(){
  int n;cin>>n;
  int t=n, d=0;
  while(t!=0){
    d+=t%10;
    t/=10;
  }
  cout << (n%d==0? "Yes":"No") << endl;
}


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

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

  std::vector<int> ax;
  for(int i=0; i<n; i++)
  {
    int a;
    std::cin >> a;
    ax.push_back(a);
  }

  int high1st = 0;
  int high2nd = 0;
  for(const auto& e : ax)
  {
    if( high1st <= e ) { high2nd = high1st; high1st = e;}
    else if( high2nd <= e ) { high2nd = e; }
  }

  for(const auto& e : ax)
  {
    std::cout << (e == high1st ? high2nd : high1st) << std::endl;
  }
}


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

using namespace std;
#define ll long long
struct pp{
    int a,b,c;
}num[200005];
bool cmp(pp a,pp b)
{
    if(a.b!=b.b)
        return a.b<b.b;
    return a.a<b.a;
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d%d",&num[i].a,&num[i].b);
        num[i].c=num[i].b-num[i].a;
        if(num[i].c<0)
        {
            printf("No\n");
            return 0;
        }
    }
    sort(num,num+n,cmp);
    for(int i=0,t=0;i<n;i++)
    {
        t+=num[i].a;
        if(t>num[i].b)
        {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 2560
/* ex4_1
  bonbonc */

#include<stdio.h>
int main(void){
	int tree, range;
	int assigned;/*一人が割り当てられる木の本数の最大値*/

	scanf("%d %d",&tree,&range);
	assigned = 2*range+1; /*自分のいる位置と左右にrange本*/

	if (tree%assigned==0){/*木の本数がassignedで割り切れるとき*/
		printf("%d\n",tree/assigned);/*木の本数をassignedで割った商を出力*/
	}else{
		printf("%d\n",tree/assigned +1);/*木の本数をassignedで切り捨て除算し、1を加えて出力*/
	}

	
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Text;
using System.IO;
using System.Collections.Generic;
using System.Linq;

namespace sandbox
{
    class Program
    {
        static void Main(string[] args)
        {
            var consoleReader = new ConsoleReader(Console.In);
            var N = consoleReader.Int;

            var items = consoleReader.Repeat(N).String
            .Select(x => new string(x.OrderBy(c => c).ToArray()))
            .GroupBy(x => x)
            .Select(g => (long)g.Count());
            long count = 0;

            foreach (var i in items)
            {
                if (i > 1)
                {
                    count += i * (i - 1) / 2;
                }
            }


            Console.WriteLine(count);
        }
    }

    class ConsoleReader
    {
        private StringBuilder sb = new StringBuilder(4096);
        private TextReader textReader;
        public ConsoleReader(TextReader tr) { textReader = tr; }
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
        public string String
        {
            get
            {
                sb.Clear();
                int current = textReader.Read();
                while (current > 0 && char.IsWhiteSpace((char)current)) { current = textReader.Read(); }
                while (current > 0 && !char.IsWhiteSpace((char)current)) { sb.Append((char)current); current = textReader.Read(); }
                return sb.ToString();
            }
        }


        public class RepeatReader
        {
            ConsoleReader cr; int count;
            public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; }
            public IEnumerable<T> Select<T>(Func<ConsoleReader, T> func) { for (int i = 0; i < count; i++) yield return func(cr); }
            public IEnumerable<string> String { get { for (int i = 0; i < count; i++) yield return cr.String; } }
            public IEnumerable<int> Int { get { for (int i = 0; i < count; i++) yield return cr.Int; } }
            public IEnumerable<double> Double { get { for (int i = 0; i < count; i++) yield return cr.Double; } }
        }
        public RepeatReader Repeat(int count) => new RepeatReader(this, count);
    }
}


Measured memory_bytes: 35728
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

void solve()
{
    using namespace std;
    int n, x;
    cin >> n >> x;
    vector<int> v(n);
    for (auto& x : v) cin >> x;

    x -= accumulate(v.cbegin(), v.cend(), 0);
    int min = accumulate(v.cbegin(), v.cend(), v[0],
        [](int init, int x)
    {
        if (init > x)   return x;
        else            return init;
    });

    cout << n + x / min << endl;

}

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

Measured memory_bytes: 256
def solve(string):
    s, t = map(list, string.split())
    ans = min(
        sum(1 if s[i + j] != t[j] else 0
            for j, _ in enumerate(t))
        for i in range(len(s) - len(t) + 1))
    return str(ans)

    pass


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


Measured memory_bytes: 9056
#include <iostream>
using namespace std;
     
int main(){
    long long int N,set;
    char head;
    int node[5]={0,0,0,0,0};
    string S;
     
    cin>>N;
    for(int i=0;i<N;i++){
            cin>>S;
            head=S[0];
            if(head=='M') node[0]+=1;
            if(head=='A') node[1]+=1;
            if(head=='R') node[2]+=1;
            if(head=='C') node[3]+=1;
            if(head=='H') node[4]+=1;       
     }
     
     set=0;
     for(int i=0;i<5;i++){
            for(int j=i+1;j<5;j++){
                for(int k=j+1;k<5;k++){
                    set+=1LL*node[i]*node[j]*node[k];
                }
            }
      }
     
     
      cout<< set <<endl;
     
      return 0;
}


Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <iostream>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
using namespace std;
typedef long long ll;

int n;
ll vs[200000+10];
map<ll, int> ms;

int main(void) {
  scanf("%d", &n);
  REP(i, n) {
    scanf("%lld", &vs[i]);
    ms[vs[i]]++;
  }
  //  sort(vs, vs + n);
  int res = 0;
  for(int d = 30; d >= 0; --d) {
    ll target = 1 << d;
    FOR(it, ms) {
      if(it->first >= target) break;
      while(it->second > 0) {
        int partner = target - it->first;
        if(partner != it->first) {
          if(ms.count(partner) > 0 && ms[partner] > 0) {
            ++res;
            it->second--;
            ms[partner]--;
          } else {
            break;
          }
        } else {
          if(it->second >= 2) {
            ++res;
            it->second -= 2;
          } else {
            break;
          }
        }
      }
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
#include <boost/multi_array.hpp>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i, n) for (int i = 0; i < int(n); i++)
#define FOR1(i, m, n) for (int i = int(m); i < int(n); i++)
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))

int main(int argc, char *argv[]) {
  int N, M, Q;
  //cin >> N >> M >> Q;
  scanf("%d%d%d", &N, &M, &Q);

  //boost::multi_array<int, 2> mat(boost::extents[N + 1][N + 1]);
  int mat[501][501] = {};

  FOR(i, M) {
    int L, R;
    // cin >> L >> R;
    scanf("%d%d", &L, &R);
    mat[L][R]++;
  }

  FOR(i, N + 1) {
    FOR(j, N) { mat[i][j + 1] += mat[i][j]; }
  }

  for (int i = N; i > 0; i--) {
    FOR(j, N + 1) { mat[i - 1][j] += mat[i][j]; }
  }

  while (Q--) {
    int p, q;
    // cin >> p >> q;
    scanf("%d%d", &p, &q);
    // cout << mat[p][q] << "\n";
    printf("%d\n", mat[p][q]);
  }

  return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <climits>
#define INF INT_MAX>>1 //要climits#includ

using namespace std;

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

int main(void){
	while(1){
		int w, h; cin >> w >> h;
		if(!w && !h) break;

		char c[21][21];
		pair <int, int> node[11];
		int count = 1;
		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				cin >> c[i][j];
				if(c[i][j] == 'o'){
					node[0].first = i;
					node[0].second = j;
				} else if(c[i][j] == '*'){
					node[count].first = i;
					node[count].second = j;
					count++;
				}
			}
		}

		int adj[11][11] ={0};
		for(int i=0; i<count; i++){
			queue <pair<int, int> > que;
			que.push(make_pair(node[i].first, node[i].second));
			int dist[21][21]={0};
			while(!que.empty()){
				int y = que.front().first;
				int x = que.front().second;
				que.pop();

				for(int j=0; j<4; j++){
					int ny = y+dy[j];
					int nx = x+dx[j];
					if(nx<0 || w<=nx || ny<0 || h<=ny) continue;
					if(c[ny][nx] == 'x') continue;

					if(dist[ny][nx] == 0 || dist[y][x]+1 < dist[ny][nx]){
						dist[ny][nx] = dist[y][x]+1;
						que.push(make_pair(ny, nx));
					} else{
						continue;
					}
					if(c[ny][nx] == 'o' || c[ny][nx] == '*'){
						for(int k=0; k<count; k++){
							if(ny == node[k].first && nx == node[k].second){
								adj[i][k] = adj[k][i] = dist[ny][nx];
								break;
							}
						}
					}
				}
			}
		}
		for(int k=0; k<count; k++){
			adj[k][k] = INF;
		}
		
		int noFlag = false;
		for(int i=0; i<count; i++){
			for(int j=0; j<count; j++){
				if(adj[i][j] == 0) noFlag = true;
			}
		}
		if(noFlag){
			cout << -1 << endl;
			continue;
		}

		int ans = INF;
		vector<int> v(count);
		for(int i=0; i<count; i++){
			v[i] = i;
		}
		do{
			int cost = 0;
			for(int i=0; i<count-1; i++){
				cost += adj[v[i]][v[i+1]];
			}
			ans = min(ans, cost);
		} while(next_permutation(v.begin()+1, v.end()));

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


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

#define mod 1000000007

ll N, K;
vector<ll>A;

ll xu, iu;

// 開区間と判定関数を引数にして条件を満たす境界値を返す
ll BiSearch(ll ok, ll ng, function<bool(ll)> C){
    while (abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        if (C(mid)) ok = mid;
        else ng = mid;
    }
    return ok;
}

// x以下がK個以上あるかどうか
bool C1(ll x){
    xu = x;
    ll cnt = 0;
    for (int i = 0; i < N - 1; ++i) {
        iu = i;
        if (A[i] > 0) {
            if (A[i] * A[i+1] > x) break;
            int k = BiSearch(i+1, N, [](ll j){ return A[iu] * A[j] <= xu;});
            cnt += k - i;
        } else if (A[i] == 0) {
            if (x >= 0) cnt += N - 1 - i;
        } else {
            if (A[i] * A[N-1] > x) break;
            int k = BiSearch(N-1, i, [](ll j){ return A[iu] * A[j] <= xu;});
            cnt += N - k;
        }
        if (cnt >= K) return true;
    }
    return false;
}


int main() {
    cin >> N >> K;
    A.resize(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    cout << BiSearch(1000000000000000001, -1000000000000000001, C1) << "\n";
    return 0;
}

Measured memory_bytes: 1792
import java.io.BufferedInputStream;
import java.io.IOException;
import java.util.Scanner;

/**
 * Created by Harry on 5/10/20.
 */
public class Main {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(new BufferedInputStream(System.in));
        int d = scanner.nextInt();
        int t = scanner.nextInt();
        int s = scanner.nextInt();
        double need = (double)d/s;
        System.out.println(need<=t ? "Yes" : "No");
    }
}


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


int main() {
  string s, t;
  cin >> s;
  t = s;
  reverse(rng(t));
  int ans = 0;
  if(s==t) {
    cout << ans << endl;
    return 0;
  }
  int i = 0, j = 0;
  while(j < s.size()) {
    if(s[i]==t[j]) {
      i++; j++;
    }
    else if(s[i]=='x') i++;
    else if(t[j]=='x') {//sに挿入するxの数だけ数えればよい
      j++;
      ans++;
    }
    else {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3844
#include<iostream>
using namespace std;
int main(){
	int k,x,i;

	cin>>k;
	cin>>x;

	for(i=-k;i<k-1;i++){
		if(-1000000<=(x+i+1) && 1000000>=(x+i+1)){
			cout<<(x+i)+1<<" ";
		}
	}

	cout<<endl;

	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e9;
const static ll MOD = 1e9+7;

int main(){
    int X; cin >> X;
    ll ans = 0;
    ans += (X / 500) * 1000;
    //cout << ans << endl;
    X -= (X/500) * 500;
    //cout << X << endl;
    ans += (X/5) * 5;
    cout << ans << endl;
}

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

int a[100010];
long long sum[100010];
long long sum1[100010];

int main(){
	int n, k; scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; i++){
		scanf("%d", &a[i]);
		sum[i] = sum[i - 1] + a[i];
		sum1[i] = sum1[i - 1] + (a[i] < 0 ? 0 : a[i]); 
	}
	long long ans = 0;
	for (int i = 1; i <= n - k + 1; i++){
		int l = i, r = i + k - 1;
		long long val = sum[r] - sum[l - 1];
		ans = max(ans, sum1[l - 1] + sum1[n] - sum1[r] + (val < 0 ? 0 : val));
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 2176
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define swap(a, b, type) { type _tmp = a; a = b; b = _tmp; }
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int N, ans = 1;

	cin >> N;

	while (ans * 2 <= N) ans *= 2;

	cout << ans << endl;

	return 0;
}


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

#define int long long
#define inf 1000000007LL

#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1LL; i >= 0; i--)
#define trep(i, n) for(int i = 0; i <= (n); i++)
#define rep1(i, n) for(int i = 1LL; i <= (n); i++)
#define mfor(i, s, t) for(int i = (s); i < (t); i++)
#define tfor(i, s, t) for(int i = (s); i <= (t); i++)
/*
class Dinic {
public:
  vector<vector<pair<int, int>>> v;
  vector<int> e;

  vector<int> k;
  vector<int> j;

  void init(int n) {
    v = vector<vector<pair<int, int>>>(n);
    e = vector<int>();
    k = vector<int>(n);
    j = vector<int>(n);
  }
  void add_edge(int a, int b, int atob, int btoa = 0) {
    v[a].push_back(make_pair(b, e.size()));
    e.push_back(atob);
    v[b].push_back(make_pair(a, e.size()));
    e.push_back(btoa);
  }
  void dyk(int s) {
    for(auto& i : k) {
      i = inf;
    }
    queue<pair<int, int>> pq;
    pq.push(make_pair(0, s));
    while(!pq.empty()) {
      int w = pq.front().first;
      int b = pq.front().second;
      pq.pop();
      if(k[b] > w) {
        k[b] = w;
        for(auto i : v[b]) {
          if(e[i.second] > 0) {
            pq.push(make_pair(w + 1LL, i.first));
          }
        }
      }
    }
  }
  int dfs(int s, int t, int p, int c) {
    if(p == t) {
      return c;
    }
    int all = 0;
    while(c > all && j[p] < v[p].size()) {
      if(k[v[p][j[p]].first] == k[p] + 1LL) {
        int r = dfs(s, t, v[p][j[p]].first, min(c - all, e[v[p][j[p]].second]));
        e[v[p][j[p]].second] -= r;
        e[v[p][j[p]].second ^ 1LL] += r;
        if(r < c - all) {
          j[p]++;
        }
        all += r;
      }
      else {
        j[p]++;
      }
    }
    return all;
  }
  int solve(int s, int t) {
    int all = 0;
    while(1LL) {
      dyk(s);
      for(auto& i : j) {
        i = 0;
      }
      int r = dfs(s, t, s, inf);
      if(r == 0) {
        return all;
      }
      all += r;
    }
  }
};
*/

int d[1919];

signed main() {
  int n;
  cin >> n;
  rep(i, n) {
    cin >> d[i];
  }
  sort(d, d + n);
  cout << d[n - 1] - d[0] << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
#include<unordered_set>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<tuple>
#include<iomanip>
#define ll long long int
#define mod 1000000007
#define pi acos(-1)
using namespace std;

void bfs( vector <int>vec[] , int vertex , int level[],int parent[])
{
	int visit[vertex+1]={0};
    
	queue <int>que;
	level[1]=0;
	visit[1]=1;
	que.push(1);
	while(que.size())
	{
      int tmp = que.front();
      que.pop();
      for(auto it : vec[tmp])
      {
        if(visit[it]!=1)
        {
          visit[it]=1;
          parent[it] = tmp;
          level[it]=level[tmp]+1;
          que.push(it); 
        }
      }
    } 
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
  
    int n , m;
    cin>>n>>m;
    int level[n+1]={0},parent[n+1]={0};
    vector<int>  lst[n+1];
    for(int i=0;i<m;i++)
    { 
      int  tmp, tmp2;
      cin>>tmp>>tmp2;
      lst[tmp].push_back(tmp2);
      lst[tmp2].push_back(tmp);
    }
    bfs( lst, n , level,parent);
    for(int i=2;i<=n;i++)
    {
        if(level[i]==0)
        {
            cout<<"No";
            return 0;
        }
    }
    //vector<int> odd , even;
    cout<<"Yes\n";
    for(int i=2;i<=n;i++)
    {
      cout<<parent[i]<<endl;
    }
	
	return 0;
}

Measured memory_bytes: 11340
/* **********************************JAI SAI RAM ************************************* */
// Help in Codeforces  Round Div2 of Devil.
//Well this is just a mere fun.
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<ll> adj[200001];
ll vis[20001];
void  solve()
{
  ll i,j,l,k,m,n,o,p,q,r,t,x,y;
  cin>>x;
  if(x>=400&&x<=599)
  cout<<"8\n";
  if(x>=600&&x<=799)
  cout<<"7\n";
  if(x>=800&&x<=999)
  cout<<"6\n";
  if(x>=1000&&x<=1199)
  cout<<"5\n";
  if(x>=1200&&x<=1399)
  cout<<"4\n";
  if(x>=1400&&x<=1599)
  cout<<"3\n";
  if(x>=1600&&x<=1799)
  cout<<"2\n";
  if(x>=1800&&x<=1999)
  cout<<"1\n";
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t,n,m,k;
    n=1;
     t=n;
    while(t--)
    {
       solve();
       n++;
    }
    return 0;
}
    


Measured memory_bytes: 8340
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

ll x[100000];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, a, b;
    cin >> n >> a >> b;
    for (int i = 0; i < n; ++i)
        cin >> x[i];
    ll sol = 0;
    for (int i = 0; i < n - 1; ++i)
    {
        ll dst = x[i + 1] - x[i];
        ll cst = min(dst * a, b);
        sol += cst;
    }
    cout << sol;
}


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

public class AtCoderD
{
    static void Main()
    {
        int n;
        int m;
        int k;
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            n = int.Parse(words[0]);
            m = int.Parse(words[1]);
            k = int.Parse(words[2]);
        }

        UnionFind friendGroups = new UnionFind(n);
        int[] friendCount = new int[n + 1];
        for (int i = 0; i < m; i++)
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            int a = int.Parse(words[0]);
            int b = int.Parse(words[1]);
            friendGroups.Unite(a, b);
            friendCount[a]++;
            friendCount[b]++;
        }

        int[] suggestions = new int[n];
        for (int i = 0; i < n; i++)
        {
            suggestions[i] = friendGroups.RootCount(i + 1) - friendCount[i + 1] - 1;
        }

        for (int i = 0; i < k; i++)
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            int a = int.Parse(words[0]);
            int b = int.Parse(words[1]);
            if (friendGroups.SameRoot(a, b))
            {
                suggestions[a - 1]--;
                suggestions[b - 1]--;
            }
        }

        //string answer = "";
        //for (int i = 0; i < n; i++)
        //{

        //    answer += " " + suggestions[i];
        //}

        //Console.WriteLine(answer.Trim());

        Console.WriteLine(string.Join(" ", suggestions));
    }

    public class UnionFind
    {
        private int[] parents;

        // 同じ根に属する枝の数を格納する
        private int[] rootCount;

        public int RootCount(int branch)
        {
            return rootCount[root(branch)];
        }

        public UnionFind(int count)
        {
            parents = new int[count + 1];
            rootCount = new int[count + 1];
            for (int i = 0; i < count + 1; i++)
            {
                parents[i] = i;
                rootCount[i] = 1;
            }
        }

        private int root(int N)
        {
            if (parents[N] == N) return N;
            return parents[N] = root(parents[N]);
        }

        //木を併合する際に、枝の数も合算する
        public void Unite(int X, int Y)
        {
            int rootX = root(X);
            int rootY = root(Y);
            if (rootX == rootY) return;
            rootCount[rootX] += rootCount[rootY];
            parents[rootY] = rootX;
        }

        public bool SameRoot(int X, int Y)
        {
            return root(X) == root(Y);
        }
    }
}

Measured memory_bytes: 22568
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
int main(void){
    double max=0;
    double sum=0;
    vector<double> v;
    int n,k,num;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>num;
        v.push_back(1.0+(num-1.0)*0.5);
    }
    int x=0;
    
    for(x;x<k;x++){
        sum+=v[x];
    }
    max=sum;
    //xはk
    for(int i=x;i<v.size();i++){
        sum-=v[i-k];
        sum+=v[i];
        if(max<sum)max=sum;
    }
    cout<< fixed << setprecision(5) << max;
}


Measured memory_bytes: 2420
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
#include<queue>
using namespace std;
typedef long long  LL;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define F first
#define S second
inline int read(){
	int x = 0; char ch = getchar(); bool positive = 1;
	for (; !isdigit(ch); ch = getchar())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = getchar())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
#include<string>
int n,ji,ou;
#define DEBUG 0
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)if(read()&1)ji++;
	ou=n-ji;
	cout<<pow(3,n)-(1<<ou)<<endl;
}


Measured memory_bytes: 1144
#include <bits/stdc++.h>
#define ll long long
#define lsb(x) (x & -x)

using namespace std;

const int MOD = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("a.in", "r", stdin);

    int n;
    string s;
    cin >> n >> s;
    s = " " + s;
    s = " " + s;

    vector<vector<int>> dp(n + 1, vector<int> (n + 1, 0));
    vector<vector<int>> sdp(n + 1, vector<int> (n + 1, 0));

    for(int i = 1; i <= n; i ++) {
        dp[1][i] = 1;
        sdp[1][i] = sdp[1][i - 1] + 1;
    }

    for(int i = 2; i <= n; i ++) {
        for(int j = 1; j <= i; j ++) {
            if(s[i] == '<')
                dp[i][j] = sdp[i - 1][j - 1];
            else
                dp[i][j] = (MOD + sdp[i - 1][i - 1] - sdp[i - 1][j - 1]) % MOD;

            sdp[i][j] = (dp[i][j] + sdp[i][j - 1]) % MOD;
        }
    }

    cout << sdp[n][n];

    return 0;
}


Measured memory_bytes: 70912
#include <iostream>
using namespace std;
struct {int n, d[3];} p[10000];
int main()
{
	int n, i, m, l;
	while (cin >> n && n)
	{
		for (i = 0; i < n; i++)
		{
			cin >> p[i].n >> p[i].d[0] >> p[i].d[1];
			p[i].d[2] = p[i].d[0] + p[i].d[1];
			if (i == 0 || l < p[i].d[2]) m = p[i].n, l = p[i].d[2];
		}
		cout << m << " " << l << endl;
	}
}

Measured memory_bytes: 1024
function Main(input) {
  const args = input.trim().split("\n");
  let n = args.length;
  for (let i = 0; i < n; i++) {
    let tmp = args[i].split(" ").map((x) => Number(x));
    let h = tmp[0];
    let w = tmp[1];
    if (h === 0 && w === 0) {
      break;
    }
    let s = "";
    for (let x = 0; x < w; x++) {
      s += "#";
    }
    for (let y = 0; y < h; y++) {
      console.log(s);
    }
    console.log();
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 17772
def solve(left, right)
  return if left > right
  x = $preorder[$cur]
  y = $inorder.index(x)
  $cur += 1
  solve(left, y-1)
  solve(y+1, right)
  $postorder << x
end
n = gets.to_i
$preorder = gets.split.map(&:to_i)
$inorder = gets.split.map(&:to_i)
$postorder = []
$cur = 0
solve(0, n-1)
puts $postorder.join(" ")

Measured memory_bytes: 8708
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        int ans = 0;
        int x=0;
        for(int i=0; i<N; i++){
            if(S.charAt(i)=='I'){
                x++;
            }else{
                x--;
            }
            ans=Math.max(ans,x);
        }
        System.out.println(ans);
    }
}

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

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	
	for(int i = 0; i < n; i++) {
		cin >> v[i];
	}
	
	vector<int> dp(n, INT_MAX);
	dp[0] = 0;
	dp[1] = abs(v[0] - v[1]);
	
	for(int i = 2; i < n; i++) {
		dp[i] = min(dp[i-2] + abs(v[i] - v[i-2]), dp[i-1] + abs(v[i] - v[i-1]));
	}
	cout << dp[n-1] << "\n";
}


Measured memory_bytes: 3928
mod = 998244353

class Combination:
    def __init__(self, N):
        self.fac = [1] * (N + 1)
        for i in range(1, N + 1):
            self.fac[i] = (self.fac[i - 1] * i) % mod
        self.invmod = [1] * (N + 1)
        self.invmod[N] = pow(self.fac[N], mod - 2, mod)
        for i in range(N, 0, -1):
            self.invmod[i - 1] = (self.invmod[i] * i) % mod

    def calc(self, n, k):  # nCk
        return self.fac[n] * self.invmod[k] % mod * self.invmod[n - k] % mod


N, M, K = map(int, input().split())
C = Combination(N)

ans = 0
for k in range(K + 1):
    tmp = C.calc(N - 1, N - k - 1) * M * pow(M - 1, N - k - 1, mod) % mod
    ans = (ans + tmp) % mod

print(ans)

Measured memory_bytes: 24680
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

vector< bool > isprimetable(int n) {
	vector< bool > prime(n + 1, true);
	if (n >= 0) prime[0] = false;
	if (n >= 1) prime[1] = false;
	for (int i = 2; i * i <= n; i++) {
		if (!prime[i]) continue;
		for (int j = i + i; j <= n; j += i) {
			prime[j] = false;
		}
	}
	return prime;
}



int main() {

	int q; cin >> q;

	vector<int> imos(100010,0);
	
	auto prime = isprimetable(100010);
	for (int i = 1; i < 100000; i++) {
		if (i % 2 == 0) {
			imos[i] = imos[i - 1];
		}
		else {
			if (prime[i] == true && prime[(i + 1) / 2] == true) {
				imos[i] =imos[i - 1]+1;
			}
			else {
				imos[i] = imos[i - 1];
			}
		}
	}

	for (int i = 0; i < q; i++) {
		int l, r; cin >> l >> r;

		cout << imos[r] - imos[l-1] << endl;
	}


	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include <cstdio>
#include<cstring>
#include <cstdlib>  
#include<cmath>   
#include <cctype>
#include<string>
#include<set>
#include <iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 

using namespace std;
using ll = long long;
double pi() { return 3.14; }
int sum(int a, int b) { return a + b; }
int mul(int a, int b) { return a * b; }
int main() {
	int n, m;
	int t = 1;
	int p = 0;
	int l = 0;
	cin >> n;
	vector<ll>a(n);

	for (int i = 0;i < n;i++) {
		cin >> a.at(i);
	}
	sort(a.begin(), a.end());
	cin >> m;
	vector<int>c(m);
	vector<ll>b(m);
	for (int j = 0;j < m;j++) {
		cin >> b.at(j);
	}
	sort(b.begin(), b.end());
	for(int t=0;t<m;t++){
		for (int k = l;k < n;k++) {
			if (b.at(t) == a.at(k)) { l = k; c.at(t) = 1;break; }
			if (b.at(t) < a.at(k)) { c.at(t) = 0;break; }
		}
		if (c.at(t) == 0) { p = 1; cout << 0 << endl;break; }
	}
	if(p==0){
	cout << t << endl;
}
    return 0;

}



Measured memory_bytes: 6764