akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <math.h>

using namespace std;

int main(){

    int n;
    cin >> n;
    int x[n];
    int y[n];

    for(int i=0; i<n; i++){
        cin >> x[i];
    }
    for(int i=0; i<n; i++){
        cin >> y[i];
    }    

    double md=0.0, ed=0.0, td=0.0, cd=0.0;

    for(int i=0; i<n; i++){
        md += abs(x[i] - y[i]);
        ed += abs(x[i] - y[i]) * abs(x[i] - y[i]);
        td += pow(abs(x[i] - y[i]), 3.0);
        cd = abs(x[i]-y[i]) > cd ? abs(x[i]-y[i]) : cd; 
    }
    
    ed = sqrt(ed);
    td = pow(td, 1.0/3.0);

    printf("%.6lf\n", md);
    printf("%.6lf\n", ed);
    printf("%.6lf\n", td);
    printf("%.6lf\n", cd);

    return 0;
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)
#define Rep(i, n) for(i = 1; i < n; i++)
#define Ans(s) cout << s << endl;

const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

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; }

int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

typedef long long ll;

// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

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

	vector<tuple<string, int, int>> v;
	for (int i = 0; i < n; i++)
	{
		string a;
		int b;
		cin >> a >> b;
		b *= -1;
		v.emplace_back(a, b, i + 1);
	}
	sort(begin(v), end(v));

	for (auto x : v)
	{
		cout << get<2>(x) << endl;
	}
}

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

long long n,a[20000005],maxx;

bool sdown(int i,int j,int k) {
	return a[j]<=k && a[i]<=k;
}

bool sup(int i,int j,int k) {
	return a[j]>k && a[i]>k;
}

bool check(int k) {
	for(int i=0;i<n;i++) {
		if(sup(n+i,n+i+1,k) || sup(n-i,n-i-1,k)) return 0;
		if(sdown(n+i,n+i+1,k) || sdown(n-i,n-i-1,k)) return 1;
	}
	return sdown(1,1,k);
}

int main() {
	scanf("%lld",&n);
	for(int i=1;i<=2*n-1;i++) {
		scanf("%lld",&a[i]);
		//maxx=max(maxx,a[i]);
	}
	long long l=1,r=2*n-1;
	while(l<r) {
		long long mid=(l+r)/2;
		if(check(mid)) {
			r=mid;
		} else {
			l=mid+1;
		}
	}
	printf("%lld\n",r);
	
	return 0;
}

Measured memory_bytes: 1792
def main():
    a,b,n = map(int, input().split())
    
    ans = 0
    if n < b:
        ans = a*(n/b)
    
    else:
        for i in range(1,int(n//b+1)):
            x = b*i-1
            ans = max(ans, a*((x-(i-1)*b)/b))
            break
    
    print(int(ans//1))

if __name__ == "__main__":
    main()


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

using namespace std;
long long n,i,j,a,b,c,d,sol,val;

int main()
{
    ios_base::sync_with_stdio(false);
    cin>>a>>b>>c>>d>>val;
    b=min(b,2*a);
    c=min(c,2*b);
    d=min(d,2*c);
    val*=4;
    sol+=(val/8)*d; val=val%8;
    sol+=(val/4)*c; val=val%4;
    sol+=(val/2)*b; val=val%2;
    sol+=val*a;
    cout<<sol<<'\n';
    return 0;
}


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

int main()
{
	int n, q, m, i;
	while (cin >> n >> q, n | q) {
		int date[101] = {0};
		date[0] = q - 1;
		while (n--) {
			for (cin >> m; m--; date[i]++) cin >> i;
		}
		
		int j = 0, v = date[0];
		for (i = 1; i < 101; i++) {
			if (date[i] > v) {
				v = date[i];
				j = i;
			}
		}
		cout << j << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

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

//prototype declaration
int getint();
long long getllint();
double getdint();
char getch();
void setstring(char *s);
void showint(int i);
void showllint(long long i);
void showdint(double i);
void showchar(char c);
void showstring(char *s);

int myPower(int a, int n) { // aのn乗の計算
	int x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

int min(int a, int b) {
	return a < b ? a : b;
}

int main(void) {
	int i, n, k, ans = 1000000000;
	n = getint();
	k = getint();
	int x[n];
	ROOP(i, n) {
		x[i] = getint();
	}
	ROOP(i, n - k + 1) {
		int left = abs(x[i]),
				right = abs(x[i+k-1]),
				distance = x[i+k-1] - x[i] + min(left, right);
		if (distance < ans) {
			ans = distance;
		}
	}
	showint(ans);
	return 0;
}

int getint() {
	int i;
	scanf("%d", &i);
	return i;
}

long long getllint() {
	long long i;
	scanf("%lld", &i);
	return i;
}

double getdint() {
	double i;
	scanf("%lf", &i);
	return i;
}

char getch() {
	char c;
	scanf("%c", &c);
	return c;
}

void setstring(char *s) {
	scanf("%s", s);
}

void showint(int i) {
	printf("%d\n", i);
}

void showllint(long long i) {
	printf("%lld\n", i);
}

void showdint(double i) {
	printf("%lf\n", i);
}

void showchar(char c) {
	printf("%c\n", c);
}

void showstring(char *s) {
	printf("%s\n", s);
}


Measured memory_bytes: 512
#include<iostream>
#include <climits>
#include<vector>
#include<list>
#include<numeric>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string s;
	cin >> s;
	int i = 0, left=s.size() - 1;
	vector<int> L, R;
	int A = 0;
	while (i < s.size()) {
		while (i<s.size() - 1 && s[i] != '\\') i++;
		if (i == s.size() - 1) break;
		int height = -1;
		int j = i + 1;
		double a = 0.5;
		while (j < s.size() && height != 0) {
			a += abs(height);
			if (s[j] == '/') {
				a -= 0.5;
				height++;
			}
			if (s[j] == '\\') {
				a += 0.5;
				height--;
			}
			j++;
		}
		if (height == 0) L.push_back(a), A += a;
		else left = i;
		i = j;
	}
	i = s.size() - 1;
	while (i > left) {
		while (i > left + 1 && s[i] != '/') i--;
		if (i == left + 1) break;
		int height = -1;
		int j = i - 1;
		double a = 0.5;
		while (j > left && height != 0) {
			a += abs(height);
			if (s[j] == '/') {
				a += 0.5;
				height--;
			}
			if (s[j] == '\\') {
				a -= 0.5;
				height++;
			}
			j--;
		}
		if (height == 0) R.push_back(a), A += a;
		i = j;
	}
	reverse(R.begin(), R.end());
	L.insert(L.end(), R.begin(), R.end());
	cout << A << "\n";
	if(L.size()) cout << L.size() << " ";
	else cout << 0 << "\n";
	REP(k, L.size()) {
		if (k != L.size() - 1) cout << L[k] << " ";
		else cout << L[k] << "\n";
	}

	return 0;
}


Measured memory_bytes: 3244
#include <iostream>
using namespace std;
#define rp(i,n) for(int i = 0; i < (int)n; i++)
int main(){
  int x,y;
  cin >> x >> y;
  int ans = x+y;
  int temp = 0;
 
  while(y > 0){
    temp = x%y;
    x=y;
    y=temp;
  }
  cout << ans-x+1 << endl;
}



Measured memory_bytes: 3132
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

template<typename T> class union_find{
	unordered_map<T,T> parent;
	unordered_map<string,int> tbl;
public:
	T root(T a){
		if(parent.find(a)==parent.end())parent[a]=a;
		return parent[a]==a?a:(parent[a]=root(parent[a]));
	}
	int same(T a,T b){return root(a)==root(b);}
	int unite(T a,T b,int p,int q){
		T x=root(a),y=root(b);if(x==y)return 0;
		parent[x]=y;
		tbl[y]=min(min(tbl[x]?tbl[x]:1<<29,tbl[y]?tbl[y]:1<<29),min(p,q));
		tbl.erase(x);
		return 1;
	}
	int get(T a){
		return tbl[root(a)];
	}
};

int main(){
	int N;
	unordered_map<string,int>m;
	for(cin>>N;N--;){
		string s;int x;
		cin>>s>>x;
		m[s]=x;
	}
	union_find<string> uf;
	for(cin>>N;N--;){
		string s,t;
		cin>>s>>t;
		uf.unite(s,t,m[s],m[t]);
	}
	int r=0;
	for(auto &e:m){
		r+=uf.get(e.first)?:e.second;
	}
	cout<<r<<endl;
}

Measured memory_bytes: 2180
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long int;
using ULL = unsigned long long;

int main() {
    int n; cin >> n;
    vector<pair<double, string>> v(n);
    rep(i, n) {
        double x;
        string u;
        cin >> x >> u;
        v[i] = make_pair(x, u);
    }
    double ans = 0.;
    for (auto xu : v) {
        if (xu.second == "JPY") {
            ans += xu.first;
        } else {
            ans += xu.first * 380000.0;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    int a, b; cin >> a >> b;
    for (int i = 1; i <= 1500; i++) {
        if (a == int(i * 0.08) && b == int(i * 0.1)) {
            cout << i << endl;
            return 0;
        }
    }
    puts("-1");
}

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

int main()
{
    int a,b,c;
    int temp;

    cin >> a >> b >> c;

    if(a>b){
        temp=a;
        a=b;
        b=temp;
    }
    if(b>c){
        temp=b;
        b=c;
        c=temp;
    }
    if(a>b){
        temp=a;
        a=b;
        b=temp;
    }

    cout << a << " " << b << " " << c << endl;

    return 0;
}


Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
void A(void);
void B(void);
void C(void);
void D(void);
void E(void);
void F(void);

int main(void){
    C();
}

void C(){
    int n,m,i,j,k,a,b;
    cin>>n>>m;
    vector<int> hvec(n);
    vector<int> vec(n);
    for(i=0;i<n;i++){
        cin>>hvec.at(i);
        vec.at(i)=1;
    }
    for(i=0;i<m;i++){
        cin>>a>>b;
        if(hvec.at(a-1)<hvec.at(b-1))vec.at(a-1)=0;
        else if(hvec.at(a-1)>hvec.at(b-1))vec.at(b-1)=0;
        else {
            vec.at(a-1)=0;
            vec.at(b-1)=0;
        }
    }
    int ans=0;
    for(i=0;i<n;i++){
        if(vec.at(i)==1)ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4052
x=[]
y=[]
z=[]

for i in range(3):
    a,b,c=map(int,input().split())
    x.append(a-b)
    y.append(a-c)
    z.append(b-c)

if x[0]==x[1] and x[1]==x[2] and y[0]==y[1] and y[1]==y[2] and z[0]==z[1] and z[1]==z[2]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define num 1000000007
//#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define avg(a,b) ((a)+(b))/2
#define push push_back
#define pop pop_back
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
typedef long long ll;
ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll mymod(ll a,ll b)
{
    return ((a%b)+b)%b;
}
bool prime[200001];
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=200000; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=200000; i += p) 
                prime[i] = false; 
        } 
    } 
    return;
}
ll powe[60];
void power()
{
    powe[0]=1;
    REP(i,1,15)
    {
        powe[i]=2*powe[i-1];
    }
}
ll gcdExtended(ll,ll,ll *,ll *);
ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
        ll res = (x%m + m) % m;
        return res;
} 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
    return gcd; 
} 
ll fact[100005];
void factorial()
{
    fact[0]=1;
    REP(i,1,100002)
    {
        fact[i]=mymod(i*fact[i-1], num);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,a;
	set<ll> s;
	sf;
	cin>>n;
	REP(i,0,n)
	{
		cin>>a;
		if(s.find(a)!=s.end())
		{
			flag++;
		}
		s.insert(a);
	}
	if(flag)
	{
		cout<<"NO\n";
	}
	else
	{
		cout<<"YES\n";
	}
	return 0;
}


Measured memory_bytes: 9600
//cwystc <--> 陈威宇是天才  --by cwy
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
const double PI=acos(-1);
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for (int i=(a);i<=(b);i++)
#define per(i,a,b) for (int i=(a);i>=(b);i--)
#define Rep(i,a,b) for (int i=(a);i<(b);i++)
#define Per(i,a,b) for (int i=(a);i>(b);i--)
#define travel_set(it,a) for (set<int>::iterator (it)=(a).begin();(it)!=(a).end();(it)++)
#define travel_map(it,a) for (map<int>::iterator (it)=(a).begin();(it)!=(a).end();(it)++)
#define travel_vec(it,a) for (vector<int>::iterator (it)=(a).begin();(it)!=(a).end();(it)++)
#define p(x) cout << x << endl;
#define def cout << "find" << endl;
#define what_is(x) cout << #x << " is " << x << endl;
template <class T>T sqr(T x){return x*x;}
template <class T>T alex(T x){return (x>0)?x:-x;}
template <class T>void read(T&x){
	x=0;T f=1;char ch=getchar();
	while ((ch<48||ch>57)&&ch!=45)ch=getchar();
	if (ch==45)f=-1,ch=getchar();
	while (ch>=48&&ch<=57)x=x*10+ch-48,ch=getchar();
	x*=f;
}

//-------------------------------------------------head-------------------------------------------------

#define maxn 305
int f[maxn][maxn][maxn];
char s[maxn],_s[maxn];int k,len;
int main(){
	scanf("%s",s+1);len=strlen(s+1);read(k);
	rep(i,1,len)_s[i]=s[len-i+1];
	// rep(i,0,len)f[i][0][0]=f[0][i][0]=0;
	rep(i,1,len)rep(j,1,len)if (i!=0&&j!=0){
		f[i][j][0]=max(max(f[i-1][j][0],f[i][j-1][0]),f[i-1][j-1][0]+(s[i]==_s[j]));
		rep(kk,1,k){
			f[i][j][kk]=max(max(f[i-1][j][kk],f[i][j-1][kk]),f[i-1][j-1][kk-(s[i]!=_s[j])]+1);
		}
	}
	int res=0;
	rep(i,1,len)rep(kk,0,k)res=max(f[i][len-i][k]*2,res);
	rep(i,1,len)rep(kk,0,k)res=max(f[i-1][len-i][kk]*2+1,res);printf("%d\n",res);return 0;
}

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

using namespace std;

const long long INF = 1e18;
const int N = 3e5;
const int MOD = 998244353;
const double EPS = 1e-9;

const double PI = acos(-1);


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    string s;
    cin >> s;
    for (char c : s) {
        if (c == '7') {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
}

Measured memory_bytes: 3612
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	void run(){
		for(;;){
			int w=sc.nextInt();
			if(w==-1){
				break;
			}
			int sum=0;
			if(w>30){
				sum+=160*(w-30);
				w=30;
			}
			if(w>20){
				sum+=140*(w-20);
				w=20;
			}
			if(w>10){
				sum+=125*(w-10);
				w=10;
			}
			sum+=1150;
			println(""+(4280-sum));
		}
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include<cstdio>
int main(void)
{
	int a,b;
	scanf("%d%d",&a,&b);
	int total = 0,i;
	for(int i = 1; i <= 999; i++) {
		total+=i;
		if(total-i-a == total-b) {
			printf("%d",total-b);
			return 0;
		}
	}
}

Measured memory_bytes: 128
N, K=map(int, input().split())
R, S, P=map(int, input().split())
T=list(input())
ans=0
for i in range(N):
  if i<K:
    if T[i]=="r":
      ans+=P
      T[i]="rw"
    elif T[i]=="s":
      ans+=R
      T[i]="sw"
    elif T[i]=="p":
      ans+=S
      T[i]="pw"
  else:
    if T[i]=="r" and T[i-K]!="rw":
      ans+=P
      T[i]="rw"
    elif T[i]=="s" and T[i-K]!="sw":
      ans+=R
      T[i]="sw"
    elif T[i]=="p" and T[i-K]!="pw":
      ans+=S
      T[i]="pw"
      
print(ans)
        

Measured memory_bytes: 4084
// E - Handshake

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int MOD = 1e9 + 7;

const ll MAX_N = 100000;
const ll MAX_A = 100000;

ll A[MAX_N];
ll A_csum[MAX_N]; // 値が大きい側からの累積和
ll N, M;

// t <= Ax + Ay となる組み合わせの数を求める
// Ax = A[i]ごとに二分探索で数を求めて合計する -> O(NlogN)

ll get_n_comb(ll t) {
	ll result = 0;
	for (int i=0; i<N; i++) {
		ll Ay = t - A[i];
		ll idx = lower_bound(A, A+N, Ay) - A; // t <= Ax + Ay となる最初のインデックス
		result += (N - idx);
	}

	//cout << "t=" << t << " -> comb=" << result << endl;

	return result;
}

// t <= Ax + Ay となる組み合わせの数がk以上となる最大のtを求める
ll get_max_t(ll k) {
	ll ok = 0;
	ll ng = 2 * MAX_A + 1;

	while(ng - ok > 1) {
		ll trying = (ok + ng) / 2;

		if (get_n_comb(trying) >= k) {
			ok = trying;
		} else {
			ng = trying;
		}
	}

	return ok;
}

// t <= Ax + Ay となる組み合わせについて総和を求める
ll get_sum_ge(ll t) {
	ll result = 0;
	for (int i=0; i<N; i++) {
		ll Ay = t - A[i];
		ll idx = lower_bound(A, A+N, Ay) - A; // t <= Ax + Ay となる最初のインデックス
		if (idx == N) continue; // 見つからなかった場合
		result += (A[i] * (N - idx)) + A_csum[idx]; // Axの和 + Ayの和
	}

	//cout << "t=" << t << " sum=" << result << endl; // **** debug ****

	return result;
}

int main() {

	cin >> N >> M;

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

	sort(A, A+N);

	// 値が大きい側からの累積和を作成（get_sum_ge()で用いる）
	A_csum[N-1] = A[N-1];
	for (int i=N-2; i>=0; i--) {
		A_csum[i] = A[i] + A_csum[i+1];
	}

	// t <= Ax + Ay となる組み合わせの数がM以上となる最大のtを求める
	ll max_t = get_max_t(M);
	//cout << "max_t = " << max_t << endl; // **** debug ****

	// get_sum_ge(max_t)では max_t == Ax + Ay となる握手が複数存在する場合に余分な握手が含まれてしまうので
	// （(t == max_t) の和） + （(t >= max_t + 1) の和）で求める
	ll n_max_t = M - get_n_comb(max_t + 1); // t == max_t となる場合の数
	ll ans = (max_t * n_max_t) + get_sum_ge(max_t + 1);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef pair<long long,string> P;
main(){
  long long m,n;
  long long cm;
  string str="";
  string tani[18]={"","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"};
  while(1){
    str="";
    cin>>m>>n;
    if(m==0&&n==0) break;
    cm=m;
    while(cm>0){
      str+=(char)('0'+(char)(cm%10));
      cm/=10;
    }
    for(int i=1;i<n;i++){
      string plus=str;
      for(int j=1;j<m;j++){
	long long kuriage=0;
	for(int k=0;k<str.size();k++){
	  long long sum;
	  if(k<plus.size()){
	    sum=(str[k]-'0')+(plus[k]-'0');
	  }
	  else{
	    sum=str[k]-'0';
	  }
	  sum+=kuriage;
	  if(sum>=10){
	    kuriage=1;
	  }
	  else{
	    kuriage=0;
	  }
	  str[k]=(char)('0'+(sum%10));
	}
	if(kuriage==1){
	  str+='1';
	}
      }
    }
    stack<P> sta;
    for(int i=0;i<str.size();i+=4){
      long long num=0;
      for(int j=min(i+3,(int)str.size()-1);j>=i;j--){
	num*=10;
	num+=(str[j]-'0');
      }
      if(num>0){
	sta.push(P(num,tani[i/4]));
      }
    }
    while(!sta.empty()){
      cout<<sta.top().first<<sta.top().second;
      sta.pop();
    }
    cout<<endl;
  }
}

Measured memory_bytes: 3196
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    t = ["Sunny", "Cloudy", "Rainy", "Sunny"]
    S = ST()
    i = t.index(S)
    print(t[i+1])
if __name__ == '__main__':
    main()

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

int main(int argc, char *argv[]) {
	int num_of_problems = 0;
	std::map<int, int> solve_times_map;
	int num_of_drinks = 0;
	std::vector<std::map<int, int>> cheat_time_maps;
	
	std::cin >> num_of_problems;
	int current_solve_time = 0;
	for (int i = 0; i < num_of_problems; i++) {
		std::cin >> current_solve_time;
		solve_times_map[i + 1] = current_solve_time;
	}

	std::cin >> num_of_drinks;
	int drink_number = 0;
	int cheat_time = 0;
	for (int j = 0; j < num_of_drinks; j++) {
		std::cin >> drink_number;
		std::cin >> cheat_time;
		cheat_time_maps.push_back({
			{drink_number, cheat_time}
		});
	}

	for (auto cheat_time_map: cheat_time_maps) {
		int sum_solve_time = 0;
		for (auto solve_time_entry: solve_times_map) {
			if (cheat_time_map.begin()->first == solve_time_entry.first) {
				sum_solve_time += cheat_time_map.begin()->second;
			} else {
				sum_solve_time += solve_time_entry.second;
			}
		}
		std::cout << sum_solve_time << std::endl;
	}
	return 0;
}


Measured memory_bytes: 256
#coding:utf-8
L, R = map(int,input().split())
mn = 1000000000
Y = 2019
if R >= L + Y:
    R = L + Y - 1
for j in range(L,R+1):
    for i in range(L,j):
        mn = min(mn, ((i%Y)*(j%Y))%Y)
print (mn)

Measured memory_bytes: 3060
#include <stdio.h>

int main(){
    int x;

    scanf("%d", &x);

    switch(x){
        case 3:
            printf("YES\n");
            break;
        
        case 5:
            printf("YES\n");
            break;
        
        case 7:
            printf("YES\n");
            break;
        
        default:
            printf("NO\n");
    }

    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
    int a, b;
    int n[3];
    int max = -10000;
    int i;

    scanf("%d %d", &a, &b);

    n[0] = a + b;
    n[1] = a - b;
    n[2] = a * b;

    for (i = 0; i < 3; i++) {
        if (n[i] > max) {
            max = n[i];
        }
    }
    printf("%d\n", max);
    
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long 
#define mp make_pair 
#define pb push_back 
#define F first 
#define S second 
#define f(i,n) for(int i=0;i<n;i++) 

using namespace std;
 

void test(){
	ll n;
	cin>>n;
	ll a[n];
	f(i,n)cin>>a[i];
	ll sum = 0;
	f(i,n)sum+=a[i];
	map<ll,ll> m;
	f(i,n)m[a[i]]++;
	int q;
	cin>>q;
	while(q--){
		ll b,c;
		cin>>b>>c;
		ll x = m[b];
		sum = sum - (x*b);
		sum = sum + (x*c);
		m[b]=0;
		m[c]+=x;
		cout<<sum<<"\n";
	}
}

int main(){
	int tests = 1;
//	cin>>tests;
	while(tests--){
		test();
	}
}

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

#define endl '\n'
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
#define ALL(v) v.begin(), v.end()
#define ALLR(v) v.rbegin(), v.rend()
#define deb cout<<"HOLA\n";
#define UNIQUE(v) (v).resize(unique(ALL(v))-(v).begin())
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define bs(v,f) binary_search(ALL(v),f)
#define lb(v,f) lower_bound(ALL(v),f)
#define ub(v,f) upper_bound(ALL(v),f)
#define pb push_back

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef string str;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vl;
typedef vector<ii> vii;

void solve(){
	int n,m;
	cin>>n>>m;
	if(n<=m)cout<<"unsafe";
	else cout<<"safe";
}
int main(){
	/*int t;
	cin>>t;
	while(t--)*/
		solve();
	return 0;
}

Measured memory_bytes: 3584
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,ko;
    ll x,y,w,z;
    char hoge,fuga;
    cin>>a>>b;
    if(a%2==0||b%2==0) cout<<"Even"<<endl;
    else cout<<"Odd"<<endl;
    return 0;
}


Measured memory_bytes: 3540
#include<iostream>
#include<algorithm>

using namespace std;

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

    int even[n/2], odd[n/2];
    for(int i=0;i<n/2;i++){
        cin >> even[i] >> odd[i];
    }

    sort(even, even+n/2);
    sort(odd, odd+n/2);

    int even_max_num[2] = {0,0}, odd_max_num[2] = {0,0};
    int even_i, odd_i;
    for(int i=0;i<n/2-1;i++){
        int tmp = 1;
        while(even[i]==even[i+1]){
            tmp++;
            i++;
        }
        if(tmp>even_max_num[0]){
            even_i = even[i];
            even_max_num[1] = even_max_num[0];
            even_max_num[0] = tmp;
        }
        else if(tmp>even_max_num[1]){
            even_max_num[1] = tmp;
        }
    }
    for(int i=0;i<n/2-1;i++){
        int tmp = 1;
        while(odd[i]==odd[i+1]){
            tmp++;
            i++;
        }
        if(tmp>odd_max_num[0]){
            odd_i = odd[i];
            odd_max_num[1] = odd_max_num[0];
            odd_max_num[0] = tmp;
        }
        else if(tmp>odd_max_num[1]){
            odd_max_num[1] = tmp;
        }
    }
    int ans = even_max_num[0] + odd_max_num[0];
    if(even_i==odd_i){
        if(even_max_num[1]+odd_max_num[0]>even_max_num[0]+odd_max_num[1])ans = even_max_num[1]+odd_max_num[0];
        else ans = even_max_num[0]+odd_max_num[1];
    }
    cout << n-ans << endl;
}


Measured memory_bytes: 640
//
//  ROIGold.cpp
//  Main calisma
//
//  Created by Rakhman on 05/02/2019.
//  Copyright © 2019 Rakhman. All rights reserved.
//

#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iterator>

#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define all(s) s.begin(), s.end()
#define fo(i, start, finish) for(int i = start; i <= finish; i ++)
#define y1 kdfjsalsdkf

const long long MXN = 1e6 + 5;
const long long MNN = 501;
const long long MOD = 10;
const long long INF = 100;
const long long OO = 1e9 + 500;

typedef long long llong;
typedef unsigned long long ullong;

using namespace std;

llong n, l[MXN], r[MXN], b[MXN];

int main(){
	ios;
	cin >> n;
	for(int i = 1; i <= n; i++){
	    cin >> b[i];
	}
	if(b[n] != 2) return cout << -1, 0;
	l[n] = r[n] = 2;
	for(int i = n; i >= 1; i--){
	    llong L = ((l[i] + b[i] - 1) / b[i]) * b[i], R = (r[i] / b[i]) * b[i] + b[i] - 1;
	    if(L > r[i]){
	        return cout << -1, 0; 
	    }
	    l[i - 1] = L;
	    r[i - 1] = R;
	}
	cout << l[0] << ' ' << r[0];
	return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
int searching(string N, int p, int q, int r) {
	int is=100000, js=100000;
	for (size_t i = 0; i < N.size(); i++)
	{
		if (int(N.at(i) - '0') == p) {
			is = i;
			break;
		}
	}
	for (size_t i = is+1; i < N.size(); i++)
	{
		if (int(N.at(i) - '0') == q) {
			js = i;
			break;
		}
	}
	for (size_t i = js+1; i < N.size(); i++)
	{
		if (int(N.at(i))-'0'==r)
		{
			//cout << p << q << r << endl;
			return 1;
		}
	}
	return 0;
}
int main() {
	int ans = 0,fuck;
	cin >> fuck;
	string N;
	cin >> N;
	//暗証番号の数は高々10^3個。だったら直接探せばいいやん
	for (size_t i = 0; i < 10; i++)
	{
		for (size_t j = 0; j < 10; j++)
		{
			for (size_t k = 0; k < 10; k++)
			{
				ans+=searching(N, i, j, k);
			
			}
		}
	}
	cout << ans;
}

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

using namespace std;

const long MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;

int main(){
    int N, M, Q;
    cin >> N >> M >> Q;

    int L[M], R[M];
    for(int i=0; i<M; i++){
        cin >> L[i] >> R[i];
    }

    int p[Q], q[Q];
    for(int i=0; i<Q; i++){
        cin >> p[i] >> q[i];
    }

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

    for(int i=0; i<M; i++){
        sum[L[i]][R[i]]++;
    }

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

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

    for(int i=0; i<Q; i++){
        int s = p[i];
        int e = q[i];

        int ans = sum[e][e] + sum[s-1][s-1] - sum[s-1][e] - sum[e][s-1];
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 4224
#include<stdio.h>

#define MAX 100000
int partition(int *,int ,int );

int main()
{
  int k,n,q;
  int A[MAX+1];

  scanf("%d",&n);
  for(k=0;k<n;k++)
    {
      scanf("%d",&A[k]);
    }
 
  q=partition(A,0,n-1);

  for(k=0;k<n;k++)
    {
      if(k>0)printf(" ");
      if(k==q)printf("[");
      printf("%d",A[k]);
      if(k==q)printf("]");
    }
  printf("\n");

  return 0;

 
}

int partition(int A[],int p,int r)
{
  int x,y,i,j;
 
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++)
    {
      if(A[j]<=x)
	{
	  i=i+1;
	  y=A[i];
	  A[i]=A[j];
	  A[j]=y;
	}
    }
  y=A[i+1];
  A[i+1]=A[r];
  A[r]=y;
  return i+1;
}



Measured memory_bytes: 2096
from collections import Counter
N = int(input())
L = [input() for _ in range(N)]
#for n in range(N):
    #S = input()
    #L.append(S)
Dic = Counter(L)
max_value = max(Dic.values())
max_k_list = [i for i, j in Dic.items() if j == max_value]
max_k_list = sorted(max_k_list)

print(*max_k_list , sep="\n")

Measured memory_bytes: 35976
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  map<char,char> cnt={{'A','T'},{'T','A'},{'C','G'},{'G','C'}};
  char s;
  cin >> s;
  cout << cnt[s] << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
using namespace std;
string e[100000];
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		string a,c,d,h;
		cin >> a;
		int sum = 0;
		for (int i = 1; i < a.length() ; i++) {
			c = a.substr(0, i);
			d = a.substr(i, a.length() - i);
			h = c + d;
			string f = "", g = "";
			for (int j = c.length() - 1; j >= 0; j--) 
				f += c[j];
			for (int j = d.length() - 1; j >= 0; j--)
				g += d[j];
			for (int j = 0; j < 8; j++) {
				if (j == 0) h = c + d;
				else if (j == 1) h = d + c;
				else if (j == 2) h = c + g;
				else if (j == 3) h = g + c;
				else if (j == 4) h = f + d;
				else if (j == 5) h = d + f;
				else if (j == 6) h = f + g;
				else if (j == 7) h = g + f;
				for (int z = 0; z < sum; z++) {
					if (e[z] == h) {
						goto stop;
					}
				}
				e[sum] = h;
				sum++;
			stop:;
			}
		}
		cout << sum << endl;
	}
}

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

using namespace std;

inline bool isPrime(int num){
    for(int i=2; i*i<=num; i++){
        if(num % i == 0)
            return false;
    }
    return true;
}

int main(int argc, char const* argv[])
{
    int N,num;
    size_t count = 0;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> num;
        if(isPrime(num))
            count++;
    }
    cout << count << endl;
    return 0;
}



Measured memory_bytes: 3076
using System;
class c
{
    static void Main()
    {
        var nk = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var rsp = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var t = Console.ReadLine();
        int n = nk[0], k = nk[1], r = rsp[0], s = rsp[1], p = rsp[2];
        long ans = 0;
        var judge = new bool[n];
        for (int i = 0; i < n; i++)
        {
            if (i < k) judge[i] = true;
            else if (t[i] != t[i - k] || !judge[i - k]) judge[i] = true;
        }
        for (int i = 0; i < n; i++)
        {
            if (judge[i])
            {
                if (t[i] == 'r') ans += p;
                else if (t[i] == 's') ans += r;
                else ans += s;
            }
        }
        Console.WriteLine(ans);
    }
}


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

int main(){
	int n, m;
	cin >> n >> m;
	vector<int> a(m), b(m);
	for (int i=0; i<m; i++){
		cin >> a.at(i) >> b.at(i);
	}
	vector<int> ans(n);
	for(int i=0; i<m; i++){
		ans.at(a.at(i)-1)++;
		ans.at(b.at(i)-1)++;
	}
	for(int i=0; i<n; i++){
		cout << ans.at(i) << endl;
	}
}


Measured memory_bytes: 3524
#include<cstdio>

int main(){
    long long N,M;
    scanf("%lld%lld",&N,&M);
    long long Ans=0;
    if(N>1){
        if(M>1) Ans+=(N-2)*(M-2);
        else Ans+=N-2;
    }
    else{
        if(M>1) Ans+=M-2;
        else Ans=1ll;
    }
    printf("%lld",Ans);
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
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; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

map<ll,ll> M;

int main(){
  ll N,A[100007],K=0;
  cin >> N;
  rep(i,N){
    cin >> A[i];
    M[A[i]]++;
  }
  for(auto P : M){
    if(P.fr<=P.sc){
      K+=P.sc-P.fr;
    }
    else{
      K+=P.sc;
    }
  }
  cout << K << endl;
}

Measured memory_bytes: 7040
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include <math.h>
#include <algorithm>

using namespace std;

int main(){
    string s;
    vector<string> v;
	cin>>s;
	for(int i=0;i<s.size();i++){
    	if (s[i]=='0'){
        	v.push_back("0");
        }else if (s[i]=='1'){
        	v.push_back("1");
        }else if(s[i]=='B' && v.size()>0){
        	v.pop_back();
        }
    }
	for(int i=0;i<v.size();i++){
    	cout<<v[i];
    }    

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
void SelectSort(int arr[], int n, int& cnt);

int main(void)
{
	int N;
	int arr[105];
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	cin >> N;
	int cnt = 0;
	for (int i = 0; i != N; ++i)
		scanf("%d", &arr[i]);
	SelectSort(arr, N, cnt);
	
	for (int i = 0; i != N - 1; ++i)
		printf("%d ", arr[i]);
	printf("%d\n", arr[N - 1]);
	printf("%d\n", cnt);
	//system("pause");
	return 0;
}

void SelectSort(int arr[], int n, int& cnt)
{
	int min_idx, min_value;
	for (int i = 0; i < n - 1; ++i)
	{
		min_idx = i;
		for (int j = i + 1; j < n; ++j)
		{
			if (arr[min_idx] > arr[j])
			{
				min_idx = j;
			}
		}
		if (min_idx != i)
		{
			swap(arr[i], arr[min_idx]);
			++cnt;
		}
	}
}

Measured memory_bytes: 3216
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var n = inputs[0];
        var m = inputs[1];

        var ai = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var count = ai.Where(t => (double)t >= (double)((double)ai.Sum() / (double)(4 * m))).Count();

        if (count >= m) Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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;
} 
int main(){
    ll n;cin >> n;
    vl v(n);rep(i,n)cin >> v[i],v[i]--;
    vl pls(n);rep(i,n)pls[v[i]]=i;
    ll ans=0;
    set<ll> st;st.ins(n);st.ins(-1);
    rep(i,n){
        ll p=pls[i];
        auto itr=st.lower_bound(p);
        ll right=*itr;
        itr--;
        ll left=*itr;
        ans+=(i+1)*(p-left)*(right-p);
        st.ins(p);
    }
    cout << ans <<endl;
}

Measured memory_bytes: 15648
num=int(input())


def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

ans=num2alpha(num).lower()

print(ans)

Measured memory_bytes: 9168
#coding: utf-8

list = [0,0,0,0,0]

for i in range(5):
  list[i] = int(input())
  
flag = True

kyori = 0

k = int(input())

for i in range(4):
    for j in range(i + 1,5):
        if list[i] > list[j]:
            kyori = list[i] - list[j]
        else:
            kyori = list[j] - list[i]
            
        if kyori > k:
            flag = False

if flag:
    print("Yay!")
else:
    print(":(")

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s1 = sc.next();
        String s2 = sc.next();
        ArrayList<Integer> d = new ArrayList<Integer>();
        for(int i=0; i<n; i++){
            if(s1.charAt(i) == s2.charAt(i)){
                d.add(1);
            }else{
                d.add(2);
                i++;
            }
        }
        sc.close();

        long mod = 1000000007;
        long ans;
        if(d.get(0) == 1){
            ans = 3;
        }else{
            ans = 6;
        }

        for(int i=1; i<d.size(); i++){
            if(d.get(i) == 1){
                if(d.get(i-1) == 1){
                    ans *= 2;
                }else{
                    ans *= 1;
                }
            }else{
                if(d.get(i-1) == 1){
                    ans *= 2;
                }else{
                    ans *= 3;
                }
            }
            if(ans > mod) ans %= mod;
        }

        System.out.println(ans);
    }
}

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int n;
  cin >> n;
  ll ans = 0;
  map<string, int> mp;
  for (int i = 1; i <= n; i++) {
    string s = to_string(i);
    int l = s.size();
    string t;
    t += s[0];
    t += s[l - 1];
    mp[t]++;
  }
  dump(mp);
  for (int i = 1; i <= n; i++) {
    string s = to_string(i);
    int l = s.size();
    string t;
    t += s[l - 1];
    t += s[0];
    ans += mp[t];
  }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair < ll, ll > PLL;
#define rep(i,n) for (int i = 0; i < (n); ++i)
int main() {
    string a, b;
    cin >> a >> b;
    string s = a + b;
    bool ok = false;
    for ( int i = 1; i <= stoi(s); ++i ) {
        if ( stoi(s) / i == i && stoi(s) % i == 0 ) ok = true;
    }
    if ( ok ) cout << "Yes" << endl;
    else      cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long N, K;
    cin >> N >> K;
    vector<long long> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    long long cnt = 0;
    while(1){
        cnt++;
        vector<long long> sum(N + 1, 0);
        for(int i = 0; i < N; i++){
            sum[max(0LL, i - A[i])]++;
            sum[min(N, i + A[i] + 1)]--;
        }
        for(int i = 1; i < N + 1; i++) sum[i] += sum[i - 1];
        int flag = 0;
        for(int i = 0; i < N; i++) {
            A[i] = sum[i];
            if(A[i] != N) flag = 1;
        }
        if(cnt == K) break;
        if(flag == 0) break;
    }
    for(int i = 0; i < N; i++) cout << A[i] << ' ';
    cout << endl;
}


Measured memory_bytes: 6428
#include <stdio.h>
int main(void){
  int i,count=0;
  float data[10000],high,low;
  while(1){
    scanf("%f",&data[count]);
    if(feof(stdin))break;
    count++;
  }
  high=data[0];
  for(i=0;i<count;i++){
    if(high<data[i]){
      high=data[i];
    }
  }
  low=data[0];
  for(i=0;i<count;i++){
    if(low>data[i]){
      low=data[i];
    }
  }
  printf("%.1f\n",(high-low));
  return(0);
}

Measured memory_bytes: 0
#!/usr/bin/env python3
s = input()
t = input()
n = len(t)
m = len(s)
c = "z" * m
for i in range(m - n + 1):
    if all(j in (t[k], "?") for k, j in enumerate(s[i:n + i])):
        c = min(c, s[:i] + t + s[i + n:])
print("UNRESTORABLE" if c == "z" * m else c.replace("?", "a"))


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

int main()
{
	int a, b , c , d , e , f;
	cin >> a;
	b = a / 3600;
	c = (a - b * 3600) / 60;
	d = (a - b * 3600) % 60;
	cout << b << ":" << c << ":" << d << endl;
	return 0;
}


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter prnt = new PrintWriter(System.out);
		StringBuilder sb = new StringBuilder();
        StringTokenizer st = new StringTokenizer(read.readLine());
        
        int n = parseInt(st.nextToken());
        
        int a = n % 1000;
        
        if(a==0) {
        	System.out.println(0);
        }
        else {
        	System.out.println(1000-a);
        }

	}

	
}


Measured memory_bytes: 25380
from collections import defaultdict, deque


def main():
    N, M = map(int, input().split())
    adj = defaultdict(lambda: defaultdict(lambda: 0))
    for _ in range(M):
        l, r, d = map(int, input().split())
        adj[l][r] = d
        adj[r][l] = -d
    q = deque()
    while len(adj.keys()):
        k = list(adj.keys())[0]
        pos = {k: 0}
        q.append((k, 0))
        while len(q):
            i, x = q.popleft()
            for j in adj[i]:
                if j in pos and pos[j] != x + adj[i][j]:
                    print("No")
                    return
                pos[j] = x + adj[i][j]
                q.append((j, pos[j]))
                del adj[j][i]
            del adj[i]
        if max(pos.values()) - min(pos.values()) > 10**9:
            print("No")
            return
    print("Yes")


if __name__ == "__main__":
    main()


Measured memory_bytes: 129404
def func():
    pass


def main():
    n, m = map(int, input().split())
    r = []
    for i in range(m):
        a, b = map(int, input().split())
        r.append((a, b))

    ans = [0] * n
    for ri in r:
        a, b = ri[0], ri[1]
        ans[a - 1] += 1
        ans[b - 1] += 1

    for i in ans:
        print(i)


def main2():
    n, m = map(int, input().split())
    ans = [0] * n
    for i in range(m):
        a, b = map(int, input().split())
        ans[a - 1] += 1
        ans[b - 1] += 1

    for i in ans:
        print(i)


if __name__ == '__main__':
    main2()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
 
using namespace std;
using vecint = vector<int>;

int main(){
    int n;
    cin >> n;
    set<int> s;
    FOR(i,0,n){
        int a;
        cin >> a;
        s.insert(a);
    }
    cout << s.size() << endl;
    
}

Measured memory_bytes: 256