akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline

# from collections import deque

def linput(_t=int):
    return list(map(_t, input().split()))

def gcd(n,m):
    while m: n,m = m, n%m
    return n

def lcm(n,m): return n*m//gcd(n,m)

def main():

    N = int(input())
    N %= 10

    # res = 0
    # print(N)

    if N in (2,4,5,7,9):
        res = "hon"
    elif N in (0,1,6,8):
        res = "pon"
    else:
        res = "bon"


    print(res)
    # print(("No","Yes")[res%2])



main()


Measured memory_bytes: 61836
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;   
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;

int main(){
    double a,b,d=0,n,m,k,ans=0;
    string s,s2;
    cin >> n >> m;
    VI c(m);

    for(int i=0;i<n;i++){
        cin >> k;
        VI a(k);
        for(int j=0; j < k;j++){
            cin >> a[j];
            c[a[j]-1]++;
        }
    }
    for(int i=0;i<m;i++){
        if(n==c[i]){
            ans++;
        }
    }
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(a: int, b: int, x: int):
    # N以下のxで割れる個数をもとめたい
    def counter(n):
        return n//x
    
    if a == 0:
        print(counter(b)+1)
        return 
    
    print(counter(b)-counter(a-1))

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    x = int(next(tokens))  # type: int
    solve(a, b, x)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  struct vertex { int i, c; };
  VV<> g(n);
  for (int i = 0; i < m; i++) {
    int a, b; cin >> a >> b, a--, b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  bool bi = true;
  V<> c(n);
  queue<int> q;
  c[0] = 1; q.push(0);
  [&]{
    while (!q.empty()) {
      int v = q.front(); q.pop();
      for (auto&& i : g[v]) {
        if (c[i] == c[v]) return bi = false;
        if (c[i]) continue;
        c[i] = -c[v]; q.push(i);
      }
    }
  }();
  lint res;
  if (bi) {
    int k = 0;
    for (int i = 0; i < n; i++) k += c[i] == 1;
    res = (lint) k * (n - k) - m;
  } else {
    res = (lint) n * (n - 1) / 2 - m;
  }
  cout << res << '\n';
}

Measured memory_bytes: 6272
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int n, Q, vis[101000], cnt, ct;
long long m;
vector<int>E[101000], G;
struct point {
	int a, b, c;
}w[101000];
void DFS(int a) {
	vis[a] = cnt;
	ct++;
	for (auto &x : E[a]) {
		if (!vis[x])DFS(x);
	}
}
int main() {
	int i;
	scanf("%d%lld%d", &n, &m, &Q);
	for (i = 1; i <= Q; i++) {
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		a++, b++;
		w[i] = { a,b,c };
		if (c == 0) {
			E[a].push_back(b);
			E[b].push_back(a);
		}
	}
	for (i = 1; i <= n; i++) {
		if (!vis[i]) {
			cnt++;
			ct = 0;
			DFS(i);
			G.push_back(ct);
		}
	}
	int chk = 0;
	for (i = 1; i <= Q; i++) {
		if (w[i].c && vis[w[i].a] == vis[w[i].b]) {
			puts("No");
			return 0;
		}
		if (w[i].c)chk = 1;
	}
	if (G.size() == 2) {
		G.clear();
		G.push_back(n);
	}
	long long Mn = n - 1, Mx = 0;
	if (chk)Mn = n;
	for (auto &t : G) {
		Mx += t - 1;
	}
	long long c = G.size();
	Mx += c * (c - 1) / 2;
	if (Mn <= m && m <= Mx) {
		puts("Yes");
	}
	else puts("No");
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

bool prime[1111111];

void init(){
	REP(i, 1111111)prime[i] = true;
	prime[0] = false;
	prime[1] = false;
	REP(i, 1111111){
		if(!prime[i])continue;
		for(int j = 2 * i;j < 1111111;j += i)prime[j] = false;
	}
}

ll gcd(ll a, ll b){
	return b == 0 ? a : gcd(b, a % b);
}

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

	ll a, b;cin >> a >> b;
	ll seica = gcd(a, b);

	ll ans = 0;
	REP(i, 1111111){
		if(!prime[i])continue;
		if(seica % i == 0)ans++;
		while(seica % i == 0)seica /= i;
	}
	if(seica != 1)ans++;
	cout << ans+1 << endl;

	return 0;
}


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

int main() {
  int N;
  string S;

  cin >> N;
  cin >> S;

  int b = 0;
  for(int i=0;i<N;i++)
    if( S[i] == '.') b++;

  vector<int> c;
  c.push_back(b);
  for(int i=0;i<N;i++){
    if(S[i] == '#'){
      c.push_back(c[i]+1);
    }else{
      c.push_back(c[i]-1);
    }
  }

  int min=N;
  for(int n:c)
    if(min>n) min=n;

  cout << min;

  return 0;
}


Measured memory_bytes: 1532
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;



int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	
	ini(n);
	vi morty;
	FOR(i,0,n){
		ini(x);
		morty.push_back(x);
	}
	sort(all(morty));
	int rick = -INF;
	if(n%2){
		int tmp = 0;
		FOR(i,0,n/2){
			tmp-=2LL*morty[i];
		}
		FOR(i,n/2,n){
			tmp+=2LL*morty[i];
		}
		tmp-=morty[n/2];
		tmp-=morty[n/2+1];
		rick = max(rick,tmp);
		tmp = 0;
		FOR(i,0,n/2+1){
			tmp-=2LL*morty[i];
		}
		FOR(i,n/2+1,n){
			tmp+=2LL*morty[i];
		}
		tmp+=morty[n/2];
		tmp+=morty[n/2-1];
		rick = max(rick,tmp);
	}
	else {
		int tmp = 0;
		FOR(i,0,n/2){
			tmp-=2LL*morty[i];
		}
		FOR(i,n/2,n){
			tmp+=2LL*morty[i];
		}
		tmp-=morty[n/2];
		tmp+=morty[n/2-1];
		rick= tmp;
	}
	out(rick);
	
	
















	return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
ll a,b,cnt,ans;
int main()
{
  cin>>a>>b;
  if(a==0) cnt=b/2+1;
  else cnt=b/2-(a-1)/2;
  // cout<<cnt<<endl;
  if(a&1 && b&1)
  {
    if(cnt&1) ans=a-1;
    else ans=a;
  }
  else if(a&1 && !(b&1))
  {
    if(cnt&1) ans=a^b;
    else ans=a^(b+1);
  }
  else if(!(a&1) && b&1)
  {
    if(cnt&1) ans=1;
    else ans=0;
  }
  else
  {
    if(cnt&1) ans=b;
    else ans=b+1;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int n, m;
    cin >> n >> m;
    vector<ll> dp(n+1, 0);
    vector<int> banned(m, 0);
    for(int& val: banned)
        cin >> val;
    unordered_set<int> invalid(banned.begin(), banned.end());
    ll mod = 1e9 + 7;
    dp[0] = 1;
    for(int i = 1; i <= n; i++) {
        if (invalid.count(i) == 0) {
            if (i == 1)
                dp[i] = dp[i-1];
            else
                dp[i] = dp[i-1] + dp[i-2];
        }
        dp[i] %= mod;
    }
    cout << dp[n] << endl;
    return 0;
}




Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
// rep(i, 1, 4) --> {1,2,3,4}
// rep(i, 4, 1) --> {4,3,2,1}
// rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    string s;
    cin >> s;
    if ((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3]))
        cout << "Yes";
    else
        cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<62;
const LL INF=1<<17;


const int M_V=1001;
struct edge {int to;LL cap,rev;};

struct FordFulkerson{

    vector<edge> G[M_V];
    bool used[M_V];

    void add_edge(int from,int to,LL cap){
        G[from].push_back({to,cap,G[to].size()});
        G[to].push_back({from,0,G[from].size()-1});
    }

    LL dfs(int v,int t,LL f){
        if(v==t) return f;
        used[v]=true;
        for(int i=0;i<G[v].size();i++){
            edge &e=G[v][i];
            if(!used[e.to]&&e.cap>0){
                LL d=dfs(e.to,t,min(f,e.cap));
                if(d>0){
                    e.cap-=d;
                    G[e.to][e.rev].cap+=d;
                    return d;
                }
            }
        }
        return 0;
    }

    LL max_flow(int s,int t){
        LL flow=0;
        for(;;){
            memset(used,0,sizeof(used));
            LL f=dfs(s,t,INF);
            if(f==0) return flow;
            flow+=f;
        }
    }
};

int main(){
    int N;cin >> N;
    vector<LL> a(N);
    LL sum=0;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        if(a[i]>0) sum+=a[i];
    }
    FordFulkerson FF;
    for(LL i=0;i<N;i++){
        if(a[i]<=0) FF.add_edge(0,i+1,-a[i]);
        else FF.add_edge(i+1,N+1,a[i]);
        for (LL j = 2; (i+1)*j <= N; j++) {
            FF.add_edge(i+1,(i+1)*j,LINF);
        }
    }
    cout << sum-FF.max_flow(0,N+1) << endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<utility>
#include<math.h>
#include<set>
#include<map>
#include<string.h>
#include<stack>
#define n 200000
#define loop(a, b) for(int i = a; i<=b; i++)
using namespace std;
typedef pair<int, int> P;
typedef long long lli;
typedef double llf;
struct edge{
	int from, to, weight;
	bool operator < (const edge& thing) const
	{
		return thing.weight < weight;
	}
};
vector<edge> V[n + 50];
bool visit[n + 50];
int arr[n + 50], a, b, c, d, e;
string str1, str2;
void addedge(int a, int b, int c)
{
	edge temp;
	temp.from = a;
	temp.to = b;
	temp.weight = c;
	V[a].push_back(temp);
}


//////////////////////////////////////////


void solve()
{
	cin >> a >> b >> c >> d;
	int max = 1;
	if(b > a && b > c) max = 2;
	if(c > a && c > b) max = 3;
	int ans = 0;
	if(max == 1)
	{
		ans += b + c;
		loop(0, d - 1) a *= 2;
		ans += a;
	}
	else if(max == 2)
	{
		ans += a + c;
		loop(0, d - 1) b *= 2;
		ans += b;
	}
	else
	{
		ans += a + b;
		loop(0, d - 1) c *= 2;
		ans += c;
	}	
	cout << ans;
}
int main()
{
	int times = 1;
//	cin << times;
	loop(1, times)
	{
		solve();
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 4992
#include <math.h>
#include <assert.h>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <functional>
#include <stack>
#include <array>
#include <random>
#include <chrono>
#include <climits>
#include <bitset>
using namespace std ;
#define int long long
#define ii pair<int,int>
#define FAST_IO ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL)
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
//const int N = 3e5+7 ;
//const int INF = 1e18 ;
//const int MOD = 1e9 + 7 ;

void solve(){
	int n , d ;
	cin >> n >> d ;
	d *= d ;
	int ans = 0 ;
	for(int i = 0 ; i < n ; i++){
		int x , y ;
		cin >> x >> y ;
		if(x*x+y*y <= d){
			ans++ ;
		}
	}
	cout << ans << endl ;
}

int32_t main(){
    FAST_IO ;
    int t = 1 ;
//    cin >> t ;
    while(t--){
        solve() ;
    }
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	string s;
	cin>>s;
	ll ans=0;
	ll count=1;
    for(int i=0;i<s.length();i++){
	    if(s[i]=='W'){
		    ans+=(i+1)-count;
		    count++;
	    }
    }
	printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 640
var rows = require("fs").readFileSync("/dev/stdin", "utf8").split("\n")

var N = parseInt(rows[0].trim(), 10)
var isEven = function (n) {
    return n % 2 === 0
}
var nOdd = function (n) {
    return isEven(n) ? n / 2 : (n + 1) / 2
}

console.log(nOdd(N) / N)

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

//  https://ja.wikipedia.org/wiki/Xorshift
int xor64(void) {
	static unsigned long long x = 88172645463325252ULL;
	x ^= x << 13;
	x ^= x >> 7;
	x ^= x << 17;
	return int(x & 0x7fffffff);
}

int main()
{
	//  入力
	int D;
	cin >> D;
	vector<int> C(26);
	for (int &c : C)
		cin >> c;
	vector<vector<int>> S(D, vector<int>(26));
	for (auto &s : S)
		for (auto &x : s)
			cin >> x;

	auto start = system_clock::now();

	//  選んだコンテスト
	vector<int> T(D, -1);

	int score = 0;
	for (int t = 0; t < 26; t++)
		score -= C[t] * D*(D + 1) / 2;

	//  d日目にコンテストtを開く
	auto add = [&](int d, int t)
	{
		int d0 = d;
		while (d0 >= 0 && T[d0] != t)
			d0--;
		int d1 = d;
		while (d1 < D && T[d1] != t)
			d1++;
		score += C[t] * (d - d0)*(d1 - d);
		score += S[d][t];
		T[d] = t;
	};

	//  d日目のコンテストを止める
	auto remove = [&](int d)
	{
		int t = T[d];
		T[d] = -1;
		int d0 = d;
		while (d0 >= 0 && T[d0] != t)
			d0--;
		int d1 = d;
		while (d1 < D && T[d1] != t)
			d1++;
		score -= C[t] * (d - d0)*(d1 - d);
		score -= S[d][t];
	};

	for (int d = 0; d < D; d++)
		add(d, d % 26);

	double time = 0.0;
	double limit = 1.8;

	int step;
	for (step = 0; time < limit; step++)
	{
		if (step % 10000 == 0)
			time = duration_cast<microseconds>(system_clock::now() - start).count() * 1e-6;

		if (step % 2 == 0)
		{
			//  1日のコンテストの種類を変えてみる
			int d = xor64() % D;
			int t = xor64() % 26;
			int old_score = score;
			int old_t = T[d];
			remove(d);
			add(d, t);

			//  悪くなったら戻す
			if (score < old_score)
			{
				remove(d);
				add(d, old_t);
			}
		}
		else
		{
			//  1週間以内のコンテストを交換してみる
			int d0 = xor64() % D;
			int d1 = d0 + xor64() % 15 - 7;
			if (d1 != d0 && 0 <= d1 && d1 < D)
			{
				int old_score = score;
				int t0 = T[d0];
				int t1 = T[d1];
				remove(d0);
				remove(d1);
				add(d0, t1);
				add(d1, t0);

				//  悪くなったら戻す
				//  ただし、ある程度までは許容する
				//  許容範囲は時間とともに狭める（焼きなまし）
				if (score < old_score - int(10000 * (limit - time) / limit))
				{
					remove(d0);
					remove(d1);
					add(d0, t0);
					add(d1, t1);
				}
			}
		}
	}

	for (int t : T)
		cout << t + 1 << endl;

	cerr << "score: " << max(0, score + 1000000) << endl;
	cerr << "step: " << step << endl;
}


Measured memory_bytes: 3632
import math
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

#maincode-------------------------------------------------
n = ini()
a = inl()
ans = 0
for i in range(1,n):
    if a[i-1] > a[i]:
        ans += a[i-1] - a[i]
        a[i] = a[i-1]
print(ans)

Measured memory_bytes: 33104
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
struct param{
    int v,d,l,c;
    int rank;
};

// ツ残ツづィツ氾ッツ用ツづ古卍つヲツづゥツ催仰ュツδニツッツト
param dp[301][301];
int n,m;
vector<param> bydol;

param dfs(int idx,int money){
    if(idx==n){
        param p;
        p.v=p.d=p.l=0;
        return p;
    }
    if(dp[idx][money].rank!=-1)
        return dp[idx][money];
    param res;
    res.d=res.l=res.v=0;
    // ツつアツつアツづ可スツ妥篠古卍つ、ツつゥ
    for(int i = 0; ;i++){
        if(i*bydol[idx].c>money)
            break;
        param p=dfs(idx+1,money-i*bydol[idx].c);
        // ツ催妥・ツ値ツづーツ更ツ新
        res.d=max(res.d,p.d+i*bydol[idx].d);
        res.l=max(res.l,p.l+i*bydol[idx].l);
        res.v=max(res.v,p.v+i*bydol[idx].v);
    }
    dp[idx][money]=res;
    dp[idx][money].rank=max(max(res.d,res.l),res.v);
    return dp[idx][money];
}

int main(){
    while(cin>>n>>m){
        bydol.clear();
        for(int i = 0; i < 301; i++)
            for(int j = 0; j < 301; j++)
                dp[i][j].rank=-1;
        int minC=100000;
        for(int i = 0; i < n; i++){
            string name;
            getline(cin,name);
            getline(cin,name);
            int c,v,d,l;
            cin>>c>>v>>d>>l;
            minC=min(minC,c);
            param p;
            p.c=c;p.v=v;p.l=l;p.d=d;
            bydol.push_back(p);
        }
        if(minC>m){
            cout<<0<<endl;
            continue;
        }
        param p=dfs(0,m);
        cout<<p.rank<<endl;
    }
    return 0;
}

Measured memory_bytes: 2744
#include <iostream>

int main()
{
	int freq[6] = {0,0,0,0,0,0};
	int n; std::cin >> n;
	for (int i=0; i<n; i++) {
		float height;
		std::cin >> height;
		if (height < 165.0) freq[0]++;
		else if (height < 170.0) freq[1]++;
		else if (height < 175.0) freq[2]++;
		else if (height < 180.0) freq[3]++;
		else if (height < 185.0) freq[4]++;
		else freq[5]++;
	}
	for (int i=0; i<6; i++) {
		std::cout << i+1 << ":";
		for (int j=0; j<freq[i]; j++) std::cout << "*";
		std::cout << std::endl;
	}
	
	return 0;
}




Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    string s;
    cin >> s;
    rep(i,s.size()){
        if (s[i] == '?') s[i] = 'D';
    }

    // s += 'A';
    // ll ans = 0;
    // rep(i,s.size()){
    //     if (s[i] == 'P' and s[i + 1] == 'D') ans++;
    //     else if(s[i]=='D')
    //         ans++;
    // }

    cout << s << endl;
}

Measured memory_bytes: 3712
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
  int N;
  
  cin >> N;
  
  vector<double> a(N);
  double sum = 0.0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    sum += a[i];
  }
  
  double ave = sum / a.size();
  
  double minv = 100000000;
  int frame_idx = N;
  for (int i = 0; i < N; i++) {
    if (minv > abs((a[i] * N) - (ave * N))) {
      minv = abs((a[i] * N) - (ave * N));
      frame_idx = i;
    }
  }
  
  cout << frame_idx << endl;
  
  return 0;
}

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

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

  int five = 0, seven = 0;

  for (int i = 0; i < 3; ++i) {
    int c;
    cin >> c;

    if (c == 7) ++seven;
    else if (c == 5) ++five;
  }

  if (five == 2 && seven == 1) cout << "YES\n";
  else cout << "NO\n";

  return (0);
}


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

int main() {
  int input,rest,h,m,s;
  
  
  cin >> input;
  rest = input % 3600;
  s = rest % 60;
  h = (input - rest) / 3600;
  m = (rest - s) / 60;
  
  cout << h << ":" << m << ":" << s << endl;
  return 0;
}


Measured memory_bytes: 3084
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Console.ReadLine().Split(' ').Select(num => int.Parse(num)).Sum() > 21 ? "bust" : "win");
        }
    }
}

Measured memory_bytes: 28132
#include <bits/stdc++.h>
#define X first
#define Y second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define ini(x, y) memset(x, y, sizeof(x))
#define endl '\n'
#define fastio cin.sync_with_stdio(false); cin.tie(nullptr)
using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1e9 + 7;
const int dx[] = { -1, 0, 1, 0, -1, 1, 1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

int H, W, K;
char bo[10][1001];

int bit_count(int n) {
	int ret = 0;
	while (n) ++ret, n -= n & -n;
	return ret;
}
int check(int b) {
	int sum[10]{}, ret = 0;
	for (int f, i = 0; i < W; ++i) {
		f = 0;
		bool tmp = 0;
		for (int j = 0; j < H; ++j) {
			sum[f] += bo[j][i] == '1';
			if (sum[f] > K) tmp = 1;
			if (b & 1 << j) ++f;
		}

		if (tmp) {
			++ret;
			ini(sum, 0);

			f = 0;
			for (int j = 0; j < H; ++j) {
				sum[f] += bo[j][i] == '1';
				if (sum[f] > K) return 0x3f3f3f3f;
				if (b & 1 << j) ++f;
			}
		}
	}

	return ret;
}
int main() {
	fastio;
	cin >> H >> W >> K;
	for (int i = 0; i < H; ++i) cin >> bo[i];

	int ans = 0x3f3f3f3f;
	for (int i = 0; i < 1 << H - 1; ++i) {
		ans = min(ans, bit_count(i) + check(i));
	}

	cout << ans;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
vector<string> split(string s, char p){vector<string>v;stringstream m(s);string b;while(getline(m,b,p))v.push_back(b);return v;}
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 (a>b) { a = b; return 1; } return 0; }
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;

int main(){
    string N;
    cin >> N;
    N = N.substr(N.size()-1, 1);
    if (N=="2"||N=="4"||N=="5"||N=="7"||N=="9") cout << "hon\n";
    else if (N=="0"||N=="1"||N=="6"||N=="8") cout << "pon\n";
    else cout << "bon\n";
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int n,s,q,a[100005],b[100005][20];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	cin>>s;
	int dem=1,sum=0;
	for(int i=2;i<=n;i++){
		sum+=a[i]-a[i-1];
		while(sum>s){
			b[dem][0]=i-1;
			dem++;
			sum-=(a[dem]-a[dem-1]);
		}
	}
	for(int i=dem;i<=n;i++) b[i][0]=n;
	for(int j=1;(1<<j)<=n;j++)
		for(int i=1;i<=n;i++)
			b[i][j]=b[b[i][j-1]][j-1];
			
	cin>>q;
	while(q--){
		int l,r;
		cin>>l>>r;
		if(l>r) swap(l,r);
		int ans=1;
		for(int i=log2(n);i>=0;i--){
			if(b[l][i]<r){
				l=b[l][i];
				ans+=(1<<i);
			}
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 9088
import math
from collections import deque
import copy

n = int(input())
pL = list(input().split(" "))
qL = list(input().split(" "))

q = deque()
li = list(map(str, range(1, n + 1)))

for i in range(1, n + 1):
    q.append(str(i))

while True:
    item = q.popleft()
    if len(item) == n:
        q.appendleft(item)
        break
    for s in li:
        if not s in list(item):
            q.append(item + s)

idx = 1
pi, qi = 0, 0
while len(q) != 0:
    item = q.popleft()
    if item == "".join(pL):
        pi = idx
    if item == "".join(qL):
        qi = idx
    idx += 1

print(abs(qi - pi))

Measured memory_bytes: 53340
def myinput():
    n = int(input())
    s = input()
    return n, s

def rot(n, s):
    z = ord('Z')
    chars = []

    for c in s:
        code = ord(c) + n
        if code > z:
            code -= 26
        chars.append(chr(code))
    return ''.join(chars)

def main():
    n, s = myinput()
    ret = rot(n, s)
    print(ret)

main()

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

int main()
{
  int n,k;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
	cin>>a[i];
  sort(a,a+n);
  int ans=0;
  for(int i=0;i<k;i++)
  {
    ans+=a[i];
  }
  cout<<ans;
}

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

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

using namespace std;

typedef pair<int, int> P;

P t[1 << 21];

void init(int k, int l, int r){
	if(r - l > 1){
		int m = (l + r) / 2;
		init(2 * k + 1, l, m);
		init(2 * k + 2, m, r);
	}
	t[k] = P(l, 0);
}
void init(){
	init(0, 0, 1 << 20);
}

P add(int i, int x, int k, int l, int r){
	if(i < l || r <= i){
		return t[k];
	}
	if(i <= l && r <= i + 1){
		t[k].second += x;
		return t[k];
	}
	int m = (l + r) / 2;
	P p = add(i, x, 2 * k + 1, l, m);
	P q = add(i, x, 2 * k + 2, m, r);
	return t[k] = p.second >= q.second ? p : q;
}
void add(int i, int x){
	add(i, x, 0, 0, 1 << 20);
}

P query(){
	return t[0];
}

int n, q;

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

	init();
	rep(i, q){
		int a, v;
		cin >> a >> v;

		add(a - 1, v);
		
		P p = query();
		cout << p.first + 1 << ' ' << p.second << endl;
	}
	return 0;
}

Measured memory_bytes: 19492
# C - Alchemist
def main():
    n = int(input())
    v = list(map(int, input().split()))
    v.sort()

    ans = (v[0] + v[1]) / 2
    if n == 2:
        print(ans)
    else:
        for i in range(2,n):
            ans = (v[i] + ans) / 2
        print(ans)

if __name__ ==  "__main__":
    main()

Measured memory_bytes: 9160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
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 (a>b) { a = b; return 1; } return 0; }
void rcmb(ll *x,ll s,ll r,function<void(ll *)>f){if(r==0){f(x);}else{if(s<0)return;rcmb(x,s-1,r,f);x[r-1]=s;rcmb(x,s-1,r-1,f);}}
void cmb(ll n,ll k,function<void(ll *)>f){ll x[k];rcmb(x,n-1,k,f);}
void prm(ll n,function<void(ll *)>f){ll x[n];for(ll i=0;i<n;i++)x[i]=i;do{f(x);}while(next_permutation(x,x+n));}
void prm(ll n,ll k,function<void(ll *)>f){cmb(n,k,[&](ll *c){prm(k,[&](ll *p){ll x[k];for(ll i=0;i<k;i++){x[i]=c[p[i]];}f(x);});});}
// prm(4, 2, [](ll *x){ cout << x[0] << "," << x[1] << "\n"; });
 
int main(){
    ll D;
    cin >> D;

    cout << "Christmas ";
    REP(i, 25-D-1) cout << "Eve ";
    if (D!=25) cout << "Eve\n";
}


Measured memory_bytes: 256
N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
d = [0,2,5,5,4,5,6,3,7,6]
S = set()
for a in A:
    S.add(d[a])

INF = 10 ** 8
dp = [-INF for _ in range(N+1)]
dp[0] = 0

for i in range(N+1):
    for s in S:
        if i - s >= 0:
            dp[i] = max(dp[i], dp[i-s]+1)

ans = 0
digit = dp[N]

for i in range(digit-1, -1, -1):
    if i != 0:
        for a in A:
            if dp[N-d[a]] == i:
                ans = ans * 10 + a
                N -= d[a]
                break
    else:
        for a in A:
            if N == d[a]:
                ans = ans * 10 + a
                break
print(ans)

Measured memory_bytes: 3444
//g++ t.cpp -o t && t < p.txt
//d>p.txt&&t<p.txt&&t2<p.txt

#include <iostream> // プログラムの耳と口
#include <vector> // 超有能配列秘書
#include <algorithm> // みんな大好きソートと二分探索
#include <queue> // きゅーちゃん、だいすき
#include <string> // to_string
#include <functional> // 関数を変数に入れる子
#include <set> // 値の取得・挿入・削除を高速に
#include <map> // setの妹 これまた優秀
#include <random> // 乱択さん
#include <cassert>

#define DB cerr<<"D"<<endl
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";};
using P=pair<ll,ll>;
const ll M = 1e9+7;
ll mod_pow(ll x, ll a) { ll an = 1; while(a > 0) { if (a&1) an = an * x % M; x = x * x % M; a >>= 1;} return an;}
void add(ll& x, ll y) {x+=y; x%=M;}; void mul(ll& x, ll y) {x*=y; x%=M;}; template<typename T, typename U> void chmax(T& x, U y) {if (x<y) x=y;}; template<typename T, typename U> void chmin(T& x, U y) {if (x>y) x=y;}
bool vaild(int x, int y, int hh, int ww){return 0<=x&&x<hh&&0<=y&&y<ww;}
int keta(ll a) {int res=0; while(a>0) res+=(a%10/5)+(a%5), a/=10; return res;}

int main() {
  /*
  int h,w; cin>>h>>w;
  string s[h]; for(int i=0;i<h;i++) cin>>s[i];
  ll dp[h][w]; fill(dp[0],dp[h],0); dp[0][0]=1; 
  for(int i=0;i<h;i++) {
    for(int j=0;j<w;j++) {
      if (i+1<h && s[i+1][j]=='.') add(dp[i+1][j],dp[i][j]);
      if (j+1<w && s[i][j+1]=='.') add(dp[i][j],dp[i][j+1]);
    }
  }
  cout<<dp[h-1][w-1]<<endl;*/

  int n; cin>>n;
  ld p[n]; for(int i=0;i<n;i++) cin>>p[i];

  ld u[n+1]={1.00};
  for(int i=0;i<n;i++) {
    for(int j=n-1;j>=0;j--) {
      u[j+1] += u[j] * p[i];
      u[j] = u[j] * (1 - p[i]);
    }
  }
  ld an = 0;
  for(int i=(n+2)/2;i<=n;i++) {
    an += u[i];
  }
  cout.precision(13);
  cout<<an<<endl;
}
// ・配列の大きさok？　・priority_queueはgreater？　・debug消した？
// ・落ち着いて。提出まで4分待ってね……WJ……1/10……2/10……

// Thank you for making problems and running the contest


Measured memory_bytes: 3844
<?php
$inputNum = trim(fgets(STDIN));
$conditionMatchedNum = array();

for ($i = 1; $i <= $inputNum; $i++) {
    $num = $i;
    if ($num % 3 == 0) {
        $conditionMatchedNum[] = $i;
        continue;
    }
    while ($num) {
        if ($num % 10 == 3) {
            $conditionMatchedNum[] = $i;
            break;
        }
        $num = floor($num / 10);
    }
}
 
echo ' '.implode(' ', $conditionMatchedNum), PHP_EOL;

Measured memory_bytes: 16216
#include <iostream>

using namespace std;

int main() {
  int A, B;
  cin >> A >> B;
  if (A >= 13) {
    cout << B << endl;
  } else if (A >= 6) {
    cout << B / 2 << endl;
  } else {
    cout << 0 << endl;
  }
}


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

int main(){
    string s;
    cin >> s;
    int n=s.size();
    string ans="yes";
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(s[i]==s[j])ans="no";
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
    vector<int> num(3);
    cin >> num[0] >> num[1] >> num[2];
    sort(num.begin(), num.end());
    if (num[0] % 2 == num[1] % 2 && num[1] % 2 == num[2] % 2) {
        cout << (num[2] - num[0]) / 2 + (num[2] - num[1]) / 2 << endl;
    }
    else {
        if (num[2] % 2 == num[0] % 2) {
            cout << (num[2] - num[0]) / 2 + (num[2] - num[1] + 1) / 2 + 1 << endl;
        }
        else if (num[2] % 2 == num[1] % 2) {
            cout << (num[2] - num[0] + 1) / 2 + (num[2] - num[1]) / 2 + 1<< endl;
        }
        else {
            cout << (num[2] - num[0] - 1) / 2 + (num[2] - num[1] - 1) / 2 + 1<< endl;
        }
    }


    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef unsigned long long ll;

int main()
{
  int n, k;
  cin >> n >> k;
  int a;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a;
    ans += 2 * min(a, k - a);
  }
  cout << ans << endl;
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll modpow(ll a, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    (a *= a) %= MOD;
    n >>= 1;
  }
  return res;
}

const ll maxf = 10000000;
ll fact[maxf+5];
ll ifact[maxf+5];

void fact_init(){
  fact[0] = 1;
  for(ll i=1; i<=maxf; i++) fact[i] = (fact[i-1] * i) % MOD;
  ifact[maxf]=modpow(fact[maxf],MOD-2);
  for(ll i=maxf; i>=1; i--) ifact[i-1] = (ifact[i] * i) % MOD;
}

ll comb(ll n, ll r){
  if(n<r || n<0 || r<0) return 0;
  if(fact[0] == 0) fact_init();
  return ((fact[n] * ifact[n-r]) % MOD * ifact[r]) % MOD;
}

ll naive_comb(ll n, ll r){
  ll res = 1;
  for (ll i = n; i > n - r; i--) res = res * i % MOD;
  for (ll i = 1; i <= r; i++) res = (res * modpow(i, MOD-2)) % MOD;
  return res;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,m,k; cin>>n>>m>>k;
  ll sum=0;
  for(ll i=0; i<=n-1; i++){
    for(ll j=0; j<=m-1; j++){
      ll tmp=(n-i)*(m-j)%MOD*(i+j)%MOD;
      if(i!=0 && j!=0) (tmp*=2)%=MOD;
      (sum+=tmp)%=MOD;
    }
  }
  ll ans=(sum*comb(n*m-2,k-2))%MOD;
  cout<<ans<<endl;
}

Measured memory_bytes: 156544
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var b = ReadLine();

            if (b == "A") WriteLine("T");
            if (b == "T") WriteLine("A");
            if (b == "G") WriteLine("C");
            if (b == "C") WriteLine("G");
        }
    }
}


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

int main()
{
	ll n;
   cin >> n;
   ll ans = 1e18;
   vector<ll> a(n);
   for(int i = 0;i<n;i++)cin >> a[i];
   for(int aaa = 0;aaa<2;aaa++)
   {
      if(aaa)for(auto &i:a)i = -i;
      ll sum = 0;
      ll now = 0;
      for(int i = 0;i<n;i++)
      {
         sum += a[i];
         if(i%2)//負になるようにする
         {
            now += max(0LL,sum-(-1));
            sum = min<ll>(-1,sum);
         }
         else//正になるようにする
         {  
            now += max(0LL,(1)-sum);
            sum = max<ll>(1,sum);
         }
      }
      ans = min<ll>(now,ans);
   }
   cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define mkp make_pair
int n,smlp[10000004];
vector<pii>v[10000004];
ll ans=0;
void add(int x,int y){
	v[x*y]=v[x];
	bool ok=0;
	for(int i=0;i<v[x*y].size();i++)if(v[x*y][i].first==y){
		ok=1;v[x*y][i].second++;break;
	}
	if(!ok)v[x*y].push_back(mkp(y,1));
}
int got(int x){
	int res=1;
	for(int i=0;i<v[x].size();i++)res*=(1+v[x][i].second);
	return res;
}
int main(){
	cin>>n;
	for(int i=2;i*i<=n;i++)if(!smlp[i])
		for (int j=i*i;j<=n;j+=i) smlp[j]=i;ans=1;
	for(int i=2;i<=n;i++){
		if(smlp[i]>0)add(i/smlp[i],smlp[i]);
		else add(1,i);
		ans+=1ll*got(i)*i;
	}
	cout<<ans;
}

Measured memory_bytes: 752200
#include <iostream>                                             
#include <vector>                                               
using namespace std;                                            
                                                                
int main(void) {                                                
  int n, m;                                                     
  cin >> n >> m;                                                
  vector< vector<int> > a(n,vector<int>(m));                    
  for (int i=0; i<n; i++) {                                     
    for (int j=0; j<m; j++) {                                   
      cin >> a[i][j];                                           
    }                                                           
  }                                                             
  vector<int> b(m);                                             
  for (int i=0; i<m; i++) {                                     
    cin >> b[i];                                                
  }                                                             
  vector<int> c(n,0);                                           
  for (int i=0; i<n; i++) {                                     
    for (int j=0; j<m; j++) {                                   
      c[i] += a[i][j]*b[j];                                     
    }                                                           
  }                                                             
  for (int i=0; i<n; i++) {                                     
    cout << c[i] << endl;                                       
  }                                                             
  return 0;                                                     
}                                                               
                                  

Measured memory_bytes: 3200
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;

int main(){
    long long N;
    
    cin >> N;
     
    long long A = 0,B = 0;

    for(int i = 1;i <= sqrt(N);i++){
        if(N % i)continue;
        A = max((long long)i,A);
    }

    B = N / A;

    cout << A + B - 2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int X, Y;
    cin >> X >> Y;
    bool ans = 0;
    for(int i = 0; i <= X; i++){
        if(2 * i + 4 * (X - i) == Y){
            ans = 1;
            break;
        }
    }
    if(ans){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する


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

    int a,b;
    cin >> a >> b;
    
    cout << (a % b != 0) << endl;

    return 0;
}


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

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

    bool answer = false;
    for (int i = 0; i < 3; ++i)
    {
        if (str.at(i) == '7')
        {
            answer = true;
        }
    }

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

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

int main() {
    char a, b;
    cin >> a >> b;
    
    if (a == 'H') {
        if (b == 'H') {
            cout << "H" << endl;
        } else {
            cout << "D" << endl;
        }
    } else {
        if (b == 'H') {
            cout << "D" << endl;
        } else {
            cout << "H" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include<string>
#include<iostream>
using namespace std;
int main() {
    string s;
    cin >> s;
    for(int i=0;i<s.length();++i){
        if(i%2==0){
            if(s[i]=='L'){
                cout << "No";
                return 0;
            }
        }else{
            if(s[i]=='R'){
                cout << "No";
                return 0;
            }
        }
    }
    cout << "Yes";
    return 0;
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pic = pair<int, char>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

const int MAX = 305;
const ll INF = __LONG_LONG_MAX__/3;

ll dist[MAX][MAX];
ll fuel[MAX][MAX];

int main(){
    ll n,m,l;
    cin>>n>>m>>l;
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < n; j++)
        {
            if(i==j)
            {
                dist[i][j]=0;
                fuel[i][j]=0;
            }
            else
            {
                dist[i][j]=INF;
                fuel[i][j]=INF;
            }
        }
    }
    
    for(int i = 0; i < m; i++)
    {
        ll a,b,c;
        cin>>a>>b>>c;
        a--;
        b--;
        dist[a][b]=c;
        dist[b][a]=c;
    }

    for(int k = 0; k < n; k++)
    {
        for(int i = 0; i < n; i++)
        {
            if(dist[i][k]==INF) continue;
            for(int j = 0; j < n; j++)
            {
                if(dist[k][j]==INF) continue;
                dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
            }
        }
    }

    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < n; j++)
        {
            if(dist[i][j]<=l)
            {
                fuel[i][j]=1;
            }
        }
    }

    for(int k = 0; k < n; k++)
    {
        for(int i = 0; i < n; i++)
        {
            if(fuel[i][k]==INF) continue;
            for(int j = 0; j < n; j++)
            {
                if(fuel[k][j]==INF) continue;
                fuel[i][j]=min(fuel[i][j],fuel[i][k]+fuel[k][j]);
            }
        }
    }

    int q;
    cin>>q;
    for (int i = 0; i < q; i++)
    {
        int s,t;
        cin>>s>>t;
        s--;t--;
        if(fuel[s][t]==INF) cout<<-1<<endl;
        else cout<<fuel[s][t]-1<<endl;;
    }
    
    return 0;
}

Measured memory_bytes: 1920
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef long long ll;
const int N=5e5+5;
ll res;int a[N],op[N],id[N],top,n,m,c,d;
inline bool cmp(const int &x,const int &y){return a[x]<a[y];}
int main(){
	scanf("%d%d",&n,&m);
	fp(i,1,n)++top,scanf("%d",&a[top]),op[top]=0,id[top]=top;
	fp(i,1,m)++top,scanf("%d",&a[top]),op[top]=1,id[top]=top;
	sort(id+1,id+1+top,cmp);
	fp(i,1,top){
//		printf("%d %d %d\n",id[i],a[id[i]],op[id[i]]);
		if(!op[id[i]])res+=1ll*a[id[i]]*(m+1-d),++c;
			else res+=1ll*a[id[i]]*(n+1-c),++d;
	}
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 3712