akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <ios>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
using namespace std;
typedef long long ll;
#define mp make_pair;
#define pb push_back;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N , K;
  cin >> N >> K;

  if((N+1)/2 >= K){
    cout << "YES" << endl;
  }
  else cout << "NO" << endl;
  return 0;
    

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
ll dp[2001];
const ll MOD=(ll)1e9+7;

int main(){
  ll n;
  cin>>n;
  dp[3]=1;
  for(int i=4;i<=n;i++){
    for(int j=3;j<=i-3;j++){
      dp[i]+=dp[j]%MOD;
    }
    dp[i]=(dp[i]+1)%MOD;
  }
  cout<<dp[n]<<endl;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define __STDC_LIMIT_MACROS
#include <stdint.h>
using namespace std;
#define int   long long
#define endl '\n'	 
#define pb	push_back
#define setbits(x)		__builtin_popcountll(x)
#define zrobits(x)		__builtin_ctzll(x)
void c_p_c()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int mex(int a[], int n)
{
	set<int> h;
	for(int i = 0; i<n; i++)
		h.insert(a[i]);
	int ans = 0;
	for(auto d:h)
	{
		if(d==ans)
			ans++;
	}
	return ans;
}
int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	c_p_c();
	int n;
	cin>>n;
	if(n%1000)
		cout<<1000-n%1000<<endl;
	else
		cout<<0<<endl;
}


Measured memory_bytes: 3648
ans = 0
count = 0
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
a.sort()
for i in a:
    ans += i[0] * i[1]
    count+=i[1]
    if count >= m:
        ans -= i[0] * i[1]
        ans += (m - count + i[1]) * i[0]
        break;
print(ans)

Measured memory_bytes: 27760
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<vector<int>> a(10);
  
  rep(i, n) {
    a[s[i] - '0'].push_back(i);//iは配列a[i][]に入れておく
  }
  
  /*for (int i = 0; i <= 9; i++) {
    if (a[i].size() == 0) cout << endl;
    for (int j = 0; j < a[i].size(); j++) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }*/
  
  int cnt = 0;
  int A, B, C;//ijkが作れるか見ていく
  for (int i = 0; i <= 9; i++) {
   
    if (a[i].size() == 0) continue;//iが1つもない
    
    for (int j = 0; j <= 9; j++) {
      
      if (a[j].size() == 0) continue;
      
      for (int k = 0; k <= 9; k++) {
        
        if (a[k].size() == 0) continue;
        
        bool flag = false;
        A = a[i][0];//1けた目iはAばんめにあった
        for (int x = 0; x < a[j].size(); x++) {
          
          if (a[j][x] > A) {
            B = a[j][x];//2けためjはB番目にあった
            flag = true;
            break;
          }
        
        }
        
        if (flag) {//B+1番以降でkをさがす
          
          for (int y = 0; y < a[k].size(); y++) {
            
            if (a[k][y] > B) {
              cnt++;
              break;
            }
          
          }
          
        } else {
          continue;//kがなかったからij(k+1)を作れるか見る
        }
        
      
      }
    
    }
  
  }
  
  cout << cnt << endl;
  
}




Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define PI 3.1415926535897



double a, b, h, m;



int32_t main(){
INIT
cin>>a>>b>>h>>m;


double xh=cos( ((h*60+m)/( 60*12 ))*PI*2 )*a, yh=sin( ((h*60+m)/( 60*12 ))*PI*2 )*a, xm=cos(  ( (m)/60   )*PI*2  )*b, ym=sin(  ( (m)/60   )*PI*2  )*b;

double dist=sqrt( (xh-xm)*(xh-xm)+(yh-ym)*(yh-ym)  );
cout<<fixed<<setprecision(11)<<dist;

return 0;
}


Measured memory_bytes: 4108
import java.util.*

fun main(args:Array<String>){
    solve()
}

fun solve(){
    val s = read()
    val n = s.length
    var ans = 0L
    for(mask in 0 until (1 shl (n - 1))){
        var sum = 0L
        var num = (s[0] - '0').toLong()
        for(i in 0 until n - 1){
            if(((mask shr i) and 1) == 1){
                sum += num
                num = (s[i + 1] - '0').toLong()
            }
            else{
                num *= 10
                num += (s[i + 1] - '0').toLong()
            }
        }
        sum += num
        ans += sum
    }
    println(ans)
}

fun read() = readLine()!!
fun reads() = readLine()!!.split(" ")
fun readint() = readLine()!!.toInt()
fun readints() = readLine()!!.split(" ").map{it.toInt()}
fun readlong() = readLine()!!.toLong()
fun readlongs() = readLine()!!.split(" ").map{it.toLong()}

Measured memory_bytes: 34480
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int>P;
string dp[51][51],s;
string MAX(string &a,string &b){
    if(a=="invalid")return b;
    if(b=="invalid")return a;
    if(a.size()>b.size())return a;
    else if(a.size()<b.size())return b;
    else return a<b?b:a;
}
string get_num(int l,int r){
    string res;
    if(l<r&&s[l]=='0')return "invalid";
    for(int i=l;i<=r;i++){
        if(s[i]!='?'&&!isdigit(s[i]))return "invalid";
        res+= (s[i]=='?'?'9':s[i]);
    }
    return res;
}
string dfs(int l,int r){
    if(dp[l][r]!="")return dp[l][r];
    string res=get_num(l,r);
    if(res!="invalid")return res;
    if(s[l+1]!='('&&s[l+1]!='?'||s[r]!=')'&&s[r]!='?')return "invalid";
    for(int i=l+3;i<=r-2;i++){
        if(s[i]!=','&&s[i]!='?')continue;
        string lm=dfs(l+2,i-1);
        string rm=dfs(i+1,r-1);
        if(lm=="invalid"||rm=="invalid")continue;
        if(s[l]=='L'||s[l]=='?')res=MAX(res,lm);
        if(s[l]=='R'||s[l]=='?')res=MAX(res,rm);
    }
    return dp[l][r]=res;
}
int main(){
    cin>>s;
    cout<<dfs(0,s.size()-1)<<endl;
}


Measured memory_bytes: 3196
//  SMOKE SHISHA PLAY FIFA  // 
#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef long double ld;

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pll pair<ll,ll>
#define MP make_pair
#define ff first
#define ss second
#define PB push_back
#define mod 1000000007
#define lp(i,start,end) for(ll i=start;i<=end;i++) 
#define deb1(a) cout<<#a<<" = "<<(a)<<endl;
#define deb2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define deb3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;


ll modu(ll a, ll b)
{
	ll ans =1;
	while(b>0)
	{
		if(b&1)
		ans = (ans*a)%mod;
		b/=2;
		a = (a*a)%mod;
	}
	return ans;
}

int main()
{
	fastio
	ll n;
	cin>>n;
	ll a[n],ans=0;
	lp(i,0,n-1)
		cin>>a[i];
	sort(a,a+n,greater<ll>());
	ans+=a[0];
	lp(i,1,n/2-1)
		ans+=2*a[i];
	if(n%2)
		ans+=a[n/2];
	cout<<ans<<endl;
	return 0;	
}


Measured memory_bytes: 5184
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	//cout<<sqrt(2019)<<endl;
	long long int l,r;
	cin>>l>>r;
	
		int min=2020;
		
		
			if(r-l>=2019){
				min=0;
			}

	else{
		for(long long int i=l;i<=r;i++){
			for(long long int j=i+1;j<=r;j++){
				int s;
				s=(i%2019)*(j%2019)%2019;
				if(s<min){
					min=s;
				
				}
			}
		}
		
	}
	cout<<min<<endl;
		
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
 
template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 1e9+7;
constexpr long long inf = 3e18;

int N,A[200005];
signed main(){
	cin.tie(0);ios::sync_with_stdio(false);
	cin>>N;
	int sum=0;
	rep(i,N){
		cin>>A[i];sum+=A[i];sum%=mod;
	}
	int ans=0;
	rep(i,N){
		sum-=A[i];(sum+=mod)%=mod;
		ans+=A[i]*sum%mod;
		ans%=mod;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 5208
/*
* @Author: _dp95
* @Date:   2020-04-03 08:56:57
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end() 
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

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

const int MAX = 2*1000*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

string s ;

bool ispal(int i, int j){
    string st = s.substr( i, j-i+1 ) ;
    string str = st ;
    reverse(all(str));
    return st == str ;
}

signed main( ){
  timesaver ;
  cin >> s ;
  int n = sz(s) ;
  cout << ((ispal(0,n-1) and ispal(0,(n-1)/2 -1)) and ispal( (n-1)/2 +1, n-1 ) ? "Yes" : "No") << nl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
ll dp[200005][3]={0};
ll minf=-1744174417441744;
int main(){
  ll n;
  cin>>n;
  for(int i=0;i<=n+1;i++){
    dp[i][0]=minf;
    dp[i][1]=minf;
    dp[i][2]=minf;
  }
  dp[0][0]=0;
  dp[1][0]=0;
  for(int i=2;i<=n+1;i++){
    ll a;
    cin>>a;
    dp[i][0]=max(dp[i][0],dp[i-2][0]+a);
    dp[i][1]=max(dp[i][1],dp[i-2][1]+a);
    dp[i][2]=max(dp[i][2],dp[i-2][2]+a);
    if(i>=3) dp[i][1]=max(dp[i][1],dp[i-3][0]+a);
    if(i>=3&&n%2==1) dp[i][2]=max(dp[i][2],dp[i-3][1]+a);
    if(i>=4&&n%2==1) dp[i][2]=max(dp[i][2],dp[i-4][0]+a);
  }
  ll ans;
  if(n%2==1){
    ans=max({dp[n+1][0],dp[n+1][1],dp[n+1][2]});
    ans=max({ans,dp[n][0],dp[n][1]});
    ans=max({ans,dp[n-1][0]});
  }
  else{
    ans=max({dp[n+1][0],dp[n+1][1],dp[n][0]});
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 8284
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq
import copy
import numpy as np
#n = int(input())
#n, m = map(int, sys.stdin.readline().split())
s = input()
#a = list(map(int, sys.stdin.readline().split()))

if s[len(s)-1] == "s":
    print(s + "es")
else:
    print(s + "s")







        


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

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

int main(){
    long long N;
    cin >> N;

    long long sum = 0;
    for(long long i = 1; i <= N; i++){
        if(i % 3 != 0 && i % 5 != 0){
            sum += i;
        }
    }

    cout << sum << endl;

    return 0;
}


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

int main() {
  int N;
  scanf("%d", &N);
  map<string, int> mp;

  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    auto itr = mp.find(s);
    if (itr != mp.end()) {
      itr->second++;
    } else {
      mp[s] = 1;
    }
  }

  int M;
  scanf("%d", &M);
  for (int i = 0; i < M; i++) {
    string s;
    cin >> s;
    auto itr = mp.find(s);
    if (itr != mp.end()) {
      itr->second--;
    } else {
      mp[s] = -1;
    }
  }

  int ans = 0;
  for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
    if (ans < itr->second) ans = itr->second;
  }
  printf("%d", ans);
}

Measured memory_bytes: 256
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int n;
    cin>>n;
    vector<pi64> r(n);
    forn(i,n){
        i64 x,l;
        cin>>x>>l;
        r[i] = mp(x+l,x-l);
    }
    sort(all(r));
    stack<pi64> s;
    s.push(r[0]);
    i64 cnt=1;
    for(int i=1;i<n;i++){
        pi64 a = s.top();
        if(a.fi<=r[i].se){
            cnt++;
            s.push(r[i]); 
        }
    }
    cout<<cnt<<endl;
    return 0;
}



Measured memory_bytes: 6360
#define _USE_MATH_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
using namespace std;

int main() {
    int K, S, ans = 0;
    cin >>K >> S;

    for (int i = 0; i <= K; i++) {
        for (int j = 0; j <= K; j++) {
                if (i+j>=S-K&&i + j <= S)ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
  int a,b; cin >>a >>b;
  bool batsu = true;
  if (1<=a && a<=9){
    if (1<=b && b<=9){
      cout <<a*b <<endl;
      batsu = false;
    }
  }
  if (batsu) cout <<-1 <<endl;
}


Measured memory_bytes: 256
n = int(input())
import sys

a = 0
s = []
fl = 0
for i in range(1,500):
    a += i
    s.append(a)
    
for i in range(len(s)):
    if s[i] == n:
        fl = 1
        leng = i+1
        
if fl == 0:
    print("No")
    sys.exit()
    
print("Yes")
print(leng+1)
ans = [[] for _ in range(leng)]
a = 0

for i in range(leng):
    while True:
        a += 1
        ans[i].append(a)
        if len(ans[i]) == i+1:
            break
            
for j in range(leng-1,-1,-1):
    a = ans[j][len(ans[j])-1]
    for k in range(leng-1-j):
        a += (k + j + 1)
        ans[j].append(a)
        
sime = s[:leng]
nn = len(ans[0])

for i in range(leng):
    print(nn,*ans[i])
    
print(nn,*sime)

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

bool IsPrime(int num);

int main() {
	/****input****/
  int x;
  cin >> x;

  /****calc****/
  int ans = x-1;
  bool key = false;
  while(!key){
	  ans++;
	  key = IsPrime(ans);
  }
  /****output****/

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

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}

int main() {
    int n;
    cin >> n;
    vector<int> X(n);
    rep(i,n) {
        cin >> X[i];
    }
    int res = INF;
    for(int i=1; i<=100; ++i) {
        int _res = 0;
        rep(j,n) {
            _res += pow((X[j]-i),2);
        }
        res = min(res, _res);
    }
    cout << res << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int l=s.length();
  bool flag=false;
  if(l==6){
    flag=true;
  }
  if(flag){
    for(int i=0;i<l;i++){
      if(s[i]<'a' || s[i]>'z'){
        flag=false;}
    }}
  if(flag){
  	if(s[2]==s[3] && s[4]==s[5]){
        flag=true;}
    else{
        flag=false;
    }
  }
  if(flag){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  return 0;
}


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

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

    int h, w;
    cin >> h >> w;
    vector<vector<int>> a(h + 2, vector<int>(w + 2));
    vector<vector<int>> b(h + 2, vector<int>(w + 2));
    rep(i, 0, h) rep(j, 0, w) cin >> a[i + 1][j + 1];
    rep(i, 0, h) rep(j, 0, w) cin >> b[i + 1][j + 1];
    vector<vector<int>> c(h + 2, vector<int>(w + 2));
    rep(i, 0, h) rep(j, 0, w) c[i + 1][j + 1] =
        abs(a[i + 1][j + 1] - b[i + 1][j + 1]);

    bool dp[h + 2][w + 2][13000] = {};
    dp[0][1][0] = true;
    rep(i, 1, h + 1) rep(j, 1, w + 1) {
        rep(k, 0, 13000) if (dp[i - 1][j][k] || dp[i][j - 1][k]) {
            dp[i][j][k + c[i][j]] = dp[i][j][abs(k - c[i][j])] = true;
        }
    }
    rep(i, 0, 13000) if (dp[h][w][i]) {
        cout << i << endl;
        break;
    }

    return 0;
}

Measured memory_bytes: 85760
from numpy import*
M=10**9+7
m=lambda*z:map(int,raw_input().split())
n,k=m()
b=eye(n,n,0,'O')
a=matrix(map(m,b),'O')
while k:b=[b,b*a][k&1];a=a*a%M;k/=2
print sum(b)%M

Measured memory_bytes: 16136
#include <iostream>
#define int long long
#define MAX 1000000
using namespace std;

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

  if (a == 1) {
    cout << "YES" << endl;
    return 0;
  }

  int sum = 0;
  for (int i = 0; sum <= MAX; i++) {
    sum += a;
    if (sum % b == c) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;

  return 0;
}


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

main(){
  string a,s="";
  cin >>a;
  for(int i= 0; i<a.size();i++){
    if(i == 0) s+= a[0];
    else if(a[i] != s.substr(s.size()-1, 1)[0]) s+=a[i];
  }
  cout<< s.size()-1 <<endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef long long int ll;

ll dp[5050][5050];

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<ll> h(n),p(n);
	vector<pair<ll,int>> v;
	for(int i=0;i<n;i++){
		cin >> h[i] >> p[i];
		v.push_back({h[i]+p[i],h[i]});
	}
	sort(v.begin(),v.end());
	for(int i=0;i<5050;i++){
		for(int j=1;j<5050;j++){
			dp[i][j]=1e12;
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(dp[i][j]<=v[i].second){
				dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]+v[i].first-v[i].second);
			}
			dp[i+1][j]=min(dp[i][j],dp[i+1][j]);
		}
	}
	int ma=0;
	for(int i=0;i<=n;i++){
		if(dp[n][i]<1e12){
			ma=i;
		}
	}
	cout << ma << endl;
}


Measured memory_bytes: 199808
from fractions import gcd
t = int(input())
for i in range(t):
    a,b,c,d = map(int, input().split())
    if a < b:
        print('No')
        continue
    if d < b:
        print('No')
        continue
    if c >= b - 1:
        print('Yes')
        continue
    if c < a % b:
        print('No')
        continue
    if d % b == 0:
        print('Yes')
        continue
    g = gcd(b,d)
    if c % b < (b - g + (a % g)) % b:
        print('No')
        continue
    print('Yes')


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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  int cnt = 0;
  ll sum = 0, absmin = 1 << 29;
  for (int i = 0; i < N; i++) {
    ll a;
    cin >> a;
    if (a < 0) {
      a = abs(a);
      cnt++;
    }
    sum += a;
    absmin = min(absmin, a);
  }
  cout << sum - (cnt % 2 == 0 ? 0 : 2 * absmin) << '\n';
  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
students = [list(map(int, input().split())) for _ in range(N)]
cps = [list(map(int, input().split())) for _ in range(M)]

ans = [-1] * N
for i in range(N):
    min_dist = float("inf")
    min_idx = -1
    for j in range(M):
        dist = abs(students[i][0] - cps[j][0]) + abs(students[i][1] - cps[j][1])
        if dist < min_dist:
            min_dist = dist
            min_idx = j + 1
    ans[i] = min_idx
print("\n".join(map(str, ans)))


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;

const int N = 5e5+7;

void read(int &x){
	x=0;int f=1;char c=getchar();
	while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
	x*=f;
}

string s[N];
int n;

int main(){
	int maxn = 0,tot = 0;
	read(n);
	for(int i = 1; i <= n; i++) cin >> s[i];
	sort(s+1,s+1+n);
	for(int i = 1; i <= n; i++){
		tot = 1;int j = i;
		while(s[j] == s[i]){
			tot++;
			j++;
		}
		i=j-1;
		maxn = max(maxn,tot);
	}
		for(int i = 1; i <= n; i++){
		tot = 1;int j = i;
		while(s[j] == s[i]){
			tot++;
			j++;
		}
		i=j-1;
		if(maxn == tot){
			cout << s[i] << endl;
		}
	}
}

Measured memory_bytes: 16640
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
	println(weiwei(readLine()!!)+1)
}
 
tailrec fun weiwei(list :String, c :Int = 0) : Int {
    if (list.length == 1) {
        return c
    }

    val v = if (list[0] == list[1]) {
        0
    }
    else {
        1
    }
    return weiwei(list.drop(1), c + v)
}

Measured memory_bytes: 116808
(*
ocamlfind ocamlopt -package batteries -linkpkg main.ml -o a.out
*)
open Batteries

let n, a, b = Scanf.sscanf (read_line ()) "%d %d %d" (
        fun n a b -> 
                n, a, b
)


let ablue = 
        let amari = n mod (a + b) in
                if amari < a then
                        amari
                else
                        a

let () =
        (
                let div = n / (a + b) in
                let sblue = a * div in
                        sblue + ablue
        ) |> Printf.printf "%d\n"


Measured memory_bytes: 3072
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	a := nextInt()
	b := nextInt()

	t := a - b * 2
	if t > 0 {
		fmt.Printf("%d", t)
	} else {
		fmt.Printf("%d", 0)
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    int N;
    cin >> N;
    bool four = false;
    for ( int i = 0; i < N; i++ ) {
        char a;
        cin >> a;
        if ( a == 'Y' ) { four = true; }
    }
    cout << ( four ? "Four" : "Three" ) << endl;
    return 0;
}

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

using namespace std;
int n;
vector<int> r[100];
bool ud[100];
int func(int a){
  int l=1;
  ud[a]=true;
  for(int j=0;j<r[a].size();++j){
    if(!ud[r[a][j]]) l=max(l,func(r[a][j])+1);
  }
  ud[a]=false;
  return l;
}
int main(){
  int f,t;
  while(cin>>n,n){
    int a=0;
    for(int i=0;i<100;++i){
      r[i].clear();
    }
    for(int i=0;i<n;++i){
      cin>>f>>t;
      r[--f].push_back(--t);r[t].push_back(f);
    }
    for(int i=0;i<100;++i) a=max(a,func(i));
    cout<<a<<endl;
  }   
  return 0;
}

Measured memory_bytes: 1216
#include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  vector<ll> ruiseki(N);
  cin >> ruiseki[0];
  for (int i = 1; i < N; ++i) {
    ll tmp;
    cin >> tmp;
    ruiseki[i] = ruiseki[i - 1] + tmp;
  }

  unordered_map<ll, ll> result;
  for (int i = 0; i < N; ++i) {
    auto itr = result.find(ruiseki[i]);
    if (itr != result.end()) {
      result[ruiseki[i]] += 1;
    } else {
      result[ruiseki[i]] = 1;
    }
  }
  ll ans = 0;
  for (auto itr = result.begin(); itr != result.end(); ++itr) {
    if (itr->first == 0) {
      ans += itr->second;
    }
    ans += itr->second * (itr->second - 1) / 2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 10056
#include <bits/stdc++.h>
using namespace std;
 
const int maxn = 1e3 + 20;
int vis[maxn],n;
double x[maxn],y[maxn],r[maxn],dist[maxn],mp[maxn][maxn];
 
void SPFA(int s)
{
    queue<int>q;
    for(int i = 1;i <= n;i++) dist[i] = 1e10;
    memset(vis,0,sizeof(vis));
    while(!q.empty()) q.pop();
    dist[s] = 0;
    vis[s] = 1;
    q.push(s);
    while(!q.empty())
    {
        int v = q.front();
        q.pop();
        vis[v] = 0;
        for(int i = 1;i <= n;i++)
        {
            if(dist[i] > dist[v] + mp[v][i])
            {
                dist[i] = dist[v] + mp[v][i];
                if(!vis[i])
                {
                    vis[i] = 1;
                    q.push(i);
                }
            }
        }
    }
}
 
int main()
{
    while(scanf("%lf%lf%lf%lf",&x[1],&y[1],&x[2],&y[2]) != EOF)
    {
        scanf("%d",&n);
        n += 2;
        r[1] = r[2] = 0;
        mp[1][2] = mp[2][1] = sqrt((x[1] - x[2]) * (x[1] - x[2]) + (y[1] - y[2]) * (y[1] - y[2]));
        for(int i = 3;i <= n;i++)
        {
            scanf("%lf%lf%lf",&x[i],&y[i],&r[i]);
        }
        for(int i = 1;i <= n;i++)
        {
            for(int j = 1;j <= n;j++)
            {
                mp[i][j] = sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
                mp[i][j] -= r[i] + r[j];
                if(mp[i][j] < 0)
                {
                    mp[i][j] = 0;
                }
            }
        }
        SPFA(1);
        printf("%.10f\n",dist[2]);
    }
    return 0;
}

Measured memory_bytes: 8320
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(string, a);
    if (toupper(a[0]) == a[0])
    {
        OUT("A");
    }
    else
    {
        OUT("a");
    }
}

Measured memory_bytes: 3548
import java.util.*;

class Main{
    //148c
    static final int DIV = 100000007;
    static final int MAX = 2000000000;
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        long ans = lcm(a,b);
        System.out.println(ans);
    }
    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
    
    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
  int N, K;
  cin >> N >> K;
  vector<int> A(N + 1);
  for (int i = 0; i <= N; i++)
    A[i] = INT32_MAX;
  int kind = 0;
  for (int i = 0; i < N; i++)
  {
    int value;
    cin >> value;
    if (A[value] == INT32_MAX)
    {
      kind++;
      A[value] = 1;
    }
    else
      A[value]++;
  }
  sort(A.begin(), A.end());
  int ans = 0;
  for (int i = 0; i < N; i++)
  {
    if (K < kind && A[i] != INT32_MAX)
    {
      ans += A[i];
      kind--;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
using namespace std;
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;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j]
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
ll gcd(ll a,ll b){
    while(b!=0){
        a %= b;
        if(a==0) return b;
        b %= a;
    }
    return a;
}
int main(){
    ll a,b; cin >> a >> b;
    cout << a*b/gcd(a,b) << endl;
    
}



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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll N, K, ans=0;
  cin >> N >> K;
  rep(i,N) {
    ll h;
    cin >> h;
    if (h >= K)
      ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
#include <stdlib.h>
#include<ctype.h>
typedef long long LL;
#define rep(i,n) for(LL i=0; i<(LL)(n); i++)

//qsort
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

//比較
int max(int a, int b){
	if (a>b) return a;
	else return b;
}

int min(int a,int b) {
	if(a>b) return b;
	else return a;
}


//main関数
int main() {
	char N[200000];
	scanf("%s",N);
	int keta[2000000];
	int ans = 0;
	rep(i,strlen(N)){
		keta[i] = N[i] - '0';
		ans += keta[i];
	}
	
	
	if(ans % 9 == 0){
		printf("Yes");
		return 0;
	}
	printf("No");
	
}








Measured memory_bytes: 1844
W = input()
ls = []
count = 0
while True:
    text = input()
    if text == 'END_OF_TEXT':
        break
    else:
        ls.append(list(map(str, text.split())))
for i in ls:
    for s in i:
        if s.lower() == W.lower():
            count += 1
print(count)

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

typedef pair<int,int> PI;

struct UF{
    
    int root[230010];
    
    UF(int n){
        for(int i=0;i<n;i++) root[i] = i;
    }
    
    int find(int n){
        if(root[n] == n) return n;
        return find( root[n] );
    }
    
    void unit(int a,int b){
        a = find(a);
        b = find(b);
        if(a < b) root[b] = a;
        else root[a] = b;
    }
    
    bool same(int a,int b){
        return find(a)==find(b);
    }
    
};

int main(){
    
    int n,m,d,ans;
    int a[230010],b[230010];

    while(cin >> n,n!=0){
        cin >> m;
        vector<PI> vec;
        for(int i=0;i<m;i++){
            scanf("%d,%d,%d",&a[i],&b[i],&d);
            vec.push_back( PI(d/100-1,i) );
        }
    
        sort(vec.begin(),vec.end());
        UF uf(n);
        ans = 0;
        for(int i=0;i<vec.size();i++){
            int toro = vec[i].first;
            int idx = vec[i].second;
            if(!uf.same(a[idx],b[idx])){
                ans += toro;
                uf.unit(a[idx],b[idx]);
            }
        }
    
        cout << ans << endl;
    }
    
    return(0);
}


Measured memory_bytes: 3408
package main

import (
	"fmt"
)

func f(n, m uint) uint {
	for m > 0 {
		t := n
		n = m
		m = t % m
	}

	return n
}

func main() {
	var n, m uint

	fmt.Scanf("%d %d", &n, &m)

	if m < n {
		fmt.Println(f(n, m))
	} else {
		fmt.Println(f(m, n))
	}
}



Measured memory_bytes: 1128
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)

string S, T;
map<char, int> mpS;
map<char, int> mpT;

void solve() {
    REP(i, S.length()) {
        mpS[S[i]]++;
        mpT[T[i]]++;
    }
    REP(i, S.length()) {
        if (mpS[S[i]] != mpT[S[i]] && mpS[S[i]] != mpT[T[i]]) {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

int main() {
    cin >> S >> T;
    solve();
    return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define double long double
#define pii pair<int, int>
#define FOR(i, a, b) for(int i = a; i < (int)(b); ++i)

using namespace std;

int32_t main() {
    int n;
    cin >> n;
    int v[n][3];
    FOR(i, 0, n) {
        FOR(j, 0, 3) {
            cin >> v[i][j];
        }
    }
    int d[n][3];
    FOR(i, 0, 3) {
        d[0][i] = v[0][i];
    }
    FOR(i, 1, n) {
        FOR(j, 0, 3) {
            int mx = INT32_MIN;
            FOR(q, 0, 3) {
                if (q == j) {
                    continue;
                }
                if (d[i - 1][q] > mx) {
                    mx = d[i - 1][q];
                }
            }
            d[i][j] = mx + v[i][j];
        }
    }
    int ans = INT32_MIN;
    FOR(i, 0, 3) {
        if (d[n - 1][i] > ans) {
            ans = d[n - 1][i];
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 8268
#include <iostream>
using namespace std;
int main(void){
    string str = "";
    int num = 0;
    int sum = 0;
    
    cin >> str;
    num = std::stoi(str);
    
    for(int i = 0; i < str.size(); i++)
    {
        sum += str[i] - '0';
    }
    
    if(num % sum == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


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

int price[8][8]={
	{0,0,0,0,0,0,0,0},
	{0,0,300,500,600,700,1350,1650},
	{0,300,0,350,450,600,1150,1500},
	{0,500,350,0,250,400,1000,1350},
	{0,600,450,250,0,250,850,1300},
	{0,700,600,400,250,0,600,1150},
	{0,1350,1150,1000,850,600,0,500},
	{0,1650,1500,1350,1300,1150,500,0}
};

int dist[8][8]={
	{0,0,0,0,0,0,0,0},
	{0,0,6,13,18,23,43,58},
	{0,6,0,7,12,17,37,52},
	{0,13,7,0,5,10,30,45},
	{0,18,12,5,0,5,25,40},
	{0,23,17,10,5,0,20,35},
	{0,43,37,30,25,20,0,15},
	{0,58,52,45,40,35,15,0}
};

int calSec(int h,int m){
	return h * 60 + m;
}

int main(void){
	int ts=calSec(17,30),te=calSec(19,30);
	int s,g,st,gt;

	while(cin>>s && s){
		int h,m;
		cin>>h>>m;
		st = calSec(h,m);
		cin>>g>>h>>m;
		gt = calSec(h,m);

		bool flg = false;
		if(dist[s][g]<=40 && (ts<=st && st<=te || ts<=gt && gt<=te)) flg = true;

		int ans = price[s][g];
		if(flg){
			ans /= 2;
			int rem = ans % 50;
			if(rem != 0) ans += 50 - rem;
		}

		cout<<ans<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
from collections import defaultdict, deque
import sys
import math

sys.setrecursionlimit(100000)

MIN = -10 ** 9
MAX = 10 ** 9 + 7


def main():
    N = int(input())
    # K, X = [int(a) for a in input().split()]
    s = sorted([
        "".join(sorted(input()))
        for _ in range(N)
    ])

    c = 0
    last = ""
    res = 0
    for si in s:
        if last == si:
            c += 1
            continue
        else:
            last = si
            res += (c + 1) * c // 2
            c = 0
            continue

    res += c * (c + 1) // 2
    print(res)

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


if __name__ == '__main__':
    main()


Measured memory_bytes: 11760
#include <iostream>
using namespace std;
int main(){
  int n,a,b,c,x;
  while(cin >> n >> a >> b >> c >> x, n!=0){
    int y[n];
    int cnt=0,id=0;
    for(int i=0;i<n;i++){
      cin >> y[i];
    }
    while(id<n){
      if(y[id]==x){
	id++;
      }
      x = (a*x+b)%c;
      cnt++;
      if(cnt>10000)break;
    }
    cnt--;
    if(id<n){
      cout << -1 << endl;
    }else{
      cout << cnt << endl;
    }
  }
}

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

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

    if (a == b && b == c)
        puts("Yes");
    else
        puts("No");
        
    return 0;
}

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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

template<typename T>
T gcd(T x, T y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	int n;
	cin >> n;
	Vec<int> a(n);
	for (auto&& i : a) {
		cin >> i;
	}
	sort(begin(a), end(a));
	while (n != 1) {
		for (int i = 1; i < n; i++) {
			a[i] %= a[0];
			if (a[i] == 0) {
				n--;
				swap(a[n], a[i]);
				i--;
			}
		}
		sort(begin(a), begin(a) + n);
	}
	cout << a[0] << "\n";
}

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


Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

using P = tuple<int, int>;

int main()
{
    int n;
    cin >> n;
    vector<P> p;
    rep(i, n)
    {
        int x, y;
        cin >> x >> y;
        p.push_back(P(x, y));
    }

    double result = 0;
    rep(i, n) rep(j, n)
    {
        if (i != j) {
            int x0, y0, x1, y1;
            tie(x0, y0) = p[i];
            tie(x1, y1) = p[j];
            double d = sqrt((x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1));
            result += d / n;
        }
    }

    cout << fixed << setprecision(7) << result << endl;

    return 0;
}

Measured memory_bytes: 256
n,k = list(map(int,input().split()))
num = list(map(int,input().split()))
l = [0 for _ in range(200001)]
for i in range(n):
    l[ num[i] ] +=1
count=0
a = []
for i in l:
    if(i>0):
        count+=1
        a.append(i)
a.sort()
ans = 0
for i in range(count-k):
    ans += a[i]
print(ans)

Measured memory_bytes: 25876
#include<stdio.h>
int main()
{
    long long int n, a[5];
    int i;
    scanf("%lld", &n);
    for (i = 0; i < 5; i++)
        scanf("%lld", &a[i]);
    long long int min = 1000000000000015;
    for (i = 0; i < 5; i++)
        if (a[i] < min)
            min = a[i];
    printf("%lld\n", (n + min - 1) / min + 4);
    return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long a,b;
		a = sc.nextLong();
		b = sc.nextLong();
		if(a<0 && b>0){
			System.out.println("Zero");
			return;
		}
		else if(a>0 && b>0){
			System.out.println("Positive");
			return;
		}
		
		if(((b-a)%2)==1) System.out.println("Positive");
		else System.out.println("Negative");

	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M, K;
	cin >> N >> M >> K;
	vector<int> P(N);
	vector<int> C(N);
	vector<int> J(N);
	int mx = 0;
	for (int i = 0; i < N; i++) {
		cin >> P[i];
		mx = max(mx, P[i]);
	}
	mx++;
	for (int i = 0; i < N; i++) {
		cin >> C[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> J[i];
	}
	vector<vector<int> > g(N);
	vector<vector<int> > d(N);
	int a, b, c;
	for (int i = 0; i < M; i++) {
		cin >> a >> b >> c; a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
		d[a].push_back(c);
		d[b].push_back(c);
	}
	int INF = (int)1 << 60;
	vector<vector<int> > dist(N, vector<int>(2, INF));
	dist[0][0] = 0;
	dist[0][1] = mx - P[0];

	priority_queue<pair<int, pair<int, int> > > pq;
	pq.emplace(-dist[0][0], make_pair(0, 0));
	pq.emplace(-dist[0][1], make_pair(0, 1));

	while (pq.size()) {
		int v = pq.top().second.first;
		int t = pq.top().second.second;
		if (dist[v][t] != -pq.top().first) {
			pq.pop();
			continue;
		}
		pq.pop();
		for (int i = 0; i < g[v].size(); i++) {
			if (dist[g[v][i]][t] > dist[v][t] + d[v][i]) {
				dist[g[v][i]][t] = dist[v][t] + d[v][i];
				pq.emplace(-dist[g[v][i]][t], make_pair(g[v][i], t));
			}
			if (t == 0) {
				int val = dist[v][0] + d[v][i] + mx - P[g[v][i]];
				if (dist[g[v][i]][1] > val) {
					dist[g[v][i]][1] = val;
					pq.emplace(-dist[g[v][i]][1], make_pair(g[v][i], 1));
				}
			}
		}
	}
	vector<int> res(K, -INF);

	for (int i = 0; i < N; i++) {
		res[C[i] - 1] = max(res[C[i] - 1], J[i] + mx - dist[i][1] - dist[i][0]);
	}
	for (int i = 0; i < K; i++) {
		cout << res[i] << endl;
	}
}


Measured memory_bytes: 32816
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

typedef pair<int, int> P;

int main(){
    int h, w;
    cin >> h >> w;
    vector<vector<int>> m(h+2, vector<int>(w+2, -1));
    rep(i, h){
        string s;
        cin >> s;
        rep(j, w){
            if (s.at(j) == '.') m[i+1][j+1] = 1;
        }
    }

    int max_dis = 0;
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            vector<vector<int>> dist(h+2, vector<int>(w+2, -1));
            queue<pair<int, int>> q;
            auto push = [&](int x, int y, int d){
                if(m[x][y] != -1 && dist[x][y] == -1){
                    q.push(P(x, y));
                    dist[x][y] = d;
                }
            };
            push(i, j, 0);
            while(!q.empty()){
                P p = q.front(); q.pop();
                int x = p.first, y = p.second;
                int d = dist[x][y];
                push(x-1, y, d+1);
                push(x+1, y, d+1);
                push(x, y-1, d+1);
                push(x, y+1, d+1);
                max_dis = max(max_dis, d);
            }
        }
    }
    cout << max_dis << endl;
}

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

int main() {
  string str;
  string dtr;
  cin >> str;
  cin >> dtr;

  int count = 0;
  for (int i = 0; i < str.size(); i++) {
    if (str.at(i) != dtr.at(i)) {
      count++;
    }
  }

  cout << count << endl;
}


Measured memory_bytes: 3824
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    P = il()
    Q = [n+1 for n in range(N)]

    cnt = 0
    for p, q in zip(P, Q):
        if p != q and P[p-1] != q:
            print('NO')
            exit()
        elif p != q:
            cnt += 1
    else:
        if cnt/2 < 2: print('YES')
        else: print('NO')


if __name__ == '__main__':
    main()


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

int main(){
  int n, r[52],b[52];
  bool card[4][13];
  char c[52];

  for(int i=0; i<52; ++i) r[i] = -1;
  
  for(int i=0; i<4; ++i){
    for(int k=0; k<13; ++k){
      card[i][k] = false;
    }
  }

  
  cin >> n;

  for(int i = 0; i < n; ++i){
    cin >> c[i] >> r[i];
    
    if(c[i] == 'S') card[0][r[i]-1] = true;
    if(c[i] == 'H') card[1][r[i]-1] = true;
    if(c[i] == 'C') card[2][r[i]-1] = true;
    if(c[i] == 'D') card[3][r[i]-1] = true;
  }

  int t=0;
  for(int i = 0; i < 4; ++i){
    for(int k = 0; k < 13; ++k){
       if(!card[i][k]){
	  if(i == 0)	cout << "S" << " " << k+1 << endl;
	  if(i == 1)	cout << "H" << " " << k+1 << endl;
	  if(i == 2)	cout << "C" << " " << k+1 << endl;
	  if(i == 3)	cout << "D" << " " << k+1 << endl;
	
      }
    }
  }



  
  
  return 0;
}



Measured memory_bytes: 3096
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int[] n = new int[a];
		for(int i = 0; i < a; i++){
			n[i] = Integer.parseInt(sc.next());
		}
		int cnt = 1, min = n[0];
		for(int i = 1; i < a; i++){
			if(min > n[i]){
				cnt++;
				min = n[i];
			}
		}
		System.out.println(cnt);
	}
}


Measured memory_bytes: 65300