akhauriyash/Code-Regression huggingface dataset:
import java.io.*;

/**
 * Created by Ayushi on 15/09/2019.
 */

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String in = r.readLine();
        r.close();

        if (in.equals("Sunny")) {
            System.out.println("Cloudy");
        }
        else if (in.equals("Cloudy")) {
            System.out.println("Rainy");
        }
        else {
            System.out.println("Sunny");
        }
    }
}


Measured memory_bytes: 18900
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

#include <cmath>
#include <cstdlib>
#include <climits>

//#include <stdio.h>
//#include <stdlib.h>


using namespace std;

#define debug false

int main(int argc, char *argv[]){

  int N;
  cin >> N;
  cout << 1110 - N << endl;

  return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int l,r; cin>>l>>r;
	int ans=2e9;
	for(int i=l,lim=min(l+2019,r);i<=lim;++i){
		for(int j=i+1;j<=lim;++j){
			ans=min(1L*ans,1L*i*j%2019);
		}
	}
	cout<<ans<<"\n"s;
}


Measured memory_bytes: 3640
// range
//
using System;

class range {
    public static void Main() {

        string[] str = Console.ReadLine().Split(' ');
        int a = int.Parse(str[0]);
        int b = int.Parse(str[1]);
        int c = int.Parse(str[2]);

        if(a < b && b < c){
            Console.WriteLine("Yes");
        }
        else {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 5292
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a,b;
  int n;
  cin >> a >> n;
  for(int i = 0;i < n;i++){
    int f = 0,g = 0;
    cin >> b >> f >> g;
    if(b == "print"){
      for(int k = f;k <= g;k++){
        cout << a[k];
      }
      cout << endl;
    }
    if(b == "reverse"){
      int j = 0,w = 0;
      w = (g - f + 1)/2;
      j = g;
      char x;
      for(int k = f;k <= g - w;k++){
        x = a[j];
        a[j] = a[k];
        a[k] = x;
        j--;    
      }
    }
    if(b == "replace"){
      string p;
      cin >> p;
      int u = 0;
      for(int k = f;k <= g;k++){
        a[k] = p[u];
        u++;
      }
    }
  }
}


Measured memory_bytes: 3212
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn include3(i: i32, x: i32) {
    if x % 10 == 3 {
        print!(" {}", i);
        return;
    }
    let x_next: i32 = x / 10;
    if x_next != 0 {
        include3(i, x_next);
    }
}

fn check_num(i: i32, x: i32) {
    if x % 3 == 0 {
        print!(" {}", i);
        return;
    }
    include3(i, x);
}

fn main() {
    let n: i32 = read();
    let mut i: i32 = 1;

    while i <= n {
        let x: i32 = i;
        check_num(i, x);
        i += 1;
    }
    println!();
}



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

int main() {
	int n, k;
	cin >> n >> k;
	int a[n];
	for(int i = 0; i < n; i++) cin >> a[i];
	int dp[n];
	dp[0] = 0;
	for(int i = 1; i < n; i++){
		dp[i] = 1e9+1;
		for(int j = 1; j <= k; j++){
			if(i - j >= 0){
				dp[i] = min(dp[i], dp[i - j] + abs(a[i] - a[i - j]));
			}
		}
	}
	cout << dp[n - 1] << "\n";
	return 0;
}

Measured memory_bytes: 4360
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	double l;
	cin >> l;
	double a = l/3.0;
	l -= a;
	double b = l/2.0;
	double c = l-b;
	printf("%.9f\n", a*b*c);
	return 0;
}



Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,m,q=map(int,input().split())
    A=[[0]*n for _ in range(n)]
    for _ in range(m):
        l,r=map(int,input().split())
        l-=1; r-=1
        A[l][r]+=1
    S=[[0]*(n+1) for _ in range(n+1)]
    from itertools import product
    for i,j in product(range(n),repeat=2):
        S[i+1][j+1]=A[i][j]+S[i][j+1]+S[i+1][j]-S[i][j]
    for _ in range(q):
        l,r=map(int,input().split())
        print(S[r][r]-S[l-1][r]-S[r][l-1]+S[l-1][l-1])
resolve()

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

#define FastRead        ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl            "\n"
#define sq(x)           ((x)*(x))
#define pi              acos(-1.0)
#define NUM             1000005

typedef long long ll;


int main()
{
    FastRead

    ll n,x=0,y=0,ans=0;

    cin>>n;

    vector<ll>a(n),b(n);

    for(auto &it:a)
        cin>>it;
    for(auto &it:b)
        cin>>it;

    for(ll i=0;i<n;i++)
    {
        if(a[i]>b[i])
        {
            x+=a[i];
            y+=b[i];
            ans = max(ans,x-y);
        }
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 3636
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	
	nums := make([]float64,n)
	for i := range nums {
		fmt.Scan(&nums[i])
	}
  
	denSum := 0.0
	for i := 0; i < n; i++ {
		denSum += 1 / nums[i]
	}
	
	fmt.Println(1 / denSum)
}

Measured memory_bytes: 512
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = LLONG_MAX, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W;
typedef long long ll;
typedef pair<ll, ll> Pa;

int main() {
    string s;
    cin >> s;
    if(s == "AAA" || s == "BBB") cout << "No";
    else cout << "Yes";
}


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

int main(void) {
  int N;
  int one,two,three;
    int sum=0,c=0;
    cin>>N;
    vector<int> a(N);
    for(int i=0;i<N;i++) cin>>a[i];



    for(int i=0;i<N;i++){
      sum += a[i] - 1;
    }


    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://onlinejudge.u-aizu.ac.jp/challenges/search/volumes/0631>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll solve(){
    ll res = 0;
    ll N,M; cin >> N >> M;
    vector<ll> cost(M);
    for(int i = 0; i < M;i++){
        ll A,B; cin >> A >> B;
        cost[i] = max(0LL,N-A);
    }
    sort(cost.begin(),cost.end());
    res = accumulate(cost.begin(),cost.end(),0LL) - *cost.rbegin();
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}



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

bool kaibunn(string str) {
    string copy_str = str;
    reverse(str.begin(), str.end());
    if (str == copy_str) return true;
    else return false;
}


int main(){

    string S = "";
    cin >> S;

    if (S.length() % 2 == 0) {
        cout << "No" << endl;
        return 0;
    }

    if(!kaibunn(S)) {
        cout << "No" << endl;
        return 0;
    }
    
    if(!kaibunn(S.substr(0, S.length()/2))) {
        cout << "No" << endl;
        return 0;
    } else {
      cout << "Yes" << endl;
    }


    return 0;
}

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

using namespace std;

typedef unsigned long long int ull;

int main(){
    ull N, sum=0, upper;
    cin >> N;
    for(ull i=1; i<=N; i++){
        upper = N/i;
        sum += (i * (1 + upper) * upper)/2;
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3644
n, m = map(int, input().split())
dp = [float('inf')] * 2**n
dp[0] = 0
for _ in range(m):
    a, _ = map(int, input().split())
    c = sum([2**(int(i)-1) for i in input().split()])
    for s in range(2**n):
            t = s|c
            if dp[t] > dp[s] + a:
                dp[t] = dp[s] + a
ans = dp[-1]
if ans == float('inf'):
    ans = -1
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <stdio.h>
#include <math.h>
#include <queue>
#include <algorithm>
#include <utility>
#include <vector>
#include <tuple>
#include <numeric>
using namespace std;


int main(int argc, char* argv[]){
	char S[5];
	scanf("%s",&S);

	int ans=0;
	int sum=0;
	bool flag=false;
	for(int i=0; i<3; i++){
		if(S[i]=='R'&&flag==false){
			flag=true;
			sum=1;
			if(ans<sum){
				ans=sum;
			}
		}else if(S[i]=='R'&&flag==true){
			sum++;
			if(ans<sum){
				ans=sum;
			}
		}else{
			sum=0;
		}
	}
	printf("%d\n", ans);




}


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

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

  int n, d;
  cin >> n >> d;

  if(n%(2*d+1)!=0)cout << n/(2*d+1)+1 << endl;
  else cout << n/(2*d+1) << endl;

  return 0;
}

Measured memory_bytes: 3652
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN2(n,m);
  Vs VEC(n);
  VIN(VEC)
  int height = n + 2;
  int width = m + 2;
  REP(i,height){
      if(i==0 || i == height-1){
          REP(j,width){
              cout << "#";
          }
          cout << endl;
      } else {
          cout << "#" << VEC[i-1] << "#" << endl;
      }
  }
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();

		List<Long> list = new ArrayList<>();
		long add = 0;
		for (int i = 0; i <= n; i++) {
			if (i == 0) {
				add = 2;
				list.add(add);
				continue;
			}
			if (i == 1) {
				add = 1;
				list.add(add);
				continue;
			}
			add = list.get(i - 2) + list.get(i - 1);
			list.add(add);
		}

		System.out.println(add);
	}

}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

signed main() {
    int a;
    cin >> a;
    cout << a + a * a + a * a * a << "\n";
}

Measured memory_bytes: 3596
<?php
fscanf(STDIN, '%d %d', $n, $k);
$a = array_map('intval', explode(' ', trim(fgets(STDIN))));
$minus = $zero = $plus = [];
for ($i = 0; $i < $n; $i++) {
    if ($a[$i] < 0) {
        $minus[] = -$a[$i];
    } elseif ($a[$i] === 0) {
        $zero[] = 0;
    } else {
        $plus[] = $a[$i];
    }
}

sort($plus);
sort($minus);

$cnt_plus = count($plus);
$cnt_zero = count($zero);
$cnt_minus = count($minus);

// プラスになるものの組み合わせ
$kumi_plus = $cnt_plus * ($cnt_plus - 1) / 2 + $cnt_minus * ($cnt_minus - 1) / 2;
// 0になるものの組み合わせ
$kumi_zero = $cnt_zero * ($n - $cnt_zero) + $cnt_zero * ($cnt_zero - 1) / 2;
// マイナスになるものの組み合わせ
$kumi_minus = $cnt_minus * $cnt_plus;

// 二分探索
$left = -10 ** 18 - 1;
$right = 10 ** 18 + 1;
while ($right - $left > 1) {
    $mid = intdiv($left + $right, 2);
    if (cnt($mid) < $k) $left = $mid;
    else $right = $mid;
}
echo $left;

// $x未満になるものの組み合わせの数を返す
function cnt($x)
{
    global $minus, $plus, $cnt_minus, $cnt_plus, $kumi_minus, $kumi_zero, $kumi_plus;

    if (!$x) { // 0の場合はマイナスになる組み合わせの数を返す
        return $kumi_minus;
    }

    if ($x > 0) {
        $res = $kumi_minus + $kumi_zero;

        // しゃくとり プラスxプラス
        $r = $cnt_plus - 1;
        for ($l = 0; $l < $cnt_plus; $l++) {
            while ($r > $l && $plus[$l] * $plus[$r] >= $x) {
                $r--;
            }
            $res += $r - $l;
            if ($l >= $r) break;
        }

        // しゃくとり マイナスxマイナス
        $r = $cnt_minus - 1;
        for ($l = 0; $l < $cnt_minus; $l++) {
            while ($r > $l && $minus[$l] * $minus[$r] >= $x) {
                $r--;
            }
            $res += $r - $l;
            if ($l >= $r) break;
        }

        return $res;
    }

    if ($x < 0) {
        $res = 0;

        // しゃくとり マイナスxプラス
        $r = 0;
        for ($l = $cnt_minus - 1; $l >= 0; $l--) {
            while ($r < $cnt_plus && -$minus[$l] * $plus[$r] >= $x) {
                $r++;
            }
            $res += $cnt_plus - $r;
        }

        return $res;
    }
}

Measured memory_bytes: 29172
X=input()
YM=0
MY=0
F=int(X[0] + X[1])
B=int(X[2] + X[3])
if 0<F<=12 :
    MY += 1
else:
    pass

if 0<B<=12 :
    YM += 1
else:
    pass

if YM == 1 and MY == 1 :
    print("AMBIGUOUS")
elif YM == 1 and MY == 0 :
    print("YYMM")
elif YM == 0 and MY == 1 :
    print("MMYY")
else :
    print("NA")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define debug(x) cout << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
typedef long long ll;
const int maxn=4e6+7;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;

ll quick(ll x,ll n)
{
    ll res=1;
    while(n)
    {
        if(n&1) res=(res*x)%mod;
        x=x*x%mod;
        n>>=1;
    }
    return res;
}
ll inv(ll x) {return quick(x,mod-2);}

ll fac[maxn],invfac[maxn];
void init()
{
    fac[0]=1;
    for(int i=1;i<maxn;++i) fac[i]=(fac[i-1]*i)%mod;
    invfac[maxn-1]=inv(fac[maxn-1]);
    for(int i=maxn-2;i>=0;--i) invfac[i]=(invfac[i+1]*(i+1))%mod;
}

ll C(int n,int m)
{
    return fac[n]*invfac[m]%mod*invfac[n-m]%mod;
}

ll dp[2007][2007];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    init();
    int n,k;
    cin>>n>>k;
    if(k==1) cout<<1<<endl;
    else
    {
        dp[0][0]=1;
        for(int i=1;i<=n;++i)
        {
            for(int j=0;j<=i;++j)
            {
                if(j==0) dp[i][j]=1;
                else
                {
                    assert(n*k-i-(j-1)*(k-1)-1>=k-2);
                    dp[i][j]=(dp[i-1][j]+1ll*dp[i][j-1]*(n-j+1)%mod*C(n*k-i-(j-1)*(k-1)-1,k-2)%mod)%mod;
                }
            }
        }
        cout<<dp[n][n]<<endl;
    }
    return 0;
}


Measured memory_bytes: 92800
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,cnt=0;
  cin>>n;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    if(s=="Y")cnt++;
  }
  if(cnt>0)cout<<"Four"<<endl;
  else cout<<"Three"<<endl;
  return(0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  int i;
  int ans = -1;
  for(i=1;i<=1000;i++){
    if((int)(i*0.08)==a && (int)(i*0.10)==b){
      ans = i;
      break;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 21;
char dn[dm], * di = dn;
inline void putkotae(int X, int Y) {
	char C[12];
	rep(i, 6) {
		*(C + i) = '0' + Y % 10;
		Y /= 10;
	}
	rep(i, 6) {
		*(C + i + 6) = '0' + X % 10;
		X /= 10;
	}
	for (int i = 11; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

ll tmp[100001];
void pakuri_sort(int N, ll A[]) {
	const int b = 8;
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}

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


	int N = getint(), M = getint();
	int P[100000], PK[100001] = {};
	ll S[100000];
	rep(i, M) {
		P[i] = getint();
		S[i] = ((ll)i << 32) + getint();
	}
	pakuri_sort(M, S);

	rep(i, M) {
		int j = S[i] >> 32;
		tmp[j] = ++PK[P[j]];
	}
	rep(i, M) putkotae(P[i], tmp[i]);

	fwrite_unlocked(dn, di - dn, 1, stdout);

	Would you please return 0;
}


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

int main(){
	int n;
	int a,ba;
	int cnt = 1,ans = 0;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a;
		if(i == 0){
			ba = a;
		}else{
			if(ba == a){
				cnt++;
			}else{
				ans += cnt / 2;
				cnt = 1;
			}
			ba = a;
		}
	}
	if(cnt != 1) ans += cnt / 2;
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-


#----------
a,b,c = [int(i) for i in input().rstrip().split()]
#----------

#if ((a <= c) and (c <= b)) or ((b <= c) and (c <= a)):
#  print("Yes")
#else:
#  print("No")

# 距離で判定してみる
if ( abs(b-a) > abs(c-a) ) and ( abs(b-a) > abs(c-b) ):
  print("Yes")
else:
  print("No")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin>>s;
	int a=-1,z=-1;
	for(int i = 0;i<s.length(); i++)
	{
		if(s[i]=='A' && a==-1)
			a= i;
		else if(s[i]=='Z')
			z = i;
	}
	cout<<(z-a+1)<<endl;
	return 0;
}

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

int main(void){
  int k, s;
  cin >> k >> s;
  
  int count = 0;
    
  for (int x = 0; x <= k; x++) {
    for (int y = 0; y <= k; y++) {
      int z = s - x - y;
      if (z >= 0 && z <= k) count++;
    }
  }
  
  cout << count << endl;
}

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

int main(void) {
    int64_t N,A,B;
    int64_t last; 
    int64_t ans = 0;
    cin >> N >> A >> B;

    vector<int> X(N);
    for(int i=0;i<N;i++) {
        cin >> X[i];
    }    

    last = X[0];
    for(int i=1;i<N;i++) {
        if(((X[i]-X[i-1]) * A) > B) {
            ans += B;
        } else {
            ans += ((X[i]-X[i-1]) * A);
        } 
    }

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 640
def solve(string):
    n, *a = map(int, string.split())
    e = [sum(a[1::2]), sum(a[2::2])]
    s = a[0] + sum(e)
    ans = []
    for i in range(n):
        ans.append(str(s - e[i % 2] * 2))
        if i < n - 1:
            e[i % 2] += a[i] - a[i + 1]
    return " ".join(ans)


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))


Measured memory_bytes: 16200
#include<bits/stdc++.h>
using namespace std;
int a[200010];
int b[200010];
int main(){
	int n,m;
	cin>>n>>m;
	int flag=0;
	while(m--){
		int c,d;
		scanf("%d%d",&c,&d);
		if(c==1) a[d]=1;
		if(d==n) b[c]=1;
	}
	for(int i=1;i<n;i++){
		if(a[i]==1&&b[i]==1){
			cout<<"POSSIBLE"<<endl;
			return 0;
		}
	}
	cout<<"IMPOSSIBLE"<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int n,a[100001],sum=0;
bool cmp(int x,int y){
	return x<y;
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+1+n,cmp);
	for(int i=2;i<=n;i++)
		if(a[i]==a[i-1]) sum++;
	if(sum%2==1) sum++;
	printf("%d\n",n-sum);
	return 0;
}

Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cstdio>
using namespace std;

int main()
{
    const char I = 'I';

    int N;
    if (scanf("%d", &N) < 1) return 0;

    char S[101];
    if (scanf("%s", S) < 1) return 0;

    int x = 0;
    int m = -101;
    m = max(m, x);

    for (int i = 0; i < N; i++)
    {
        if (S[i] == I) x++;
        else x--;
        m = max(m, x);
    }

    printf("%d\n", m);
    return 0;
}


Measured memory_bytes: 128
M = 10**9 + 7
a = [1] + [0] * 12
p = 1
for c in reversed(input()):
    r = range(0, p * 10, p) if c == '?' else (p * int(c),)
    a = [sum(a[(i - j) % 13] for j in r) % M for i in range(13)]
    p = p * 10 % 13
print(a[5])


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

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

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

void gen_sosuu(int sosuu[]){
  REP(i,100010){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(100000)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<=100000;j++){
      //printf("%d %d %d\n",i*j,i,j);
      sosuu[i*j] =false;
    }
  }
}

/*

レート 1-399：灰色
レート 400-799：茶色
レート 800-1199：緑色
レート 1200-1599：水色
レート 1600-1999：青色
レート 2000-2399：黄色
レート 2400-2799：橙色
レート 2800-3199：赤色
*/

int cls[10] = {0};
int n;
int a;

int main(){
  scanf("%d",&n);
  REP(i,n){
    scanf("%d",&a);
    cls[min(8,a/400)]++;
  }
  int sum = 0;
  REP(i,8){
    if(cls[i]>0) sum++;
  }
  printf("%d ",max(1,sum));
  printf("%d\n",sum+cls[8]);
}










Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map { it.toInt() }
    val broken = (0 until m).map {
        readLine()!!.toInt()
    }.toSet()
    val dp = IntArray(n + 1) { 0 }
    dp[0] = 1

    for (i in (1..n)) {
        if (broken.contains(i)) {
            dp[i] = 0
            continue
        }

        if (i == 1) {
            dp[i] = 1
            continue
        }

        dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
    }

    println(dp[n])
}


Measured memory_bytes: 43752
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {

            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

       




        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var s = Console.ReadLine().ToArray();
            var ans =0;
            var memo = "";
            var now = "";
            
            for (int i = 0; i < s.Length; i++)
            {
                now+= s[i].ToString();
                if (memo!=now)
                {
                    ans++;
                    memo = now;
                    now = "";
                }
                
            
            }
            Console.WriteLine(ans);


            Console.Out.Flush();
        }
    }
}




Measured memory_bytes: 17288
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>

int main()
{
	int i;
	int j;
	for(i=1;i<10;i++) for(j=1;j<10;j++) printf("%dx%d=%d\n",i,j,i*j);
	return 0;
}

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

#include <cstdio>

using namespace std;
#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--)
typedef long long ll;
typedef unsigned long long ull;

int C[500];
int S[500];
int F[500];

int main()
{
	int N;
	int t, rem;

	cin >> N;

	repc(i, 1, N - 1) cin >> C[i] >> S[i] >> F[i];
	
	repc(start, 1, N - 1) {
		t = 0;

		repc(current, start, N - 1) {
			if (t < S[current]) t = S[current];

			rem = (t - S[current]) % F[current];
			if (rem > 0) t += F[current] - rem;
			t += C[current];
		}

		cout << t << '\n';
	}
	/* case N */
	cout << 0 << '\n';

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int p, n, sum = 0, cnt = 0, nsum = 0;
	float ave = 0.0;
	while ((scanf("%d,%d",&p, &n)) != EOF) {
		sum += p * n;
		nsum += n;
		cnt++;
	}
	printf("%d\n", sum);
	printf("%.0f\n", (float)nsum / (float)cnt+0.5);
	return 0;
}


Measured memory_bytes: 2040
fun main(args: Array<String>) {
    sandbox4()
}

fun sandbox4() {
    val s = readLine()!!

    val list = listOf("Sunny", "Cloudy", "Rainy")

    val answer = list[(list.indexOf(s) + 1).let { if (it >= 3) it - 3 else it }]

    println(answer)
}


Measured memory_bytes: 32204
#include <bits/stdc++.h>
using namespace std;
const int N = 2e7 + 5e6 + 20;
int a[2][5];
long long ans[2][N];
void getAns(int t) {
	iota(ans[t], ans[t] + N - 10, 0);
	for (int i = 0; i < N - 10; i++) {
		for (int j = 0; j < 3; j++) {
			if (a[t][j] <= i)
				ans[t][i] = max(1ll * ans[t][i],(long long)  ans[t][i - a[t][j]] + a[1 - t][j]);
		}			
	}
}
int main() {
	ios_base::sync_with_stdio (false), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i < 2; i++)
		for (int j = 0; j < 3; j++)
			cin >> a[i][j];
	getAns(0);
	getAns(1);
	cout << ans[1][ans[0][n]];
	return 0;
}


Measured memory_bytes: 390912
#include<stdio.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

/*
	入力例：
	3
	1 1 3
*/

int main(){
	long N=0;
	long p,e,z;
	scanf("%ld", &N);
	char S[N][4];
	long C[4];
	for(long i=0;i<N;i++){
		scanf("%s",S[i]);
	}
	C[0]=0;
	C[1]=0;
	C[2]=0;
	C[3]=0;
	for(long i=0;i<N;i++){
		if(strcmp(S[i],"AC")==0){
			C[0]++;
		}else if(strcmp(S[i],"WA")==0){
			C[1]++;
		}else if(strcmp(S[i],"TLE")==0){
			C[2]++;
		}else if(strcmp(S[i],"RE")==0){
			C[3]++;
		}
	}
	printf("AC x %ld\n",C[0]);
	printf("WA x %ld\n",C[1]);
	printf("TLE x %ld\n",C[2]);
	printf("RE x %ld\n",C[3]);
	return 0;
}

Measured memory_bytes: 2120
#include<iostream>
#include<cstring>
#include<queue>
#include<cmath>
#include<utility>
#include<map>
#include<algorithm>
using namespace std;
const int maxt=1e8;
int ans[maxt];
int num=0;
struct st
{
	int a;
	int b;
};
bool cmp(st &x,st &y)
{
	return x.a<y.a;
}
int main()
{
	std::ios::sync_with_stdio(false);
	int n;
	cin>>n;
	st m[100005];
	for(int i=1;i<=n;i++)
	{
		cin>>m[i].a;
		m[i].b=i;
	}
	sort(m+1,m+n+1,cmp);
	for(int i=1;i<=n;i++)
	    cout<<m[i].b<<" ";
    cout<<endl; 
	return 0; 
} 

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define FIN         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii          pair<int,int>
#define F           first
#define S           second
#define pb          push_back
#define all(x)      (x).begin(),(x).end()
#define rall(x)     (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a)   for(int i = a; i >= 0; i--)
#define fori(i,m)   for(auto i = m.begin(); i != m.end(); i++) 
#define w(t)        while(t--)
#define sz(s)       int(s.size())
#define cls(a,car)  memset(a,car,sizeof (a))
#define db(x)       cerr << #x << " is " << x << '\n'
#define FI          freopen("input.txt", "r", stdin)
#define FO          freopen("output.txt", "w", stdout)
#define EjecuteTime cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x)    double(x * acos(-1) / 180.0)
using namespace std;
typedef long long   ll;
typedef vector<int> vi;
typedef vector<ii>  vii;
const int N = 1e2 + 5;
const ll mod = 1e8 + 7;
const double E = 1e-9;
//int dx[] = {0, -1}, dy[] = {-1, 0};
//int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//int dx[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2}, dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int n;
ll w[N], g[N];
ll dp[N][100005];
ll f(int i, int gain){
    if(gain < 0)return 1e12;
    if(i == n){
        if(gain == 0)
            return 0;
        return 1e12;
    }
    ll &ans = dp[i][gain];
    if(ans == -1){
        ans = 1e12;
        ans = min(f(i + 1, gain - g[i]) + w[i], f(i + 1, gain));
    }
    return ans;
}

void solve(){
    int W;
    cin >> n >> W;
    for(int i = 0; i < n; i++){
        cin >> w[i] >> g[i];
    }
    cls(dp, -1);
    ll ans = 0;
    for(int i = 0; i <= 1e5; i++)
        if(f(0, i) <= W){
            ans = i;
        }
    cout << ans << '\n';
}  
int main(){
    FIN;
    int t = 1;
    //cin >> t;
    for(int i = 1; i <= t; i++){
        solve(); 
    }
    EjecuteTime;
    return 0;
}       

Measured memory_bytes: 85820
#include<iostream>
#include<vector>
using namespace std;
int abs(int a){
  if(a<0) return a*(-1);
  else return a;
}
int main(){
  int n,i,a,count=0,absmin;
  long sum;
  cin>>n;
  cin>>a;
  absmin=abs(a);
  sum=absmin;
  if(a<0) count++;


  for(i=1;i<n;i++){
    cin>>a;
    sum+=abs(a);
    if(abs(a)<absmin) absmin=abs(a);
    if(a<0) count++;
  }

  if(count%2) sum-=(absmin*2);

  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 384
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	int n, C;
	while(cin >> n >> C) {
		vector<int> s(n), t(n), c(n);
		REP(i, n) {
			cin >> s[i] >> t[i] >> c[i];
			s[i]--;
			c[i]--;
			// t[i]++;
		}
		// map<int, int> ma:
		// vector<int> ps(101010);
		vector<vector<int>> ps(C, vector<int>(101010, 0));
		REP(i, n) {
			ps[c[i]][s[i]]++;
			ps[c[i]][t[i]]--;
		}
		// REP(k, C) dpite(ALL(ps[k]));
		
		REP(k, C) REP(i, SZ(ps[k])-1) {
			// DEBUG(ps[k][i]);
			ps[k][i+1] += ps[k][i];
		}
		REP(k, C) REP(i, SZ(ps[k])) {
			chmin(ps[k][i], 1);
		}

		// REP(k, C) dpite(ALL(ps[k]));
		int ans = 0;
		REP(i, SZ(ps[0])) {
			int sum = 0;
			REP(j, C) {
				sum += ps[j][i];
			}
			DEBUG(sum);
			chmax(ans, sum);
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 13696
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>

using namespace std;
typedef long long ll;
const int LEN = 100000;

struct fastio{
  int it,len;
  char s[LEN + 5];
  fastio(){
    it = len = 0;
  }
  char get(){
    if(it < len) return s[it++];
    it = 0, len = fread(s,1,LEN,stdin);
    return len ? s[it++] : EOF;
  }
  bool notend(){
    char c;
    for(c = get();c == ' ' || c == '\n';c = get());
    if(it) it--;
    return c != EOF;
  }
  void put(char c){
    if(it == LEN) fwrite(s,1,LEN,stdout), it = 0;
    s[it++] = c;
  }
  void flush(){
    fwrite(s,1,it,stdout);
  }
}buff,bufo;
inline int getint(){
  char c; int res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline ll getll(){
  char c; ll res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline void putint(int x,char suf){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[15];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
  bufo.put(suf);
}
inline void putll(ll x,char suf){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[25];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
  bufo.put(suf);
}
inline char get_char(){
  char c;
  for(c = buff.get();c == ' ' || c == '\n';c = buff.get());
  return c;
}
#define maxn 100005
int n;
ll a[maxn],m;
int main(){
  n = getint(), m = getll();
  for(int i = 1;i <= n;i++) a[i] = getll() / 2;
  ll lcm = 1;
  for(int i = 1;i <= n;i++){
    lcm = lcm * a[i] / __gcd(lcm,a[i]);
    if(lcm > m){
      puts("0");
      return 0;
    }
  }
  for(int i = 1;i <= n;i++){
    if((lcm / a[i]) % 2 == 0){
      puts("0");
      return 0;
    }
  }
  printf("%lld\n",(m / lcm + 1) / 2);
  return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
    int A, B, C;
    cin >> A >> B >> C;

    int a = A;
    for (int i = 1; i <= B; i++)
    {
        if (a % B == C)
        {
            cout << "YES" << endl;
            return 0;
        }

        a += A;
    }

    cout << "NO";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
 
int main(){
    int n;
    cin >>n;
    set<string> st;
        string s;
    rep(i,n){
        cin >>s;
        st.insert(s);
    }
    cout << st.size();
    return 0;
}

Measured memory_bytes: 19228
/**
 * ?????????

???????????´??° a ??¨ b ?????????????????§?????\?????????????¨??????????????????°?????????????????????????????????

a ?? b ??? d (??´??°)
a ?? b ????????? ??? r (??´??°)
a ?? b ??? f (???????°???°?????°)
Input
1?????????????????´??° a, b ????????????????????????

Output
d, r, f
????????????????????§????????£????????????????????????????????????f??????????????????0.00001??\????????????????????£????????????????????¨????????????

Constraints
1 ??? a, b ??? 10^9
Sample Input
3 2
Sample Output
1 1 1.50000

 */

#include <iomanip>
#include <iostream>
#include <sstream>

int main(int argc, char const *argv[]) {
  unsigned int a, b, d, r;
  a = b = 1;
  d = r = 0;
  double f = 0;

  while (true) {
    std::string param;

    getline(std::cin, param);
    std::istringstream iss(param);
    iss >> a >> b;

    if ((a < 1 || a > 1000000000) || (b < 1 || b > 1000000000)) {
      std::cout << "Error: 1 <= a, b <= 1000000000" << std::endl;
    } else {
      break;
    }
  }

  d = a / b;
  r = a % b;
  f = (double)a / (double)b;

  std::cout << std::fixed << std::setprecision(5);
  std::cout << d << " " << r << " " << f << std::endl;

  return 0;
}

Measured memory_bytes: 3264
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
vd x,y;

int main(){
	cin>>n;
	x=y=vd(n);
	for(int i=0;i<n;i++) cin>>x[i]>>y[i];
	double res=inf;
	for(int i=0;i<n;i++) for(int j=i+1;j<n;j++){
		double X=(x[i]+x[j])/2,Y=(y[i]+y[j])/2;
		double d=sqrt((x[i]-X)*(x[i]-X)+(y[i]-Y)*(y[i]-Y));
		bool flag=1;
		for(int k=0;k<n;k++){
			if(sqrt((x[k]-X)*(x[k]-X)+(y[k]-Y)*(y[k]-Y))-eps>d) flag=0;
		}
		if(flag) res=min(res,d);
	}
	for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) for(int k=j+1;k<n;k++){
		double a=x[i],b=y[i],c=x[j],d=y[j],e=x[k],f=y[k];
		double aa=a*a,bb=b*b,cc=c*c,dd=d*d,ee=e*e,ff=f*f;
		double Y=((e - a) * (aa + bb - cc - dd) - (c - a) * (aa + bb - ee- ff)) / (2 * (e - a)*(b - d) - 2 * (c - a) * (b - f));
		double X;
		if((c-a)*(f-b)-(d-b)*(e-a)==0) continue;
		if(fabs(c-a)<eps) X=(2 * (b - f) * Y - aa - bb + ee + ff) / (2 * (e - a));
		else X=(2 * (b - d) * Y - aa - bb + cc + dd) / (2 * (c - a));
		double dis=sqrt((x[i]-X)*(x[i]-X)+(y[i]-Y)*(y[i]-Y));
		bool flag=1;
		for(int l=0;l<n;l++){
			if(sqrt((x[l]-X)*(x[l]-X)+(y[l]-Y)*(y[l]-Y))-eps>dis) flag=0;
		}
		if(flag) res=min(res,dis);
	}
	cout<<syosu(9)<<res<<endl;
}

Measured memory_bytes: 256
// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fi first
#define se second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>
 
using std::cin;
using std::cout;
using std::endl;
 
typedef long long ll;
typedef unsigned long long ull;
 
const int N = 100000 + 5;
const int M = 1000 + 5;
const int K = 1e7 + 5;
const int MOD = 1e9 + 7;
const int inv2 = 500000004;
const int LOG = 40;
const ull BASE = 19260817;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };
// const double PI = acos(-1);
const double PI = 3.14159;

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
 
template<class T>
inline T readT() {
    T res = 0, f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + ch - '0';
    return res * f;
}
#define read readT<int>

namespace Comb{
const int N = 10 + 5;
inline void exgcd(ll a, ll b, ll &g, ll &x, ll &y) {
    if (!b) g = a, x = 1, y = 0;
    else exgcd(b, a % b, g, y, x), y -= x * (a / b);
}
 
inline ll inv(ll a) {
    ll g, res, tmp;
    exgcd(a, MOD, g, res, tmp);
    return ((res % MOD) + MOD) % MOD;
}
 
ll f[N], invFact[N];
 
inline void prepare() {
    f[0] = 1;
    int n = 200000;
    for (int i = 1; i <= n; i++) f[i] = f[i - 1] * i % MOD;
    invFact[n] = inv(f[n]);
    for (int i = n - 1; i >= 1; i--) invFact[i] = invFact[i + 1] * (i + 1) % MOD;
}
 
inline ll C(int n, int m) {
    if (!m) return 1;
    if (n == m) return 1;
    if (m > n) return 0;
    if (m < 0) return 0;
    return f[n] * invFact[m] % MOD * invFact[n - m] % MOD;
}
}

int n, h, sum;

int main() {
    cin >> h >> n;
    for (int i = 1, x; i <= n; i++) {
        scanf("%d", &x);
        sum += x;
    }
    puts(sum >= h ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 256
s = input()
counts = [0]*2019
counts[0] += 1
num = 0
d = 1
for c in reversed(s):
    num += int(c) * d
    counts[num % 2019] += 1
    d *= 10
    d %= 2019
ans = 0
for count in counts:
    ans += count*(count -1) // 2
print(ans)

Measured memory_bytes: 9364
#include<bits/stdc++.h>
#define int long long
using namespace std;

unordered_map<int,int>U;
signed main(){
int n,m;cin>>n>>m;
U[0]++;
int sum=0;
for(int i=0;i<n;i++){
int a;cin>>a;
sum+=a;
U[sum%m]++;
}
int ans=0;
for(auto i:U){ans+=i.second*(i.second-1)/2;}
  cout<<ans<<endl;
}

Measured memory_bytes: 3596
from copy import *
from sys import *
from math import *
import queue
from collections import defaultdict,Counter,deque

setrecursionlimit(1000000)

#dp[i][w]
def main():
	n,w = map(int,input().split())
	wv = [list(map(int,input().split())) for i in range(n)]
	dp = [[0 for _ in range(w+1)] for _ in range(n+1)]
	for i in range(1,n+1):
		cw = wv[i-1][0]
		cv = wv[i-1][1]
		for j in range(w+1):
			dp[i][j] = max(dp[i-1][j],dp[i-1][j-cw] + cv) if j-cw >= 0 else dp[i-1][j]
	print(dp[-1][-1])

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class Queue():
	#競プロ用のQueue
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)

class Stack():
	#怯プロ用のStack
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)

main()

Measured memory_bytes: 173304
#include <stdio.h>

int main(void)
{
	int N,M,i,j,k,l,m,n,comp,A[1000],B[1000],V[1000],Max=0;
	scanf("%d %d",&N,&M);
	for(i=0;i<N;i++) scanf("%d",&A[i]); 
	for(j=0;j<M;j++) scanf("%d",&B[j]); 
	for(k=0;k<N;k++) V[k]=0; 
	for(l=0;l<M;l++){
		for(m=0;m<N;m++){
			if(A[m]<=B[l])
				{V[m]++;break;}
			}
		}
	for(n=0;n<N;n++){
		if(Max<V[n])
			{Max=V[n];comp=n+1;}
	}
	printf("%d\n",comp);
	return 0;
}

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

S = [""] * N
for i in range(N):
    S[i] = input()

S.sort()
ans = [""]
maximum = 0
hoge = S[0]
nyoro = 0
for i in S:
    if i == hoge:
        nyoro += 1
    else:
        if maximum < nyoro:
            ans = [hoge]
            maximum = nyoro
        elif maximum == nyoro:
            ans.append(hoge)
        
        hoge = i
        nyoro = 1
else:
    if maximum < nyoro:
        ans = [hoge]
    elif maximum == nyoro:
        ans.append(hoge)

ans.sort()

for i in ans:
    print(i)

Measured memory_bytes: 20636
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vi W(n); for(auto& e : W) cin >> e;

    int res = inf;
    rep(T, n+1){
        int S0 = 0, S1 = 0;
        rep(i, T) S0 += W[i];
        rep(i, T, n) S1 += W[i];

        chmin(res, abs(S0 - S1));
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main(){
    int ascii = 97;
    string str;
    string search_str;
    char x[50];
    cin >> str;
    while(1){
        if(ascii == 123){
            cout << "None" << endl;
            break;
        }
        int n = sprintf(x,"%c", ascii);
        search_str = (string)x;
        if(str.find(search_str) == -1){
            cout << search_str << endl;
            break;
        }
        ascii++;
    }
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<math.h>
#include<stdio.h>
#include<string>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main() {
	int n;
	cin >> n;
	int ans = 0;
	vector<int> d(n);
	rep(i, n)cin >> d[i];
	rep(i,n)
	{
		for(int j=i+1;j<n;j++)
		{
			ans += d[i] * d[j];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256