akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#pragma GCC optimization_level 3
#define _GLIBCXX_DEBUG

using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;



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

    vector<ll> p(n);

    ll cnt = 0;

    for (size_t i = 0; i < n; i++)
    {
        cin>>p.at(i);
    }
    
    for (size_t i = 1; i < n-1; i++)
    {
        if (p.at(i-1) < p.at(i) && p.at(i) < p.at(i+1))
        {
            cnt++;
        } else if (p.at(i+1) < p.at(i) && p.at(i) < p.at(i-1))
        {
            cnt++;
        } 
        
        
    }
    
    cout<<cnt<<endl;
    
}


Measured memory_bytes: 256
N, T = [int(s) for s in input().split()]

c = []
t = []
for n in range(N):
    inputs = input().split()
    c.append(int(inputs[0]))
    t.append(int(inputs[1]))

min_cost = "TLE"
for i in range(N):
    if t[i] <= T and (min_cost is "TLE" or c[i] <= min_cost):
        min_cost = c[i]

print(min_cost)

Measured memory_bytes: 3064
import math
import itertools
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

def da(a,n):
    x = [1,2,3,4,5,6,7,8]
    y = x[:n]
    count = 0
    for v in itertools.permutations(y):
        w = list(v)
        if w == a:
            return count
        
        count += 1
print(abs(da(q,n)-da(p,n)))


Measured memory_bytes: 3064
# coding: utf-8
# Your code here!
import heapq as hq

n = int(input())
a = list(map(int,input().split()))
l = a[:n]
r= a[2*n:3*n]
r = list(map(lambda x:x*(-1),r))

hq.heapify(l)
hq.heapify(r)
ans = 0
suml =[0 for _ in range(n+1)]
suml[0] = sum(l)
sumr=[0 for _ in range(n+1)]
sumr[-1] = -1*sum(r)

for i in range(n,2*n):
    minl =hq.heappop(l)
    if a[i] >minl:
        suml[i+1-n] =suml[i-n]+ a[i] - minl
    else:
        suml[i+1-n] =suml[i-n]
    hq.heappush(l,max(a[i],minl))
for i in range(-1-n,-n-n-1,-1):
    maxr =-1*hq.heappop(r)
    if a[i] <maxr:
        sumr[i-1+n] =sumr[i+n]+ a[i] - maxr
    else:
        sumr[i-1+n] =sumr[i+n]
    hq.heappush(r,-1*min(a[i],maxr))

ans = max([x - y for x,y in zip(suml,sumr)])
print(ans)
        
    


Measured memory_bytes: 37212
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int MOD = 998244353;

long long power(long long x, int n)
{
	if (n == 0) {
		return 1;
	}
	else if (n % 2 == 0) {
		long long t = power(x, n / 2);
		return (t * t) % MOD;
	}
	else {
		return (x * power(x, n - 1)) % MOD;
	}
}

long long inv(long long x)
{
	return power(x, MOD - 2);
}

vector<long long> make_fact(int N)
{
	vector<long long> fact(N + 1);
	fact[0] = 1;
	for (int i = 1; i <= N; ++i) {
		fact[i] = (fact[i - 1] * i) % MOD;
	}
	return fact;
}

vector<long long> make_ifact(int N)
{
	auto fact = make_fact(N);
	vector<long long> ifact(N + 1);
	for (int i = 0; i <= N; ++i) {
		ifact[i] = inv(fact[i]);
	}
	return ifact;
}


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

	auto fact = make_fact(N);
	auto ifact = make_ifact(N);

	auto c = [&](int n, int r)
	{
		return fact[n] * ifact[n - r] % MOD * ifact[r] % MOD;
	};

	long long ans = 0;

	for (int a = 0; a <= N; ++a) {
		if ((K - a * A) % B != 0) {
			continue;
		}
		if ((K - a * A) / B > N) {
			continue;
		}
		if ((K - a * A) / B < 0) {
			continue;
		}
		int b = (int)((K - a * A) / B);
		ans += (c(N, a) * c(N, b)) % MOD;
		ans %= MOD;
	}

	cout << ans << endl;
}


Measured memory_bytes: 7296
n=int(input())
room=[[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
for i in range(n):
    b,f,r,v=map(int,input().split())
    room[b-1][f-1][r-1]+=v

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" {0}".format(room[i][j][k]),end="")
        print()
    if(i!=3):
        print("####################")


Measured memory_bytes: 5624
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n,x=0;
   cin>>n;
   ll a[n];
   for(int i=0;i<n;i++){
    cin>>a[i];
     if(a[i]==0)
        x++;
}
if(x>0)
    return cout << 0 << endl,0;
   ll pro=1;
   for(int i=0;i<n;i++){
    if(a[i]<=1000000000000000000/pro)
        pro*=a[i];
    else
        return cout <<-1 << endl,0;
    }
   cout << pro << endl;

    return 0;

}


Measured memory_bytes: 4400
import scala.io.StdIn
import scala.collection.mutable.Stack


object Main{
    def main(args: Array[String]) = {
        val array = StdIn.readLine.split(" ")
        val stack = new Stack[String]
        for(value <- array){
            value match {
                case "+" => stack.push((stack.pop().toInt + stack.pop().toInt).toString)
                case "-" => {
                  var a = stack.pop().toInt;var b = stack.pop().toInt
                  stack.push((b - a).toString)
                }
                case "/" => {
                  {
                  var a = stack.pop().toInt;var b = stack.pop().toInt
                  stack.push((b / a).toString)
                }
                }
                case "*" => stack.push((stack.pop().toInt * stack.pop().toInt).toString)
                case _ => stack.push(value)
            }
        }
        println(stack.pop())
        
    }
}



Measured memory_bytes: 43664
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define pii pair < int, int >
typedef vector<int> vi;
typedef  long long ll;
const int mod =1e9+7;
const int N = (int)2e5 + 5;

void solve(){
	set<int>s;
	int n;
	cin>>n;
	rep(i,n){
		int x;
		cin>>x;
		s.insert(x);
	}
	cout<<sz(s);


}

int main(){
	Red;
	int t=1;
	// cin>>t;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define dfor(i,a,b) for(ll i=(a);i>=(b);i--)
#define mem(u, vis) memset(u, vis, sizeof(u))
#define ll long long
#define ull unsigned long long
#define MOD  1000000007
#define MAX  1e9
#define pb   push_back
#define F    first
#define S    second


int main() {
	int n,m;
	cin>>n>>m;
	cout<<((n*(n-1))/2)+((m*(m-1))/2);
	
}

Measured memory_bytes: 256
from collections import defaultdict, deque

N, K = map(int, input().split())
M = 10**9 + 7
e = defaultdict(list)
for i in range(N-1):
    a, b = map(int, input().split())
    e[a].append(b)
    e[b].append(a)

d = deque()
d.appendleft((1, -1))
ans = K
while d:
    now, prev = d.pop()
    num_next = len(e[now])
    num_next = 0
    for v in e[now]:
        if(v != prev):
            d.appendleft((v, now))
            num_next += 1
            
    if(prev == -1):
        num_color = K-1
    else:
        num_color = K-2
        
    for i in range(num_next):
        ans *= (num_color-i)
        ans %= M
        
print(ans)



Measured memory_bytes: 34796
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 200000000
#define mod 1000000007
#define INF2 1000000000000000000

int dp[20010];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, N;
    cin >> H >> N;
    int A[1010], B[1010];
    rep(i, N) cin >> A[i] >> B[i];
    rep(i, 20010) dp[i] = INF;
    dp[0] = 0;
    rep(i, H + 1) {
        rep(j, N) {
            dp[i + A[j]] = min(dp[i + A[j]], dp[i] + B[j]);
        }
    }

    int ans = INF;
    REP(i, H, 20000) ans = min(ans, dp[i]); 
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3748
#include <iostream>
#include <vector>
using namespace std;
int N;
int main(){
	cin >> N;
	bool judge = false;
	int count = 0;
	vector<vector<int>> v(100010);
	for(int i=0;i*(i-1)/2<=N;i++){
		if(i*(i-1)/2==N){
			judge = true;
			count = i;
		}
	}
	if(!judge){
		cout << "No" << endl;
		return 0;
	}
	int c = 1;
	for(int i=1;i<count;i++){
		for(int j=i+1;j<=count;j++){
			v[i].push_back(c);
			v[j].push_back(c);
			c++;
		}
	}
	cout << "Yes" << endl;
	cout << count << endl;
	for(int i=1;i<=count;i++){
		cout << v[i].size() << " ";
		for(int j=0;j<v[i].size();j++){
			cout << v[i][j] << (j!=v[i].size()-1? " ":"\n");
		}
	}
}

Measured memory_bytes: 4608
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cmath>
using namespace std;
using ld = long double;
using ll = long long;

int main(void){
    ld a, b;
    cin >> a >> b;
    ll ans = nextafter(a * b, INFINITY);
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3724
#include <iostream>
#include <algorithm>
using namespace std;
 
long long num[200010];
int main()
{
    int n;
    long long x;
    cin>>n;
    //ios::sync_with_stdio(false);
    for(int i=0;i<n;i++)
    {
        cin>>x;
        num[i]=x-(i+1);
    }
    sort(num,num+n);
    int p=n/2;
    long long ans=0;
    long long t=num[p];
    for(int i=0;i<n;i++)
    {
        ans+=abs(num[i]-t);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;

int n;

int main () {

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	int sol = 0;
	for (int i = 1; i <= n; i ++) {
		int d = i;
		int k = 0;
		while (d > 0) {
			k ++;
			d /= 10;
		} 
		
		if (k % 2 == 1) sol ++;
	}
	
	cout << sol;


	return 0;
}

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

using namespace std;

#define null -1

struct node{

    int parent, left, right;

};

node T[30];

//preorder tree walk

void preorder( int u ){

    if( u == null ) return;

    printf(" %d", u);

    preorder( T[u].left );

    preorder( T[u].right );

}

//inorder tree walk

void inorder( int u ){

    if( u == null ) return;
    
    inorder( T[u].left );

    printf(" %d", u);

    inorder( T[u].right );

}

//postorder tree walk

void postorder( int u ){

    if( u == null ) return;
    
    postorder( T[u].left );

    postorder( T[u].right );

    printf(" %d", u);

}


int main(){

    int n, i, num, l, r,  root, v;

    scanf("%d", &n);

    for( i = 0; i < n; i++ ){

        T[i].left = null;
        T[i].right = null;
        T[i].parent = null;

    }

    for( i = 0; i < n; i++ ){

        scanf("%d", &num);

        scanf("%d %d", &l, &r);

        T[num].left = l;
        T[num].right = r;

        if( l != null && r != null ){

            T[l].parent = num;
            T[r].parent = num;

        } else if( l != null && r == null ){

            T[l].parent = num;

        } else if( r != null && l == null ){

            T[r].parent = num;

        } 

    }

    for( i = 0; i < n ; i++ ){

        if( T[i].parent == null ) root = i;

    }


    printf("Preorder\n");
    preorder( root );
    printf("\n");

    printf("Inorder\n");
    inorder( root );
    printf("\n");

    printf("Postorder\n");
    postorder( root );
    printf("\n");

}

Measured memory_bytes: 2708
#include <iostream>
#include <numeric>
#include <vector>
#include <algorithm>
#include <map>
#include<queue>
#include <sstream>
#include <set>
typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}
using namespace std;
int main(){
    int tmp=10,x,y,ans=0;
    vector<int> vec(5);
    vector<int> amari(5);
    REP(i,5){
        cin >> vec[i];
        amari[i] = vec[i]%10;
        if(tmp>amari[i]&&amari[i]!=0){
            x = i;
            tmp = amari[i];
        }
    }
    REP(i,5){
        if(x == i){
            ans += vec[i];
        }else{
            if(amari[i]==0){
                ans += vec[i];
            }else{
                ans += vec[i];
                ans += 10-amari[i];
            }
        }
    }
    cout << ans <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,a[12][12][12];
int main()
{
    
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int b,f,r,v;
        scanf("%d%d%d%d",&b,&f,&r,&v);
        a[b][f][r]+=v;
    }
    for(int b=1;b<=4;b++)
    {
        for(int f=1;f<=3;f++)
        {
            for(int r=1;r<=10;r++)
                printf(" %d",a[b][f][r]);
            printf("\n");
        }
        if (b<4)
        {for(int i=0;i<20;i++) printf("#");
        printf("\n");}
    }
}



Measured memory_bytes: 3192
function Main(input) {
  const inp = input.split(" ");
  const sum =
    parseInt(inp[0], 10) + parseInt(inp[1], 10) + parseInt(inp[2], 10);

  var ans = sum === 17 ? "YES" : "NO";
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<atcoder/all>
#include<algorithm>

using namespace std;


int n, d;
int x[1100], y[1100];

int main(){
    cin >> n >> d;
    for(int i = 0;i < n;i++){
        cin >> x[i] >> y[i];
    }
    atcoder::two_sat ts(n);
    for(int i = 0;i < n;i++){
        for(int j = i + 1;j < n;j++){
            if(abs(x[i] - x[j]) < d){
                ts.add_clause(i, false, j, false);
            }
            if(abs(x[i] - y[j]) < d){
                ts.add_clause(i, false, j, true);
            }
            if(abs(y[i] - x[j]) < d){
                ts.add_clause(i, true, j, false);
            }
            if(abs(y[i] - y[j]) < d){
                ts.add_clause(i, true, j, true);
            }           
        }
    }

    if(!ts.satisfiable()){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    auto answer = ts.answer();
    for(int i = 0;i < n;i++){
        cout << (answer[i]?x[i]:y[i]) << endl;
    }
    return 0;
}

Measured memory_bytes: 3300
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if (a + b >= c) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
# n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

n=int(input())

ls = []
for i in range(n):
    a, b = input().split()
    ls.append([a,int(b),i])

ls_s = sorted(ls, key=lambda x:x[0])
#print(ls_s)

new_ls =[]
city = ls_s[0][0]
tmp = []
for elem in ls_s:
    if city == elem[0]:
            tmp.append(elem)
    else:
        city = elem[0]
        new_ls.extend(sorted(tmp, key=lambda x:x[1], reverse=True))
        tmp = []
        tmp.append(elem)
new_ls.extend(sorted(tmp, key=lambda x:x[1], reverse=True))
for elem in new_ls:
    print(elem[2] + 1)



Measured memory_bytes: 21152
#include <stdio.h>
#include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>
#include <stdexcept>
using namespace std;


#define abs(N) ((N>0)?N:-1*N)
#define lt(A,B) ((A>B)?B:A)
#define gt(A,B) ((A<B)?B:A)
#define print(S) (cout << S)
#define println(S) (cout << S << endl)

template <typename T>
class queue{
public :
	const static int LEN = 1000000;
	queue<T>(){
		head = tail = 0;
	}

	void empty(){
		head = tail = 0;
	}

	bool isEmpty(){
		return (head == tail);
	}

	bool isFull(){
		return ((tail + 1)%LEN == head);
	}

	T dequeue(){
		if(isEmpty()){
			throw exception();
		}
		if(head == LEN - 1){
			head = 0;
			return body[LEN -1];
		}
		return body[head++];
	}

	void enqueue(T el){
		if(isFull()){
			throw exception();
		}
		if(tail == LEN -1){
			tail = 0;
			body[LEN-1] = el;
		}else{
			body[tail++] = el;
		}
	}

	T top(){
		if(isEmpty()){
			throw exception();
		}
		return body[head];
	}

private:
	T body[LEN];
	int head,tail;
};

typedef struct{
	string name;
	int time;
}process;

int main(){
	queue<process> que;
	int n ,q;
	cin >> n >> q;

	for (int i = 0; i < n; ++i) {
		process p;
		cin >> p.name >> p.time;
		que.enqueue(p);
	}
	int t = 0;
	while(!que.isEmpty()){
		process p = que.dequeue();
		if(p.time>q){
			p.time -= q;
			que.enqueue(p);
			t += q;
		}else{
			t += p.time;
			cout << p.name << " " << t << endl;;
		}
	}

	return 0;
}



Measured memory_bytes: 21088
#include<stdio.h>
int main()
{
   int n,a,x,i,cnt;
   int b[100000];
   scanf("%d %d",&n,&a);
   for(i=0;i<a;i++)
   {
       scanf("%d",&b[i]);
   }
   cnt=0;
   for(i=0;i<a;i++)
   {
       cnt=cnt+b[i];

   }
   x=n-cnt;
   if(x>=0)
    printf("%d",x);
   else

    printf("-1");
    return 0;
}

Measured memory_bytes: 1752
import sys
def input():
    return sys.stdin.readline()[:-1]

N = int(input())
L = []
for i in range(N):
    L.append(list(map(str, input().split())))
S = input()

ans = 0
flag = False
for i in range(N):
    s,t = L[i]
    if flag:
        ans += int(t)
    if s == S:
        flag = True
print(ans)

Measured memory_bytes: 3064
# -*- coding utf-8 -*-

H, W = map(int, input().split())
field = []    # field[h][w]

for i in range(H):
    field.append(list(input()) + ['#'])
field.append(['#'] * (W + 1))

ans = 0

beam_h = [[0] * W for _ in range(H)]
for h in range(H):
    l = 0
    r = 0
    while r < W + 1:
        num = 0
        while field[h][r] == '.':
            r += 1
            num += 1
        if l != r:
            beam_h[h][l:r] = [num] * num
            ans = max(ans, num)
            l = r
        l += 1
        r += 1

beam_w = [[0] * W for _ in range(H)]
for w in range(W):
    l = 0
    r = 0
    while r < H + 1:
        num = 0
        while field[r][w] == '.':
            r += 1
            num += 1
        if l != r:
            # beam_w[l:r][w] = [num] * num
            for i in range(l, r):
                beam_w[i][w] = num
                ans = max(ans, beam_w[i][w] + beam_h[i][w] - 1)
            l = r
        l += 1
        r += 1

print(ans)


Measured memory_bytes: 250248
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n, x;
  cin >> n >> x;
  
  int d = 0;
  int cnt = 1;
  for (int i = 0; i < n; i++) {
    int l;
    cin >> l;
    d += l;
    if (d <= x) {
      cnt++;
    }
  }
  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
typedef long long ll;
typedef unsigned un;
typedef std::string str;
typedef std::pair<ll,ll> pll;
ll read(){ll x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}return f*x;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
void umax(ll& a,ll t){if(t>a)a=t;}
void umin(ll& a,ll t){if(t<a)a=t;}
const ll INF=1ll<<58;
#define MAXN 200011
ll x[MAXN],f[MAXN],pos[MAXN], tmp[MAXN],n;
struct per
{
	ll a[MAXN];
	per(){memset(a,0,sizeof a);}
	void operator *=(const per& t)
	{
		for(ll i=1;i<=n;++i)tmp[i]=t.a[a[i]];
		for(ll i=1;i<=n;++i)a[i]=tmp[i];
	}
};
per Qpow(per& a,ll m)
{
	static per res;
	for(ll i=1;i<=n;++i)res.a[i]=i;
	while(m)
	{
		if(m&1)res*=a;
		a*=a,m>>=1;
	}
	return res;
}
int main()
{
	//puts("here");
	static per s,res;
	n=read();
	for(ll i=1;i<=n;++i)x[i]=read(),pos[i]=i;
	ll m=read(),k=read();
	while(m--)
	{
		ll t=read();
		std::swap(pos[t-1],pos[t]);
	}
	for(ll i=1;i<=n;++i)s.a[pos[i]]=i;
	res=Qpow(s,k);
	f[1]=x[1];
	for(ll i=1;i<n;++i)f[res.a[i]+1]=x[i+1]-x[i];
	for(ll i=1;i<=n;++i)printf("%lld.0\n",f[i]+=f[i-1]);
}

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

int main()
{
  std::string s;
  int count=0;

  std::cin >> s;

  for (int i=0; i < 3; ++i){
    if (s[i] == 'o'){++count;}
  }

  std::cout << 700 + (100 * count) << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int a , b , c , d[100001] = {0} , q;
    ll x = 0;
    for( int i = 0 ; i < n ; i++ ) {
        cin >> a;
        x += a;
        d[a]++;
    }
    cin >> q;
    for( int i = 0 ; i < q ; i++ ) {
        cin >> b >> c;
        x += 1ll * ( c - b ) * d[b];
        cout << x << endl;
        d[c] += d[b];
        d[b] = 0;
    }
}


Measured memory_bytes: 4040
n=int(input())
a=[int(i) for i in input().split()]
a.append(0)
a=[0]+a
total=0

for i in range(1,n+2):
    total+=abs(a[i-1]-a[i])

def herasu(i):
    ans=total-abs(a[i-1]-a[i])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1])
    return ans


for i in range(1,n+1):
    print(herasu(i))



Measured memory_bytes: 20396
import sys
input = sys.stdin.buffer.readline

n = int(input())
edge = [[] for _ in range(n)]
for i in range(n-1):
    a,b,c = map(int, input().split())
    a, b = a-1, b-1
    edge[a].append((c, b))
    edge[b].append((c, a))

q, k = map(int, input().split())
k -= 1

import heapq
INF = 10**18
def dijkstra_heap(s, edge, n):
    d = [INF] * n
    used = [True] * n #True: not used
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in edge[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v],e[1]))
    return d

d = dijkstra_heap(k, edge, n)
for i in range(q):
    x, y = map(int, input().split())
    x, y = x-1, y-1
    print(d[x]+d[y])


Measured memory_bytes: 76464
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    int n, a, w, t, r;
    string s;
    cin >> n;
    
    a = w = t = r = 0;
    for(int i = 0; i < n; ++i)
    {
        cin >> s;
        if(s == "AC")
        {
            ++a;
        }
        else if (s == "WA")
        {
            ++w;
        }
        else if(s == "TLE")
        {
            ++t;
        }
        else
        {
            ++r;
        }
    }
    
    cout << "AC x " << a << endl;
    cout << "WA x " << w << endl;
    cout << "TLE x " << t << endl;
    cout << "RE x " << r << endl;
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5 + 10;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
int t;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    int n, m;
    cin >> n >> m;
    if(n == m) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

const int mod = 1e9 + 7;
inline int add(int u, int v) {
  return (u + v) % mod;
}
inline int sub(int u, int v) {
  return (u + mod - v) % mod;
}
inline int mul(int u, int v) {
  return (u * 1ll * v) % mod;
}
int pwr(int a, int n) {
  int r = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) r = mul(r, a);
    a = mul(a, a);
  }
  return r;
}
inline int inv(int a) {
  return pwr(a, mod - 2);
}

const int N = 2e6 + 5;
int fact[N], invf[N];

int get(int r, int c) {
  return mul(fact[r + c + 2], mul(invf[r + 1], invf[c + 1]));
}

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  fact[0] = invf[0] = 1;
  for (int i = 1; i < N; i++) {
    fact[i] = mul(fact[i - 1], i);
    invf[i] = inv(fact[i]);
  }

  int r1, c1; cin >> r1 >> c1;
  int r2, c2; cin >> r2 >> c2;

  int ans = sub(
    add(
      get(r2, c2),
      get(r1 - 1, c1 - 1)),
    add(
      get(r2, c1 - 1),
      get(r1 - 1, c2)));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;


int main() {
//    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n;
    cin >> n;
    ll a[n];
    ll sum = 0;
    vector<ll> pos, neg;
    ll z = 0;
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] > 0) pos.pb(a[i]);
        else if (a[i] < 0) neg.pb(a[i]);
        else z++;
        sum += abs(a[i]);
    }


    if (pos.empty()) {
        while (z--) neg.pb(0);
        sort(neg.begin(), neg.end(), greater<ll>());
        ll p = neg[0];
        cout << sum + 2 * neg[0] << '\n';
        for (ll i = 1; i < n; i++) {
            cout << p << ' ' << neg[i] << '\n';
            p -= neg[i];
        }

        return 0;
    }

    if (neg.empty()) {
        while (z--) pos.pb(0);
        sort(pos.begin(), pos.end());
        cout << sum - 2 * pos[0] << '\n';
        ll p = pos[0];
        for (ll i = 1; i < n - 1; i++) {
            cout << p << ' ' << pos[i] << '\n';
            p -= pos[i];
        }

        cout << pos.back() << ' ' << p;
        return 0;
    }


    if (n == 2 && pos.size() == 1 && neg.size() == 1) {
        cout << pos[0] - neg[0] << '\n';
        cout << pos[0] << ' ' << neg[0];
        return 0;
    }


    cout << sum << '\n';
    while (z--) neg.pb(0);
    ll p = neg.front();
    for (ll i = 0; i < pos.size() - 1; i++) {
        cout << p << ' ' << pos[i] << '\n';
        p -= pos[i];
    }

    neg.pb(p);
    p = pos.back();
    for (ll i = 1; i < neg.size(); i++) {
        cout << p << ' ' << neg[i] << '\n';
        p -= neg[i];
    }

}



Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define ll long long int
#define ss second
#define ff first
#define pb push_back
#define all(v) v.begin(),v.end()
#define unik(v)  v.erase(unique(v.begin(),v.end()),v.end())
using namespace std;
typedef pair<int, int> pii;
const ll mod = 998244353;
const int sz = 200000 + 3, inf = 1e9 + 10;

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

	ll k, n;
	cin >> k >> n;
	vector<ll>a(n);
	for (auto &x : a)cin >> x;
	ll mx = 0;
	a.pb(a[0] + k);
	for (int i = 0; i < n; i++){
		mx = max(mx, a[i + 1] - a[i]);}
	cout << k - mx << "\n";

	return 0;
}

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

int main(){
    int64_t n, m;
    cin >> n >> m;

    vector<int64_t> hw(m);
    int64_t sum = 0;
    for (auto i = 0; i < m; i++) {
        cin >> hw[i];
        sum += hw[i];
    }

    if(sum > n) cout << -1 << endl;
    else cout << (n - sum) << endl;

    return 0;
}

Measured memory_bytes: 3680
#include <cstdio>
#include <cstring>
#include <cstdlib>

char *inputStr(char *str, int len) {
	char *rtn;
	if ((rtn = fgets(str, len, stdin)) == NULL) { return NULL; }
	if (str[(len = (strnlen(str, len) - 1))] == '\n') {
		str[len] = '\0';
	} else {
		fflush(stdin);
	}
	return rtn;
}

int inputXYS(int &x, int &y, int &siz) {
	char str[8], *ptok;
	if (inputStr(str, sizeof(str) / sizeof(str[0])) == NULL) { return 1; }
	if ((ptok = strtok(str, ",")) != NULL) {
		x = atoi(ptok);
		if ((ptok = strtok(NULL, ",")) != NULL) {
			y = atoi(ptok);
			if ((ptok = strtok(NULL, ",")) != NULL) {
				siz = atoi(ptok);
			} else {
				return 1;
			}
		} else {
			return 1;
		}
	} else {
		return 1;
	}
	return 0;
}

int main() {
	int bitmap[10][10], max = 0;
	int white = 10 * 10;
	int cx, cy, size, mx, my, i;
	static const int inkX[] = {0,1,0,-1,0,1,-1,-1,1,2,0,-2,0};
	static const int inkY[] = {0,0,1,0,-1,1,1,-1,-1,0,2,0,-2};
	static const int inkN[] = {5, 9, 13};
	for (cx = 0; cx < 10; ++cx) {
		for (cy = 0; cy < 10; ++cy) {
			bitmap[cy][cx] = 0;
		}
	}
	while (inputXYS(cx, cy, size) == 0) {
		for (i = 0; i < inkN[size - 1]; ++i) {
			mx = cx + inkX[i];
			my = cy + inkY[i];
			if (mx < 0 || mx >= 10 || my < 0 || my >= 10) { continue; }
			if (bitmap[my][mx] == 0) {
				--white;
			}
			++bitmap[my][mx];
			if (bitmap[my][mx] > max) {
				max = bitmap[my][mx];
			}
		}
	}
	printf("%d\n%d\n", white, max);
	return 0;
}

Measured memory_bytes: 0
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    s=input()
    al = list(chr(ord('A') + i) for i in range(26))
    l=[]
    for j in s:
        l.append(al[(al.index(j)+n)%26])
    print(''.join(l))
resolve()

Measured memory_bytes: 3064
program extension
  implicit none
  integer(8), parameter :: m = 998244353
  integer :: a, b, c, d, i, j
  integer(8) :: dp(3001, 3001) = 0
  read(*,*) a, b, c, d
  dp(a, b) = 1
  do i = a, c
    do j = b, d
      dp(i + 1, j) = mod(dp(i + 1, j) + dp(i, j) * j, m)
      dp(i, j + 1) = mod(dp(i, j + 1) + dp(i, j) * i, m)
      dp(i + 1, j + 1) = mod(dp(i + 1, j + 1) - dp(i, j) * i * j, m)
    end do
  end do
  write(*,'(i0)') dp(c, d)
end program extension

Measured memory_bytes: 72936
#pragma GCC optimize("Ofast")
#include<stdio.h>
int main(void)
{
  char buf1[400001];
  char* i = buf1 + 200000;
  gets(buf1);
  gets(i);
  int ans = 0;
  do if(*(i - 200000) != *i) ++ans; while(*(++i));
  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 1976
#include <stdio.h>

int main(){
// initializing phase
	int N,M;
	int i,j;
	int A[1000],B[1000];
	int votes[1000];
	int max;
	for(i=0;i<1000;i++)
		votes[i] = 0;
// data reading phase
	scanf("%d%d", &N , &M );
	for(i=0;i<N;i++)
		scanf("%d", &A[i] );
	for(i=0;i<M;i++)
		scanf("%d", &B[i] );
// voting phase
	for(i=0;i<M;i++){
		for(j=0;j<N;j++)
			if(A[j]<=B[i])	break;
		votes[j]++;
	}
// searching maximum phase
	max = 0;
	for(i=0;i<N;i++)
		if(votes[max] < votes[i])
			max = i;
// writing answer phase
	printf("%d\n",max+1);
	return 0;
}

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

int main(){
    int A, B; cin >> A >> B;
    if(A + B < 10) cout << A+B;
    else cout << "error";
}

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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

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

typedef long long ll;



int main() {
    vector<string> ss(3);
    REP(i,3) cin >> ss[i];

    REP(i,3) {
        if (i<2) {
            if (ss[i][ss[i].size()-1] == ss[i+1][0]) continue;
            else {
                cout << "NO" << endl;
                return 0;
            }
        } else {
            cout << "YES" << endl;
            return 0;
        }
    }

}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };

	static int n, a, b, c, l[];
	static int inf = Integer.MAX_VALUE/2;
	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		n = fs.nextInt(); 
		a = fs.nextInt();
		b = fs.nextInt();
		c = fs.nextInt();
		l = new int[n];
		for(int i=0;i<n;i++)l[i] = fs.nextInt();
		
		int ans = dfs(0, new int[n]);
		System.out.println(ans);
		
	}
	static int dfs(int t, int ar[]) {
		if(t==n) return calc(ar);
		int res = inf;
		for(int i=0;i<4;i++) {
			ar[t]=i;
			res = Math.min(res, dfs(t+1, ar));
		}
		return res;
	}
	
	static int calc(int ar[]) {
		int al = 0 , bl = 0, cl = 0;
		int acnt = 0, bcnt = 0, ccnt = 0;
		for(int i=0;i<n;i++) {
			if(ar[i]==0) {
				al += l[i];
				acnt++;
			}
			if(ar[i]==1) {
				bl += l[i];
				bcnt++;
			}
			if(ar[i]==2) {
				cl += l[i];
				ccnt++;
			}
			if(ar[i]==3) ;
		}
		if(al==0||bl==0||cl==0) return inf;
		int ans = (acnt - 1) * 10;
		ans += (bcnt - 1) * 10;
		ans += (ccnt - 1) * 10;
		ans += Math.abs(al-a);
		ans += Math.abs(bl-b);
		ans += Math.abs(cl-c);
		return ans;
	}
	
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

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

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

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

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

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


int main() {
    int h,n;
    cin>>h>>n;
    int a[n];
    rep(i,n)cin>>a[i];

    int sm = 0;
    rep(i,n) sm += a[i];

    if(sm >= h) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    double A[N];
    REP(i, N){
        cin >> A[i];
    }

    double B, C;
    REP(i, N){
        B += 1/A[i];
    }

    C = 1/B;

    cout << fixed << setprecision(6) << C << endl;
}

Measured memory_bytes: 3764
n = int(input())
nums = list(map(int, input().split()))
ans = 1
ok = True
if(0 in nums):
    print(0)
else:
    for i in nums:
        ans *= i
        if(ans > int(1e18)):
            ok = False
            break
    if(not ok):
        print(-1)
    else:
        print(ans)


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

int main()
{
    int n;
    cin>>n;
    vector<long long>v(n+1),vv(n);
    for(int i=0;i<n+1;i++) {
        cin>>v[i];
    }

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


    long long res=0;
    for(int i=0;i<n;i++) {
        if(v[i]<vv[i]) {
            res+=v[i];
            vv[i]-=v[i];

            if(vv[i]>v[i+1]) {
                    res+=v[i+1];
                v[i+1]=0;
            }
            else {
                res+=vv[i];
                v[i+1]-=vv[i];
            }
        }

        else {
           res+=vv[i];
           v[i]-=vv[i];
        }
    }

    cout<<res<<endl;

    return 0;
}


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

int main()
{
	int N;
	scanf("%d", &N);
	
	if(N % 10 == 3)
		printf("bon");
		
	else if(N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8)
		printf("pon");
		
	else
		printf("hon");
}

Measured memory_bytes: 3816
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <climits>
#include <cmath>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define PB push_back
#define MP make_pair

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

int kk(ll &n, int k){
	int d = 0;
	while(n % k == 0){
		d++;
		n /= k;
	}

	return d;
}


pair<int,int> f(string a){
	ll n = 0, m = 0;

	for (int i = 0; i < a.length(); i++){
		if (a[i] != '.') n = n * 10 + (a[i] - '0');
		else m = a.length() - i - 1;   
	}
	m = pow(10, m);

	ll l = gcd(n , m);
	n = n / l;
	m = m / l;

	return {kk(n, 2) - kk(m, 2), kk(n, 5) - kk(m, 5)}; 
}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); 
	int n;
	cin >>n;
	string a;

	map<pair<int ,int> , int> mp;
	for (int i = 0; i < n; i++){
		cin >> a;
		pair<int ,int> r = f(a);
		mp[r]++;
	}
	ll ans = 0;
	for (auto p1: mp){
		for (auto p2: mp){
			if (p1.F.F + p2.F.F >= 0 && p1.F.S + p2.F.S >= 0){
				if (p1 < p2){
					ans += 1ll*p1.S * p2.S;
				} else if (p1 == p2) {
					ans += 1ll*p1.S * (p1.S - 1) / 2; 
				}
			}
		}
	}

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





Measured memory_bytes: 3528
#include <vector>
#include <deque>
#include <iostream>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <functional>
#include <numeric>

static const int INF = 1001001001;

using namespace std;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	// 3つのうちどれかが奇数
	if (a%2!=0 || b%2!=0 || c%2!=0) {
		cout << 0 << endl;
		return 0;
	}
	// 3つとも4で割り切れない
	if (a%4!=0 && b%4!=0 && c%4!=0) {
		cout << -1 << endl;
		return 0;
	}
	// 3つとも同じ数
	if (a==b && b==c && c==a) {
		cout << -1 << endl;
		return 0;
	}
	// 他の場合は探索
	int count = 0;
	while (true) {
		count += 1;
		int a_2 = a/2;
		int b_2 = b/2;
		int c_2 = c/2;
		a = b_2 + c_2;
		b = a_2 + c_2;
		c = a_2 + b_2;
		if (a%2!=0 || b%2!=0 || c%2!=0) {
			cout << count << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#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 REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    ll a, b, k;
    cin >> a >> b >> k;
    if (a >= k) {
        cout << a - k << " " << b << endl;
    } else {
        cout << "0 " << max(0LL, b - (k - a)) << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mod 1000000007

int main(){
	int K,S;
	cin >> K >> S;
	int ans = 0;
	for(int x = 0; x <= K; x++){
		for(int y = 0; y <= K; y++){
				int z = S-x-y;
				if(0 <= z && z <= K){
					ans++;
			}
		}
	}
	cout << ans << endl;
}

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

struct Tree
{
    int p;
    vector<int> c;
};

void printPriorder( Tree* t, int a )
{
    if( a == -1 )
        return;
    cout << " " << a;
    printPriorder( t, t[a].c[0] );
    printPriorder( t, t[a].c[1] );
}

void printInorder( Tree* t, int a )
{
    if( a == -1 )
        return;
    printInorder( t, t[a].c[0] );
    cout << " " << a;
    printInorder( t, t[a].c[1] );
}

void printPostorder( Tree* t, int a )
{
    if( a == -1 )
        return;
    printPostorder( t, t[a].c[0] );
    printPostorder( t, t[a].c[1] );
    cout << " " << a;
}

int main()
{
    Tree t[25];
    int n, a, b, c;

    cin >> n;

    for( int i = 0; i < 25; i++ )
        t[i].p = -1;

    for( int i = 0; i < n; i++ )
    {
        cin >> a >> b >> c;
        if( b != -1 )
            t[b].p = a;
        if( c != -1 )
            t[c].p = a;
        t[a].c.push_back(b);
        t[a].c.push_back(c);
    }

    //親の要素番号を把握。
    for( int i = 0; i < n; i++ )
        if( t[i].p == -1 )
            a = i;

    cout << "Preorder" << endl;
    printPriorder( t, a );
    cout << endl << "Inorder" << endl;
    printInorder( t, a );
    cout << endl << "Postorder" << endl;
    printPostorder( t, a );
    cout << endl;

    return 0;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    long long int a[n];
    for(int i = 0;i < n;i++)
    {
        cin >> a[i];
    }
    deque<long long int> d;
    for(int i = 0;i < n;i++)
    {
        if(i % 2 == 0)
        {
            d.push_back(a[i]);
        }
        else
        {
            d.push_front(a[i]);
        }
    }
    if(n % 2 == 1)
    {
        for(int i = n - 1;i >= 0;i--)
        {
            cout << d.at(i) << " ";
        }
    }
    else
    {
        for(int i = 0;i < n;i++)
        {
            cout << d.at(i) << " ";
        }
    }
    
    return 0;
}

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

int main() {

  string s;
  cin >> s;

  if(s == "AAA") {
    cout << "No" << endl;
  } else if(s == "BBB") {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000],cnt[1000000];
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);   
    long long n,k,i,j,d,x,y,z;
    cin>>n>>k;
    for (i=0;i<k;i++)
    {
    	cin>>d;
    	for (j=0;j<d;j++)
    	{
    		cin>>arr[j];
    		cnt[arr[j]]++;
		}
	}
	x=0;
	for (i=1;i<=n;i++)
	{
		if (cnt[i]==0)
		{
			x++;
		}
	}
	cout<<x<<endl;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
 
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  string result;
  
  if(b == a && c == b) {
    result = "Yes";
  }
  else{
    result = "No";
  }

  cout << result << endl;

}

Measured memory_bytes: 256
use std::io;
use std::collections::VecDeque;

fn main() {
    let mut input = Input::new();
    let n: i64 = input.next();
    let mut x: i64 = 0;
    let mut t: i64 = 0;
    let mut stack: VecDeque<(i64, i64)> = VecDeque::new();
    stack.push_back((-1, -1));
    for i in 0..n {
        let a: i64 = input.next();
        let mut j = i;
        loop {
            let (v, p) = *stack.back().unwrap();
            if v < a {
                t += (i - j + 1) * a;
                stack.push_back((a, j));
                break;
            }
            t -= (j - p) * v;
            j = p;
            stack.pop_back();
        }
        x += t;
    }
    println!("{}", x);
}

struct Input {
    queue: VecDeque<String>,
}

impl Input {
    fn new() -> Input {
        Input { queue: VecDeque::new() }
    }

    fn next<T>(&mut self) -> T
        where T: std::str::FromStr,
              T::Err: std::fmt::Debug
    {
        if self.queue.is_empty() {
            let mut line = String::new();
            let _ = io::stdin().read_line(&mut line);
            for x in line.split_whitespace() {
                self.queue.push_back(String::from(x));
            }
        }
        return self.queue.pop_front().unwrap().parse::<T>().unwrap();
    }
}



Measured memory_bytes: 15596
/**
 *   author: sahushivam
 *   created: 24 November 2019 (Sunday)  17:26:44
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,a,b) for(int i = a; i<b; i++)
#define MOD 1000000007
#define INF 1e18
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define int long long

signed main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int t=1;
    cin>>t;
    string s;
    cin>>s;
    t=t%26;
    for(int i=0;i<s.length();i++)
    {
    	s[i]=(char)(s[i]+t);
    	if(s[i]<'A' || s[i]>'Z')
    		s[i]=char(s[i]-26);
    }
    cout<<s;
   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<utility>
#include<algorithm>
#include<stdlib.h>
using namespace std;

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

		int size = s.length();

		for (int i = 0; i < size; i++)
		{
			if (s[i] == 'R')
			{
				if ((i+1) % 2 == 0)
				{
					cout << "No" << endl;
					return 0;
				}
			}
			if (s[i] == 'L')
			{
				if (i % 2 == 0)
				{
					cout << "No" << endl;
					return 0;
				}
			}
		}
		cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
/*
 * written by Yaqi Zhang
 * University of Wisconsin-Madison
 * 2020
 */

#include<algorithm>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stdio.h>
#include<vector>

#define INF 0x3f3f3f3f

using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    char ch;
    cin >> ch;
    cout << (char) (ch + 1) << endl;
    return 0;

}



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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll i,j,k,l,n,t;

	string m;
	cin >> n >> m;

	l = 0;
	

	l += (m[0]-'0')*100;
	l += (m[2]-'0')*10;
	l += (m[3]-'0')*1;

	
	
	

	cout << (n*l)/100 << '\n';	

}

Measured memory_bytes: 3652