akhauriyash/Code-Regression huggingface dataset:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]


a = int(input())
ans = a+a**2+a**3


print(ans)


Measured memory_bytes: 68644
// J'aime
// Chemise Blanche

#include <bits/stdc++.h>
using namespace std;

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

void MAIN() {
  int n; cin >> n;
  int app = 1;
  vector<int> a(n);
  for (auto &i : a) {
    cin >> i;
    if (i % 2 == 0 && i % 3 && i % 5) app = 0;
  }
  if (app) cout << "APPROVED" << '\n';
  else cout << "DENIED" << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3616
N,M=list(map(int, input().split()))
S=set()
D=[]
for i in range(M):
    l=list(map(int, input().split()))
    if l[0]==1:
        S.add(l[1])
    else:
        D.append(l)
# print(S)
# print(D)
D.sort()
L=len(D)
for i in range(L):
    if D[i][1]==N and D[i][0] in S:
        print('POSSIBLE')
        exit()
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 107948
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {
    int n; cin >> n;
    vector<pair<ll, int>> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i].first;
        a[i].second = i + 1;
    }
    sort(a.rbegin(), a.rend());
    vector<vector<ll>> dp(n + 1, vector<ll>(n + 1, 0));
    dp[0][0] = 0;
    for (int k = 1; k <= n; k++) {
        for (int i = 0; i <= k; i++) {
            int j = k - i;
            if (i - 1 >= 0) dp[i][j] = max(dp[i][j], dp[i - 1][j] + a[k - 1].first * (a[k - 1].second - i));
            if (j - 1 >= 0) dp[i][j] = max(dp[i][j], dp[i][j - 1] + a[k - 1].first * (n - j + 1 - a[k - 1].second));
        }
    }
    ll ans = 0;
    for (int i = 0; i <= n; i++) {
        ans = max(ans, dp[i][n - i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 34624
import fractions
a, b, c, d = map(int, input().split())
 
def wareruzu(x):
    if b < x:
        return 0
    if b == x:
        return 1
    start_a = a if a % x == 0 else a - (a % x) + x
    end_b = b - (b % x) # bより小さい最大の値。
    m = end_b - start_a
    if m < 0:
        return 0
    return int(m // x) + 1
 
all_n = b - a + 1
print(all_n - wareruzu(c) - wareruzu(d) + wareruzu((c*d) // fractions.gcd(c,d)))

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

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

    for (int i = N - 2; i >= 0; i--) {
        if (H[i] > H[i + 1]) {
            H[i]--;
        }
        if (H[i] > H[i + 1]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>

using namespace std;

struct card
{
	int num;
	char suit;
	int order;
};

int partition(card *A,int p,int r)
{
	int j;
	card x,temp;

	x = A[r];
	j = p-1;

	for(int i = p; i < r; i++)
	{
		if (A[i].num <= x.num)
		{
			j++;
			temp = A[j];
			A[j] = A[i];
			A[i] = temp;
		}
	}

	temp = A[j+1];
	A[j+1] = A[r];
	A[r] = temp;

	return j+1;
}

void quicksort(card *A,int p,int r)
{
	int q;

	if (p < r)
	{
		q = partition(A,p,r);
		quicksort(A,p,q-1);
		quicksort(A,q+1,r);
	}
}



int main()
{
	bool check = true;
	int n;
	card A[100000],B[100000];

	scanf("%d", &n);

	for(int i = 0; i < n; i++)
	{
		scanf(" %c %d", &A[i].suit,&A[i].num);
		A[i].order = i;
	}

	quicksort(A,0,n-1);

	for(int i = 1; i < n; i++)
	{
		if (A[i].num == A[i-1].num)
		{
			int j = 0;

			while(A[i-1].num == A[i+j].num)
			{
				if (A[i-1].order > A[i+j].order)
				{
					check = false;
					break;
				}
				j++;
			}
		}

		if (!check)
		{
			break;
		}
	}

	if (check)
	{
		printf("Stable\n");
	}else
	{
		printf("Not stable\n");
	}

	for(int i = 0; i < n; i++)
	{
		printf("%c %d\n", A[i].suit, A[i].num);
	}



	return 0;
}
	

Measured memory_bytes: 4364
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        if(i <= 111){
            System.out.println("111");
        }else if(i <= 222){
            System.out.println("222");
        }else if(i <= 333){
            System.out.println("333");
        }else if(i <= 444){
            System.out.println("444");
        }else if(i <= 555){
            System.out.println("555");
        }else if(i <= 666 ){//悪魔の数字！フ　リ　ー　メ　イ　ソ　ン　！
            System.out.println("666");
        }else if(i <= 777){
            System.out.println("777");
        }else if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        }
    }
}

Measured memory_bytes: 20948
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include<limits>
#include<iomanip>
#include<cassert>

using namespace std;

typedef long long ll;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n-1;i >= 0;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second

const long double pi = 3.141592653589793;
const int mod = 998244353;


int main() {

// freopen("input.in","r",stdin);
// freopen("output.out","w",stdout);

 string s,t;cin>>s>>t;int ans=0;
 rep(i,s.size()) if(s[i] != t[i]) ans++;
 cout<<ans<<endl;

 return 0;
}


Measured memory_bytes: 3916
<?php
fscanf(STDIN, "%d", $n);
fscanf(STDIN, "%d", $k);
fscanf(STDIN, "%d", $x);
fscanf(STDIN, "%d", $y);

if($n > $k){
  echo $k * $x + ($n - $k) * $y;
} else {
  echo $n * $x;
}

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

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int n,m;
    cin>>n>>m;
    array<int,2> d[n];
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        d[i] = {a[i],i};
    }
    sort(d,d+n);
    vector<vector<array<int,2>>> v(n);
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--,b--;
        v[a].push_back({b,i});
        v[b].push_back({a,i});
    }
    int c[n];
    for(int i=0;i<n;i++) c[i] = -1;
    int ans[m];
    int INF = 1e9;
    for(int i=0;i<m;i++) ans[i] = INF;
    priority_queue<array<int,2>,vector<array<int,2>>,greater<array<int,2>>> q;
    q.push({d[0][0],d[0][1]});
    bool used[n];
    for(int i=0;i<n;i++) used[i] = 0;
    while(q.size()){
        array<int,2> p = q.top();
        //cerr << p[0] << " " << p[1] << endl;
        q.pop();
        used[p[1]]=1;
        if(c[p[1]]==-1) c[p[1]] = 1;
        for(auto i:v[p[1]]){
            if(c[i[0]]==-1) c[i[0]] = c[p[1]] ^ 1;
            ans[i[1]] = max(a[i[0]], p[0]);
            if(!used[i[0]]){
                used[i[0]]=1;
                q.push({a[i[0]],i[0]});
            }
        }
    }
    for(int i=0;i<n;i++){
        bool pos = false;
        for(auto j:v[i]){
            int p = j[0];
            int itr = j[1];
            if(c[p] == c[i]) continue;
            if(ans[itr] < a[i]){
                cout << -1 << endl;
                return 0;
            }
            if(ans[itr] == a[i]) pos = 1;
        }
        if(!pos){
            cout << -1 << endl;
            return 0;
        }
    }
    for(int i=0;i<n;i++){
        if(c[i] == 1) cout << "W";
        else cout << "B";
    }
    cout << "\n";
    for(int i=0;i<m;i++){
        cout << ans[i] << "\n";
    }
}

Measured memory_bytes: 13180
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    ll x;
    cin >> x;
    ll now = 0;
    rep(i,x){
        now += i+1;
        if(x <= now){
            cout << i+1 << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#include<set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)

#include <algorithm>
using namespace std;
#include <cmath>
#include <string>
#include<vector>
#define elif else if
typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 200005
int N;
char s[55][55]={'.'};

bool check(int i,int j){
    bool flag = false;
    if(s[i-1][j] == '#' )flag = true;
    if(s[i+1][j] == '#' )flag = true;
    if(s[i][j-1] == '#' )flag = true;
    if(s[i][j+1] == '#' )flag = true;
    return flag;
}

int main(){
    int H,W;
    cin>>H>>W;

    rep1(i,H+1){
        rep1(j,W+1)
            cin>>s[i][j];
    }
    bool is_OK = true;
    rep1(i,H+1){
        rep1(j,W+1){
            if(!check(i,j) && s[i][j]== '#')is_OK = false; 
        }    
    }

    if(is_OK)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
    
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int n;
while(cin>>n,n){
  double mon=0;
int k[n],ans=0;
for(int i=0;i<n;++i){cin>>k[i],mon+=k[i];}
mon/=n;
for(int i=0;i<n;++i){
  if(k[i]<=mon) ++ans;
}
cout<<ans<<endl;
}
}


Measured memory_bytes: 3132
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <bitset>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long N, K;
  cin >> N >> K;
  vector<long> A(N);
  rep (i, N) cin >> A[i];

  long result = 0;
  rep (i, N) rep (j, N) {
    if (A[i] <= A[j]) continue;
    if (i < j) result += K * (K + 1) / 2;
    else result += K * (K - 1) / 2;
    result %= MOD;
  }
  cout << result << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


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

const int maxn = 510;

int n, f[maxn][maxn], ans;

int main() {
	cin >> n;
	while ((1<<ans) < n) ans++;
	for (int i = 0; i < ans; ++i)
		for (int j = 0; j < n; ++j)
			for (int k = 0; k < n; ++k)
				if (((j>>i)&1) == 0 && ((k>>i)&1) == 1)
					f[j][k] = i+1;
	for (int i = 0; i < n; ++i) {
		for (int j = i+1; j < n; ++j)
			printf("%d ", f[i][j]);
		puts("");
	}
}


Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>
#include <cassert>
#include <utility>
#include <stack>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
typedef long long ll;
typedef pair<int,int> Pii;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int main(){
	vector<ll> divi;
	ll n,m;
	cin>>n>>m;
	for(ll i=2;i<sqrt(m);i++){
		if(m%i==0){
			divi.push_back(i);
			divi.push_back(m/i);
		}
	}
	sort(divi.begin(),divi.end());
	ll res=-1;
	for(ll i=0;i<divi.size();i++){
		if(divi[i]<=m/n){
			res=i;
		}
	}
	if(n==1){
		cout<<m<<endl;
	}else if(res==-1){
		cout<<"1"<<endl;
	}else{
		cout<<divi[res]<<endl;
	}
	return 0;
}
		
		

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

int main() {
  int N,K;
  cin>>N>>K;
  ll sum = 0;
  vector<int> h(N);
  for(int i=0; i<N; i++){
    cin>>h.at(i);
  }
  sort(h.begin(),h.end());
  reverse(h.begin(),h.end());
  if(K>=N) cout<<0<<endl;
  else{
  	for(int i=K; i<N; i++){
    	sum+=h.at(i);
    }
    cout<<sum<<endl;
  }
}

Measured memory_bytes: 3988
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

using namespace std;

int main()
{
    int n;
    char s[100];
    char t[100];
    
    cin >> n;
    for (int i = 0;i < n;i++){
        cin >> s[i];
    }
    for (int i = 0;i < n;i++){
        cin >> t[i];
    }
    
    for (int i = 0;i < n;i++){
        cout << s[i] << t[i];
    }
    printf("\n");
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vvl = vector<vector<ll>>;
using vl  = vector<ll>;
#define _GLIBCXX_DEBUG
#define acc_io cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(ll i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
#define DBG(a,b,c,d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
const ll MOD = 1000000007;
const double PI = acos(-1);  
//name[i]   -> vl  name(i)
//name[i][j]-> vvl name(i,vl(j))
//or-> ||
//map<int,int>mp

ll n;
//ll ans;
string s;
signed main(){
	acc_io;
	cin>>n;
	int one=n%10;
	if(one==3){
		s="bon";
	}
	else if(one==1){
		s="pon";
	}
	else if(one==6){
		s="pon";
	}
	else if(one==8){
		s="pon";
	}
	else if(one==0){
		s="pon";
	}
	else{
		s="hon";
	}
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 3652
#include<stdio.h>
#include<string.h>
int main(void){
    int n=0,i;
    char T[100]={},H[100]={};
    int scoreT=0,scoreH=0,sT,sH,max,count=0;
    scanf("%d",&n);
    while(scanf("%s %s",T,H)==2){
        if(count==n){ 
            printf("\n");
            break;
        }
        count++;
          sT=strlen(T);
          sH=strlen(H);
          if(sT>=sH) max=sT;
          else max=sH;
          if(strcmp(T,H)>0){
                  scoreT+=3; 
              }
              else if(strcmp(T,H)<0){
                   scoreH+=3; 
              }
              else if(strcmp(T,H)==0){//引き分け
            scoreT++;
            scoreH++;
        }
        max=0;
    }
    printf("%d %d\n",scoreT,scoreH);
    return 0;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

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


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a,b;
    cin >> a >> b;
    if(a < 10 && b < 10 ) cout << a*b << "\n";
    else cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
// I can't tell you what it really is,
// I can only tell you what it feels like.
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define F first
#define S second
#define sz(x) (int)x.size() - 1
#define rep(i,a,n) for (int i = a; i <= n; ++i)
#define fo(i, n)   for (int i = 1; i <= n; ++i)
#define all(v)  v.begin(), v.end()
#define pb push_back
#define P pair < int, int >
#define E cout << '\n'

const int mod = 1e9 + 7;
const int N = 3e5 + 5;
int pre[N];
inline void solve() {
     int n, q, l, r;
     cin >> n >> q;
     string s;
     cin >> s;
     for(int i = 0; i < n; ++i) {
         if(s[i] == 'A' && i + 1 < n && s[i+1] == 'C')
             pre[i + 1] = 1;
     }
     fo(i, n)
         pre[i] += pre[i-1];
    while(q--) {
        cin >> l >> r;
        cout << abs(pre[l-1] - pre[r-1]) << '\n';
    }
}

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


Measured memory_bytes: 1488
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int x;
  cin >> x;
  int ans = 1;
  rep2(i, 2, x){
    int add = i*i;
    if(add > x) continue;
    while(1){
      if((add*i) > x){
        break;
      }
      add *= i;
    }
    ans = max(ans, add);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define de cout<<"debuglandınız\n";
ll int n,i;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin >> n;
	vector<int> v(n),dp(n);
	for(i=0;i<n;i++)cin>>v[i];
	dp[0]=0;
	dp[1]=abs(v[1]-v[0]);
	for(i=2;i<n;i++){
		dp[i]=min(dp[i-2]+abs(v[i-2]-v[i]), dp[i-1]+abs(v[i-1]-v[i]));
	}
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 1152
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iterator>
#include <fstream>
#include <math.h>

#include <random>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <list>
#include <bitset>
#include <unordered_set>
#include <unordered_map>

#include <random>
#include <ctime>

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define FOR(i, from, to) for (int i = from; i < to; i++)
#define ROF(i, from, to) for (int i = from; i > to; i--)

const long double PI = 3.141592653589793238463;
const int INF = 0x3f3f3f3f;
const int INFS = 1000000000;
const ll M = 1000000007;
const ll LLINF = 1000000000000000000;
const double EPS = 1e-8;

#define int long long

int ans = 0, k;
vector<vector<int> > tree;
vector<int> mxd, d;

void dfs1(int v, int cd) {
    d[v] = cd;
    mxd[v] = cd;
    for (auto u : tree[v]) {
        dfs1(u, cd + 1);
        mxd[v] = max(mxd[v], mxd[u]);
    }
}

void dfs2(int v, int prev) {
    for (auto u : tree[v])
        dfs2(u, v);
    mxd[v] = d[v];
    for (auto u : tree[v])
        mxd[v] = max(mxd[v], mxd[u]);
    if (prev == 0)
        return;
    if (mxd[v] - d[v] == k - 1) {
        ++ans;
        mxd[v] = d[prev];
    }
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n >> k;
    tree.resize(n);
    mxd.resize(n);
    d.resize(n);
    vector<int> a(n);
    cin >> a[0];
    --a[0];
    if (a[0] != 0)
        ++ans;
    FOR(i, 1, n) {
        cin >> a[i];
        --a[i];
        tree[a[i]].push_back(i);
    }
    dfs1(0, 0);
    dfs2(0, 0);
    cout << ans << "\n";

    return 0;
}


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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
int mp[200009];
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n-1;i++)
    {
        int a;
        cin>>a;
        mp[a]++;
    }
    for(int i=1;i<=n;i++)
        cout<<mp[i]<<"\n";

}


Measured memory_bytes: 4416
#include<cstdio>
#include<vector>

using namespace std;

char input[30000];
vector<int> res, resr;

char *p;

int sur(void) {
    int d=1,res=1;

    for(p++; *p && d; p++) {
        switch(*p) {
            case '\\':
                d++;
                break;
            case '/':
                d--;
                break;
            case '_':
                break;
        }
        res += d;
    }
    if(d) return -1;
    return res;
}
int surr(void) {
    int d=1,res=1;

    for(p--; *p && d; p--) {
        switch(*p) {
            case '\\':
                d--;
                break;
            case '/':
                d++;
                break;
            case '_':
                break;
        }
        res += d;
    }
    if(d) return -1;
    return res;
}

int main(void) {
    int sum=0;

    scanf("%s", input);

    p = input;

    char *last=p;
    while(true){
        while(*p && (*p++ != '\\'));
        if(!*p) break;
        p--;

        int r=sur();
        if(r==-1) break;
        last=p;
        res.push_back(r);
    }
    p--;
    while(true){
        while(*p && (*p-- != '/'));
        if(!*p || p<last) break;
        p++;

        int r=surr();
        if(p<last) break;
        resr.push_back(r);
    }

    for(vector<int>::iterator it = res.begin(); it != res.end(); it++)
        sum += *it;
    for(vector<int>::iterator it = resr.begin(); it != resr.end(); it++)
        sum += *it;
    printf("%d\n", sum);

    printf("%d", res.size() + resr.size());
    for(vector<int>::iterator it = res.begin(); it != res.end(); it++)
        printf(" %d", *it);
    for(vector<int>::reverse_iterator it = resr.rbegin(); it != resr.rend(); it++)
        printf(" %d", *it);
    printf("\n");

    return 0;


}

Measured memory_bytes: 1080
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

   int a,b;
   cin >> a >> b;
   int ans = 1;
   int cnt = 0;
   while(ans<b){
      ans--;
      ans += a ;
      cnt++;
   }

   cout << cnt << endl;

   return 0;
}

Measured memory_bytes: 384
#include <cstdio>
const int maxn = 200010;
const int maxm = 1000010;

int a[maxn];
int f[maxm];

int main() {
  static int n, ans;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  for (int i = 1; i <= n; ++i) f[a[i]]++;
  for (int i = 1000000; i; --i) if (f[i]) {
    for (int j = i + i; j <= 1000000; j += i) {
      f[j] += f[i];
    }
  }
  for (int i = 1; i <= n; ++i) ans += (f[a[i]] == 1);
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 6408
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
sumA = sum(A)
counter = Counter(A)
Q = int(input())
for i in range(Q):
    B, C = map(int, input().split())
    sumA += (counter[B]*C-counter[B]*B)
    counter[C] += counter[B]
    counter[B] = 0
    print(sumA)
    

Measured memory_bytes: 94028
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <utility>
#include <cmath>
using namespace std;

typedef long long ll;

int main(){
  int n; cin >> n;
  int a[n+2];
  a[0] = 0; a[n+1] = 0;
  for(int i=1; i<=n; i++){
    cin >> a[i];
  }

  bool flag[n+1];
  ll all=abs(a[1]-a[0]);
  for(int i=1; i<=n; i++){
    if((a[i]-a[i-1])*(a[i+1]-a[i])<0) flag[i]=true;
    else flag[i]=false;

    all += abs(a[i+1]-a[i]);
  }

  for(int i=1; i<=n; i++){
    if(flag[i]){
      cout << all-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1]) << endl;
    }
    else cout << all << endl;
  }

  return 0;
}


Measured memory_bytes: 1664
#include<stdio.h>
main(){
  int n,a,b,c,d,cou=0;
  while(scanf("%d",&n) != EOF){;
    for(a=0;a<10;a++){
      for(b=0;b<10;b++){
	for(c=0;c<10;c++){
	  for(d=0;d<10;d++){
	    if(a+b+c+d == n){
	      cou++;
	    }
	  }
	}
      }
    }
    printf("%d\n",cou);
    cou = 0;
  }
  return 0;
}

Measured memory_bytes: 596
import java.util.*;
class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[][][] oh = new int[4][3][10];
		for (int i=0; i<n; i++) {
			int b = stdIn.nextInt()-1;
			int f = stdIn.nextInt()-1;
			int r = stdIn.nextInt()-1;
			int v = stdIn.nextInt();
			oh[b][f][r] += v;
		}
		for (int i=0; i<4; i++) {
			for (int j=0; j<3; j++) {
				for (int k=0; k<10; k++) {
					System.out.print(" "+oh[i][j][k]);
				}
				System.out.println();
			}
			if(i<3)
				System.out.println("####################");
		}
	}
}

Measured memory_bytes: 21052
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std;

int main()
{
	int x, y, z, num;
	scanf("%d %d %d",&x,&y,&z);
	num = x / (y + z);
	if(num * (y + z) + z > x)
		printf("%d",num - 1);
	else
		printf("%d",num);
}


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

const MOD: usize = 1_000_000_007;

fn main() {
    let n: usize = read();
    let m: usize = read();
    let a: Vec<usize> = (0..m).map(|_| read()).collect();

    let mut dp: Vec<usize> = vec![0; n+1];
    dp[0] = 1;
    dp[1] = 1;
    if n > 1 {
        dp[2] = 2;
    }
    for i in 3..n+1 {
        dp[i] = dp[i-1] + dp[i-2];
        dp[i] %= MOD;
        //println!("{}", dp[i]);
    }

    if m == 0 {
        println!("{}", dp[n]);
        return;
    }

    let mut ok = true;
    for i in 0..m-1 {
        if a[i+1] - a[i] == 1 {
            ok = false;
        }
    }
    if !ok {
        println!("0");
        return;
    }

    let mut ans: usize = 1;
    if a[0] > 1 {
        ans = dp[a[0]-1];
    }
    for i in 1..m {
        if a[i] > a[i-1] + 1 {
            ans *= dp[a[i] - a[i-1]-2];
            ans %= MOD;
        }
    }
    ans *= dp[n-1 - a[m-1]];
    ans %= MOD;
    println!("{}", ans);
}

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


Measured memory_bytes: 6396
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<math.h>
#include<string>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1ll<<60;

using namespace std;
typedef pair<int, int> P;

int main(){
   int a, b;
   char op;
   cin >> a >> op >> b;
   if(op=='+')out(a+b);
   else out(a-b);
}

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

struct node {
	int id, score;
};
bool operator<(node a, node b) {
	if (a.score == b.score)return a.id > b.id;
	return a.score < b.score;
}
int s[100000], cnt[100000];
int d[1000000], t[1000000], x[1000000];
int main() {
	int n, r, l; scanf("%d%d%d", &n, &r, &l);
	priority_queue<node>que;
	rep(i, r)scanf("%d%d%d", &d[i], &t[i], &x[i]);
	rep(i, r) {
		d[i]--;
		s[d[i]] += x[i];
		que.push({ d[i],s[d[i]] });
		while (!que.empty() && que.top().score != s[que.top().id])que.pop();
		if (i == r - 1)cnt[que.top().id] += l - t[i];
		else cnt[que.top().id] += t[i + 1] - t[i];
	}
	printf("%d\n", max_element(cnt, cnt + n) - cnt + 1);
}

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

int main(){
  unsigned int k;
  cin >> k;
  vector<ll> a;
  for(int i=1;i<=9;++i) a.push_back(i);
  while(1){
    vector<ll> pre_a;
    if(k<=a.size())break;
    k-=a.size();
    swap(pre_a,a);
    for(ll j:pre_a){
      for(ll i=-1;i<=1;++i){
        ll m=j%10+i;
        if(m<0||9<m) continue;
        ll n=j*10+m;
        a.push_back(n);
      }
    }
  }
  cout << a[k-1] << endl;
  return 0;
}

Measured memory_bytes: 4684
#define _USE_MATH_DEFINES  // M_PI等のフラグ

#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <vector>
#include <list>

#define MOD 1000000007
#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))

using namespace std;


void solve(){
    int N;
    cin >> N;

    map<string, int> mp;
    mp["AC"] = 0;
    mp["WA"] = 0;
    mp["TLE"] = 0;
    mp["RE"] = 0;

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

    // 出力
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
}

int main(int argc, char const *argv[]){
    solve();
    return 0;
}

Measured memory_bytes: 3624
use std::io::*;
use std::str::FromStr;
use std::collections::HashMap;

fn main() {
    let n: usize = read();
    let s: Vec<char> = read::<String>().chars().collect();

    let mut map: HashMap<(Vec<char>, Vec<char>), usize> = HashMap::new();
    for i in 0..(1<<n) {
        let mut pair: (Vec<char>, Vec<char>) = (Vec::new(), Vec::new());
        for j in 0..n {
            if (i >> j) & 1 == 1 {
                pair.0.push(s[j]);
            } else {
                pair.1.push(s[j]);
            }
        }
        let count = map.entry(pair).or_insert(0);
        *count += 1;
    }

    let mut ans = 0;
    for i in 0..(1<<n) {
        let mut pair: (Vec<char>, Vec<char>) = (Vec::new(), Vec::new());
        for j in 0..n {
            let k = 2 * n - j - 1;
            if (i >> j) & 1 == 1 {
                pair.0.push(s[k]);
            } else {
                pair.1.push(s[k]);
            }
        }
        if let Some(&po) = map.get(&pair) {
            ans += po;
        }
    }
    println!("{}", ans);
}

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


Measured memory_bytes: 75932
import java.util.Scanner;

public class Main{
	static int H, W;
	static char[][] map;

	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		H = scn.nextInt();
		W = scn.nextInt();
		map = new char[H][W];
		boolean ans = true;

		scn.nextLine();
		for (int i = 0; i < H; i++) {
			map[i] = scn.nextLine().toCharArray();
		}
		for (int i = 0; i < H; i++) {
			if(!ans)break;
			for (int j = 0; j < W; j++) {
				ans &= check(i,j);
			}
		}
		System.out.println(ans?"Yes":"No");
	}

	public static boolean check(int h, int w) {
		if (map[h][w] == '#') {
			boolean ans = false;
			if(h!=0)ans |= map[h-1][w] == '#';
			if(h!=H-1)ans |= map[h+1][w] == '#';
			if(w!=0)ans |= map[h][w-1] == '#';
			if(w!=W-1)ans |= map[h][w+1] == '#';
			return ans;

		} else {
			return true;
		}

	}
}


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

public class Program
{
	public static void Main(string[] args)
	{
		int[] intArray = new int[3];
		intArray = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).ToArray();
		double c =Math.Sqrt(Math.Pow(intArray[0],2)+Math.Pow(intArray[1], 2)-intArray[0]*intArray[1]*2*Math.Cos(intArray[2]* (Math.PI / 180)));
		Console.WriteLine(intArray[0] * intArray[1] * Math.Sin(intArray[2]* (Math.PI / 180))/2);
		Console.WriteLine(intArray[0]+intArray[1]+c);
		Console.WriteLine(intArray[1]*Math.Sin(intArray[2]* (Math.PI / 180)));

		//var ss = new StreamScanner();
		//---------------------------------
		//????????????int, double, string?????????????????£????????????


		//int x = ss.Next<int>();
		//double d = ss.Next<double>();
		//string s = ss.Next<string>();

		//?????°???????????????????????¨?????????????????????????????????????????????????´???????
		//int[] array = ss.Next<int>(10);
		//---------------------------------

	}
}
public class StreamScanner
{
	private readonly char[] _c = { ' ' };
	private int _index = -1;
	private string[] _input = new string[0];
	private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

	public T Next<T>()
	{
		if (_index == _input.Length - 1)
		{
			_index = -1;
			while (true)
			{
				string rl = _sr.ReadLine();
				if (rl == null)
				{
					if (typeof(T).IsClass) return default(T);
					return (T)typeof(T).GetField("MinValue").GetValue(null);
				}
				if (rl != "")
				{
					_input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
					break;
				}
			}
		}
		return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
	}

	public T[] Next<T>(int x)
	{
		var ret = new T[x];
		for (var i = 0; i < x; ++i) ret[i] = Next<T>();
		return ret;
	}

	public T[][] Next<T>(int x, int y)
	{
		var ret = new T[y][];
		for (var i = 0; i < y; ++i) ret[i] = Next<T>(x);
		return ret;
	}
}

Measured memory_bytes: 9688
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std ;
int main () {
    int n,a,b;
    cin >> n >> a >> b;
    if(n == 2){
        cout << a+b << endl;
    }else{
        cout << "Hello World" << endl;
    }
    return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */
int DBG = 1;										/* デバッグプリント 提出時は0 */
/* main *************************************************************/
int main()
{
	int		a,b,c,i,j,k,n,m,x,y,ans = 0, p[51];
	char	str[256];
	
	scanf("%d", &n);
	for(i=1;i<=n;i++) scanf("%d",&p[i]);

	for(i=1;i<=n;i++) 
		if (p[i] != i) ans++;
	
	if (ans <=2 ) printf("YES\n");
	else printf("NO\n");


	return 0;
}


Measured memory_bytes: 128
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_5_A
#include <iostream>
using namespace std;
int main(){
  int H, W;
  while (cin >> H >> W) {
    if(H == 0 && W == 0){
      break;
    }
    else{
      for(int j = 0; j < H; j++){
        for(int i = 0; i < W; i++){
          cout << "#";
        }
        cout << endl;
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 1152
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>

using namespace std;
typedef long long int ll;

#define C(I) cout<<(I)<<endl

ll n,m,a,b,c,x,y,z,aa[100010],ba[100010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1000][1000];
vector<ll> va,vb,vc;


int main(){
    cin>>n;
    m=0;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        m+=abs(a-b)+1;
    }
    C(m);
    
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int lcd(int a,int b){
	if(a<b) swap(a,b);
	while(b){
		int t = a%b;
		a = b;
		b = t;
	}
	return a;
}
int main(){
	int n;
	cin>>n;
	int arr[100005];
	for(int i=1; i<=n; i++) cin>>arr[i];
	int left[100005];
	left[1] = arr[1];
	for(int i=2; i<=n; i++){
		left[i] = lcd(left[i-1],arr[i]);
	}
	int right[100005];
	right[n] = arr[n];
	for(int i=n-1; i>=1; i--){
		right[i] = lcd(right[i+1],arr[i]);
	}
	int ret = max(right[2],left[n-1]);
	for(int i=2; i<n; i++){
		ret = max(ret,lcd(left[i-1],right[i+1]));
	}
	cout<<ret;
}

Measured memory_bytes: 4816
#include <stdio.h>

int main(){
	int in, sec, min, hour;
	scanf("%d", &in);
	
	// Set int
	sec = in % 60;
	min = (in - sec) % 3600 / 60;
	hour = (in - sec) / 3600;
	
	printf("%d:%d:%d\n", hour, min, sec);
	return 0;
}

Measured memory_bytes: 592
#include <stdio.h>

int main(void){
    int n;
    scanf("%d",&n);

    int judge=n%10;
    if(judge==2 || judge==4 ||judge ==5 || judge ==7 || judge==9){
        printf("hon\n");
    }else if(judge==3){
        printf("bon\n");
    }else{
        printf("pon\n");
    }
    return 0;
}


Measured memory_bytes: 1656
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n, q;
  cin >> n >> q;
  map<pair<int, int>, pair<int, int>> ymp;
  map<pair<int, int>, pair<int, int>> xmp;
  int r = n;
  int b = n;
rep(_q, q){
  int qe, x;
  cin >> qe >> x;
  if(qe == 1){
    if(x < r){
      ymp[{x+1, r}] = {b-2, 0};
      r = x;
    }else{
      // cerr << "t" << endl;
      auto itr = ymp.upper_bound({x, INT_MAX});
      itr--;
      if(itr != ymp.end()) itr->second.second++;
    }
  }else{
    if(x < b){
      xmp[{x+1, b}] = {r-2, 0};
      b = x;
    }else{
      // cerr << "z" << endl;
      auto itr = xmp.upper_bound({x, INT_MAX});
      itr--;
      if(itr != xmp.end()) itr->second.second++;
    }
  }
}
  ll ans = (ll)(b-2)*(r-2);
  // cerr << b << " " << r << endl;
  for(auto p : ymp){
    ll add = p.first.second - p.first.first - p.second.second;
    add *= (ll)p.second.first;
    ans += add;
    // // cerr << add << endl;
    // cerr << p.first.first << " " << p.first.second << " ";
    // cerr << p.second.first << " " << p.second.second << endl;
  }
  // cerr << endl << endl;
  for(auto p : xmp){
    ll add = p.first.second - p.first.first - p.second.second;
    add *= (ll)p.second.first;
    ans += add;
    // // cerr << add << endl;
    // cerr << p.first.first << " " << p.first.second << " ";
    // cerr << p.second.first << " " << p.second.second << endl;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 15976
#include <iostream>
#include <string>
#include <sstream>

int main(){
    std::string s;
    std::cin>>s;

    std::stringstream ss(s);
    std::string buffer;
    while(std::getline(ss,buffer,',')){
        std::cout<<buffer;
        std::cout<<" ";
    }
    std::cout<<std::endl;


}

Measured memory_bytes: 256
'use strict';
(function(stdin) {
  var line = stdin.split('\n');
  var param = line[0].split(' ').map(Number);
  var param = line[0].split(' ').map(Number);
  var result = (function(width,height,x,y,r) {
    return [
        y + r > height
        ,y - r < 0
        ,x - r < 0
        ,x + r > width
    ].some(function(v){
        return v;
    }) ? 'No' : 'Yes' ;
  }(
    param[0],param[1],param[2],param[3],param[4]
  ));
  console.log(result);
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 7384
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

int main() {
    string t;
    cin >> t;
    int n = t.size();
    rep(i,n) {
        if(t[i] == '?') t[i] = 'D';
    }
    cout << t << endl;
}


Measured memory_bytes: 3724
import itertools

# 2点間距離を求める
def length(a, b):
    x = (a[0] - b[0])**2
    y = (a[1] - b[1])**2
    
    return (x + y)**(1/2)

N = int(input())
zahyo = [tuple(map(int, input().split())) for _ in range(N)]

machi = [n for n in range(N)]

parms = list(itertools.permutations(machi, N))
ans = 0

for parm in parms:
    temp = 0
    for i in range(len(parm)-1):
        a = parm[i]
        b = parm[i+1]
        temp += length(zahyo[a], zahyo[b])
        
    ans += temp / len(parms)
    
print(ans)
        

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    cout << N*(N-1)/2 + M*(M-1)/2 << endl;
}

Measured memory_bytes: 256
let ans, c, h, w, a_s = Scanf.(scanf "%d %d %d" @@ fun h w n -> Array.(make_matrix h w 0, ref 0, h, w, init n @@ fun _ -> scanf " %d" (+) 0))
let rec f i = if a_s.(i) = 0 then f (i + 1) else (a_s.(i) <- a_s.(i) - 1; i)
let _ = for i = 0 to h - 1 do for j = 0 to w - 1 do c := f !c; ans.(i).(if i mod 2 = 1 then w - 1 - j else j) <- !c + 1 done done; Array.(iter (fun cs -> to_list cs |> List.map string_of_int |> String.concat " " |> print_endline) ans)

Measured memory_bytes: 2688
#include <cstdio>
bool d[1000000];
int c[999999];
int main() {
    int i,j,r=0,n;
	for(i=4;i<=999999;i+=2)d[i]=true;
    for(i=2;i*i<=999999;i++) {
        if(d[i])continue;
        for(j=i*2;j<=999999;j+=i)d[j]=true;
    }
	for(i=1;i<999999;i++) {
		c[i]=c[i-1];
		if(!d[i+1])c[i]++;
	}
    while(scanf("%d",&n)!=EOF) {
        printf("%d\n",c[n-1]);
    }
}

Measured memory_bytes: 5904
#include<iostream>
using namespace std;
#define ll long long
#define ull unsigned long long
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ull n,i,count=0;
	cin>>n;
	ull a[n];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(i=1;i<n-1;i++)
	{
		if((a[i]>a[i-1] && a[i]<a[i+1]) || (a[i]<a[i-1] && a[i]>a[i+1]))
		count++;
	}
	cout<<count;
	return 0;
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    COMinit();
    int N, P; cin >> N >> P;
    int md2[2] = {};
    ll pow2[50] = {1};
    rep(i, N){
        int a; cin >> a;
        md2[a%2]++;
    }
    rep(i, 50) pow2[i+1] = pow2[i]*2;
    ll acc = 0;
    if(P == 0){
        for(int i = 0; i <= md2[1]; i+=2) acc += COM(md2[1], i);
    }
    else{
        for(int i = 1; i <= md2[1]; i+=2) acc += COM(md2[1], i);
    }
    cout << acc*pow2[md2[0]] << endl;
    return 0;
}

Measured memory_bytes: 12160
#include<iostream>
#include<cstdio>
using namespace std;
int n,m;
int dp[1<<16][16];
int sum[1<<16];
int dis[16][16];
int all;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		x--;y--;
		dis[x][y]=dis[y][x]=z;
		all+=z;
	}
	for(int i=1;i<(1<<n);i++)
	{
		for(int j=0;j<n;j++)
		{
			if(i>>j&1)
			{
				for(int k=j+1;k<n;k++)
				{
					if(i>>k&1)
					{
						sum[i]+=dis[j][k];
					}
				}
			}
		}
	}
	for(int i=0;i<(1<<n);i++)
	{
		for(int j=0;j<n;j++)dp[i][j]=-1;
	}
	dp[1][0]=0;
	for(int i=1;i+1<(1<<n);i++)
	{
		for(int j=0;j<n;j++)
		{
			if(dp[i][j]==-1)continue;
			int st=((1<<n)-1)^i;
			if(dis[j][n-1])
			{
				dp[(1<<n)-1][n-1]=max(dp[(1<<n)-1][n-1],dp[i][j]+sum[st]+dis[j][n-1]);
			}
			for(int k=(st-1)&st;k;k=(k-1)&st)
			{
				if(k>>(n-1)&1)continue;
				dp[i|k][j]=max(dp[i|k][j],dp[i][j]+sum[(1<<j)|k]);
			}
			for(int k=0;k<n;k++)
			{
				if(k!=n-1 && !(i>>k&1) && dis[j][k])
				{
					dp[i|(1<<k)][k]=max(dp[i|(1<<k)][k],dp[i][j]+dis[j][k]);
				}
			}
		}
	}
	printf("%d",all-dp[(1<<n)-1][n-1]);
	return 0;
} 

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int main(){
	int a;
	cin>>a;
	
	int ans=a+a*a+a*a*a;
	
	cout<<ans<<endl;
}

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

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

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  string s; cin >> s;

  vector<int> w, r;
  REP(i, n) {
    if(s[i] == 'W') {
      w.push_back(i);
    } else {
      r.push_back(i);
    }
  }

  reverse(ALL(r));

  int pos1 = 0, pos2 = 0;
  int sz1 = SZ(w), sz2 = SZ(r);

  int cnt = 0;
  while(pos1 < sz1 && pos2 < sz2) {
    if(w[pos1] < r[pos2]) {
      cnt++;
      pos1++;
      pos2++;
    } else {
      break;
    }
  }
  cout << cnt << endl;

}








Measured memory_bytes: 4812