akhauriyash/Code-Regression huggingface dataset:
#coding:UTF-8
class Node:
    def __init__(self,point):
        self.n=point
        self.left=None
        self.right=None
        
def Insert(t,z):
    y=None
    x=t
    while x!=None:
        y=x
        if z.n<x.n:
            x=x.left
        else:
            x=x.right
    if y==None:
        return z
    else:
        if z.n<y.n:
            y.left=z
        else:
            y.right=z
        return t

def Find(t,p):
    if t.n == p:
        return True
    elif t.left!=None and t.n>p:
        a=Find(t.left,p)
    elif t.right!=None and t.n<p:
        a=Find(t.right,p)
    else:
        return False
    return a

def Delete(t,p):
    if t.left!=None and t.left.n==p:
        if t.left.left==None and t.left.right==None:
            t.left=None
        elif t.left.left==None and t.left.right!=None:
            t.left=t.left.right
        elif t.left.left!=None and t.left.right==None:
            t.left=t.left.left
        else:
            a=newPoint(t.left.right)
            Delete(t,a)
            t.left.n=a
    elif t.right!=None and t.right.n==p:
        if t.right.left==None and t.right.right==None:
            t.right=None
        elif t.right.left==None and t.right.right!=None:
            t.right=t.right.right
        elif t.right.left!=None and t.right.right==None:
            t.right=t.right.left
        else:
            a=newPoint(t.right.right)
            Delete(t,a)
            t.right.n=a
    else:
        if t.n>p and t.left!=None:
            Delete(t.left,p)
        elif t.n<p and t.right!=None:
            Delete(t.right,p)

def newPoint(t):
    if t.left!=None:
        a=newPoint(t.left)
    else:
        a=t.n
    return a
        

def Pre(t,l):
    l.append(str(t.n))
    if t.left!=None:
        Pre(t.left,l)
    if t.right!=None:
        Pre(t.right,l)

def In(t,l):
    if t.left!=None:
        In(t.left,l)
    l.append(str(t.n))
    if t.right!=None:
        In(t.right,l)

def BST3(A,n):
    tree=None
    for i in range(n):
        if A[i]=="print":
            PreAns=[]
            InAns=[]
            Pre(tree,PreAns)
            In(tree,InAns)
            print(" "+" ".join(InAns))
            print(" "+" ".join(PreAns))
        else:
            if A[i].split(" ")[0]=="find":
                point=int(A[i].split(" ")[1])
                if Find(tree,point)==True:
                    print("yes")
                else:
                    print("no")
            elif A[i].split(" ")[0]=="delete":
                point=int(A[i].split(" ")[1])
                Delete(tree,point)
            else:    
                z=Node(int(A[i].split(" ")[1]))
                tree=Insert(tree,z)
            
if __name__=="__main__":
    n=int(input())
    A=[]
    for i in range(n):
        A.append(input())
    BST3(A,n)

Measured memory_bytes: 186268
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    if(a%2!=0||b%2!=0||c%2!=0){
        cout<<0<<endl;
        return 0;
    }
    ll cnt=0;
    ll memo=a;
    while(!(memo%2)){
        memo/=2;
        ++cnt;
    }
    ll minv=cnt;
    cnt=0;
    memo=b;
    while(!(memo%2)){
        memo/=2;
        ++cnt;
    }
    minv=min(minv,cnt);
    cnt=0;
    memo=c;
    while(!(memo%2)){
        memo/=2;
        ++cnt;
    }
    minv=min(minv,cnt);
    cnt=minv;
    minv=(ll)pow(2,minv);
    if(((a/minv)%2==0&&(b/minv)%2==0&&(c/minv)%2==0)||((a/minv)%2&&(b/minv)%2&&(c/minv)%2))++cnt;
    if(a==b&&b==c&&c==a)cout<<-1<<endl;
    else cout<<cnt<<endl;
    return 0;
    }


Measured memory_bytes: 256
n=int(input())
w=list(int(x) for x in input().split())
ans=[]

for i in range(n):
    s1=sum(w[:i+1])
    s2=sum(w[i+1:])
    ans.append(abs(s1-s2))
    
a=sorted(ans)
print(a[0])

Measured memory_bytes: 3060
fn main() {
    let a: i32 = read();
    let op: String = read();
    let b: i32 = read();

    if op == "+" {
        println!("{}", a+b);
    } else {
        println!("{}", a-b);
    }
 }

// 以下関数

use std::io::*;
use std::str::FromStr;
pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub const MOD: u64 = 10e9 as u64 + 7;

pub fn is_prime(n: i32) -> bool {
    if n < 2 {
        return false;
    } else if n == 2 {
        return true;
    }
    let mut i = 2;
    while i * i < n {
        if n % i == 0 {
            return false;
        } else {
            i += 1;
            continue;
        }
    }
    true
}

pub fn lcm(mut n: i32, mut m: i32) -> i32 {
    n = if n > m { m } else { n };
    m = if n > m { n } else { m };
    let mut i = n;
    while i % m != 0 {
        i += n;
    }
    i
}

pub fn abs(n: i32) -> i32 {
    if n >= 0 {
        n
    } else {
        -n
    }
}

pub fn max(n: i32, m: i32) -> i32 {
    if n >= m {
        n
    } else {
        m
    }
}

pub fn min(n: i32, m: i32) -> i32 {
    if n <= m {
        n
    } else {
        m
    }
}

Measured memory_bytes: 4352
# coding: utf-8
# Your code here!
i = list(map(int, input().split()))
N = i[0]
D = i[1]

shiya = 2*D + 1

if N%shiya == 0:
    human = int(N/shiya)
else:
    human = int(N/shiya)+1

print(human)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <climits>
#include <iomanip>
#define endl "\n"
#define debug(x) cout << #x << " : " << x << endl;
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0);
typedef long long ll;
using namespace std;

int main()
{
	long double A, B;
	cin >> A >> B;
	long double ans = A * B;
	ll intAns = ans;
	cout << intAns << endl;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int v[64];
priority_queue<int, vector<int>, greater<int>> que;

int main(){
	int n, k; scanf("%d%d", &n, &k);
	REP(i, n) scanf("%d", v+i);
	
	int ans = 0;
	REP(l, n+1){
		REP(r, n+1){
			if(l+r>n || l+r>k) continue;
			// DEBUG("(%d, %d)\n", l, r);
			REP(i, l) que.push(v[i]);
			FOR(i, n-r, n) que.push(v[i]);
			REP(i, k-l-r){
				if(que.size() && que.top() < 0) que.pop();
			}
			int sm = 0;
			while(que.size()){
				sm += que.top();
				que.pop();
			}
			LAR(ans, sm);
		}
	}
	printf("%d\n", ans);
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

// {{{
template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar[0].size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}

template<typename T>
T digitsum(T x){
    T y=0;
    while(x){
        y += x % 10;
        x /= 10;
    }

    return y;
}
// }}}
/* vim:set foldmethod=marker: */

void solve(){
    string s;
    cin >> s;

    int a,b;
    for (int i = 0; i < sz(s); i++) {
        if (s[i] == 'A') {
            a = i;
            break;
        }
    }
    for (int i = sz(s)-1; i >= 0; i--) {
        if (s[i] == 'Z') {
            b = i;
            break;
        }
    }

    cout << b-a+1 << endl;

    return;
}

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

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector 昇順
// sort(v.begin(), v.end(), greater<int>()); // 降順

// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }

// string を int に変換 stoi("1010")
// int を string に変換 to_string(1010)


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

int main() {
  long W, H, x, y; cin >> W >> H >> x >> y;
  double surface = W * H / 2.0;
  
  int flag = 0;
  
  if (H % 2 == 0 && W % 2 == 0 && x == W / 2 && y == H / 2) flag = 1;
  
  cout << surface << ' ' << flag << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int k,n,m;
int main()
{
    cin>>n>>m>>k;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            if(i*m+j*n-2*(i*j)==k){
                printf("Yes");
                return 0;
            }
        }
    }
    printf("No");
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {
  int n, max, sum = 0;
  scanf("%d", &n);
  
  int x[n];
  for(int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
  }
  
  max = x[0];
  for(int i = 0; i < n; i++) {
    if(max < x[i]) {
      max = x[i];
    }
    sum += x[i];
  }
  
  if(max < sum-max) {
    printf("Yes");
  } else {
    printf("No");
  }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K, mini_num = 1;
  cin >> N >> K;
  
  for(int i = 0; i < N; i++) {
    if(mini_num < K) {
      mini_num *= 2;
    }
    else {
      mini_num += K;
    }
  }
  cout << mini_num << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#define llint long long

using namespace std;

string s;
llint m;
llint dp[105][4][2];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> s >> m;
	reverse(s.begin(), s.end());
	llint n = s.size();
	
	dp[n][0][0] = 1;
	for(int i = n; i > 0; i--){
		for(int j = 0; j <= m; j++){
			for(int k = 0; k < 2; k++){
				for(int l = 0; l < 10; l++){
					int nj = j, nk = k;
					if(l != 0) nj++;
					if(nj > m) continue;
					if(s[i-1]-'0' < l && k == 0) continue;
					if(s[i-1]-'0' > l) nk = 1;
					dp[i-1][nj][nk] += dp[i][j][k];
					
				}
			}
		}
	}
	cout << dp[0][m][0] + dp[0][m][1] << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int cmp(const void*a,const void*b){
	return *(int*)a-*(int*)b;
}

int main(void){
	int n;
	scanf("%d",&n);
	int a[n];
	int i;
	int temp;
	int ans=0;
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	qsort(a,n,sizeof(int),cmp);
	for(i=0;i<n;i++){
		temp = 1;
		while(a[i]==a[i+1]){
			i++;
			temp++;
			if((i+1)>=n)break;
		}
		if(temp%2==1)ans++;
	}
	printf("%d",ans);
}

Measured memory_bytes: 892
X = gets.to_i
case X
when 400..599
    puts 8
when 600..799
    puts 7
when 800..999
    puts 6
when 1000..1199
    puts 5
when 1200..1399
    puts 4
when 1400..1599
    puts 3
when 1600..1799
    puts 2
when 1800..1999
    puts 1
end

Measured memory_bytes: 14340
a=[list(map(int,input().split())) for i in range(3)]
n=int(input())
b=[int(input()) for _ in range(n)]
for i in range (3):
  for j in range(3):
    if a[i][j] in b:
      a[i][j]=0
if a[0][0]==0 and a[0][1]==0 and a[0][2]==0:
  print('Yes')
elif a[1][0]==0 and a[1][1]==0 and a[1][2]==0:
  print('Yes')
elif a[2][0]==0 and a[2][1]==0 and a[2][2]==0:
  print('Yes')
elif a[0][0]==0 and a[1][0]==0 and a[2][0]==0:
  print('Yes')
elif a[0][1]==0 and a[1][1]==0 and a[2][1]==0:
  print('Yes')
elif a[0][2]==0 and a[1][2]==0 and a[2][2]==0:
  print('Yes')
elif a[0][0]==0 and a[1][1]==0 and a[2][2]==0:
  print('Yes')
elif a[0][2]==0 and a[1][1]==0 and a[2][0]==0:
  print('Yes')
else:
  print('No')

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


int main()
{
	
	int n,m;
	cin >> n >> m;
	
	double tot = 0.0;
	double a[100 + 7] = {0};
	
	for(int i = 0; i < n ;++i)
	{
		cin >> a[i];
		tot += a[i];
	}
	sort(a , a + n);
	
	tot /= 4 *(double) m;
	
	int cnt = 0;
	for(int i = 0;i < n;++i)
		if(a[i] >= tot) cnt++;
	
	if(cnt >= m) printf("Yes\n");
	else		 printf("No\n");
	
	
	return 0;
 } 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    ll n;
    cin>>n;
    ll ans = (n * (n + 1) * 1ll)/2ll;
    ans -= n;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
import numpy as np

n = int(input())

cnt_max = 0

if n in [1, 2]:
    output = 1
else:

    xy = []
    for i in range(n):
        xy.append([int(x) for x in input().split()])

    xy = np.array(xy)
    temp2 = []
    for i in range(n):
        temp1 = list(zip(xy[:, 0] - xy[i, 0], xy[:, 1] - xy[i, 1]))
        temp1.pop(i)
        temp2.append(temp1)
    cnt = 0
    for i in range(n):
        for j in range(n - 1):
            cnt = 0
            for k in range(n):
                # print(i, j, k)
                if temp2[i][j] in temp2[k]:
                    cnt += 1
        if cnt_max < cnt:
            cnt_max = cnt

    output = n - cnt_max

print(output)

Measured memory_bytes: 20692
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = in.nextInt();
        }
        int q = in.nextInt();
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = in.nextInt();
        }

        int c = 0;
        for (int i : t) {
            if (linearSearch(s, i)) {
                c++;
            }
        }
        System.out.println(c);
    }

    private static boolean linearSearch(int[] s, int val) {
        for (int i : s) {
            if (val == i) {
                return true;
            }
        }
        return false;
    }
}



Measured memory_bytes: 39896
#include<iostream>
#include<cstdlib>
#include<vector>
#include <cmath>
#include <time.h>
using namespace std;

const int n_MAX = 50;

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

  int cnt = 1;
  for (int i = 0; i < (n - 1); ++i) {
    if (s[i] != s[i + 1]) {
      cnt += 1;
    }
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 512
import java.util.Arrays;
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();
		int[] n = {a, b, c};
		Arrays.sort(n);
		String s = String.valueOf(n[2]) + String.valueOf(n[1]);
		String t = String.valueOf(n[0]);
		System.out.println(Integer.valueOf(s) + n[0]);
	}
}


Measured memory_bytes: 21972
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long int lli;
#define REP(i, e) for(int (i)=1; (i)<=(e); (i)++)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

bool dfs(int y, int x, int gy, int gx, vector<int> &ry, vector<int> &rx, vector<vector<bool> > &used, vector<vector<char> > &field){
    if(field[y][x] == '#' || used[y][x]) return false;
    used[y][x] = true;
    if(y==gy && x==gx){
        ry.push_back(y);
        rx.push_back(x);
        return true;
    }
    for(int i=0; i<4; i++){
        if(dfs(y+dy[i], x+dx[i], gy, gx, ry, rx, used, field)){
            ry.push_back(y);
            rx.push_back(x);
            return true;
        }
    }
    return false;
}

int main(){
    int r,c,m;
    cin >> r >> c >> m;
    vector<vector<char> > field(r+2, vector<char>(c+2, '#'));
    vector<vector<lli> > on, off, keep(r+2, vector<lli>(c+2));
    on = off = keep;
    REP(i, r) REP(j, c) cin >> field[i][j];
    REP(i, r) REP(j, c) cin >> keep[i][j];
    REP(i, r) REP(j, c) cin >> on[i][j];
    REP(i, r) REP(j, c) cin >> off[i][j];
    vector<int> tx(m), ty(m);
    for(int i=0; i<m; i++){
        cin >> ty[i] >> tx[i];
        ty[i]++; tx[i]++;
    }

    vector<vector<vector<int> > > his(r+2, vector<vector<int> >(c+2));
    int time=0;
    for(int i=0; i<m-1; i++){
        vector<int> rx, ry;
        vector<vector<bool> > used(r+2, vector<bool>(c+2, false));
        dfs(ty[i+1], tx[i+1], ty[i], tx[i], ry, rx, used, field);
        int e = (i==m-2)? rx.size() : rx.size()-1;
        for(int j=0; j<e; j++){
            his[ry[j]][rx[j]].push_back(time+j);
        }
        time += e;
    }

    lli ans=0;
    for(int i=1; i<=r; i++){
        for(int j=1; j<=c; j++){
            if(!his[i][j].empty()){
                ans += on[i][j] + off[i][j];
            }
            for(int k=0; k<(int)his[i][j].size()-1; k++){
                ans += min((his[i][j][k+1]- his[i][j][k])*keep[i][j], off[i][j] +on[i][j]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 8436
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
#include<vector>
#include<cstring>
#define INF 1000000000
using namespace std;
int a[51],b[51],c[51],d[51],n,m,q,score=0,ans=-1,A[11];
unsigned long long sum=100,x;
void dfs(int x,int y){
    if(x==n+1){
        for(int i=1;i<=q;i++){
            if(A[b[i]]-A[a[i]]==c[i])
                score+=d[i];
        }
            
        ans=max(score,ans);
        score=0;
        return;
    }
    for(int i=0;y+i<=m&&y+i>=A[x-1];i++){
        A[x]=y+i;
        dfs(x+1,y+i);
    }
    
    
}
int main(){
    cin>>n>>m>>q;
    for(int i=1;i<=q;i++){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
    }
    a[0]=1;
    dfs(0,1);
    cout<<ans;
}


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

int main() {
    string X;
    cin >> X;
    
    int S_cnt = 0, T_cnt = 0;
    rep(i, X.size()) {
        if (X[i] == 'T') {
            if (S_cnt >= 1) {
                --S_cnt;
            } else {
                ++T_cnt;
            }
        } else {
            ++S_cnt;
        }
    }
    cout << S_cnt + T_cnt << endl;
    return 0;
}


Measured memory_bytes: 3756
n = int(input())
s=0
t=0
u=0
v=0
for i in range(1,n+1):
  s = s+i
  if i%3==0:
    t = t+i
  elif i%5==0:
    u = u +i
  elif v %15==0:
    v = v+i
print(s-t-u+v-1)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
#define forn(i,n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef long long i64;
typedef long double ld;
const int inf = int(1e9) + int(1e5);
const ll infl = ll(2e18) + ll(1e10);

const int maxn = 505;
string s[maxn];
bool bad[maxn];

int main() {
    #ifdef LOCAL
    assert(freopen("b.in", "r", stdin));
    #else
    #endif
    int n;
    cin >> n;
    forn (i, n)
        cin >> s[i];
    int bads = 0;
    int bl = 0;
    forn (i, n) {
        forn (j, n) {
            bad[i] |= (s[j][i] == '.');
            bl += (s[i][j] == '#');
        }
        bads += bad[i];
    }
    if (bl == 0) {
        cout << -1 << '\n';
        return 0;
    }
    int res = inf;
    forn (i, n) {
        bool can = false;
        forn (j, n)
            if (s[j][i] == '#')
                can = true;
        int wh = 0;
        bool good = true;
        forn (j, n) {
            if (s[i][j] == '.')
                ++wh, good = false;
            if (bad[j])
                ++wh;
        }
        if (good) {
            res = bads;
            break;
        }
        if (!can)
            ++wh;
        res = min(res, wh);
    }
    cout << res << '\n';
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
#define rng(i, l, r) for (size_t i = (l); i < (r); ++i)
#define rep(i, n) rng(i, 0, n)
#define gnr(i, l, r) for (size_t i = (r)-1; i >= (l); i--)
#define per(i, b) gnr(i, 0, b)
#define ALL(obj) (obj).begin(), (obj).end()    //1,2,3,...
#define rALL(obj) (obj).rbegin(), (obj).rend() //...,3,2,1

using namespace std;

const int INF = 1e18;

void solve()
{
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("./sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    map<char, int> mp;
    string march = "MARCH";
    rep(i, n)
    {
        string s;
        cin >> s;
        bool isMarch = false;
        rep(j, 5)
        {
            if (s[0] == march[j])
                isMarch = true;
        }
        if (isMarch)
            mp[s[0]]++;
    }

    int ans = 0;
    for (int i = 0; i < 5; i++)
    {
        for (int j = 0; j < 5; j++)
        {
            for (int k = 0; k < 5; k++)
            {
                if (i > j || j > k || i > k)
                    continue;
                if (i == j || j == k || k == i)
                    continue;

                ans += mp[march[i]] * mp[march[j]] * mp[march[k]];
            }
        }
    }

    cout << ans << endl;
}

signed main()
{
    solve();
    return 0;
}


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

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 ***/

int main(){
    double pai=3.141592653589;
    int n;
    int x[1000],y[1000];
    double ans1=0,ans2=0,ans3=0,ans4=0,anstmp=0,tmp;
    scanf("%d",&n);
    for(int i=0;i<2;i++){
        for(int j=0;j<n;j++){
            if(i==0) scanf("%d",&x[j]);
            else scanf("%d",&y[j]);
        }
    }
    for(int i=0;i<n;i++){
        ans1+=abs(x[i]-y[i]);
    }
    printf("%.8lf\n",ans1);
    for(int i=0;i<n;i++){
        ans2+=(x[i]-y[i])*(x[i]-y[i]);
    }
    printf("%.8lf\n",pow(ans2,1.0/2.0));

    for(int i=0;i<n;i++){
        tmp=abs(x[i]-y[i]);
        ans3+=tmp*tmp*tmp;
    }
    printf("%.8lf\n",pow(ans3,1.0/3.0));

    for(int i=0;i<n;i++){
        anstmp=abs(x[i]-y[i]);
        ans4=max(ans4,anstmp);
    }
    printf("%.8lf\n",ans4);

    return 0;
}

Measured memory_bytes: 1264
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }
//V,P(大文字)使用不可

const ll INF=1000000000000000000;

signed main(){
    int n;ll m;
    cin>>n>>m;
    V<ll> a(n);
    cinf(n,a);
    V<ll> s(n+1,0);
    rep(i,n) s[i+1]=s[i]+a[i];
    map<ll,ll> mp;
    for(int i=0;i<=n;i++) mp[s[i]%m]++;
    ll ans=0;
    for(auto p:mp){
        ll pp=p.sc;
        ans+=pp*(pp-1)/2;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 5760
#include<stdio.h>
#include<string.h>
int main(){
  char str[21];
  int i,j;
  scanf("%s",str);
  i=strlen(str);
  for(j=i;j>0;j--){
    printf("%c",str[j-1]);
  }
  printf("\n");
  return(0);
}

Measured memory_bytes: 524
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<long long >v(n);
    for(int i=0;i<n;i++)
     cin>>v[i];
    int count=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            if(v[i]!=v[j])
            {
                for(int k=j+1;k<n;k++)
                {
                    if(v[i]+v[j]>v[k] && v[i]+v[k]>v[j] && v[j]+v[k]>v[i] && v[i]!=v[k] && v[j]!=v[k])
                    {
                        //cout<<i+1<<" "<<j+1<<" "<<k+1<<endl;
                        count++;
                    }
                }
            }
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 3188
li=[list(map(int,input().split())) for i in range(3)]

#print(li[0])

def chk(al,bl,li) :
  for i in range(3) :
    for j in range(3) :
      if li[i][j]!=al[i]+bl[j] :
        return False
  return True
        #print("No")
        #exit()
  #print("Yes")

flag=True
for a1 in range(max(li[0])+1):
  al=[]
  bl=[]
  #print(a1)
  bl=[li[0][0]-a1,li[0][1]-a1,li[0][2]-a1]
  #print(bl)
  al.append(a1)
  al.append(li[1][0]-bl[0])#a2
  al.append(li[2][0]-bl[0])#a3
  #print(al)
  if chk(al,bl,li) :
    print("Yes")
    exit()
print("No")
  
    

Measured memory_bytes: 3064
N = int(input())
boxes = input().split(" ")
for i in range(N):
    boxes[i] = int(boxes[i])

ok = True
max_value = 1
for i in range(N-1):
    if max_value < boxes[i]:
        max_value = boxes[i]

    diff = boxes[i+1] - boxes[i]
    if diff >= 0:
        pass
    elif diff == -1:
        boxes[i] -= 1
        if max_value - 1 > boxes[i]:
            ok = False
    else:
        ok = False

    if not ok:
        break

if ok:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 11152
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;
constexpr ll MOD = 1000000007;

// struct UnionFind {
//     vector<int> par;
    
//     UnionFind(int N): par(N) {
//         for (int i=0;i<N;i++) par[i] = i;
//     }

//     int root(int x) {
//         if (par[x] == x) return x;
//         else return par[x] = root(par[x]);
//     }

//     void unite(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         if (rx == ry) return;
//         par[rx] = ry;
//     }

//     bool same(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         return rx == ry;
//     }
// };

int main(void) {
    int N;
    vector<int> a(200010);
    cin >> N;
    for (int i=1;i<=N;i++) cin >> a[i];
    
    vector<int> c(200010,-1);
    for (int i=N/2+1;i<=N;i++) c[i] = a[i];
    for (int i=N/2;i>0;i--) {
        int m = 0;
        for (int j=2*i;j<=N;j+=i) m += c[j];
        c[i] = abs(a[i]-m%2);
    }
    bool flag = true;
    for (int i=1;i<=N;i++) {
        int m = 0;
        for (int j=i;j<=N;j+=i) m += c[j];
        if (m%2 != a[i]) flag = false;
    }

    if (flag) {
        int k = count(c.begin()+1, c.begin()+N+1, 1);
        cout << k << endl;
        if (k) {
            for (int i=1;i<=N;i++) if (c[i]>0) cout << i << " ";
            cout << endl;
        }
    } else cout << -1 << endl;
    return 0;
}


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

// See debug.cc for usage etc
#define DEBUG 0

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#if DEBUG
  #define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
  #define DCALL(func, ...) func(__VA_ARGS__)
#else
  #define DLOG(...)
  #define DCALL(func, ...)
#endif

int main() {
#if !DEBUG
  ios_base::sync_with_stdio(false);
#endif
  cout << setprecision(20);

  ll n;
  vector<ll> p;
  

  cin >> n;
  p.resize(n);
  for (ll i = 0; i < n; i++) cin >> p.at(i);
  ll cnt = 0;
  for (ll i = 1; i < n-1; i++) {
    ll x = p.at(i-1);
    ll y = p.at(i);
    ll z = p.at(i+1);
    if ((x < y && y < z) || (x > y && y > z)) cnt++;
  }
  cout << cnt << endl;

  return 0;
}



Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class ARemainingTime {
public:
	void solve(istream& in, ostream& out) {
        int a, b;
        in >> a >> b;
        if(a + b >= 24) out <<  a + b - 24 << endl;
        else out << a + b << endl;
	}
};

int main() {
	ARemainingTime solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

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

ll a, b, c;
ll N, M, K;

void solve() {
    cin >> N >> K;
    ll x[N];
    rep(i, N) cin >> x[i];
    ll ans = (ll)1e18;
    rep(i, N-K+1) {
        if ((x[i] < 0 && x[i+K-1] > 0) || (x[i] > 0 && x[i+K-1] < 0)) {
            ll tmp = (x[i+K-1] - x[i]) + min(abs(x[i]), abs(x[i+K-1]));
            ans = min(ans, tmp);
        } else {
            ans = min(ans, max(abs(x[i]), abs(x[i+K-1])));
        }
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 1024
def out(b, p):
	if b == p:
		return str(p)
	return "%d-%d" % (b, p)
def solve(nums):
	pre = nums[0]
	begin = nums[0]
	for x in nums[1:]:
		if x != pre + 1:
			yield out(begin, pre)
			begin = x
		pre = x
	yield out(begin, pre)
while True:
	if input() == 0: break
	print " ".join(solve(map(int, raw_input().split())))

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

int main() {
  int n,o=1;
  cin >> n;
  vector<int> v(n,1);
  for (int i=0;i<n;i++) {
    cin >> v.at(i);
  }
  while(v.at(0)!=2&&v.at(0)!=1&&o<=n+1) {
      o++;
      v.at(0) = v.at(v.at(0)-1);
  }
  if(v.at(0)==2)
  cout << o << endl;
  else
  cout << -1 << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    string S;cin>>S;
    int L=S.size();
    vector<bool> ac(L,false);
    for(int i=0;i<L;i++){
        if(S[i]=='A'||S[i]=='T'||S[i]=='G'||S[i]=='C')ac[i]=true;
    }
    int ans=0;
    for(int i=0;i<L;i++){
        for(int j=i;j<L;j++){
            bool ok=true;
            for(int k=i;k<=j;k++){
                if(ac[k]==false){
                    ok=false;break;
                }
            }
            if(ok){
                ans=max(ans,j-i+1);
            }
        }
    }
    cout<<ans<<endl;
}

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

typedef unsigned uint;
typedef long long INT;
typedef unsigned long long UINT;
const int INF = 1001001001;
const INT INFLL = 1001001001001001001LL;

 int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
INT lin() { INT x; scanf("%lld", &x); return x; }
UINT luin() { UINT x; scanf("%llu", &x); return x;}


int main(){
    int a, b, c;
    double fa, fb, fc;
    char S[128], sa[128], sb[128], sc[128];
    // int N = in();
    // int K = in();
    // scanf("%s", S);

    INT X = lin();

    INT Max = 2 * (pow(X, 0.2) + 1);
    int A = 0;
    int B = 0;
    for (A = 0; A <= Max; ++A) {
        for (B = 0; B <= Max; ++B) {
            INT nAns = powl(A, 5) - powl(B, 5);
            if (nAns == X) {
                goto ans;
            }
            nAns = powl(A, 5) + powl(B, 5);
            if (nAns == X) {
                B *= -1;
                goto ans;
            }
        }
    }
ans:

    printf("%d %d", A, B);

    return 0;
}







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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int op(int a, int b) {
    return max(a, b);
}

int e() {
    return INT_MIN;
}

int v;

bool f(int x) {
    return x < v;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

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

    segtree<int, op, e> st(a);
    for (int i=0; i<q; i++) {
        int t, x, y;
        cin >> t >> x >> y;
        x--;
        if (t == 1)
            st.set(x, y);
        else if (t == 2)
            cout << st.prod(x, y) << "\n";
        else {
            v = y;
            cout << st.max_right<f>(x) + 1 << "\n";
        }
    }

    return 0;
}


Measured memory_bytes: 6100
data = [
    "{0} {1}".format(s, r)
    for s in ('S', 'H', 'C', 'D')
    for r in range(1, 13 + 1)
    ]

count = int(input())
for c in range(count):
    card = input()
    data.remove(card)

for c in data:
    print(c)

Measured memory_bytes: 7624
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
/*
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll max3(ll a, ll b, ll c){return max(a, max(b, c));};
ll min3(ll a, ll b, ll c){return min(a, min(b, c));};
ll max4(ll a, ll b, ll c, ll d){return max(max(a, b), min(c, d));};
ll min4(ll a, ll b, ll c, ll d){return min(min(a, b), min(c, d));};
ll max5(ll a, ll b, ll c, ll d, ll e){return max(max(a, b), max3(c, d, e));};
ll min5(ll a, ll b, ll c, ll d, ll e){return min(min(a, b), min3(c, d, e));};
*/
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

//デバッグ
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};


ll kai_mod(ll x){
  if(x == 0) return 1;
  return x * kai_mod(x-1) % MOD;
}


//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

ll kai[2000100];
int main(){
  MOD = 1000003;
  kai[0] = 1;
  kai[1] = 1;
  rep(i, 2000050){
    kai[i+2] = kai[i+1] * (i+1) % MOD;
  }
  ll Q;
  cin >> Q;
  rep(i, Q){
    ll x, d, n;
    cin >> x >> d >> n;
    if(d == 0){
      ll ans = pow_mod(x, n);
      cout << ans << endl;
    }else{
      if(n >= MOD) cout << 0 << endl;
      else{
        ll a = x * inverse(d) % MOD;
        ll ans = kai[a + n] * inverse(kai[a]) % MOD * pow_mod(d, n) % MOD;
        cout << ans << endl;
      }
    }
  }
}


Measured memory_bytes: 17280
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	ll x,y;
	cin>>x>>y;
	int res=0;
	while(x<=y){
		res++;
		x<<=1LL;
	}
	cout<<res<<'\n';
}



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

int main()
{
    int N ;
    int i ;
    int Number_Of_Candies = 0 ;
    cin >> N ;

    for(i=1 ; i<=N ; i++)
    {
        Number_Of_Candies = i + Number_Of_Candies;
    }

    cout << Number_Of_Candies << "\n";

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	for (string s; cin >> s;) {
		int a, b; cin >> a >> b;
		cout << s << " " << a + b << " " << a * 200 + b * 300 << endl;
	}
	return 0;
}

Measured memory_bytes: 3124
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
//ll max(ll a,ll b){if(a<b)return b;else return a;}
//ll min(ll a,ll b){if(a>b)return b;else return a;}
//void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
//void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"

#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
template<class T>bool Max(T&a, T b){if(a < b){a = b;return 1;}return 0;}
template<class T>bool Min(T&a, T b){if(a > b){a = b;return 1;}return 0;}

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

int main(){fastio
    string s;cin>>s;
    ll n=s.size();
    ll l[n+1],r[n+1];
    memset(l,0,sizeof(l));memset(r,0,sizeof(r));
    ll c=0;
    rep(i,0,n){
        l[i]=c;
        if(i==n)break;
        if(s[i]=='<'){
            c++;
        }else{
            c=0;
        }
    }
    c=0;
    for(ll i=n;i>=0;i--){
        r[i]=c;
        if(i==0)break;
        if(s[i-1]=='>'){
            c++;
        }else{
            c=0;
        }
    }
    //rep(i,0,n)cout<<l[i]<<" ";cout<<endl;
    //rep(i,0,n)cout<<r[i]<<" ";cout<<endl;
    ll ans=0;
    rep(i,0,n){
        ans+=max(l[i],r[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 8732
#include<bits/stdc++.h>
using namespace std;
    static const double pi = 3.141592653589793;
 typedef pair<int64_t,int64_t> P;
#define rep(i, n) for (int i = 0; i < (n); i++)
 #define all(v) (v).begin(),(v).end()
 using ll = long long;
using Graph = vector<vector<int>>;
const int MAX = 510000;
const int MOD = 1000000007;

 
 
int main(){
ll N;
  cin>>N;
  ll p=sqrt(N);
 ll d=0;
  ll k=0;
  for(int j=1;j<=N;j++){ 
    if(N*2%j==0 & N*2/j==j-1) 
    {
    d=1;
      k=j;
    }
  }
ll dp[k][k]; 
 if(N==1){
 cout<<"Yes"<<endl;
   cout<<2<<endl;
   cout<<1<<' '<<1<<endl;
 cout<<1<<' '<<1<<endl;
 }
  else if(d==0) {
    cout<<"No";
  }
  else if(d==1){
    
    rep(i,k) rep(j,k) dp[i][j]=0;
    rep(i,k) dp[i][0]=k-1;
    for(int i=0;i<k;i++){
    for(int j=1;j<k;j++){
    if(i==0) dp[i][j]=j;
      else if(i>=j) dp[i][j]=dp[j-1][i];
      else if(i==j-1) dp[i][j]=dp[i-1][k-1]+1;
      else dp[i][j]=dp[i][j-1]+1;
      } 
    
    }
    
    
cout<<"Yes"<<endl;
    cout<<k<<endl;
  
  rep(i,k){
  rep(j,k){
  cout<<dp[i][j]<<' ';
    if(j==k-1) cout<<endl;
  }
  
  }
  }
}


Measured memory_bytes: 2944
#include <stdio.h>
#define MAX 500000
#define SENTINEL 2000000000
// sentinel 10^1 分少ない

int L[MAX/2+2],R[MAX/2+2];
int cnt;

void merge(int A[],int n,int left,int mid,int right){
  int i,j,k;
  int n1 = mid - left;
  int n2 = right - mid;
  for(i=0;i<n1; i++) L[i] = A[left + i];
  for(i=0;i<n2; i++) R[i] = A[mid + i];
  L[n1] = R[n2] = SENTINEL;

  i=0,j=0;
  for(k = left;k < right; k++){
    cnt++;
    if(L[i] <= R[j]){
      A[k] = L[i++];
    }
    else{
      A[k] = R[j++];
    }
  }
}

void mergeSort(int A[],int n,int left,int right){
   if( left+1 < right){
       int mid = ( left + right) /2;
       mergeSort(A,n,left,mid);
       mergeSort(A,n,mid,right);
       merge(A,n,left,mid,right);
       }
      }
        
int main(){
     int A[MAX], n,i;
     cnt =0;
     
     scanf("%d",&n);
     for(i=0;i<n;i++)scanf("%d",&A[i]);
 
     mergeSort(A,n,0,n);
     for(i=0;i<n;i++){

     if(i)printf(" ");
     printf("%d",A[i]);
    
     }

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



Measured memory_bytes: 5604
#include <iostream>
 
using namespace std;
 
int main(void){
 
  int n;
  int Array[200][3];
 
  cin >> n;
 
  for( int i = 0 ; i < n ; i++ ){
     
    for( int j = 0 ; j < 3 ; j++ ){
 
      cin >> Array[i][j];
 
    }
 
  }
 
  int j,score[200]={0};
 
  for( int k = 0; k < 3 ; k++ ){
 
    for( int i = 0 ; i < n ; i++ ){
 
      for( j = 0 ; j < n ; j++ ){
  
    if( i == j ) continue;
    if( Array[j][k] == Array[i][k] ) break;
 
    
      }
 
      if( n == j ) score[i] += Array[i][k];  
    
    }
     
  }
 
  for(int i = 0 ; i < n ; i++ ){
 
    cout << score[i] << endl;
 
  }
 
 
  return 0;
 
 
}

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

int main()
{
  int a[5] ; 
  for(int i = 0 ;  i < 5 ; ++i)
    cin >> a[i] ; 
  int ans ; 
  for(int i = 0 ; i< 5 ; ++i)
  {
    if(a[i] == 0)
      cout << i+1;
  }
  return 0 ;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

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

    ll N;
    cin >> N;

    vector<ll> A(N), B(N);
    rep (i, N) {
        cin >> A[i] >> B[i];
    }

    ll ans = 0;
    rrep(i, N) {
        A[i] += ans;
        if (A[i]%B[i] != 0) {
            ans += B[i]-A[i]%B[i];
        }
    }

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


Measured memory_bytes: 1792
a,b,c = map(int,input().split())
max_num = max(a,b,c)
sum_num = a+b+c
if (max_num-3*sum_num)%2==0:
  print((max_num*3-sum_num)//2)
else:
  print(((max_num+1)*3-sum_num)//2)

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

int main()
{
  int N,X;cin>>N>>X;
  vector<int> L(N);
  for (int i=0;i<N;i++)
   cin>>L[i];
  
  int sum=0;
  for (int i=0;i<N;i++)
  {
    sum += L[i];
    if (sum > X)
    {
      cout<< i+1 <<endl;
      return (0);
    }
  } 
  cout<<N+1<<endl;
} 

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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;
using P = pair<int, int>;

int main() {
    int n, a;
    cin >> n;
    string s;
    cin >> s;
    rep(i, s.size()) {
        a = (s[i] - 'A');
        a = (a + n) % 26;
        putchar(a + 'A');
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3608