akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, q;
ll tim = 0;
queue<string> Q;
map<string, int> M;

void Init() {
	scanf("%d %d", &n, &q);
	string name;
	int time;
	while (n--) {
		cin >> name >> time;
		M[name] = time;
		Q.push(name);
	}
}
void solve() {
	while (!Q.empty()) {
		string s = Q.front();
		if (M[s] <= q) {
			tim += M[s];
			Q.pop();
			cout << s<<" "<<tim << endl;
		}
		else {
			tim += q;
			M[s] -= q;
			Q.pop();
			Q.push(s);
		}
	}
}
int main() {
	Init();
	solve();

	return 0;
}



Measured memory_bytes: 9016
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
const int N = 200200;
int n, a[N], tmp[N], ans; 
bool check(int x) {
	for(int i = 1; i <= 2 * n - 1; i++) tmp[i] = ( a[i] >= x );
	int l, r; l = r = n;
	for( ; l >= 1; l--, r++) {
		if(tmp[l] == tmp[l + 1]) return tmp[l];
		if(tmp[r] == tmp[r - 1]) return tmp[r];
	}
	return tmp[n] ^ (n & 1) ^ 1;
}
int main() {
    scanf("%d", &n);
    for(int i = 1; i <= 2 * n - 1; i++) 
        scanf("%d", &a[i]);
    int l = 1, r = 2 * n;
    while(l <= r) {
    	int mid = (l + r) / 2;
    	if(check(mid)) l = mid + 1, ans = mid;
    	else r = mid - 1;
	}
	printf("%d\n", ans);
	return 0;
}

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

int main(){

  string str;
  getline(cin, str);

  for(int i=0;i<str.size();i++){
    if('a' <= str[i] && str[i] <= 'z'){
      str[i] += 'A' - 'a';
    }
  }

  cout << str << endl;
}


  

Measured memory_bytes: 1172
import math
x = int(input())

def using_sqrt(k):
    factor = 0
    
    # 2以外の偶数は素数ではないので無視する
    if k % 2 == 0 and k != 2:
        return False
    
    # 繰り返しの上限を対象の平方根にする
    for divisor in range(2, math.floor(math.sqrt(k))+1):
        if k % divisor == 0:
            factor += 1
            
    if factor == 0:
        return True
    else:
        return False
            

for i in range(x,110001):
    if using_sqrt(i):
        print(i)
        break

Measured memory_bytes: 3060
#include <cassert>
#include <cstdio>
#include <vector>
#include <set>

#include <map>
#include <unordered_map>
#include <deque>
#include <string>
#include <utility>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <climits>

using namespace std;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

// const int INF = 1e9;
// const long long LINF = 1e18;

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

    printf("%f\n", 2.0 * 3.14159265359 * R);

    return 0;
}


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

int main(){
	int a;
  	string s;
  	cin >> a >> s;
  
  	if(a >= 3200) cout << s << endl;
  	else cout << "red" << endl;
}

Measured memory_bytes: 3548
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>

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

using namespace std;

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 N, K;
int xs[100];

int main() {
    cin >> N >> K;
    rep(i, N) cin >> xs[i];

    int ans = 0;
    for (int i = 0; i < N; i++) {
        int x = xs[i];
        int a = abs(x) * 2;
        int b = abs(K - x) * 2;
        ans += min(a, b);
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')

def main():
  a, b = map(int, readline().split())
  if (a+b)%2==0:
    print(int((a+b)/2))
  else:
    print('IMPOSSIBLE')
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 5076
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        public static void Main(string[] args)
        {
            var x = ReadLineIntSpilit();
            var result = "A";

            if(Math.Abs(x[0]-x[1]) > Math.Abs(x[0] - x[2])){
                result = "B";
            }

            Console.WriteLine(result);
            ReadLine();
        }

        /// <summary>
        /// stringを一文字ずつintにキャストして配列に変換します。
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static int[] StringCharArrayIntArray(string str)
        {
            List<int> b = new List<int>();
            for (int i = 0; i < str.Length; i++) {
                b.Add( int.Parse(str[i].ToString()));
            }
            return b.ToArray();
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }

        public static int ReadLineInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static string[] ReadLineStringSplit(char a = ' ')
        {
            return ReadLine().Split(a).ToArray();
        }

        public static int[] ReadLineIntSpilit(char a = ' ')
        {
            return ReadLine().Split(a).Select(x => int.Parse(x)).ToArray();
        }
    }
}

Measured memory_bytes: 13396
#include<iostream>

#include<cstdio>

#include<algorithm>

using namespace std;

int main()

{

	int N, K, a[100005], cnt = 0;	cin >> N >> K;

	for (int i = 0; i < N; i++)

	{

		cin >> a[i];

		if (a[i] >= K)

			cnt++;

	}

	cout << cnt << endl;

	return 0;

}

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

int main ()
{
	string s,t;  cin>>s>>t;
	int a,b;  cin>>a>>b;
	string u;  cin>>u;
	
	if(u==s){
		cout<<a-1<<" "<<b<<endl;
	}
	else{
		cout<<a<<" "<<b-1<<endl;
	}


}



Measured memory_bytes: 3624
// #pragma GCC optimize(2)
// #pragma G++ optimize(2)
// #pragma comment(linker,"/STACK:102400000,102400000")

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

typedef long long int64;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef float fl;
typedef double dl;
typedef pair<int,int> pii;
#if (WIN32) || (WIN64) || (__WIN32) || (__WIN64) || (_WIN32) || (_WIN64) || (WINDOWS)
#define lld "%I64d"
#define llu "%I64u"
#else
#define lld "%lld"
#define llu "%llu"
#endif
#define uint(n) ((unsigned int)(n))
#define int64(n) ((long long)(n))
#define ull(n) ((unsigned long long)(n))
#define fl(n) ((float)(n))
#define dl(n) ((double)(n))
#define char(n) ((char)(n))
#define Bool(n) ((bool)(n))
#define fixpoint(n) fixed<<setprecision(n)

const int INF=1061109567;
const int NINF=-1044266559;
const int64 LINF=4557430888798830399;
const dl eps=1e-15;
#define MOD (1000000007)
#define PI (3.1415926535897932384626433832795028841971)

#define MP make_pair
#define MT make_tuple
#define All(a) (a).begin(),(a).end()
#define pall(a) (a).rbegin(),(a).rend()
#define Log(x,y) log(x)/log(y)
#define SZ(a) ((int)(a).size())
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define rep1(i,n) for(int i=1;i<=((int)(n));i++)
#define repd(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define repd1(i,n) for(int i=((int)(n));i>=1;i--)
#define repv(itr,v) for(__typeof((v).begin()) itr=(v).begin();itr!=(v).end();itr++)
#define repV(i,v) for(auto i:v)
#define repE(i,v) for(auto &i:v)
#define MS(x,y) memset(x,y,sizeof(x))
#define MC(x) MS(x,0)
#define MINF(x) MS(x,63)
#define MCP(x,y) memcpy(x,y,sizeof(y))
#define UN(v) sort(All(v)),v.erase(unique(All(v)),v.end())
#define filein(x) freopen(x,"r",stdin)
#define fileout(x) freopen(x,"w",stdout)
#define fileio(x)\
	freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout)
#define filein2(filename,name) ifstream name(filename,ios::in)
#define fileout2(filename,name) ofstream name(filename,ios::out)
#define fileio2(filename,name) fstream name(filename,ios::in|ios::out)
#define sqr(x) ((x)*(x))
#define Pause system("pause")
#define Cls system("cls")
#define fs first
#define sc second
#define SF scanf
#define PF printf

const int maxn=110;

int n,d[maxn][2];

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

	int ans=0;
	for(int i=1;i<=n-2;i++) if(d[i][0]==d[i][1]&&d[i+1][0]==d[i+1][1]&&d[i+2][0]==d[i+2][1]) ans++;
	cout<<(ans?"Yes":"No");

	return 0;
}

Measured memory_bytes: 3480
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function euc(a,m)
	b = m
	x = 1
	u = 0
	while b>0
		q = div(a,b)
		tmp = u
		u = x-q*u
		x = tmp
		tmp = b
		b = a-q*b
		a = tmp
	end
	x<0?x+abs(m):x
end

function main()
	p = 10^9+7
	n,a,b,c = readline() |> split |> parseMap
	s = 0
	ar = zeros(Int,n+1)
	br = zeros(Int,n+1)
	hr = zeros(Int,2*n)
	u = euc(a+b,p)
	ar[1]=1
	br[1]=1
	hr[1]=1
	for i in 1:n
		ar[i+1] = ar[i]*a%p
		br[i+1] = br[i]*b%p
	end
	for i in 1:2*n-1
		hr[i+1] = hr[i]*u%p
	end
	ncr = 1
	for m in n:2*n-1
		s = (s+(ncr*m)%p*(ar[n+1]*br[m-n+1]%p+ar[m-n+1]*br[n+1]%p)%p*hr[m+1]%p)%p
		ncr = (ncr*euc(m-n+1,p)%p)*m%p
	end
	t = euc(100-c,p)*100%p
	println(s*t%p)
end
main()

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

int main() {
	int a[5];
	while(cin >> a[0], a[0]) {
		for(int i = 1; i < 5; i++)
			cin >> a[i];
		int b[3] = {};
		for(int i = 0; i < 5; i++)
			b[a[i]-1] = 1;
		int c = b[0] + b[1] + b[2];
		if(c != 2) {
			for(int i = 0; i < 5; i++)
				cout << 3 << endl;
		}
		else {
			int none;
			for(int i = 0; i < 3; i++)
				if(b[i] == 0)
					none = i;

			for(int i = 0; i < 5; i++) {
				if((none-(a[i]-1)+3)%3 == 1) {
					cout << 2 << endl;
				}
				else {
					cout << 1 << endl;
				}
			}
		}
	}
}

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



public class Main {
	public static boolean isNumber(String s) {
		try {
			Long.parseLong(s);
			return true;
		} catch (NumberFormatException e) {
			return false;
		}
	}
	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		List<Long> list = new ArrayList<>();
		while (sc.hasNext()) {
			String s = sc.next();
			if(isNumber(s)) {
				long a = Long.parseLong(s);
				list.add(a);
			} else if(s.equals("+")) {
				long b = list.get(list.size() - 2) + list.get(list.size() - 1);
				list.remove(list.size() - 1);
				list.set(list.size() - 1, b);
			} else if(s.equals("-")) {
				long b = list.get(list.size() - 2) - list.get(list.size() - 1);
				list.remove(list.size() - 1);
				list.set(list.size() - 1, b);
			} else {
				long b = list.get(list.size() - 2) * list.get(list.size() - 1);
				list.remove(list.size() - 1);
				list.set(list.size() - 1, b);
			}
		}
		System.out.println(list.get(0));
		sc.close();
	}

}



Measured memory_bytes: 26236
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <time.h>
#include <queue>
#include <stdarg.h>
#include <map>
#include <vector>
#include <algorithm>
#include <stack>
#include <iostream>
#include <numeric>
#include <set>

#define ll long long

using namespace std;

ll mod = 1e9 + 7;

void
solve() {
  ll n, k;
  cin>>n>>k;

  ll x, zero = 0;
  vector<ll> left, right;
  for (ll i=0; i<n; i++) {
    cin>>x;
    if (x < 0) 
      left.push_back(x);
    else if (x == 0)
      zero++;
    else
      right.push_back(x);
  }

  bool positive = true;
  if (k % 2 && right.size() == 0) {
    positive = false;
  }
  else {
    ll l = left.size() / 2 * 2;
    ll r = right.size();
    if (k % 2)
      r--;
    r = r / 2 * 2;
    if (r + l < (k / 2 * 2))
      positive = false;
  }

  if (positive) {
    sort(left.begin(), left.end());
    sort(right.rbegin(), right.rend());

    ll ans = 1;
    ll a = 0;
    if (k % 2) {
      k--;
      ans = right[0];
      a = 1;
    }

    priority_queue<ll> data;
    for (ll i=0; i+1<left.size(); i+=2)
      data.push(left[i]*left[i+1]);
    for (ll i=a; i+1<right.size(); i+=2)
      data.push(right[i]*right[i+1]);

    while (k > 0) {
      auto p = data.top();
      data.pop();

      p %= mod;
      ans *= p;
      ans %= mod;
      k -= 2;
    }
    cout<<ans<<endl;
  }
  else if (zero > 0) {
    cout<<0<<endl;
  }
  else {
    sort(left.rbegin(), left.rend());
    sort(right.begin(), right.end());

    ll a = 0;
    ll ans = left[0];
    if (k % 2 == 0) {
      a = 1;
      k -= 2;

      ans *= right[0];
      ans %= mod;
      ans += mod;
      ans %= mod;
    }
    else {
      k -= 1;
    }

    priority_queue<ll, vector<ll>, greater<ll>> data;
    for (ll i=1; i+1<left.size(); i+=2)  {
      data.push(left[i] * left[i+1]);
      //cout<<left[i]<<"->"<<left[i+1]<<endl;
    }
    for (ll i=a; i+1<right.size(); i+=2) {
      data.push(right[i] * right[i+1]);
      //cout<<right[i]<<"->"<<right[i+1]<<endl;
    }

    while (k > 0) {
      auto p = data.top();
      data.pop();
      
      p %= mod;
      ans *= p;
      ans %= mod;
      ans += mod;
      ans %= mod;
      k -= 2;
    }
    cout<<ans<<endl;
  }
}

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

  int t = 1;
  //cin>>t;

  while (t > 0) {
    t--;
    solve();
  }

  return 0;
}



Measured memory_bytes: 6604
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
#include <deque>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

const int SIGDIGIT = 10010;
struct LongFloat2 {
  ll integer;
  vector<char> fractional;
  LongFloat2(int a = 0) : integer(a), fractional(SIGDIGIT) {}
  char operator[](int index) const { return fractional[index]; }
  char &operator[](int index) { return fractional[index]; }

  LongFloat2 operator+(const LongFloat2 &rhs) const {
    LongFloat2 lhs = *this;
    int c = 0;
    for (int i = SIGDIGIT-1; i>=0; --i) {
      int s = lhs[i]+rhs[i]+c;
      lhs[i] = s % 10;
      c = s / 10;
    }
    lhs.integer += rhs.integer+c;
    return lhs;
  }
  LongFloat2 operator/(ll rhs) const {
    LongFloat2 lhs = *this;
    ll a = lhs.integer;
    lhs.integer = a/rhs;
    a = a % rhs * 10;
    REP(i, SIGDIGIT) {
      a += lhs[i];
      lhs[i] = a/rhs;
      a = a%rhs * 10;
    }
    return lhs;
  }
  string toString() const {
    ostringstream os;
    os << integer << ".";
    FOR(it, fractional) os << (int)*it;
    return os.str();
  }
  LongFloat2 round(int r) const {
    LongFloat2 ret;
    ret[r] = 5;
    ret = *this + ret;
    return ret;
  }
};

LongFloat2 mydiv(ll a, ll b) {
  ll d = 0;
  LongFloat2 ret(a/b);
  a = a%b*10;
  REP(i, SIGDIGIT) {
    ret[i] = a/b;
    a = a%b * 10;
  }
  return ret;
}

ostream &operator<<(ostream &os, const LongFloat2 &rhs) {
  os << rhs.toString();
  return os;
}

int main() {
  int n,k,m,r;
  while(cin>>n>>k>>m>>r, n||k||m||r) {
    LongFloat2 ans = mydiv(1,n);
    if (m) {
      LongFloat2 sum;
      for (int i=1; i<n; ++i) {
        sum = sum + mydiv(1,i);
      }
      ans = ans + sum / n;
    }
    ans.round(r);
    string a = ans.toString();
    cout << a.substr(0, r+2) << endl;
  }
}

Measured memory_bytes: 1000
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<=n;++i)
string s;
int main(){
  int n;
  cin>>s;
  n=(int)s.length();
  vector<ll> a(n+1);
  a[0]=0;
  rep1(i,n){
    if(s[i-1]=='<')a[i]=a[i-1]+1;
    if(s[i-1]=='>')a[i]=0;
  }
  for(int i=n-1;i>=0;i--){
    if(s[i]=='>')a[i]=max(a[i],a[i+1]+1);
  }
  ll sum=0;
  rep(i,n+1)sum+=a[i];
  cout<<sum<<endl;
  return 0;
}


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

const int MAX_N = 200005;

int N, num,u,v,L,R;
long long ans,w, A[MAX_N], Answer[MAX_N], pref[MAX_N][2];
bool used[MAX_N];
priority_queue<pair<long long, pair<int, int>>> pq;
set<int> unused;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> N;
	for (int i = 1; i <= N; i++)
	{
		cin >> A[i];
	}

	for (int i = 1; i <= N; i++)
	{
		pq.push({ A[i], {i, i + 1} });
	}

	for (int i = 0; i <= N + 2; i++)
	{
		unused.emplace(i);
	}

	for (int i = 1; i <= N + 2; i++)
	{
		pref[i][0] = pref[i - 1][0];
		pref[i][1] = pref[i - 1][1];
		pref[i][i & 1] += A[i];
	}

	while (num < N / 2)
	{
		w = pq.top().first;
		u = pq.top().second.first;
		v = pq.top().second.second;
		pq.pop();
		if (used[u] || used[v])
		{
			continue;
		}
		used[u] = true, used[v] = true;
		unused.erase(u);
		unused.erase(v);
		num++;
		ans += w;
		L = *prev(unused.lower_bound(u));
		R = *unused.lower_bound(v);

		if (1 <= L && R <= N + 1) 
		{
			pq.push({ (pref[R - 1][L & 1] - pref[L - 1][L & 1]) - (pref[R - 1][(L & 1) ^ 1] - pref[L - 1][(L & 1) ^ 1]), {L, R} });
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 20688
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    if a[i]%2==0:
        b.append(a[i]/2)
fl=0
for i in range(len(b)):
    if b[i]%3==0 or b[i]%5==0:
        fl+=0
    else:
        fl+=1
if fl==0:
    print('APPROVED')
else:
    print('DENIED')


Measured memory_bytes: 3060
# coding: utf-8

n = int(input())
s_list = []
t_list = []

for i in range(n):
    s,T = map(str,input().split())
    t = int(T)

    s_list.append(s)
    t_list.append(t)

x = input()
inemuri = False
inemuri_t = 0

for j in range(n):
    if inemuri:
        inemuri_t += t_list[j]
    
    if x == s_list[j]:
        inemuri = True

print(inemuri_t)

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

using namespace std;

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

const int N = 1e5 + 5;

vector <int> ed[N];

deque <int> ans;

int n,m,vis[N],lst[N];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cin >> n >> m;
  for (int i = 1 ; i <= m ; i++) {
    int u,v;
    cin >> u >> v;
    ed[u].push_back(v);
    ed[v].push_back(u);
  }

  ans.push_front(1);
  
  vis[1] = 1;

  while(1) {
    bool flag = false;

    int x = ans.front(),y = ans.back();

    for (int i = lst[x] ; i < ed[x].size() ; i++) {
      int u = ed[x][i];
      lst[x]++;
      if (vis[u] == 0) {
        vis[u] = 1;
        flag = true;
        ans.push_front(u);
        break;
      }
    }

    if (flag == true)
      continue;

    for (int i = lst[y] ; i < ed[y].size() ; i++) {
      int u = ed[y][i];
      lst[y]++;
      if (vis[u] == 0) {
        vis[u] = 1;
        flag = true;
        ans.push_back(u);
        break;
      }
    }

    if (flag == false)
      break;
  }

  cout << ans.size() << "\n";

  while(ans.empty() == false) {
    cout << ans.front() << " ";
    ans.pop_front();
  }

}


Measured memory_bytes: 7552
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//数が大きい時のせぐふぉはコードテストで試してみる
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll M = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1)) % M;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num){
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; 
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2){
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n-1) + f(n-2);
}

int main() {
	string s; cin >> s;
	rep(i, s.size()) {
		if (i == 3) cout << s[i] << ' ';
		else cout << s[i];
	}
	cout << endl;
}

Measured memory_bytes: 8064
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

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

	bool flag = true;
	int	count=0;
	while (flag) {
		for (int i = 0; i < n; i++) {
			if (a[i] % 2 != 0) flag = false;
			a[i] /= 2;
		}
		if (flag) count++;
	}
	cout << count << endl;
}

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

int main()
{
    int N;
    string S;

    cin >> N >> S;
    //N = 6, S = "aabbca";
    int ans = 0;
    for (int i = 1; i < N; i++)
    {
        int temp = 0;
        string str1 = S.substr(0, i);
        string str2 = S.substr(i, S.length() - i);
        sort(str1.begin(), str1.end());
        str1.erase(unique(str1.begin(), str1.end()), str1.end());

        for (int j = 0; j < str1.length(); j++)
        {
            if (str2.find(str1[j]) != string::npos)
            {
                ++temp;
            }
        }
        ans = max(temp, ans);
    }

    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

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

    int n, m;
    cin >> n >> m;

    vector<int> h(n);
    vector<bool> ok(n, true);
    REP(i, n) cin >> h[i];

    REP(i, m) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        if (h[a] <= h[b]) ok[a] = false;
        if (h[b] <= h[a]) ok[b] = false;
    }

    int count = 0;
    REP(i, n) if (ok[i]) count++;

    cout << count << '\n';
    return 0;
}


Measured memory_bytes: 3724
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
  public static void main(String[] args) {
    FastReader sc = new FastReader();
    int k = sc.nextInt();
    int x = sc.nextInt();
    
    int l = (x - (k - 1));
    int r = (x + (k - 1));
    
    if (l < -1000000) { l = -1000000; }
    if (r > 1000000) { r = 1000000; }
    
    for (int i = l; i <= r; i++) {
    	if (i == r) {
    		System.out.println(i);
    	} else {
    		System.out.print(i + " ");
    	}
    }
  }

  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
  
    String next() { 
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException  e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() { 
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
        try{
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
      }
  }
}


Measured memory_bytes: 22996
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = int.Parse(line[0]);
        var pm = line[1];
        var b = int.Parse(line[2]);
        Console.WriteLine(pm == "+" ? a + b : a - b);
    }
}

Measured memory_bytes: 11220
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


void solve(void)
{

  int A,B;
  cin>>A>>B;
  if(A%3 == 0 || B%3 == 0 ||(A+B)%3 == 0)
  {
    cout<<"Possible"<<endl;
  }
  else
  {
    cout<<"Impossible"<<endl;
  }
  
  
  
  return; 
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int r,g,b;
    cin>>r>>g>>b;
    int ans=r*100+g*10+b;
    if(ans%4==0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


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

int main(){

int N,A,B,C,D;
B=0;
C=0;
char c;
//cin >> N >> D;
//cin >> K >> A >> B;
//vector<int> X(N);

for(int i = 0; i < 3;i++){
	cin >> c;
	if(c == 'R') C++;
	if(i==1 && c=='S') B=1;
}
if(B==1 && C==2) cout << 1 << endl;
else cout << C << endl;
}

Measured memory_bytes: 3608
#include<iostream>
using namespace std;
int main(){
	int a,b;
	while(true){
	cin>>a>>b;
	if(a==0 && b==0)break;
	for(int i=0;i<a;i++){
		for(int j=0;j<b;j++){
			if(0==(j+i)%2){
				cout<<"#";
			}
			else{
				cout<<".";
			}
		}
		cout<<endl;
	}
	cout<<endl;
	}
}

Measured memory_bytes: 1152
hmhmk = gets.split(' ').map(&:to_i)

h1 = hmhmk[0]
m1 = hmhmk[1]
h2 = hmhmk[2]
m2 = hmhmk[3]
k = hmhmk[4]

puts (h2*60+m2) - (h1*60+m1) - k


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

int N, C;
int V[101], W[101];
int dp[101][10001];
    
int maxValue(int i, int j) {
  if (i == 0) return 0;
  if (dp[i][j]) return dp[i][j];
  if (j < W[i]) return dp[i][j] = maxValue(i - 1, j);
  return dp[i][j] = max(maxValue(i - 1, j), maxValue(i - 1, j - W[i]) + V[i]);
}

int main(void){
  cin >> N >> C;
  for (int i = 1; i <= N; i++) cin >> V[i] >> W[i];
  V[0] = W[0] = 0;
  
  cout << maxValue(N, C) << endl;
  
  return 0;
}

Measured memory_bytes: 4896
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var K = int.Parse(Console.ReadLine());
            int ret = 1;
            for (int i = 0; i < N; i++)
            {
                var a = ret * 2;
                var b = ret + K;
                if (a < b)
                {
                    ret = a;
                }
                else
                {
                    ret = b;
                }
            }
            Console.WriteLine(ret);
        }
        
    }
}

Measured memory_bytes: 13140
#include<iostream>
#include <algorithm>
using namespace std;
typedef long long int lli;

int main()
{
    lli n,k; cin>>n>>k;
    lli a[1000001]; for(lli i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    lli h=a[k-1]-a[0];
    for(lli i=1,j=k;j<n;i++,j++) h=min(h,a[j]-a[i]);
    cout<<h<<endl;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll k,a,b;
  cin>> k >> a >> b;
  ll ans=a;
  if(b-a<=2){
    cout << k+1;
    return 0;
  }
  k=k-(a-1);
  if(k%2==0){
    ans+=(k/2)*(b-a);
  }else{
    ans+=(k/2)*(b-a)+1;
  }
  cout << ans;
}

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

namespace program
{
    class Program
    {
        static void Main()
        {
          var n = Input.ScanInt();
          int res = 0;
          for(int i=0; i<n; i++){
            var a = Input.ScanIntArray();
            res += a[1] - a[0]+ 1;
          }
          
          Out(res);
        }
        static public void Out(object s) { Console.WriteLine(s); }
    }
    
    static class Input {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split().Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split().Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split().Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(); }
    }

    static class MyMath {
        public static int DistanceL1(int[] a, int[] b){
            if(a.Length != b.Length) return -1;
            int[] c = new int[a.Length];
            for(int i=0;i<a.Length;i++)
              c[i] = Math.Abs(a[i]-b[i]);
            return c.Sum();
        }

        public static double DistanceL2(int[] a, int[] b){
            if(a.Length != b.Length) return -1;
            int[] c = new int[a.Length];
            for(int i=0;i<a.Length;i++)
              c[i] = (a[i]-b[i])*(a[i]-b[i]);
            return Math.Sqrt(c.Sum());
        }
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 13396
import java.util.Scanner;

class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int N = sc.nextInt();
		int R = sc.nextInt();
		if (10 <= N) System.out.println(R);
		else System.out.println(R + 100 * (10 - N));
	}
}

class Main {
	public static void main(String... args) {
		Scanner in = new Scanner(System.in);

		Solver.INSTANCE.solve(in);

		in.close();
	}
}

Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
using namespace std;

int main(){
    double a;
    cin >> a;
    cout << fixed << setprecision(10);
    double b = a/3;
    cout << b*b*b << endl;
    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;

int main() {
  int H,W,N,iy,ix;
  string S,T;
  cin >> H >> W >> N >> iy >> ix >> S >> T;
  ix--; iy--;
  int l = -1, r = W, u = -1, d = H;
  bool flg = false;
  for( int i=N-1; i>=0; --i ) {
    if ( i !=N-1 ) {
      if (T[i] == 'L' ) r = min(r+1, W);
      else if (T[i] == 'R' ) l = max(-1,l-1);
      else if (T[i] == 'U' ) d = min(d+1, H);
      else u = max(-1, u-1);
    }
    if (S[i] == 'L' ) l++;
    else if (S[i] == 'R' ) r--;
    else if (S[i] == 'U' ) u++;
    else d--;
//    cout << " " << i << " : " << l << " " << r << " " << u << " " << d << endl;
//    if ( (l >= W) || (r<=0) || (u>=H) || (d<=0) ) {
    if ( (l+1 >= r) || (u+1 >= d) ) {
      flg = true;
      break;
    }
  }
  if ( flg ) {
    cout << "NO" << endl;
  } else if ( (l >= ix) || (r <= ix) || (u >= iy) || (d <= iy) ) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
}



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

using namespace std;
#define ll long long
#define ld long double

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    string s, t;
    cin >> s >> t;
    cout << t + s << '\n';
    return 0;
}



Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C: 755
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_M = 9;
const int K = 3;
const int KBITS = 1 << K;

/* typedef */

/* global variables */

int ds[MAX_M], dp[MAX_M + 1][KBITS];

/* subroutines */

/* main */

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

  int m = 0;
  for (n++ ; n > 0; n /= 10) ds[m++] = n % 10;
  //for (int i = 0; i < m; i++) printf("%d ", ds[i]); putchar('\n');

  dp[0][0] = 1;
  for (int i = 0; i < m; i++)
    for (int bits = 0; bits < KBITS; bits++)
      if (dp[i][bits] > 0)
	for (int j = 0, bj = 1; j < K; j++, bj <<= 1)
	  dp[i + 1][bits | bj] += dp[i][bits];

  //for (int i = 0; i <= m; i++) {
  //for (int bits = 0; bits < KBITS; bits++) printf("%d ", dp[i][bits]);
  //putchar('\n');
  //}

  int sum = 0;
  for (int i = 0; i < m; i++) sum += dp[i][KBITS - 1];

  for (int i = m - 1, hbits = 0; i >= 0; i--) {
    for (int j = 0, bj = 1; j < K; j++, bj <<= 1) {
      int dj = j * 2 + 3;
      if (dj >= ds[i]) break;

      for (int bits = 0; bits < KBITS; bits++)
	if ((hbits | bits | bj) == KBITS - 1) sum += dp[i][bits];
    }

    if (ds[i] != 3 && ds[i] != 5 && ds[i] != 7) break;
    hbits |= 1 << ((ds[i] - 3) / 2);
    //if (i == 0 && hbits == KBITS - 1) sum++;
  }

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


Measured memory_bytes: 256
//Heaplax
#include<bits/stdc++.h>
#define LL long long
#define LOG(x) cerr<<#x<<" = "<<x<<endl
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
    while(ch=getchar(),ch<33);
    if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
    while(ch=getchar(),ch>33)x=x*10+ch-48;
    if(fs)x=-x;
}
using namespace std;
int n,m;
char s[505];
bool red[505][505],blue[505][505];
int main()
{
	re(n),re(m);
	for(int i=1;i<=n;++i)
	{
		scanf("%s",s+1);
		for(int j=1;j<=m;++j)
			if(s[j]=='#')
				red[i][j]=blue[i][j]=1;	
	}
	for(int i=1;i<=m;++i)
		red[1][i]=blue[n][i]=1;
	for(int i=2;i<n;++i)
		for(int j=1;j<=m;++j)
			(j&1?red[i][j]:blue[i][j])=1;
	for(int i=1;i<=n;++i,puts(""))
		for(int j=1;j<=m;++j)
			putchar(red[i][j]?'#':'.');
	puts("");
	for(int i=1;i<=n;++i,puts(""))
		for(int j=1;j<=m;++j)
			putchar(blue[i][j]?'#':'.');
}

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

int main() {
  int N,D,X;
  cin >> N;
  cin >> D >> X;
  vector<int> vec(N);
  for(int i = 0;i < N;i++) {
    cin >> vec.at(i);
  }
  int count = 0;
  for(int j = 0;j < N;j++) {
    count = count + (D - 1) / vec.at(j) + 1;
  }
  cout << count + X << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    ll n;cin>>n;
    vll a(n),each(n+1);
    rep(i,n){
        cin>>a[i];
        each[a[i]]++;
    }
    ll num=0;
    rep2(i,1,n+1)num+=each[i]*(each[i]-1)/2;
    vll ans(n,num);
    rep(i,n)ans[i]+=-each[a[i]]+1;
    rep(i,n)cout<<ans[i]<<endl;
}

Measured memory_bytes: 7296
process.stdin.resume();
process.stdin.setEncoding('utf8');
// 自分の得意な言語で
// Let's チャレンジ！！

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
 var tree = parseInt(lines[0].split(' ')[0],10);
 var range =parseInt(lines[0].split(' ')[1],10);

 var kansi = 1+2*range;
 var count = 0;
  while(tree>=0){

    count++;
  	tree = tree- kansi;
   if(tree<=0){
   	break;
   }

  }
   console.log(count);


  
});

Measured memory_bytes: 29904
from sys import stdin
import collections
#stdin = open('sample.txt')

input = stdin.readline

def main():
    ans = 0
    N = int(input())
    L = list(map(int, input().rstrip().split()))
    l = collections.Counter(L)
    ll = sorted(l.items())
    for i in range(len(ll)):
        for j in range(i):
            for k in range(j):
                if ll[i][0] < ll[j][0] + ll[k][0]:
                    ans += ll[i][1] * ll[j][1] * ll[k][1]
    print(ans)

if __name__ == "__main__":
    main()
    


Measured memory_bytes: 68236
#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 q;cin >> q;
    while(q--){
        ll a,b;cin >> a >>b;
        if(a>b)swap(a,b);
        if(a==b||a+1==b){
            cout << 2*a-2 <<endl;continue;
        }
        ll p=a*b;
        ll z=floor(sqrt(p));
        if(z*z==p)z--;
        if(z*(z+1)>=a*b){
            cout << 2*z-2 <<endl;
        }
        else{
            cout << 2*z-1 <<endl;
        }
    }
}

Measured memory_bytes: 3676
import java.util.*;

public class Main{
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(b - a == c - b){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
        
    }
}

Measured memory_bytes: 35668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    string T; cin >> T;
    char prev;
    for (int i = 0; i < T.size(); i++) {
        if (T[i] == '?') {
            cout << 'D';
        }
        else {
            cout << T[i];
        }
    }
    cout << endl;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ll maxn  = 3e6;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);
 
#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) cout << x ;  return(0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}
 
 
 
int main(){
    migmig
    string s;
  cin >> s;
  if(s[0] == '7' or s[1] == '7' or s[2] == '7'){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
 
    return(0);
}
 
//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.
//kuxtal jach uts chuchul u u páajtal máak jach táaj meyajilo'ob le castigadas tumen ch'aik descansos.

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

using namespace std;
using ll = long long;

#define MOD 1000000007
template<int mod>
struct ModInt{
   int x;
   ModInt():x(0){}
   ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
   ModInt &operator+=(const ModInt &p){
       if((x+=p.x)>=mod)x-=mod;
       return *this;
   }
   ModInt &operator-=(const ModInt &p){
       if((x+=mod-p.x)>=mod)x-=mod;
       return *this;
   }
   ModInt &operator*=(const ModInt &p){
       x=(int)(1LL*x*p.x%mod);
       return *this;
   }
   ModInt &operator/=(const ModInt &p){
       *this*=p.inverse();
       return *this;
   }
   ModInt &operator^=(long long p){
       ModInt res = 1;
       for (; p; p >>= 1) {
           if (p & 1) res *= *this;
           *this *= *this;
       }
       return *this = res;
   }
   ModInt operator-()const{return ModInt(-x);}
   ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
   ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
   ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
   ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
   ModInt operator^(long long p)const{return ModInt(*this)^=p;}
   bool operator==(const ModInt &p)const{return x==p.x;}
   bool operator!=(const ModInt &p)const{return x!=p.x;}
   explicit operator int() const { return x; }
   ModInt operator=(const int p) {x = p; return ModInt(*this);}
   ModInt inverse()const{
       int a=x,b=mod,u=1,v=0,t;
       while(b>0){
           t=a/b;
           a-=t*b;
           std::swap(a,b);
           u-=t*v;
           std::swap(u,v);
       }
       return ModInt(u);
   }
   friend std::ostream &operator<<(std::ostream &os,const ModInt<mod> &p){
       return os<<p.x;
   }
   friend std::istream &operator>>(std::istream &is,ModInt<mod> &a){
       long long x;
       is>>x;
       a=ModInt<mod>(x);
       return (is);
   }
};
typedef ModInt<MOD> mint;
 
struct MComb {
   std::vector<mint> fact;
   std::vector<mint> inversed;
   MComb(int n) { // O(n+log(mod))
       fact = std::vector<mint>(n+1,1);
       for (int i = 1; i <= n; i++) fact[i] = fact[i-1]*mint(i);
       inversed = std::vector<mint>(n+1);
       inversed[n] = fact[n] ^ (MOD-2);
       for (int i = n - 1; i >= 0; i--) inversed[i]=inversed[i+1]*mint(i+1);
   }
   mint ncr(int n, int r) {
        if (n < r) return 0;
        if (n < 0 || r < 0) return 0;
       return (fact[n] * inversed[r] * inversed[n-r]);
   }
   mint npr(int n, int r) {
        if (n < r) return 0;
        if (n < 0 || r < 0) return 0;
       return (fact[n] * inversed[n-r]);
   }
   mint nhr(int n, int r) {
       assert(n+r-1 < (int)fact.size());
       return ncr(n+r-1, r);
   }
   mint fac(int n) {
       if(n < 0)return 0;
       return fact[n];
   }
};
MComb comb(200000);
 
mint ncr(int n, int r) {
   mint res = 1;
   for (int i = n - r + 1; i <= n; i++) res *= i;
   for (int i = 1; i <= r; i++) res /= i;
   return res;
}


int main()
{
    int n, k; cin >> n >> k;
    cout << comb.npr(k, n) << endl;
}


Measured memory_bytes: 4252
#include <iostream>

using namespace std;

int main()
{
    int x=0;
    int n=4;
    string s;
    cin>>s;
    for(int i=0;i<n;i++)
    {
    if(s[i]=='+'){
    x+=1;
    }
    else if(s[i]=='-'){
    x-=1;
    }
    }
    cout<<x;
    return 0;
}


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

// マクロ
#define rep(i,N) for(int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x));
#define cou(x) cout << x << endl;
#define y() cout << "Yes" << endl;
#define n() cout << "No" << endl;
#define x2(x) x * x

// 型エイリアス
using lint = long long;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;

int main() {
	int N;
	cin >> N;
	cou(48-N)
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <cmath>
#include <climits>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

int main(int argc, char const* argv[])
{
  string s;
  cin >> s;
  cout << s.substr(0, s.size() - 8) << endl;
	return 0;
}


Measured memory_bytes: 256