akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long cnt = 0;
		for(int x = 0; x <= K; x++){
			for(int y = 0; y <= K; y++){
				int rest = S - (x + y);
				if( 0 <= rest && rest <= K ) cnt++;
			}
		}
		
		Console.WriteLine(cnt);
		
	}
	int K,S;
	public Sol(){
		var d = ria();
		K = d[0];
		S = d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 2776
#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout<<x<<" "<<endl;
#define gg(x,y) cout<<x<<" & "<<y<<" "<<endl
#define jam(t) cout<<"Case #"<<t<<": "
#define ggg(x,y,z) cout<<x<<" & "<<y<<" & "<<z<<" "<<endl
#define all(x) x.begin(),x.end()
#define input_from_file  freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 400005
#define bitcnt(x) __builtin_popcountll(x)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}



void solve(){
    ll a;
    string b;
    cin >> a >> b;
    ll re = 0;
    ll idx= 0 ;
    while(b[idx]!='.'){
        re = re * 10  + (b[idx++]-'0');
       
    }
    idx++;
    ll bad = 0;
    while(idx < b.length()){
        bad = bad*10 + (b[idx++]-'0');
        
    }

    ll res = a*re + (a*bad)/100;
    g(res);
}
int main()
{
#ifndef ONLINE_JUDGE
input_from_file
#endif
 
    FASTIO
    cin.tie(NULL);
    fflush(stdout);
    ll t = 1;
   // cin >> t;
    for(ll tcase = 1;tcase <= t;tcase++){
        solve();
        
    }
return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define int long long int
#define double long double
#define endl "\n"
#define sz(x) (int)x.size()
using namespace std;

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

  double a,b,c,d;
  cin>>a>>b>>c>>d;

  double val=c*30;
  double val2=d*6;
  val+=(d/60)*30;

  double an=abs(val-val2);
  if(an>180) {
    an=360-an;
  }

  double sq=(a*a)+(b*b)-(2*a*b*cos(an*(((double)atan((double)1)*4)/180)));
  double ans=sqrt(sq);
  cout<<fixed<<setprecision(20)<<ans;

}


Measured memory_bytes: 4136
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	Int n, a, b; cin >> n >> a >> b;
	Int ans = min(b-1, n-a);
	if((b - a) % 2 == 0){
		ans = min(ans, (b-a) / 2);
	}else{
		ans = min(ans, a + (b-a) / 2);
		ans = min(ans, n-b+1+(n-(a+n-b+1))/2);
	}
	cout << ans << "\n";
}

Measured memory_bytes: 256
def solver(a, b, c, d):
  """
  >>> solver(600, 300, 220, 420)
  520
  >>> solver(555, 555, 400, 200)
  755
  >>> solver(549, 817, 715, 603)
  1152
  """

  result = 0

  result += a if a < b else b
  result += c if c < d else d

  return result

if __name__ == '__main__':
  inputs = [int(input()) for _ in range(4)]
  print(solver(inputs[0], inputs[1], inputs[2], inputs[3]))


Measured memory_bytes: 3060
#include <stdio.h>

int main(void)
{
	int n[3];
	int seven = 0;
	int f = 0;
	int i = 0;
	
	scanf("%d %d %d", &n[0], &n[1], &n[2]);
	
	for (i = 0; i < 3; i++){
		if (n[i] == 5){
			f++;
		}
		else if (n[i] == 7){
			seven++;
		}
	}
	
	if (f == 2 && seven == 1){
		printf("YES\n");
	}
	else {
		printf("NO\n");
	}
	
	return (0);
}

Measured memory_bytes: 128
//In The Name Of Allah
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define double long double 
#define x real()
#define y imag()
#define fi first
#define se second
#define pii pair<int, int>

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	int a, b;
	cin >> a >> b;
	for (int i = 1; i <= 3; i++) {
		if (i != a && i != b) {
			cout << i << "\n";
		}
	}
}



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

int main(){
	int a,b;
	string s;
	for(int i=0;i<100;i++){
	cin>>a>>s>>b;
	if(s=="+"){
		cout<<a+b<<endl;
	}
	else if(s=="-"){
		cout<<a-b<<endl;
	}
	else if(s=="*"){
		cout<<a*b<<endl;
	}
	else if(s=="/"){
		cout<<a/b<<endl;
	}
	else if(s=="?"){
		i=100;
	}
}
}



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

using namespace std;

#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL)
#define endl "\n"
#define dump(x) cerr<<"~ "<<#x<<" = "<<x<<endl


int n,m;
int dp[103][103][2];
int mat[103][103];

int f(int x, int y, int color) {

	int &res = dp[x][y][color];
	if(res != -1) return res;

	res = 1e9;
	int flag = 0;

	if(color != mat[x][y]) {
		color ^= 1; 
		flag += (mat[x][y] == 1);
	}

	if(x+1 <= n) {
		res = min(res, f(x+1, y, color));
	}

	if(y+1 <= m) {
		res = min(res, f(x, y+1, color));
	}

	if(res == 1e9) res = 0;
	res += flag;

	return res;
}

int main() {

	fast_cin;

	string s;
	cin >> n >> m;

	for(int i = 1; i <= n; i++) {
		
		cin >> s;

		for(int j = 1; j <= m; j++) {
			mat[i][j] = ( s[j-1] == '.' ? 0 : 1 );
			//dump(mat[i][j]);
		}
	}

	memset(dp,-1,sizeof(dp));
	cout << f(1,1,0) << endl;
	
	
	
	return 0;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int K = Integer.parseInt(br.readLine());
        if (K % 2 == 0) {
            int k = K / 2;
            out.println(k * k);
        } else {
            int k = (K + 1) / 2;
            out.println(k * (k - 1));
        }      
        out.close();
    }
}

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

int main() {
  int64_t a;
  double b;
  cin >> a >> b;
  int64_t a_1 = a/1000000;
  int64_t a_2 = a%1000000;
//  int b_i = b;
//  int64_t c_i = a*b_i;
//  double c_r = a*(b-b_i);
//  int64_t d = c_r;
  int64_t d1 = a_1 * b * 100;
  int64_t d2 = a_2 * b;
  int64_t d = d1*10000+d2;
  cout << d << endl;

}

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

int w,n;
int a,b;
int l[30];

int main()
{
        cin >> w >> n;
        for(int i=0;i<w;i++) l[i] = i+1;
        for(int j=0;j<n;j++){
                scanf("%d%*c%d",&a,&b);
                swap(l[a-1],l[b-1]);
        }
        for(int k=0;k<w;k++) cout << l[k] << endl;

        return 0;

}

Measured memory_bytes: 1240
using System;

public class Hello
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        var sL = s.Length;
        if (sL % 2 == 0) Console.WriteLine(sL / 2 + check0(s, sL / 2));
        else Console.WriteLine((sL + check1(s, sL / 2)) / 2);
    }
    static int check2(string s) => s[0] == s[1] ? 2 : 1;
    static int check1(string s, int a)
    {
        var s0 = s[a];
        var count = 1;
        for (int i = 1; i <= a; i++)
        {
            if (s[a - i] == s0 && s[a + i] == s0) count += 2;
            else return count;
        }
        return count;

    }
    static int check0(string s, int a)
    {
        if (s[a - 1] != s[a]) return 0;
        var s0 = s[a - 1];
        var count = 1;
        for (int i = 1; i < a; i++)
        {
            if (s[a + i] == s0 && s[a - 1 - i] == s0) count++;
            else return count;
        }
        return count;
    }
}


Measured memory_bytes: 26292
import java.util.*;

public class Main{
    public static void main(String[] args){
        try{
            Scanner sc = new Scanner(System.in);
   
            int N = sc.nextInt();

            Map<Integer,Integer> map = new TreeMap<Integer, Integer>();
            for(int i = 0; i < N; i++){
                int X = sc.nextInt();
                int L = sc.nextInt();
                map.put(X,L);
            }

            int leftArm = -100000000;
            int rightArm = 0;
            int removeNum = 0; 
      
            for (Integer key : map.keySet()){

                if(leftArm + rightArm > key - map.get(key)){
                    removeNum++;

                    if(leftArm + rightArm > key + map.get(key)){
                        leftArm = key;
                        rightArm = map.get(key);
                    }
                
                }else{
                    leftArm = key;
                    rightArm = map.get(key);                   
                }
            }   
            int ans = N - removeNum;
            System.out.println(ans);
   
        sc.close();

        }catch(NoSuchElementException e){
			System.out.println("無効な値です");
		}
    }
}

Measured memory_bytes: 97672
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let a: u64 = iterator.next().unwrap().parse().unwrap();
    let b: u64 = iterator.next().unwrap().parse().unwrap();
    let c: u64 = iterator.next().unwrap().parse().unwrap();
    let d: u64 = iterator.next().unwrap().parse().unwrap();

    let gcd = if c > d { gcd(c, d) } else { gcd(d, c) };
    let k = c / gcd * d;

    let x = b / c + b / d - b / k;
    let y = (a - 1) / c + (a - 1) / d - (a - 1) / k;

    let ans = (b - x) - (a - 1 - y);

    return ans.to_string();
}

fn gcd(m: u64, n: u64) -> u64 {
    assert_eq!(m >= n, true);

    if n == 0 {
        m
    } else {
        gcd(n, m % n)
    }
}


Measured memory_bytes: 4352
#include<string.h>
#include<stdlib.h>
#include<stdio.h>

int top, S[1000];

void push(int x)
{
	S[top] = x;
	top++;
}

int pop()
{
	top--;
	return S[top];
}

int main()
{
	top = 0;
	int a, b;
	char s[100];

	while (scanf("%s",s) != EOF)
	{
		if (s[0] == '+')
		{
			a = pop();
			b = pop();
			push(a + b);
		}

		else if (s[0] == '-')
		{
			a = pop();
			b = pop();
			push(b - a);
		}

		else if (s[0] == '*')
		{
			a = pop();
			b = pop();
			push(a * b);
		}

		else
			push(atoi(s));

	}

	printf("%d\n",pop());


	return 0;
}


Measured memory_bytes: 2148
#include<stdio.h>
#include<stdio.h>
int main(){
	char s[5]={'\0'};
	int t=0;
	scanf("%s",s);
	if(s[1]=='B'){
		t=1;
	}
	if(t==1) printf("ARC");
	else printf("ABC");
	return 0;
}

Measured memory_bytes: 1684
s = input()
n = len(s)

count = 0

if n % 2 == 0:
    for i in range(int(n/2)):
        if s[i] != s[n-i-1]:
            count += 1
else:
    for i in range(int((n-1)/2)):
        if s[i] != s[n-i-1]:
            count += 1

print(count)


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <functional>
#include <iomanip>
#include <stack>
#include<tuple>
#include<deque>
using namespace std;

#define rep(p,q) for(int i = p;i < q;i++)

#define LL long long int

#define inf 10000000000

//1_3_B

int main(void) {
	deque<tuple<string, int>> q = deque<tuple<string, int>>();
	int n, t;
	cin >> n >> t;
	rep(0, n) {
		string s;
		int time;
		cin >> s >> time;
		q.push_back(make_tuple(s, time));
	}
	int total = 0;
	while (q.size() > 0) {
		auto x = q.front();
		q.pop_front();
		if (get<1>(x) <= t) {
			total += get<1>(x);
			cout << get<0>(x) << " " << total << endl;
		}
		else {
			get<1>(x) -= t;
			total += t;
			q.push_back(x);
		}
	}
}


Measured memory_bytes: 6220
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>

using namespace std;

typedef long long int lli;

int gcd(int a, int b) {
	return b != 0 ? gcd(b, a%b) : a;
}
lli gcd(lli a, lli b) {
	return b != 0 ? gcd(b, a%b) : a;
}
int lcm(int a, int b) {
	return a * b / gcd(a, b);
}
lli lcm(lli a, lli b) {
	return a * b / gcd(a, b);
}

#define N_MAX 50
#define MOD 1000000007

//lli fac[N_MAX], finv[N_MAX], inv[N_MAX];
//
//void COMinit() {
//	fac[0] = fac[1] = 1;
//	finv[0] = finv[1] = 1;
//	inv[1] = 1;
//	for (int i = 2; i < N_MAX; 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;
//	}
//}
//
//lli COM(int n, int k) {
//	if (n < k) return 0;
//	if (n < 0 || k < 0) return 0;
//	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
//}
//
//lli modpow(lli base, lli p)
//{
//	if (0 == p) {
//		return 1;
//	}
//	if (0 == p % 2) {
//		lli val = modpow(base, p / 2);
//		return (val*val) % MOD;
//	}
//	else {
//		return (modpow(base, p - 1)*base) % MOD;
//	}
//}


int N;
int x[N_MAX], y[N_MAX];
double ret = 1e8;

void func(int a, int b, int c, int d, int e, int f)
{
	if (a == c && c == e) {
		return;
	}
	double px, py;
	py = (double)((e - a)*(a*a + b * b - c * c - d * d) - (c - a)*(a*a + b * b - e * e - f * f)) /
		(double)(2 * (e - a)*(b - d) - 2 * (c - a)*(b - f));
	if (c != a) {
		px = ((double)(2 * (b - d))*py - (double)(a*a + b * b - c * c - d * d)) /
			(double)(2 * (c - a));
	}
	else {
		px = ((double)(2 * (b - f))*py - (double)(a*a + b * b - e * e - f * f)) /
			(double)(2 * (e - a));
	}

	double r2 = ((double)a - px)*((double)a - px) + ((double)b - py)*((double)b - py);

	for (int i = 0; i < N; i++) {
		double d2 = ((double)x[i] - px)*((double)x[i] - px) + ((double)y[i] - py)*((double)y[i] - py);
		if (d2 - r2 > 1e-6) {
			return;
		}
	}

	ret = min(ret, sqrt(r2));

	return;
}

void func2(int a, int b, int c, int d)
{
	double px = (double)(a + c) / 2.0l, py = (double)(b + d) / 2.0l;
	double r2 = ((double)((a - c)*(a - c) + (b - d)*(b - d))) / 4.0l;
	for (int i = 0; i < N; i++) {
		double d2 = ((double)x[i] - px)*((double)x[i] - px) + ((double)y[i] - py)*((double)y[i] - py);
		if (d2 - r2 > 1e-6) {
			return;
		}
	}

	ret = min(ret, sqrt(r2));

	return;
}

void solv()
{
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d%d", x + i, y + i);
	}

	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			func2(x[i], y[i], x[j], y[j]);
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			for (int k = j + 1; k < N; k++) {
				func(x[i], y[i], x[j], y[j], x[k], y[k]);
			}
		}
	}

	printf("%.10lf", ret);

	return;
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	solv();

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}


Measured memory_bytes: 128
// #pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pb push_back
#define N 1000000007
#define N2 998244353
#define Nmax 500001
#define pll pair<ll,ll>
#define pii pair<ll,ll>
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(ll i=m;i<(n);i++)
#define get(n) ll (n); scanf("%lld",&(n));
#define ALL(c) (c).begin(),(c).end()
#define fill_nums(A,n) for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);
#define pi 3.1415926535897

vector<ll> factorize(ll num) {
    
    vector<ll> res;
    for(ll i=1;i<=sqrt(num);i++) {
        if((num%i)==0) { 
            if(i*i==num) {
                res.push_back(i);
            }
            else {
                res.push_back(i);
                res.push_back(num/i);
            }
        }
    }

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

    // for(auto i:res)
    //  printf("%lld ",i);
    // printf("\n");

    return res;
}

int main() {

    get(a);
    get(b);
    get(x);

    double val;
    if(2*x>=a*a*b)
        val = (2*(b*a*a-(double)x))/(double)(a*a*a);
    else
        val = ((double)b*(double)b)*a/(double)(2*x);
    double ans = atan(val);
    // cout<<val<<endl;
    // cout<<ans<<endl;
    cout<<fixed<<setprecision(12);
    cout<<(ans/pi)*180.0<<endl;
    

    return 0;
}


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

int main(){

    int N, M;
    cin >> N >> M;

    int ac_num = 0, pena_num = 0;
    pair<int, string> p;
    //map<pair<int, string>, int> m;
    vector<int> ac_flg(N);
    vector<int> pena(N);

    for (int i=0; i<M; i++){
        int tmp_i;
        cin >> tmp_i;
        string tmp_s;
        cin >> tmp_s;

        p.first = tmp_i;
        p.second = tmp_s;

        if ((p.second == "AC") && (ac_flg.at(p.first-1) == 0)){
            //m[p]++;
            ac_flg.at(p.first - 1) = 1;
            ac_num++;
        }
        if ((p.second == "WA") && (ac_flg.at(p.first-1) == 0)){
            //m[p]++;
            pena.at(p.first-1) += 1;
        }
    }

    for (int i=0; i<N; i++){
        if (ac_flg.at(i) == 1){
            pena_num += pena.at(i);
        }
    }

    cout << ac_num << " " << pena_num << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main {    
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] nums=new int[n];
        for(int i=0;i<n;i++){
            nums[i]=sc.nextInt();
        }
        sc.close();
        int sum=0;
        for(int a:nums){
            sum+=a;
        }
        double avtemp=(sum*10/n);
        int average=(int)Math.round(avtemp/10);
        int output=0;
        for(int a:nums){
            output+=(a-average)*(a-average);
        }
        System.out.println(output);
        

    }
    
}

Measured memory_bytes: 23252
#include<stdio.h>

int strlen(char *a){for(int i=0;;i++)if(a[i]=='\0')return i;}

int strcmp(char *a,char *b){
	for(int i=0;i<7;i++)if(*(a+i)!=*(b+i))return 0;
	return 1;
}

char a[105][105];
int h,w;
int dR[105],dC[105],dRS=0,dCS=0;

int main(){
	scanf("%d%d",&h,&w);
	for(int i=0;i<h;i++)scanf("%s",a[i]);
	for(int i=0;i<h;i++){
		int f = 0;
		for(int j=0;j<w;j++)if(a[i][j]=='#'){
			f=1;
			break;
		}
		if(f==0){
			dR[dRS++]=i;
		}
	}
	for(int i=0;i<w;i++){
		int f = 0;
		for(int j=0;j<h;j++)if(a[j][i]=='#'){
			f=1;
			break;
		}
		if(f==0){
			dC[dCS++]=i;
		}
	}
	for(int i=0;i<h;i++){
		int af=0;
		for(int k=0;k<dRS;k++)if(dR[k]==i)af=1;
		if(af==1)continue;
		for(int j=0;j<w;j++){
			int f = 0;
			for(int k=0;k<dCS;k++)if(dC[k]==j)f=1;
			if(f==1)continue;;
			printf("%c",a[i][j]);
		}
		puts("");
	}
	
}
/*
int x[4],y[4];
	scanf("%d%d%d%d",&x[0],&y[0],&x[1],&y[1]);
	int dx=x[1]-x[0],dy=y[1]-y[0];
	x[2] = x[1] - dy,y[2]=y[1]-dx;
	x[3] = x[0] - dy,y[3] = y[0] - dx;
	printf("%d %d %d %d",x[2],y[2],x[3],y[3]); 

*/


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long a,b,c,d;
  d=1;
  cin >> a >> b;
  if (a<b) {
    c=b;
    b=a;
    a=c;
  };
  for(int i=1;i<=a&&d==1;i++){
    if(a/i*i==a&&b/(a/i)*(a/i)==b) d=a/i;
  };
  cout << a*b/d;
}

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

// Nを入力したあとでN個の要素をもつ配列を入力する
vector<int> input(int N) {
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  return vec;
}

int main() {
  // Nの入力
  int N;
  cin >> N;

  // 受け取る
  vector<int> A;
  A = input(N);

  string result = "APPROVED";

  rep(i,N){
    if(A.at(i) % 2 == 0){
      if( !(A.at(i) % 3 == 0 || A.at(i) % 5 == 0) ){
      result = "DENIED";
      break;
      }
    }
  }

  cout << result << endl;

}


Measured memory_bytes: 256
#include <stdio.h>

#define MAX(X,Y) ((X)>(Y)?(X):(Y))
#define MIN(X,Y) ((X)<(Y)?(X):(Y))

int main(void){
    int n,x,y;
    
    scanf("%d", &n);
    x = 800*n;
    y = 200*(n / 15);
    printf("%d\n", x-y);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main() {
    ll n,a,b,c,d,e;
    cin >> n >> a >> b >> c >> d >> e;
    ll mi = min({a,b,c,d,e});
    cout << 5+((n+mi-1)/mi)-1 << endl;
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

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

int main(){
  int N; string S;	
  cin >> N >> S;
  bool loop =true;
  if((N % 2) == 1){
    loop = false;
  }
  else{
    for(int i=0; i < N/2; i++){
      if(S.at(i) != S.at(i+N/2)){
        loop = false;
        break;
      }
    }
  }
  
  if(loop) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9 + 7;
const int inf = 1e9;

int main() {
	ll N,M;
	cin>>N>>M;
	vector<ll> a(N),b(N),c(M),d(M),D(N),ans(N);
	rep(i,N)cin>>a[i]>>b[i];
	rep(i,M)cin>>c[i]>>d[i];
	rep(i,N){
		D[i]=inf;
		rep(j,M){
			ll dis = abs(a[i]-c[j])+abs(b[i]-d[j]);
			if(D[i]>dis){
				ans[i]=j+1;
				D[i] = dis;
			}
		}
	}
	rep(i,N)
	cout<<ans[i]<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;

const lld N = 200043;
const lld MOD = 1000000007;

lld add(lld x, lld y)
{
    x =((x%MOD)+(y%MOD))%MOD;
    while(x >= MOD) x -= MOD;
    while(x < 0) x += MOD;
    return x;
}

lld mul(lld x, lld y)
{
    return ((x%MOD)*(y%MOD))% MOD;
}

lld binpow(lld x, lld y)
{
    lld z = 1;
    while(y)
    {
        if(y & 1) z = mul(z, x);
        x = mul(x, x);
        y >>= 1;
    }
    return z;
}

lld inv(lld x)
{
    return binpow(x, MOD - 2);
}

lld divide(lld x, lld y)
{
    return mul(x, inv(y));
}

// Combinations

/*
lld fact[N];

void precalc()
{
    fact[0] = 1;
    for(lld i = 1; i < N; i++)
        fact[i] = mul(fact[i - 1], i);
}

lld C(lld n, lld k)
{
    return divide(fact[n], mul(fact[k], fact[n - k]));
}
*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t,i,j;
    //cin>>t;
    t=1;
    while(t--)
    {
        string str;
        cin>>str;
        if(str[str.length()-1]=='s')
            cout<<str<<"es"<<endl;
        else
            cout<<str<<"s"<<endl;
    }
}





Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

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 auto __lcm(T& a, T& b) 
{ return a * b / __gcd(a, b); }

template<typename T> void remove(std::vector<T>& vector, unsigned int index)
{ vector.erase(vector.begin() + index); }


int main() {
    int A, B;  cin >> A >> B;
    if (A - 2 * B > 0) print(A - 2 * B);
    else print(0);

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    // 整数の入力
    int a;
    cin >> a;
    // スペース区切りの整数の入力
    // int b,c;
    // cin >> b >> c;
    // 文字列の入力
    // string s;
    // cin >> s;
    // 出力
    cout << (a+1) * a / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
// amigos y no más
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)

using namespace std;
typedef long long ll;

int n;
string cad;
int cont = 0;
int contp = 0 , contm = 0 ;  // contpuntos , contmichi
vector<int> line;

int main(){
    fastio;
    cin>>n;
    cin>>cad;
	
	for(int i=0; i<n;i++){
		if(cad[i]=='.'){
			if(contm!=0){
				line.push_back(contm);contm = 0;
			}
			contp++;
		}
		else if(cad[i] == '#'){
			if(contp!=0){
				if(line.size()>0) {
					line.push_back(contp);
				}
				contp = 0;
			}
			contm++;
		}
	}
	if(contp!=0){
		line.push_back(contp);contp = 0;
	}

	
	if(line.size()<=1) cout<<"0\n";
	else{
		int x = 0 , y = 0 ;
		vector<int> sx , sy;
		sx.push_back(0);
		
		for(int i=0;i<line.size();i++){
			if((i&1) == 0) {x+=line[i]; sx.push_back(x);}
		}
		
		for(int i=line.size()-1 ; i>=0 ; i--){
			if(i&1) {y+=line[i]; sy.push_back(y);}
		}
		reverse(sy.begin(),sy.end());
		sy.push_back(0);
		
		cont = sx[0] + sy[0];

		for(int i=1; i<sx.size();i++){
			cont = min(cont, sx[i] + sy[i]);
		}
		cout<<cont<<"\n";
	}
	
    return 0;
 
}

Measured memory_bytes: 2572
#include <bits/stdc++.h>
#include<set>
#define ll long long 
using namespace std;
int main()

{
	int n,m,a,nc=0,np=0,i;
	cin>>n>>m;
	int c[n+1],b[n+1];
	for(i=1;i<n+1;i++)
	{
		c[i]=0;
		b[i]=0;
	}
	while(m--)
	{
		cin>>a;
		string s;
		cin>>s;
		if (s=="AC")
		{
			c[a]=1;
		}
		else 
		{
			if (c[a]==0)
			b[a]++;
		}
	
		
		
		
	}
		for(i=1;i<n+1;i++)
		{
			nc+=c[i];
		}
		for(i=1;i<n+1;i++)
		{
			if (c[i]>=1)
			np+=b[i];
		}
		cout<<nc<<" "<<np<<endl;
	

	
}




Measured memory_bytes: 1024
package main

import "fmt"

func gcd(x, y int) int {
	for y > 0 {
		x, y = y, x%y
	}
	return x
}

func lcm(x, y int) int {
	return x / gcd(x, y) * y
}

func main() {
	var (
		n, m int
		s, t string
	)
	fmt.Scan(&n, &m, &s, &t)

	l := lcm(n, m)
	xm := make(map[int]byte)
	for i := 0; i < n; i++ {
		xm[1+(l/n)*i] = s[i]
	}
	for i := 0; i < m; i++ {
		if v, ok := xm[1+(l/m)*i]; ok && v != t[i] {
			fmt.Println(-1)
			return
		}
	}
	fmt.Println(l)
}


Measured memory_bytes: 4736
/*
A1530.c
*/
#include <stdio.h>
#include <stdlib.h>
#define min(x,y) (((x)<(y))?(x):(y))

int t[1000];

int comp( const void * a , const void * b ) {

  if( *( int * )a < *( int * )b ) {
    return -1;
  }
  else
  if( *( int * )a == *( int * )b ) {
    return 0;
  }
  return 1;
}

int solve(int t[],int n)
{ int a,b;
  
  if(n==1)
    return(t[0]);
  else if(n==2)
    return(t[1]); 
  else if(n==3)
    return(t[0]+t[1]+t[2]);
  else
    {
      a=2*t[0]+t[n-1]+t[n-2];
      b=t[0]+2*t[1]+t[n-1];

      return(min(a,b)+solve(t,n-2)) ;
    }
}

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

  for(i=0;i<n;i++)
  {
    scanf("%d",&t[i]);
  }
  qsort(t,n,sizeof(int),comp);
  ret=solve(t,n);
  printf("%d\n",ret);
  return(0);
}



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

int main() {
    int n;
    cin >> n;
    vector<bool> isprime(101,true);
    vector<int> primes;
    for (int i=2; i<=100; i++) {
        if (!isprime[i]) continue;
        primes.push_back(i);
        for (int j=i+i; j<=100; j+=i) isprime[j] = false;
    }
    vector<int> powers(primes.size(),0);
    for (int i=2; i<=n; i++) {
        int curr = i;
        for (int j=0; j<powers.size(); j++) {
            while (curr%primes[j]==0) {
                curr/=primes[j];
                powers[j]++;
            }
        }
    }
    int result = 0;
    for (auto i : powers) if (i+1>=75) result++;
    /*
    for (int i=0; i<powers.size(); i++) {
        for (int j=i+1; j<powers.size(); j++) {
            if ((powers[i]+1>=15 && powers[j]+1>=5) || (powers[i]+1>=5 && powers[j]+1>=15) || (powers[i]+1>=3 && powers[j]+1>=25) || (powers[i]+1>=25 && powers[j]+1>=3)) result++;
        }
    }
    */
    for (int i=0; i<powers.size(); i++) {
        for (int j=i+1; j<powers.size(); j++) {
            if (powers[i]+1>=15 && powers[j]+1>=5) result++;
        }
    }
    for (int i=0; i<powers.size(); i++) {
        for (int j=i+1; j<powers.size(); j++) {
            if (powers[i]+1>=5 && powers[j]+1>=15) result++;
        }
    }
    for (int i=0; i<powers.size(); i++) {
        for (int j=i+1; j<powers.size(); j++) {
            if (powers[i]+1>=3 && powers[j]+1>=25) result++;
        }
    }
    for (int i=0; i<powers.size(); i++) {
        for (int j=i+1; j<powers.size(); j++) {
            if (powers[i]+1>=25 && powers[j]+1>=3) result++;
        }
    }
    /*
    for (int i=0; i<powers.size(); i++) {
        for (int j=i+1; j<powers.size(); j++) {
            for (int k=j+1; k<powers.size(); k++) {
                if ((powers[i]+1>=3 && powers[j]+1>=5 && powers[k]+1>=5) || (powers[i]+1>=5 && powers[j]+1>=3 && powers[k]+1>=5) || (powers[i]+1>=5 && powers[j]+1>=5 && powers[k]+1>=3)) result++;
            }
        }
    }
    */
    for (int i=0; i<powers.size(); i++) {
        for (int j=i+1; j<powers.size(); j++) {
            for (int k=j+1; k<powers.size(); k++) {
                if (powers[i]+1>=3 && powers[j]+1>=5 && powers[k]+1>=5) result++;
            }
        }
    }
    for (int i=0; i<powers.size(); i++) {
        for (int j=i+1; j<powers.size(); j++) {
            for (int k=j+1; k<powers.size(); k++) {
                if (powers[i]+1>=5 && powers[j]+1>=3 && powers[k]+1>=5) result++;
            }
        }
    }
    for (int i=0; i<powers.size(); i++) {
        for (int j=i+1; j<powers.size(); j++) {
            for (int k=j+1; k<powers.size(); k++) {
                if (powers[i]+1>=5 && powers[j]+1>=5 && powers[k]+1>=3) result++;
            }
        }
    }
    cout << result;
    return 0;
}

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

int digsum(int n) {
  int r = 0;
  while (n) {
    r += n % 10;
    n /= 10;
  }
  return r;
}

signed main() {
  int N;
  cin >> N;
  
  int ans = 1e9;
  for (int A = 1; A < N; ++A) {
    int B = N - A;
    ans = min(ans, digsum(A) + digsum(B));
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())

total = 0
for i in range(1, N+1):
    if i % 3 == 0 and i % 5 == 0:
        continue
    elif i % 3 == 0:
        continue
    elif i % 5 == 0:
        continue
    else:
        total += i

print(total)

Measured memory_bytes: 9112
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <vector>
#include <bitset>
#include <queue>
using namespace std;

int main(){
    string a, b;
    cin >> a >> b;
    if(a.length() == b.length()){
        for(int i = 0; i < a.length(); i++){
            cout << a[i] << b[i];
        }
        cout << endl;
        return 0;
    }else{
        for(int i = 0; i < b.length(); i++){
            cout << a[i] << b[i];
        }
        cout << a[b.length()] << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		int a = in.nextInt();
		int b = in.nextInt();
		int n = in.nextInt();

		int ans = 0;

		for (int i=0; i<n; i++) {
			a %= b;
			a *= 10;
			ans += a/b;
		}

		out.println(ans);
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		while(in.hasNext()) solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

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

#define N_MAX 18
#define M_MAX 1000002
#define ll long long

using namespace std;

int n;

int a[N_MAX][N_MAX];

ll dp[M_MAX];

ll total[M_MAX];

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
            cin >> a[i][j];
    for(int mask = 0; mask < (1 << n); mask++)
    {
        for(int i = 1; i <= n; i++)
            if((mask >> (i - 1)) & 1)
                for(int j = 1; j <= n; j++)
                    if((mask >> (j - 1)) & 1)
                        total[mask] += a[i][j];
    }
    for(int mask = 1; mask < (1 << n); mask++)
    {
        for(int mask1 = mask; mask1 > 0; mask1 = (mask1 - 1) & mask)
            dp[mask] = max(dp[mask], dp[mask ^ mask1] + total[mask1]);
    }
    cout << dp[(1 << n) - 1] / 2 << "\n";
    return 0;
}


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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



int main(){
  int n, k;
  cin >> n >> k;
  vi a(n);
  rep(i,n) cin >> a[i];
  for(int i = k; i < n; i++) {
    YesorNo(a[i-k] < a[i]);
  }
}

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


int main(void) {
  int n, m;
  cin >> n >> m;
  vector<int> check(n+1, 0);
  vector<int> wa(n+1, 0);
  int ans[2] = {0,0};
  rep(i, m) {
    int num;
    string s;
    cin >> num >> s;
    if(s == "WA" && check[num] == 0) {
      wa[num]++;
    } else if(s == "AC" && check[num] == 0) {
      ans[0]++;
      check[num] = 1;
    }
  }
  rep(i, n+1) {
    if(check[i] == 1) {
      ans[1] += wa[i];
    }
  }

  cout << ans[0] << " " << ans[1] << endl;

  return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;

int main() {
  // 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int a, p;

  cin >> a >> p;

  cout << (a * 3 + p) / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    int mn = a[0];
    int cnt = 0;
    for(int i=0;i<n;i++)
    {
        if(a[i]<=mn)
            cnt++;
        mn = min(a[i],mn);
    }
    cout<<cnt;
    
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
class Solve{
    public int[] S;
    public int length;
    public Solve(){}
    public static int Main(){
        new Solve().Calc();
        return 0;
    }
    void Calc(){
        getinput();
        int k = 1;
        long count = 0;
        for(int i=0;i < length-1;i++){
            k *= 2;
        }
        for(int i=0;i < k;i++){
            bool[] b = new bool[length-1];
            int l = i;
            long num = S[0];
            for(int j = 0;j < length-1;j++){
                if(l % 2 == 1){
                    b[j] = true;
                }
                else{
                    b[j] = false;
                }
                l /= 2;
            }
            for(int j = 0;j < length-1;j++){
                if(b[j]){
                    count += num;
                    num = S[j+1];
                }
                else{
                    num = num*10+S[j+1];
                }
            }
            count += num;
        }
        Console.WriteLine(count);
    }
    void getinput(){
        string str = Console.ReadLine();
        length = str.Length;
        S = new int[length];
        for(int i=0;i < length;i++){
            S[i] = int.Parse(str[i]+"");
        }
    }    
}

Measured memory_bytes: 2648
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e18;

int main()
{
	long long int N, W;
	cin >> N >> W;
	
	vector<P> v1, v2;
	P p;
	p.first = 0;
	p.second = 0;
	v1.push_back(p);
	v2.push_back(p);
	
	for(int i = 0; i < N / 2; i++){
		long long int v, w;
		cin >> v >> w;
		int sz = v1.size();
		for(int j = 0; j < sz; j++){
			p = v1[j];
			p.first += w;
			p.second += v;
			v1.push_back(p);
		}
	}
	
	for(int i = 0; i < (N + 1) / 2; i++){
		long long int v, w;
		cin >> v >> w;
		int sz = v2.size();
		for(int j = 0; j < sz; j++){
			p = v2[j];
			p.first += w;
			p.second += v;
			v2.push_back(p);
		}
	}
	
	p.first = INF;
	p.second = 0;
	
	v2.push_back(p);
	
	long long int ans = 0;
	int id = 0;
	
	sort(v1.begin(), v1.end());
	sort(v2.begin(), v2.end());
	/*
	for(int i = 0; i < v1.size(); i++){
		cout << v1[i].first << " " << v1[i].second << endl;
	}
	cout << endl;
	for(int i = 0; i < v2.size(); i++){
		cout << v2[i].first << " " << v2[i].second << endl;
	}
	*/
	long long int vmax = 0;
	for(int i = v1.size() - 1; i >= 0; i--){
		if(v1[i].first > W){
			continue;
		}
		while(true){
			vmax = max(vmax, v2[id].second);
			if(v1[i].first + v2[id + 1].first > W){
				break;
			}
			id++;
		}
		ans = max(ans, v1[i].second + vmax);
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 52224
def remove_slimes(ls):
	l = [ls[0]]
	for i in range(1, len(ls)):
		if ls[i-1] != ls[i]:
			l.append(ls[i])
	return len(l)

n = int(input())
s = input()
cnt = 1
if len(s) != 1:
	cnt = remove_slimes(list(s))
print(cnt)

Measured memory_bytes: 10512
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Buffer(make([]byte, 500000), 500000)
	sc.Split(bufio.ScanWords)

	n := nextInt64()

	m := int64(0)
	for i := int64(1); i < n; i++ {
		m += i
	}
	fmt.Println(m)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextInt64() int64 {
	sc.Scan()
	i, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return i
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef complex<double> xy_t;

const lint mod = 1e9 + 7;

int main(){
    int n, m, R;
    scanf("%d%d%d", &n, &m, &R);
    int r[R];
    rep(i, R){
        scanf("%d", &r[i]);
        --r[i];
    }
    sort(r, r+R);
    int d[n][n];
    const int INF = mod;
    rep(i, n){
        rep(j, n){
            d[i][j] = INF;
        }
        d[i][i] = 0;
    }
    rep(i, m){
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        --a; --b;
        d[a][b] = d[b][a] = c;
    }
    
    rep(k, n)rep(i, n)rep(j, n)if(d[i][k] < INF && d[k][j] < INF){
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    }
    
    int ans = INF;
    do{
        int tmp = 0;
        rep(i, R-1) tmp += d[r[i]][r[i+1]];
        ans = min(ans, tmp);
    }while(next_permutation(r, r+R));
    
    printf("%d\n", ans);
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
 
using namespace std;
 


int main()
{
    
    int n;

    int ac = 0, wa = 0, tle = 0, re = 0;

    cin >> n;

    string s;

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

        cin >> s;

        if (s == "AC") {

            ac++;
        }

        if (s == "WA") {
            wa++;
        }

        if (s == "TLE") {

            tle++;
        }

        if (s == "RE") {

            re++;
        }
    }
   
    cout << "AC x " << ac << endl;

    cout << "WA x " << wa << endl;

    cout << "TLE x " << tle << endl;

    cout << "RE x " << re;
 
}

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

typedef long long int lld;

/*
g++ -std=c++11 d-knapsack.cpp -o k
*/
int main() {
    int N, W;
    cin >> N >> W;
    int w[N+1];
    int v[N+1];
    vector<vector<lld>> m;
    m.push_back(vector<lld>(W+1));
    for(int i = 1; i < N+1; i++) {
        cin >> w[i] >> v[i];
        m.push_back(vector<lld>(W+1));
    }

    for(int j = 0; j < W+1; j++)
        m[0][j] = 0;

    for(int i = 1; i < N+1; i++) {
        for(int j = 0; j < W+1; j++) {
            if(w[i] > j) {
                m[i][j] = m[i-1][j];
            } else {
                m[i][j] = max(m[i-1][(j - w[i])] + (lld) v[i], m[i-1][j]);
            }
        }
    }

    cout << m[N][W] << endl;

    return 0;
}


Measured memory_bytes: 79488
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
const long long INF = 1ll << 60;



int main() {
  ll a, b, k; cin >> a >> b >>k;
  ll x = min(a,k);
  a-=x;
  k-=x;
  x = min(b,k);
  b-=x;

  cout << a << " " << b << endl;
  
	return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N,K;
    cin >> N >> K;
    deque<ll> V(N);
    rep(i,N){
        cin >> V[i];
    }
    ll ans = 0;
    rep(i,K+1){// i ko get
        rep(j,i+1){//j ko get from left
            deque<ll> U = V;
            deque<ll> T;
            ll tmp = 0;
            rep(k,j){
                if(U.empty()) break;
                tmp += U.front();
                if(U.front() < 0) T.push_back(U.front());
                U.pop_front();
            }
            rep(k,i-j){
                if(U.empty()) break;
                tmp += U.back();
                if(U.back() < 0) T.push_back(U.back());
                U.pop_back();
            }
            sort(T.begin(), T.end());
            rep(j,K-i){
                if(T.empty())break;
                tmp -= T.front();
                T.pop_front();
            }
            cmax(ans, tmp);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3644
N, K, Q = [int(x) for x in input().split(" ")]
lis = [K for i in range(N)]
ans = []
for i in range(Q):
    ans.append(int(input()))
for num in ans:
    lis[num - 1] += 1

for i in range(N):
    if lis[i] - Q > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 10472
n = int(input())
a = {}
for i in range(n):
    b = int(input())
    if b in a.keys():
        a[b] += 1
    else:
        a[b] = 1
ans = 0
for i in a.keys():
    if a[i]%2 == 1:
        ans += 1
print(ans)


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

using namespace std;

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

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vs = vector<string>;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	string s;
	cin >> s;

	int n = s.size();
	int ans = n;

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

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


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


int main()
{
	int N,C;
	cin>>N>>C;
	vector<vector<int>> D(C,vector<int>(C));
	rep(i,C) rep(j,C) cin>>D[i][j];
	vector<vector<int>> c(N,vector<int>(N));
	rep(i,N) rep(j,N) cin>>c[i][j];
	vector<map<int,int>> color(3);
	rep(i,N)
	{
		rep(j,N)
		{
			color[(i+j+2)%3][c[i][j]]++;
		}
	}
	ll ans=1e10;
	rep(i,C)
	{
		rep(j,C)
		{
			if(i==j) continue;
			rep(k,C)
			{
				if(i==k||j==k) continue;
				ll val=0;
				rep(cnt,3)
				{
					for(auto p : color[cnt])
					{
						if(cnt==0)
							val+=D[p.first-1][i]*p.second;
						else if(cnt==1)
							val+=D[p.first-1][j]*p.second;
						else
							val+=D[p.first-1][k]*p.second;
					}
				}
				ans=min(ans,val);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;


int main(void){
	string s; cin >> s;
	bool flag = true;
	for (int i = s.size() - 1; i >= 0; --i){
		// printf("%d %c\n", i, s[i]);
		if(s.substr(max(0, i - 5), 6) == "eraser"){
			i -= 5;
		}else if(s.substr(max(0, i - 4), 5) == "erase"){
			i -= 4;
		}else if(s.substr(max(0, i - 6), 7) == "dreamer"){
			i -= 6;
		}else if(s.substr(max(0, i - 4), 5) == "dream"){
			i -= 4;
		}else{
			flag = false;
			break;
		}

	}
	if(flag)printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
long long h[200005],n,k;
long long ans=0;
bool cmp(long long a,long long b){
	return a>b;
}
int main(){
	scanf("%lld%lld",&n,&k);
	for(int i=1;i<=n;i++) scanf("%lld",&h[i]);
	sort(h+1,h+n+1,cmp);
	for(int i=1;i<=n;i++) if(i>k) ans+=h[i];
	printf("%lld",ans);
	return 0;
} 

Measured memory_bytes: 1792