akhauriyash/Code-Regression huggingface dataset:
#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=n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=m; i<ll(n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(x) ll(x.size()) 
using P = pair<int, int>;
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 int INF = 2e9;
const ll LINF = (1LL<<60);

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,x,t; 
  cin >> n >> x >> t;
  cout << (n/x) * t + (n%x==0 ? 0 : t) << '\n';

  return 0;
}


Measured memory_bytes: 3608
S = input().rstrip()
N = len(S)
K = int(input())
A = []
for i in range(N):
    A.append(S[i:])
A.sort()
B = set()
flg = False
for i in range(len(A)):
    for j in range(1,len(A[i])+1):
        B.add(A[i][:j])
        if len(B)==K:
            flg = True
            break
    if flg: break
B = list(B)
B.sort()
print(B[-1])

Measured memory_bytes: 81168
#include<bits/stdc++.h>
using namespace std;
int t[200005];
int main()
{
	int n;
	cin>>n;
	for(int i=1; i<=n-1; i++)
	{
		int x;
		cin>>x;
		t[x]++;
	}
	for(int i=1; i<=n; i++)cout<<t[i]<<endl;
}

Measured memory_bytes: 4368
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }

    /*for(int i=0; i<a.size(); i++){
        cout << a[i] << endl;
        cout << a.size() << endl;
    }*/



    ll mymoney = 1000;
    for(int i=0; i<n-1; i++){
        long long stocks = 0;
        if(a[i] < a[i+1]){
            stocks = mymoney / a[i];
            mymoney += (a[i+1] - a[i]) * stocks;
        }
    }

    cout << mymoney << endl;
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_0 = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());

signed main()
{   
    gearup;
    ll n,m; cin >> n >> m;
    vpii p;
    rep(i,m){
        int a,b;cin >> a >> b;
        p.push_back({b,a});
    }
    sort(all(p));
    int res = 0;
    int to = 0;
    rep(i,m){
        if (p[i].second > to) {
            to = p[i].first - 1;
            ++res;
        }
    }
    cout << res << endl;
}



Measured memory_bytes: 4292
from bisect import bisect_left

N = int(input())
L = list(map(int, input().split()))

L_sorted = sorted(L)

count = 0
for i in range(N):  # shortest stick
    for j in range(i+1, N):  # second shortest stick
        r = bisect_left(L_sorted, L_sorted[i] + L_sorted[j], j)
        count += r - j - 1

print(count)


Measured memory_bytes: 3188
N, P = [int(_c) for _c in input().split(" ")]

if N == 1:
    print(P)
else:
    _max = 1
    M = int(P ** (1 / N) + 1.0 * 1e-9)
    for i in range(1, M + 1):
        if P % (i ** N) == 0:
            _max = i

    print(_max)

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

int main() {
    int64_t N,M;
    cin >> N >> M;
    vector<int64_t> A(N),B(N);
    for ( int64_t i = 0; i < N; ++i){
        cin >> A.at(i) >> B.at(i);
    }
    
    vector<vector<int64_t>> AB;
    AB.resize(M+1);
    // AB.at(i) i日後にもらえる仕事
    for ( int i = 0; i < N; ++i){
        if ( A.at(i) > M ) continue;
        AB.at(A.at(i)).push_back(B.at(i));
    }
    
    //cout << "A" << endl;
    
    priority_queue<int64_t> que;
    int64_t ans = 0;
    for (int d = 1; d <= M; ++d){
        for ( int i = 0; i < AB.at(d).size(); ++i){
            que.push(AB.at(d).at(i));
        }
        if ( que.size() ){
            ans += que.top(); que.pop();
        }
    }

    cout << ans << endl;
    
    
    return 0;
}

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

int main() {
	int N; cin >> N;
	long long ans = 0;
	vector<long long> A(N+2);
	A[0] = 0; A[N + 1] = 0;
	for (int i = 1; i <= N; i++) { cin >> A[i]; }
	for (int i = 1; i <= N+1; i++)ans += abs(A[i] - A[i - 1]);
	for (int i = 1; i <= N; i++) {
		cout << ans - abs(A[i] - A[i - 1])-abs(A[i+1]-A[i]) + abs(A[i + 1] - A[i - 1]) << endl;
	}
}



Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int inf = 1001001001;

int main(){
  string s;
  cin >> s;
  int ans = 0;
  
  rep(i,4){
    if(s.at(i) == '+') ans++;
    else ans--;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

typedef tuple<ll, ll, ll> T;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    cout<<n*800 - n/15*200<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
typedef long long ll;

using namespace std;

ll gcd(ll a, ll b) {
  if (b == 0) return a;
  ll r = a % b;
  return gcd(b, r);
}

int main () {
  ll a,b;
  ll c,d;
  cin >> a>>b>>c>>d;
  ll ans = b-b/c-b/d+b/(c*d/gcd(c,d)) -((a-1)-(a-1)/c - (a-1)/d + (a-1)/(c*d/gcd(c,d)));
  
  ll cj=floor((a-1)/c);
  ll dj=floor((a-1)/d);

  
  ll ci = floor(b/c);
  ll di = floor(b/d);
  
  ll g = gcd(c,d);
  //int g = 1;
  ll f = c*d/g;
  //cout << g;
  ll fj=floor((a-1)/f);
  ll fi = floor(b/f);
  //ans = b-ci - di + fi -(a-1-cj-dj+fj);
  cout << ans;
  //cout << ans <<ci<<cj <<di<<dj<<fi<<fj;
  
}


Measured memory_bytes: 256
S = input()
K = int(input())

n = 0
for si in S:
    if si == '1':
        n += 1
    else:
        break

# if str(S)[0] == 1 and K == 1:
#     print(1)
# else:
#     print(str(S)[0])

if n >= K:
    print('1')
else:
    print(S[n])


Measured memory_bytes: 3064
#include <stdio.h>
  
int main(void)
{
    int p, min_p = 2000;
    int j, min_j = 2000;
    int i;
      
    for (i = 0; i < 3; i++){
        scanf("%d", &p);
        if (min_p > p){
            min_p = p;
        }
    }
    for (i = 0; i < 2; i++){
        scanf("%d", &j);
        if (min_j > j){
            min_j = j;
        }
    }
      
    printf("%d\n", min_p + min_j - 50);
      
    return (0);
}

Measured memory_bytes: 592
n, K = map(int, input().split())
h = list(map(int, input().split()))

INF = 1 << 40
dp = [INF] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(1, n - 1):
	minv = 1 << 40
	for k in range(1, K + 1):
		if i + 1 - k < 0:
			continue
		minv = min(minv, dp[i + 1 - k] + abs(h[i + 1] - h[i + 1 - k]))
	dp[i + 1] = minv

print(dp[-1])

Measured memory_bytes: 52448
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
    int N;
    int a[100];
    scanf("%d", &N);
    for(int i = 0; i < N; i++){
        scanf("%d", &a[i]);
    }

    sort(a, a + N);

    int ans = 0;
    for(int i = N - 1; i >= 0; i--){
        if (i % 2 == 0) ans += a[i];
        else ans -= a[i];
    }
    if (N % 2 != 0){
        printf("%d\n", ans);
    }else {
        printf("%d\n", -ans);
    }

}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
const int N = 205;
int n;
char str[N];
int cost(char c){
	if(c == '('){
		return 1;
	}
	return -1;
}
int dp[N][N];
int solve(int pos , int sum){
	if(sum >= N || sum < 0){
		return 1e9;
	}
	if(pos == n){
		return sum;
	}
	if(dp[pos][sum] != -1){
		return dp[pos][sum];
	}
	int res = 1e9;
	res = min(res , 1 + solve(pos + 1 , sum + cost(str[pos])));
	res = min(res , 1 + solve(pos , sum + 1));
	return dp[pos][sum] = res;
}
void go(int pos , int sum){
	if(pos == n){
		for(int i = 0 ; i < sum ; ++i){
			printf(")");
		}
		return;
	}
	int a = solve(pos + 1 , sum + cost(str[pos]));
	int b = solve(pos , sum + 1);
	if(a < b){
		printf("%c" , str[pos]);
		go(pos + 1 , sum + cost(str[pos]));
		return;
	}
	printf("(");
	go(pos , sum + 1);
	return;
}
int main(){
	scanf("%d" , &n);
	scanf("%s" , str);
	memset(dp , -1 , sizeof(dp));
	go(0 , 0);
}

Measured memory_bytes: 384
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

int main(){
  int H,W,h,w;
  cin>>H>>W>>h>>w;
  
  cout<<H*W-h*W-H*w+h*w<<endl;
 
  return 0;
}

Measured memory_bytes: 3600
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long A[] = new long[N];
		HashMap<Long, Long> map = new HashMap<Long, Long>();
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextLong();
			if(map.containsKey(A[i])) {
				map.put(A[i], map.get(A[i]) + 1);
			} else {
				map.put(A[i], (long)1);
			}
		}
		
		long ans = 0;
		for(Map.Entry<Long, Long> entry : map.entrySet()) {
			ans += entry.getValue() * (entry.getValue() - 1) / 2;
		}
		
		for(int i = 0; i < N; i++) {
			System.out.println(ans - (map.get(A[i]) - 1));
		}
	}
}


Measured memory_bytes: 109628
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a, b, c;
	cin >> a >> b >> c;
	cout << a + b + c - max({ a,b,c }) << endl;
	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 Sort(v) sort((v).begin(), (v).end())
using veci = vector<int>;
using vecs = vector<string>;
using vecd = vector<double>;
using vecl = vector<long long>;
using G = vector<vector<int>>;
using ll = long long;
using P = pair<string, int>;
ll lINF = LLONG_MAX; ll lmINF = LLONG_MIN;
int INF = INT_MAX; int mINF = INT_MIN;
int main(){
    int x, y;
    cin >> x >> y;
    if (2*x <= y & 4*x >= y && y%2 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3636
// i am a noob

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

#define endl "\n"

const int MOD = 1000000007;


int main()
{
    int a,len;
    str x;
    cin >> a >> x;
    len = x.length();
    if (len <= a){
        cout << x << endl;
    }
    else {
        for(int i = 0;i < a ; i++){
            cout << x[i] ;
            }
            cout <<  "...";
                    }


	return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k,t,d,uma[100000],ans,umas[100001],ch,vs[100001];
vector<ll>v,v1;
int main(void){
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>t>>d;
        t--;
        if(uma[t]<d){
            if(uma[t]!=0)v.push_back(uma[t]);
            uma[t]=d;
        }
        else v.push_back(d);
    }
    for(int i=0;i<n;i++){
        if(uma[i]>0){v1.push_back(uma[i]);ch++;}
        
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());
    sort(v1.begin(),v1.end());
    reverse(v1.begin(),v1.end());
    for(int i=0;i<ch;i++){
        umas[i+1]=umas[i]+v1[i];
    }
    for(int i=0;i<n-ch;i++){
        vs[i+1]=vs[i]+v[i];
    }
    for(ll i=1;i<=min(k,ch);i++){
        if(n-ch<k-i)continue;
        //cout<<umas[min(k,ch)]<<" "<<min(k,ch)*min(k,ch)<<" "<<vs[k-min(k,ch)]<<endl;
        ans=max(ans,umas[i]+i*i+vs[k-i]);
        //cout<<ans<<endl;
        
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 2680
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



namespace Test1 {

    class ClassMain {

        public static void Main(String[] args) {
            string line;
            while ((line = Console.ReadLine()) != null) {
                string[] strs = line.Split(' ');
                int n0 = int.Parse(strs[0]);
                int n1 = int.Parse(strs[1]);
                if (n0 == 0 && n1 == 0) { break; }
                int[] xy = new int[2];
                xy[0] = Math.Max(n0,n1);
                xy[1] = Math.Min(n0, n1);

                int cnt =0;
                while (true) {
                    int resi = xy[0] % xy[1];
                    xy[0] = xy[1];
                    xy[1] = resi;
                    cnt++;
                    if (xy[1] == 0) { break; }
                }
                Console.WriteLine(xy[0] + " " + cnt);
                


            }
        }

    }

}

Measured memory_bytes: 5816
import sys

class Node:
    __slots__ = ['key', 'left', 'right']
    def __init__(self, key):
        self.key = key
        self.left = self.right = None

root = None

def insert(key):
    global root
    x, y = root, None
    while x != None: x, y = x.left if key < x.key else x.right, x
    if y == None: root = Node(key)
    elif key < y.key: y.left = Node(key)
    else: y.right = Node(key)

def find(target):
    result = root
    while result and target != result.key:
        result = result.left if target < result.key else result.right
    return result != None

def inorder(node):
    return inorder(node.left) + f' {node.key}' + inorder(node.right) if node else ''
def preorder(node):
    return f' {node.key}' + preorder(node.left) + preorder(node.right) if node else ''

input()
for e in sys.stdin:
    if e[0] == 'i': insert(int(e[7:]))
    elif e[0] == 'f': print(['no','yes'][find(int(e[5:]))])
    else: print(inorder(root)); print(preorder(root))


Measured memory_bytes: 55624
///
// File:  c.go
// Author: ymiyamoto
//
// Created on Sun Feb 18 21:09:17 2018
//
package main

import (
	"fmt"
)

func main() {
	c := make([]int, 9)
	for i := 0; i < 9; i++ {
		fmt.Scan(&c[i])
	}

	for a1 := -1000; a1 <= 1000; a1++ {
		invalid := false
		b1 := c[0] - a1
		b2 := c[1] - a1
		b3 := c[2] - a1

		a2 := c[3] - b1
		if c[4]-b2 != a2 {
			invalid = true
		}
		if c[5]-b3 != a2 {
			invalid = true
		}

		a3 := c[6] - b1
		if c[7]-a3 != b2 {
			invalid = true
		}
		if c[8]-a3 != b3 {
			invalid = true
		}

		if !invalid {
			fmt.Println("Yes")
			return
		}
	}

	fmt.Println("No")

	return
}


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

int main(){
    long long int r,d,x;
    long long int tmp;
    cin>>r>>d>>x;
    for(int i=0;i<10;i++){
        tmp = x;
        x = r * tmp - d;
        cout<<x<<endl;
    }
}

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

int main()
{
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;

	for (int i = 0; i < ty - sy; i++){
		cout << "U";
	}
	for (int i = 0; i <= tx - sx; i++){
		cout << "R";
	}
	for (int i = 0; i < abs(ty - sy) + 1; i++){
		cout << "D";
	}
	for (int i = 0; i <= tx - sx; i++){
		cout << "L";
	}
	cout << "UL";
	for (int i = 0; i < ty - sy + 1; i++){
		cout << "U";
	}
	for (int i = 0; i < tx - sx + 1; i++){
		cout << "R";
	}

	for (int i = 0; i < ty - sy + 1; i++){
		cout << "D";
	}
	for (int i = 0; i < tx - sx; i++){
		cout << "L";
	}
	puts("");
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,i,j,pos=1,s=0,sum=-1,c=0,t;
	cin>>n;
	ll a[n+1],m[n+1];
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		m[i]=-1;
	}
	m[1]=0;
	for(i=1;i<=n;i++)
	{
		j=i+1;
		while(j<=n && c==0)
		{
			if(m[j]<0)
			{
				m[j]=abs(a[j]-a[i])+m[i];
			}
			else if(m[j]>=abs(a[j]-a[i])+m[i])
			{
				m[j]=abs(a[j]-a[i])+m[i];
			}
			if(j==i+2)
			{
				c=1;
			}
			j=i+2;
		}
		c=0;
	}
	cout << m[n] <<'\n';
}

Measured memory_bytes: 1792
//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;

const int N = 100;
const int mod = 1e9 + 7;

ll dp[N][N][N * N];

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

Measured memory_bytes: 207104
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

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

    string s;
    cin >> s;

    s.push_back('<');

    const int n = (int)s.size() + 1;

    vector<lint> a(n + 1, 0LL);
    rep(i, n - 1){
        if(s[i] == '<'){
            int j = i - 1;
            while(j >= 0 && s[j] == '>'){
                chmax(a[j], a[j + 1] + 1LL);
                --j;
            }

            j = i;
            while(j < n - 1 && s[j] == '<'){
                chmax(a[j + 1], a[j] + 1LL);
                ++j;
            }

            i = j - 1;
        }
    }

    lint ans = 0;
    rep(i, n - 1){
        ans += a[i];
        // cout << a[i] << ' ';
    }
    // cout << endl;

    cout << ans << endl;

    cout << flush;

    return 0;
}

Measured memory_bytes: 4764
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;
int fac[] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320};
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int answer[40325];
const int Inf = 0x3f3f3f3f;
int Cantor(int n, char num[])
{
    int sum = 0, cnt;
    for(int i = 0; i < n; i++)
    {
        cnt = 0;
        for(int j = i + 1; j < n; j++)
        {
            if(num[i] > num[j])
                cnt++;
        }
        sum += cnt * fac[n - i - 1];
    }

    return sum + 1;
}
struct Node
{
    char array[8];
    int cantorValue;
    int position;
    Node(char _array[], int _cantorValue, int _position)
    {
        memcpy(array, _array, sizeof(_array));
        cantorValue = _cantorValue;
        position = _position;
    }
};
void BFS()
{
    queue <Node> que;

    char number[8], temp[8];
    int code;
    memset(answer, 0x3f, sizeof(answer));

    for(int i = 0; i < 8; i++)
        number[i] = i + '0';

    code = Cantor(8, number);
    answer[code] = 0;

    que.push(Node(number, code, 0));

    while(!que.empty())
    {
        Node s = que.front();
        que.pop();

        int x = s.position / 4;
        int y = s.position % 4;

        for(int i = 0; i < 4; i++)
        {
            int tx = x + dx[i];
            int ty = y + dy[i];

            memcpy(temp, s.array, sizeof(s.array));

            if(tx >= 0 && tx < 2 && ty >= 0 && ty < 4)
            {
                swap(temp[tx * 4 + ty], temp[s.position]);
                code = Cantor(8, temp);
                if(answer[code] == Inf)
                {
                    que.push(Node(temp, code, tx * 4 + ty));
                    answer[code] = answer[s.cantorValue] + 1;
                }
            }
        }
    }
    return;
}
int main(void)
{

    char number[8];

    BFS();

    while(scanf("%d", &number[0]) != EOF)
    {
        number[0] += '0';

        for(int i = 1; i < 8; i++)
        {
            scanf("%d", &number[i]);
            number[i] += '0';
        }

        int code = Cantor(8, number);

        printf("%d\n", answer[code]);
    }

	return 0;
}



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

public class Program
    {
        static void Main(string[] args)
        {
            var readLine = Console.ReadLine();
            var result = Logic(readLine);
            result.ForEach(Console.WriteLine);
        }

        public static List<string> Logic(string argument)
        {
            var Argument = argument;
            var inputCount = int.Parse(Argument);

            var resultName = inputCount < 1000 ? "C" : "D";
            var ContestName = $"AB{resultName}";
            
            var results = new List<string>();
            results.Add(ContestName);
            return results;
        }
    }

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    map<string, ll> mp;
    for (int i = 0; i < n; i++) {
        string c;
        cin >> c;
        sort(c.begin(), c.end());
        mp[c]++;
    }
    ll ans = 0;
    for (auto x : mp) {
        if (x.second >= 2) {
            ans += x.second * (x.second - 1) / 2;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 11136
#pragma GCC optimize (2)
#pragma G++ optimize (2)
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MAX 100005
using namespace std;
//char nc()
//{
//	static char buf[100000],*p1=buf,*p2=buf;
//	return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
//}
char nc(){return getchar();}
int read()
{
	int x=0,y=1;
	char c=nc();
	while(!isdigit(c))
	{
		if(c=='-')y=-1;
		c=nc();
	}
	while(isdigit(c))
	{
		x=(x<<1)+(x<<3)+(c^48);
		c=nc();
	}
	return x*y;
}
int n,m,head[MAX],cnt=1,deg[MAX];
struct edge{
	int next,to;
}a[MAX<<1];
void add(int x,int y)
{
	a[++cnt].next=head[x];
	a[cnt].to=y;
	head[x]=cnt;
	deg[y]++;
}
int cant,st;
bool dfs(int x,int from)
{
	for(int i=head[x];i;i=a[i].next)
	{
		int t=a[i].to;
		if(i==from||t==cant) continue;
		if(t==st||dfs(t,i^1)) return true;
	}
	return false;
}
int main()
{
	n=read();m=read();
	int x,y;
	for(int i=1;i<=m;i++)
		x=read(),y=read(),add(x,y),add(y,x);
	bool flag=false;
	int cnt=0;
	for(int i=1;i<=n;i++)
	{
		if(deg[i]&1) return puts("No"),0;
		if(deg[i]>=6) flag=true;
		if(deg[i]==4) cnt++;
	}
	if(flag||cnt>=3) return puts("Yes"),0;
	if(cnt<=1) return puts("No"),0;
	for(int i=1;i<=n;i++)
		if(deg[i]==4)
		{
			if(!flag) cant=i,flag=true;
			else st=i,puts(dfs(i,0)?"Yes":"No");
		}
	return 0;
}


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

int main() {
  long long l,r,n,m, mod=2019, ans=9000000;
  cin>>l>>r;
  
  n=l/mod; m=r/mod;
  if(n!=m)
    cout<<0<<endl;
  else{
    for(int i=l; i<r; i++){
      for(int j=i+1; j<=r; j++){
        n=((i%mod)*(j%mod))%mod;
        if(n<ans)
          ans=n;
      }
    }
    cout<<ans<<endl;
  }
  
  
}

Measured memory_bytes: 256
//#include "stdafx.h"
#include "iostream"
#include "fstream"
#include "algorithm"
#include "iomanip"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "map"
#include "set"
#include "list"
#include "deque"
#include "complex"
#include "bitset"
#include "cmath"
#include "unordered_set"
#include "unordered_map"
#include "iterator"
#include <ctime>
#include <cassert>
#include "numeric"
#include <cstdio>
#include "random"
#include "chrono"
#include "cstring"

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target_ans("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

//#define f(i,n) for(int i=0; i<n;i++)
//#define rf(i, n) for(int i=n-1;i>=0;i--)
//#define forn(i, j, n) for(int i=j; i<n; i++)
//#define ff(i, j, n) f(i, n)f(j, n)
#define pb push_back
#define maxi(a,b) a = max(a, b);
#define mini(a,b) a = min(a, b);
#define endl '\n'

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sqr(x) ((x) * (x))
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;
//typedef long long ll;
typedef long double ld;

#define int long long
//#define int unsigned int
#define double ld
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pii> vpii;
typedef vector<char> vc;
typedef vector<vi> vvi;

template<class T>
void show(const vector<T> &a)
{
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

vi xx = { 1, 0, -1, 0 };
vi yy = { 0, 1, 0, -1 };
string dir = "LRUD";

const int N = 5e5 + 50, oo = 3e18 + 500;
const int mod = 998244353;
//const int mod = 1e9 + 7;
//const int mod = 1e9 + 9;
const double eps = 1e-12, PI = 2 * acos(0.0);
int n, m, k;
long long cnt = 0;
int lg = 18;
vi g[N];
vi rg[N];
vi visit(N, 0);

int pr[N], sz[N];

void make_set(int v)
{
	pr[v] = v;
	sz[v] = 1;
}

int find_set(int v)
{
	if (v == pr[v])
		return v;

	return pr[v] = find_set(pr[v]);
}

void union_sets(int u, int v, int w, int &ans)
{
	u = find_set(u);
	v = find_set(v);

	if (u == v)
		return;

	ans += w;
	cnt--;

	if (sz[u] < sz[v])
		swap(u, v);

	pr[v] = u;
	sz[u] += sz[v];
}

double logr(int a)
{
	return log(a) / log(10);
}

int mult(int a, int b)
{
	if (a == 0 || b == 0)
		return 0;

	if (a == -1 || b == -1)
		return -1;

	if (logr(a) + logr(b) > 18)
	{
		return -1;
	}

	int res = a*b;
	int x = 1000000000000000000;

	if (res > x)
	{
		res = -1;
	}
	return res;
}

signed main()
{
	ios::sync_with_stdio(0);
	cout.tie(0); cin.tie(0);
	/*freopen("abbreviation.in", "r", stdin);
	freopen("abbreviation.out", "w", stdout);*/
	//ПРОВЕРЯЙ ДЕФАЙНЫ ТУПОЙ!!!

	double a, b;
	cin >> a >> b;

	a *= b;
	n = a;
	cout << n << endl;
}



Measured memory_bytes: 30280
a=[int(input()) for i in range(5)]
b=[(a[i]-1)//10*10 for i in range(5)]
c=[a[i]%10 for i in range(5)]
for i in range(5):
	if a[i]%10==0:
		c[i]=10
d=min(c)
print(d+40+sum(b))

Measured memory_bytes: 3060
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
/* #include <regex> */

using namespace std;

/* g++ -g -std=c++11 */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int inf = 1e9;
const int maxn = 1e5+5;
int A[maxn], dp[maxn];

int dfs(const int i)
{
    if (i == 0)
        return 0;
    int& ans = dp[i];
    if (-1 == ans) {
        ans = inf;
        FOR(d,1,3) if (i-d >= 0) {
            const int j = i-d;
            const int res = dfs(j)+abs(A[i]-A[j]);
            ans = min(ans,res);
        }
    }
    return ans;
}

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    int n;
    while (cin >> n) {
        memset(dp,-1,sizeof(dp));
        FOR(i,0,n)
            cin >> A[i];
        const int ans = dfs(n-1);
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
    #define ll long long
    #define maxn 100005 /*rem*/
    #define mod 998244353
    #define db double
    #define vi vector<int>
    #define pb push_back
    #define mp make_pair
    #define pi pair<int, int>
    #define fi first
    #define se second
     
    template <typename T> bool chkmax(T &x,T y){return x<y?x=y,true:false;}
    template <typename T> bool chkmin(T &x,T y){return x>y?x=y,true:false;}
     
    using namespace std;

    int a[maxn]; 
    int main() {
    	ll f = 1;
    	int n;
    	cin >> n;
    	ll S = 0;
    	for (int i = 0; i <= n; i++) scanf("%d", &a[i]), S += a[i];
    	ll ans = 0;
    	for (int i = 0; i <= n; i++) {
    		ans += f;
    	//	cout << i << ' ' << f << endl;
    		if (f < a[i]) {
    			cout << -1 << endl;
    			return 0;
    		}
    		f -= a[i];
    		S -= a[i];	
    		f *= 2;
    		f = min(f, S);
    	
    	}
    	cout << ans << endl;
    	return 0;
    }


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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;

bool calc(int d){
	if(d ==1) return true;
	for(int i=2; i*i <=d; i++){
		if(d/i == i && d%i==0){
 			return true;

		}
	}

	return false;
}


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

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

	vector<int> x[n];

	for(int i=0; i<n; i++){
		for(int j=0; j<d; j++){
			int tmp;cin>>tmp;
			x[i].push_back(tmp);
		}
	}
	int cnt=0;
	for(int i=0; i<n-1; i++){
		for(int j=i+1; j<n; j++){
			int sum=0;
			for(int k=0; k<d; k++){
				int tmp = abs(x[i][k]-x[j][k]);

				sum += tmp*tmp;

			}

			if(calc(sum)){cnt++;}

		}
	}
	writeln(cnt);
}




Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <climits>
using namespace std;
 
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string A;
    cin >> A;
    long long N = A.size();
    map<char, long long> mp;
    for(int i=0; i<26; i++) mp['a'+i] = 0;
    for(int i=0; i<N; i++) mp[A[i]]++;
 
    long long ans = (N*(N-1))/2;
    for(int i=0; i<26; i++){
        long long tmp = mp['a'+i];
        if(tmp <= 1) continue;
        ans -= (tmp*(tmp-1))/2;
    }
    ans++;
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 720
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<string>
#include<list>
using namespace std;
typedef long long llong;
llong gcd(llong a, llong b) {
	if (a < b) swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}
llong lcm(llong a, llong b) {
	llong g = gcd(a, b);
	return a * b / g;
}
//ここまで共通
bool ope1(pair<int, int>a, pair<int, int>b) {
	return a.second < b.second;
}
int N, K;
vector<int> A;
vector<int> V;

int ans = 0;

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		A.push_back(a);
	}

	sort(A.begin(), A.end());

	int q, r;
	for (int i = 0; i < A.size(); i++) {
		if (i == 0) {
			q = A[i];
			r = 1;
		}
		else {
			if (q == A[i]) {
				r++;
			}
			else {
				
				V.push_back(r);
				q = A[i];
				r = 1;
			}
		}

		if (i == A.size() - 1) {
			
			V.push_back(r);
		}
	}

	
	sort(V.begin(), V.end(), greater<int>());
	while (V.size() > K) {
		int q = V.back();
		ans += q;
		V.pop_back();
	}

	cout << ans;
}

Measured memory_bytes: 2548
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let a: usize = read!()  ;
    println!("{}", a + a * a + a * a * a);
}

Measured memory_bytes: 2132
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  																						   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
																													   
const int INF = 1000000001;																						   
const float PI = 3.14;	
const int mod = 1e9+7;																							   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra																													   																				   list<int>::iterator it;																								   
																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS//////////////////////////////////////////////////////

double suma_JPY = 0;
double suma_BTC = 0;
string s;

///////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	int n;
	cin >> n;
	double x;
	for(int i = 0; i < n; i++){
		cin >> x >> s;
		if(s == "JPY"){
			suma_JPY += x;
		} 
		else if(s == "BTC"){
			suma_JPY += (x * 380000.0);
		}
	}
	
	
	cout << setprecision(4) << fixed << suma_JPY << endl;
	
	
	
	
	
	
	
	
	
	
	
	

						
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		new Main().solve();
	}
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[]a=new int[n];
		for(int i=0;i<n;i++)a[i]=sc.nextInt()+1;
		int[] count=new int[100002];
		for(int i=0;i<n;i++) {
			count[a[i]-1]++;
			count[a[i]]++;
			count[a[i]+1]++;
		}
		int max=0;
		for(int i=0;i<100002;i++) {
			max=Math.max(max, count[i]);
		}
		System.out.println(max);
	}
}

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

int main() {
    vector<int> t(5);
    for (int i = 0; i < 5; ++i) cin >> t[i];
    sort(t.begin(), t.end());

    int minv = INT_MAX;
    do {
        int time = 0;
        for (int i = 0; i < 5; ++i) {
            while (time % 10 != 0) time++;
            time += t[i];
        }
        minv = min(time, minv);
    } while (next_permutation(t.begin(), t.end()));

    cout << minv << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = b[a[0]-1]
for i in range(1, n):
  if a[i] - a[i-1] == 1:
    ans += c[a[i-1]-1]
  ans += b[a[i]-1]
print(ans)

Measured memory_bytes: 3064
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String T = sc.next();
    int[] R1 = new int[26];
    int[] R2 = new int[26];
    for (int i = 0; i < 26; i++) {
      R1[i] = -1;
      R2[i] = -1;
    }
    boolean flag = true;
    for (int i = 0; i < S.length(); i++) {
      if (R1[S.charAt(i) - 'a'] < 0) {
        R1[S.charAt(i) - 'a'] = T.charAt(i) - 'a';
      } else {
        if (R1[S.charAt(i) - 'a'] != T.charAt(i) - 'a') {
          flag = false;
        }
      }
      if (R2[T.charAt(i) - 'a'] < 0) {
        R2[T.charAt(i) - 'a'] = S.charAt(i) - 'a';
      } else {
        if (R2[T.charAt(i) - 'a'] != S.charAt(i) - 'a') {
          flag = false;
        }
      }
    }
    if (flag) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 28908
N = int(input())
data = []
for i in range(N):
    data.append(input())
co_AC = 0
co_WA = 0
co_TLE = 0
co_RE = 0
for i in range(N):
    if data[i] == "AC":
        co_AC += 1
    elif data[i] == "WA":
        co_WA += 1
    elif data[i] == "TLE":
        co_TLE += 1
    else:
        co_RE += 1


print("AC" + " x " + str(co_AC))
print("WA" + " x " + str(co_WA))
print("TLE" + " x " + str(co_TLE))
print("RE" + " x " + str(co_RE))

Measured memory_bytes: 82440
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<int> A(N, 0);
  vector<int> R(N, 0);
  rep(i, N) cin >> A[i];
  for(int i=0, s=1; i<N; ++i, s *= -1) {
    R[0] += s*A[i];
  }
  for(int i=1; i<N; ++i) {
    R[i] = 2*A[i-1] - R[i-1];
  }
  rep(i,N) cout << R[i] <<" ";
  cout << endl;
  return 0;
}


Measured memory_bytes: 2048
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _overload4(_1,_2,_3,_4,name,...) name
#define _overload3(_1,_2,_3,name,...) name
#define _overload2(_1,_2,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(ll i=a;i<b;++i)
#define _repc(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) _overload4(__VA_ARGS__,_repc,_repi,_rep)(__VA_ARGS__)
#define _rrepi(i,a,b) for(ll i=b-1;i>=a;i--)
#define _rrep(i,n) _rrepi(i,0,n)
#define _rrepc(i,a,b,c) for(ll i=a+(b-a-1)/c*c;i>=a;i-=c)
#define rrep(...) _overload4(__VA_ARGS__,_rrepc,_rrepi,_rrep)(__VA_ARGS__)
#define sum(...) accumulate(range(__VA_ARGS__),0)
#define _range(i) (i).begin(),(i).end()
#define _rangek(i,k) (i).begin(),(i).begin()+k
#define range(...) _overload2(__VA_ARGS__,_rangek,_range)(__VA_ARGS__)
#define LINF (ll)1000000000000000000
#define MOD (ll)1000000007
#define INF (int)1000000007
#define Yes(i) out(i?"Yes":"No")
#define YES(i) out(i?"YES":"NO")
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,size) vector<type> name(size);
#define VEC(type,name,size) vector<type> name(size);in(name)
struct aaa{aaa(){cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}aaaaaaa;
inline void in() {}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec);
template<typename T,typename L>
istream& operator >> (istream& is, pair<T,L>& p);
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec);
template<typename T,typename L>
ostream& operator << (ostream& os, pair<T,L>& p);
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){for(T& x: vec) is >> x;return is;}
template<typename T,typename L>
istream& operator >> (istream& is, pair<T,L>& p){is >> p.first;is >> p.second;return is;}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){os << vec[0];rep(i,1,vec.size()){os << ' ' << vec[i];}return os;}
template<typename T,typename L>
ostream& operator << (ostream& os, pair<T,L>& p){os << p.first << " " << p.second;return os;}
template <class Head, class... Tail>
inline void in(Head&& head,Tail&&... tail){cin>>head;in(move(tail)...);}
template <class T>
inline void out(T t){cout<<t<<'\n';}
template <class Head, class... Tail>
inline void out(Head head,Tail... tail){cout<<head<<' ';out(move(tail)...);}

int gcd ( int a, int b ) { int c; while ( a != 0 ) { c = a; a = b%a; b = c; } return b; }
int main(){
    INT(n);
    VEC(int, d, n);
    rep(i,n)d[i]/=10;
    int max=0;
    rep(i,0,n-1){
        int a=i+d[i];
        if(a>max)max=a;
        if(max<i+1){
            out("no");
            return 0;
        }
    }
    int min=n-1;
    rrep(i,1,n){
        int a=i-d[i];
        if(a<min)min=a;
        if(min>i-1){
            out("no");
            return 0;
        }
    }
    out("yes");
}
















Measured memory_bytes: 4132
//一番きついところで生まれた遅延のみ
//それ以外はスムーズ
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N,A,B,C,D,E; cin>>N>>A>>B>>C>>D>>E;
    ll M;
    M=min(A,min(B,min(C,min(D,E))));
    cout<<(N+M-1)/M+4<<endl;
}


Measured memory_bytes: 3608
#include "bits/stdc++.h"

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl


signed main(){

	int N;
	cin >> N;
	char c[400][400], d[400][400];
	rep(i, N)rep(j, N) cin >> c[i][j];

	int ans = 0;
	// aだけ下にずらす
	rep(a, N){
		rep(i, N)rep(j, N) d[i][j] = c[(i+a)%N][j];
		bool good = true;
		rep(i, N)rep(j, N){
			if (d[i][j] != d[j][i]){
				good = false; break;
			}
		}
		if (good) ans += N;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  int N, K; cin >> N >> K;
  vector<int> A(N); rep(i,N) cin >> A[i];
  sort(all(A));
  int sum = 0;
  rep(i,K) sum += A[i];
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <iostream>

#define REP(i, N) for (int i = 0; i < N; ++i)

using namespace std;

int main()
{
    int n;
    int h[20];
    cin >> n;
    REP(i, n)
        cin >> h[i];

    int t = 0;
    int count = 0;
    REP(i, n)
        if (h[i] >= t)
        {
            ++count;
            t = h[i];
        }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256