akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int main(){
  int D;
  cin >> D;
  if(D == 25)cout << "Christmas" <<endl;
  else if(D == 24)cout << "Christmas Eve" <<endl;
  else if(D == 23)cout << "Christmas Eve Eve" <<endl;
  else if(D == 22)cout << "Christmas Eve Eve Eve" <<endl;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>

using namespace std;
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

const int maxn = 5e5;
const int MOD = 1e9 + 7;

class Modint {
public:
	long long val;

	Modint (long long _val = 0)
		: val(_val % MOD) {}

	Modint operator+ (Modint other) {
		return Modint(val + other.val);
	}

	void operator+= (Modint other) {
		val += other.val;
		val %= MOD;
	}

	Modint operator- () {
		return Modint(MOD - val);
	}

	Modint operator- (Modint other) {
		return Modint(val + MOD - other.val);
	}

	void operator-= (Modint other) {
		val += MOD - other.val;
		val %= MOD;
	}

	Modint operator* (Modint other) {
		return Modint(val * other.val);
	}

	void operator*= (Modint other) {
		val *= other.val;
		val %= MOD;
	}

	bool operator== (Modint other) {
		return val == other.val;
	}

	bool operator!= (Modint other) {
		return val != other.val;
	}
};

Modint exp (Modint a, int k) {
	if (k == 0) {
		return Modint(1);
	} else if (k % 2 == 0) {
		Modint half = exp(a, k / 2);
		return half * half;
	} else {
		return a * exp(a, k - 1);
	}
}

Modint inv (Modint a) {
	return exp(a, MOD - 2);
}

ostream& operator<< (ostream& out, Modint p) {
	out << p.val;
	return out;
}

vector<Modint> fact(maxn + 1, 1);
vector<Modint> inverse(maxn + 1, 1);

void preC() {
	for (long long i = 1; i <= maxn; i++) {
		fact[i] = Modint(i) * fact[i - 1];
		inverse[i] = inv(i) * inverse[i - 1];
	}
}

Modint C(long long n, long long r) { // nCr % MOD
	if (n < r) return 0;
	return fact[n] * inverse[r] * inverse[n - r];
}

Modint P(long long n, long long r) {
	if (n < r) return 0;
	return C(n, r) * fact[r];
}

int main() {

	preC();
	int n, m; cin >> n >> m;

	Modint ans = 0;
	for (int i = 0; i <= n; i++) {
		if ((i % 2) == 0) ans += C(n, i) * P(m, i) * P(m - i, n - i) * P(m - i, n - i);
		else ans -= C(n, i) * P(m, i) * P(m - i, n - i) * P(m - i, n - i);
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 10664
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-10;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
typedef int Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator >(const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;
void add_edge(Graph &g, int from, int to, int cost)
{
	g[from].push_back(Edge{ from, to, cost });
}

/*--------------------template--------------------*/

void dijkstra(Graph &g, vector<Weight> &d, int s)
{
	d.assign(g.size(), INF);
	d[s] = 0;
	typedef pair<Weight, int> P;
	priority_queue<P, vector<P>, greater<P>> que;
	que.push(P(0, s));
	while (!que.empty())
	{
		Weight dist = que.top().first;
		int v = que.top().second;
		que.pop();
		if (d[v] < dist) continue;
		REP(i, g[v].size())
		{
			Edge e = g[v][i];
			if (d[e.to] > d[v] + e.cost)
			{
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}


int main()
{
	int n, m, c;
	while (cin >> n >> m >> c, n)
	{
		Graph g(n*n + n);
		REP(i, m)
		{
			int from, to, cost; cin >> from >> to >> cost;
			from--; to--;
			REP(j, n)
			{
				add_edge(g, from + j*n, to + j*n, cost);
				if (j != n - 1) add_edge(g, from + j*n, to + (j + 1)*n, 0);
			}
		}
		Array d;
		dijkstra(g, d, 0);
		int ans = INF;
		REP(i, n + 1)
		{
			if (d[(n - 1) + i*n] <= c) chmin(ans, i);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int count = 0;
  if(s[1] == 'R'){
    ++count;
  	if(s[0] == 'R'){
    	++count;
    }
    if(s[2] == 'R')
      ++count;
  }
  else{
    if(s[0] == 'R' || s[2] == 'R')
      ++count;
  }
  cout<<count;
  return 0;
}

Measured memory_bytes: 3620
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <vector>
#include <cmath>

int main()
{
    while (true) {
        int d, w, h;
        std::cin >> d >> w >> h;
        if (d == 0 && w == 0 && h == 0) {
            break;
        }
        
        float dw_r, dh_r, wh_r;
        dw_r = std::sqrt(d * d + w * w) / 2.0f;
        dh_r = std::sqrt(d * d + h * h) / 2.0f;
        wh_r = std::sqrt(w * w + h * h) / 2.0f;
        
        int n;
        std::cin >> n;
        std::vector<int> r(n);
        for (int i = 0; i < n; i++) {
            std::cin >> r[i];
            if (dw_r < r[i] || dh_r < r[i] || wh_r < r[i]) {
                printf("OK\n");
            } else {
                printf("NA\n");
            }
        }
    }
    
    return 0;
}




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

int main(){

  int memo[111]={0};

  int a;
  int ans=0;
  while(scanf("%d",&a) != EOF){
    memo[a]++;
    ans=max(ans,memo[a]);
  }

  
  for(int i=0;i<101;i++){
    if(ans==memo[i]) printf("%d\n",i);
  }

  return 0;
}

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

int main()
{
	int n;
	cin >> n;
	vector<string> s(n);
	vector<int> cnt(26, 100);
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		vector<int> tmp(26);
		for (char c : s[i]) {
			tmp[c - 'a']++;
		}
		for (int j = 0; j < 26; j++) {
			cnt[j] = min(cnt[j], tmp[j]);
		}
	}
	for (int i = 0; i < 26; i++) {
		while (cnt[i]--) {
			cout << (char)(i + 'a');
		}
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
p = [int(a) for a in input().split()]

B = [0]*(N-K+1)
B[0] = sum(p[0:K])
for i in range(1, N-K+1):
    B[i] = B[i-1] - p[i-1] + p[i+K-1]
    
max_ind = B.index(max(B))

ep = 0
for i in range(K):
    ep += (p[max_ind+i]*(p[max_ind+i]+1))/(2*p[max_ind+i])

print(ep)


Measured memory_bytes: 24676
def lucas(n, memo)
  return memo[n] if memo[n]
  return 2 if n == 0
  return 1 if n == 1

  memo[n]  = lucas(n -1, memo) + lucas(n - 2, memo)
  memo[n]
end

n = gets.to_i
puts lucas(n, {})


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a) begin(a),end(a)
#define FOR(x,val,to) for(int x=(val);x<int((to));++x)
#define FORE(x,val,to) for(auto x=(val);x<=(to);++x)
#define FORR(x,arr) for(auto &x: arr)
#define FORS(x,plus,arr) for(auto x = begin(arr)+(plus); x != end(arr); ++x)
#define FORREV(x,plus,arr) for(auto x = (arr).rbegin()+(plus); x !=(arr).rend(); ++x)
#define REE(s_) {cout<<s_<<'\n';exit(0);}
#define GET(arr) for(auto &i: (arr)) sc(i)
#define whatis(x) cerr << #x << " is " << (x) << endl;
#define e1 first
#define e2 second
#define INF 0x7f7f7f7f
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::vector<std::string> vs;
typedef int64_t ll;
typedef uint64_t ull;
#define umap unordered_map
#define uset unordered_set
using namespace std;
using namespace __gnu_pbds;

#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
template<class L, class R> ostream& operator<<(ostream &os, map<L, R> P) { for(auto const &vv: P)os<<"("<<vv.first<<","<<vv.second<<")"; return os; }
template<class T> ostream& operator<<(ostream &os, set<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) { os<<"("<<P.first<<","<<P.second<<")"; return os; }
inline int fstoi(const string &str){auto it=str.begin();bool neg=0;int num=0;if(*it=='-')neg=1;else num=*it-'0';++it;while(it<str.end()) num=num*10+(*it++-'0');if(neg)num*=-1;return num;}
inline void getch(char &x){while(x = getchar_unlocked(), x < 33){;}}
inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}
template<typename T> inline bool sc(T &num){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){if(c == EOF) return false;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; return true;}template<typename T, typename ...Args> inline void sc(T &num, Args &...args){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; sc(args...); }
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; //s.find_by_order(), s.order_of_key() <- works like lower_bound
template<typename T> using ordered_map = tree<T, int, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 1000001

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    sc(n);
    int a[n+1],b[n];
    GET(a);
    GET(b);
    ll ans = 0;
    FOR(i,0,n){
        int cn = min(b[i],a[i]);
        b[i] -= cn;
        a[i] -= cn;
        ans += cn;
        cn = min(b[i],a[i+1]);
        b[i] -= cn;
        a[i+1] -= cn;
        ans += cn;
    }
    cout << ans << '\n';
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n,i,x,j,c=0;
    vector<int>a;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>x;
        a.push_back(x);
    }
    j=1;
    for(i=0;i<n;i++)
    {
       if(a[i]==j){
        c++;
        j++;
       }
    }
    if(c>0) cout<<n-c<<endl;
    else cout<<-1<<endl;
    return 0;
}


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

//vector…可変長、データの大きさに合わせてサイズを変える
//list…双方向リスト、要素を挿入、削除の多いとき
//forward_list
//array…固定長配列
//set…集合
//multiset
//bitset…2進数、固定長ビット列
//map…連想配列、キーと値を関連付ける
//multimap
//deque
//stack…FILO
//queue…FIFO
//priority_queue
//pair…二つの値を一組
//tuple…複数の値を一組

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

template<class T>
T ma(std::vector<T> &v) {
    T maxi = 0;
    for(auto &i:v) maxi = max(maxi, i);
    return maxi;
}

#define rep(i, n, m) for (int i = n; i <= m; i++)
#define Rep(i, n, m) for (int i = m; i >= 1; i--)

typedef long long ll;
typedef unsigned long long ull;

ull ans = 0;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    vector<int> c(n);
    int x = 0, y = 0;
    rep(i, 1, n) cin >> v[i];
    rep(i, 1, n) cin >> c[i];
    rep(i, 1, n) {
        if (v[i] > c[i]) {
            x += v[i];
            y += c[i];
        }
    }
    cout << x - y << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		double gyou = sc.nextDouble();
		double retu = sc.nextDouble();
		double num = sc.nextDouble();
		if(num / gyou < num / retu){
			System.out.print(String.format("%.0f",Math.ceil(num / gyou)));
		}else{
			System.out.print(String.format("%.0f",Math.ceil(num / retu)));
		}
	}
}

Measured memory_bytes: 23892
package main

import (
    "fmt"
    "math"
)

func min(nums ...int) int {
    res := nums[0]
    for i := 0; i < len(nums); i++ {
        res = int(math.Min(float64(res), float64(nums[i])))
    }
    return res
}

func main() {
    var a, b, c int
    fmt.Scan(&a, &b, &c)
    fmt.Println(min(a+b, a+c, b+c))
}

Measured memory_bytes: 512
using System;
using System.Linq;

namespace AizuOnLine
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] data = Console.ReadLine().Split(' ');
            int num1 = Convert.ToInt32(data[0]);
            int num2 = Convert.ToInt32(data[1]);
            int num3 = Convert.ToInt32(data[2]);

            if (num1 < num2 && num2 < num3)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

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

int main()
{
    int n;
    cin >> n;
    vector<string> vec(n);
    for (int i = 0; i < n; i++)
    {
        cin >> vec.at(i);
    }

    for (string s : vec)
    {
        if (s == "Y")
        {
            cout << "Four";
            std::exit(0);
        }
    }
    cout << "Three" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
////////////////////////////////////////

int main() {
	ll N, C;
	cin >> N >> C;
	vector<ll>x(N + 2), v(N + 2);
	for (int i = 1; i <= N; ++i) {
		cin >> x[i] >> v[i];
	}
	x[0] = 0;
	x[N + 1] = C;
	ll cal = 0;
	vector<vector<ll>>dp(2, vector<ll>(100010, 0));
	for (ll i = 1; i <= N; ++i) {
		cal -= x[i] - x[i - 1];
		cal += v[i];
		dp[0][i] = max(dp[0][i - 1], cal);
	}
	//ここでそれまでのカロリーの最大値をメモ
	cal = 0;
	for (ll i = N; i >= 1; --i) {
		cal -= x[i + 1] - x[i];
		cal += v[i];
		dp[1][i] = max(dp[1][i + 1], cal);
	}
	ll maxcal = 0;
	for (ll i = 0; i <= N; ++i) {
		cal = dp[0][i] + dp[1][i + 1] - x[i];
		maxcal = max(maxcal, cal);
		cal = dp[0][i] + dp[1][i + 1] - C + x[i + 1];
		maxcal = max(maxcal, cal);
	}
	cout << maxcal << endl;
	return 0;
}


Measured memory_bytes: 4096
x, k, d = map(int, input().split())

lo = 0
hi = k

while (lo < hi) :
  mid = lo + (hi - lo) // 2 + 1
  if (x >= 0) :
    if (x - mid * d >= 0) : 
      lo = mid;
    else :
      hi = mid - 1
  else :
    if (x + mid * d <= 0) :
      lo = mid;
    else :
      hi = mid - 1;

if (x >= 0) :
  x -= d * hi
else :
  x += d * hi

k -= hi;

if ( (k % 2) == 0):
  if (k == 0) :
    print(abs(x))
  else :
    print(min(abs(x), abs(x - d - d), abs(x + d + d)));
else :
  if (k == 1) :
    print(min(abs(x - d), abs(x + d)))
  else :
    print(min(abs(x - d), abs(x + d), abs(x + d + d + d), abs(x - d - d - d)));


Measured memory_bytes: 61892
import sys
s = input()
l = "abcdefghijklmnopqrstuvwxyz"
for i in range (len(l)):
    count = 0
    for j in range (len(s)):
        if(l[i] == s[j]):
            count += 1
            break
    if (count == 0):
        print(l[i])
        sys.exit()
print("None")

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

vector<vector<int>> calcsame(string S, string T) {
    int N = S.size();
    vector<vector<int>> res(N+1, vector<int>(N+1, 0));
    for (int i = 0; i <= N; ++i) {
        res[i][0] = 0;
        for (int j = 0; i + j < N; ++j) {
            if (S[i+j] == T[j]) res[i+j+1][j+1] = res[i+j][j]+1;
            else res[i+j+1][j+1] = res[i+j][j];
        }
        res[0][i] = 0;
        for (int j = 0; i + j < N; ++j) {
            if (S[j] == T[i+j]) res[j+1][i+j+1] = res[j][i+j]+1;
            else res[j+1][i+j+1] = res[j][i+j];
        }
    }
    return res;
}

long long calccost(string S, string T) {
    int N = S.size();
    const auto& cost = calcsame(S, T);

    //COUT(S); COUT(T); COUT(cost);
    
    vector<vector<long long>> dp(N+1, vector<long long>(N+1, INF));
    dp[0][0] = 0;
    for (int l = 0; l <= N; ++l) {
        for (int r = 0; r <= N; ++r) {
            if (l) {
                chmin(dp[l][r], dp[l-1][r] + cost[l][r]);
            }
            if (r) {
                chmin(dp[l][r], dp[l][r-1] + cost[l][r]);
            }
        }
    }
    return dp[N][N];
}

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> fi(W, string(H, 'U'));
    for (int i = 0; i < H; ++i) for (int j = 0; j < W; ++j) cin >> fi[j][i];
    long long res = 0;
    for (int i = 0; i + 1 < fi.size(); ++i) {
        res += calccost(fi[i], fi[i+1]);
    }
    cout << res << endl;
}

Measured memory_bytes: 4592
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * @author radhakm
 */
class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

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

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



public class Main {
    static int[] h;
    static int n;
    static int k;
    static Integer[] dp;
    public static void main(String[] args) {
        InputReader reader = new InputReader(System.in);
        n = reader.nextInt();
        k = reader.nextInt();
        h = new int[n];
        dp = new Integer[n];
        for(int i=0;i<n;i++){
            h[i] = reader.nextInt();
        }
        System.out.println(frogJump(0));
    }

    static int frogJump(int idx){
        if(idx == n-1){
            return 0;
        }
        if(dp[idx]!=null){
            return dp[idx];
        }
        int minCost = Integer.MAX_VALUE;
        for(int i=1;i<=k;i++) {
            if (idx + i < n) {
                int cost = Math.abs(h[idx] - h[idx + i]) + frogJump(idx + i);
                minCost = Math.min(minCost, cost);
            }
        }
        dp[idx] = minCost;
        return minCost;
    }
}

Measured memory_bytes: 55612
package main
import(
	"fmt"
)
func main(){
	var a,b int
	fmt.Scan(&a) 
	ss := make([]int,a)
	for i:=0;i<a;i++{
		fmt.Scan(&b)
		ss[i] = b
	}
	max := 0
	tmp:=0
	for i := len(ss)-1;i >0;i-- {
		if ss[i-1] >= ss[i] {
			tmp++
			if max <tmp{
				max = tmp
			}
		}else{
			tmp = 0
		}
	}
	fmt.Println(max)
}


Measured memory_bytes: 5504
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
ll a[200100];

ll solve() {
    map<ll, ll> m;
    m[0] = 1;
    ll res = 0;
    for (int i = 1; i <= n; i++) {
        a[i] += a[i-1];
        if (m.count(a[i]) == 0) {
            m[a[i]]++;
        } else {
            res += m[a[i]];
            m[a[i]]++;
        }
    }
    return res;
}

void input() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i+1];
}

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

    input();
    cout << solve() << endl;
}


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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DMP(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%lld",x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

const int inf=LLONG_MAX/3;

signed main(){
	vi w;REP(_,4)w.PB(read());
	int n=read()*4,ans=0;
	REP(k,3){
		if(n&1)
			ans+=w[k];
		n/=2;
		chmin(w[k+1],w[k]*2);
	}
	ans+=w[3]*n;
	cout<<ans<<endl;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){
  
  ll n;
  cin >> n;
  queue<ll> que;
  ll res = 0;
  que.push(3);
  que.push(5);
  que.push(7);
  while(!que.empty()){
    ll k = que.front();que.pop();
    if(k > n)break;
    res++;
    que.push(k*10+3);
    que.push(k*10+5);
    que.push(k*10+7);
  }
  que = queue<ll>();
  que.push(3);
  que.push(5);
  while(!que.empty()){
    ll k = que.front();que.pop();
    if(k > n)break;
    res--;
    que.push(k*10+3);
    que.push(k*10+5);
  }
  que = queue<ll>();
  que.push(3);
  que.push(7);
  while(!que.empty()){
    ll k = que.front();que.pop();
    if(k > n)break;
    res--;
    que.push(k*10+3);
    que.push(k*10+7);
  }
  que = queue<ll>();
  que.push(5);
  que.push(7);
  while(!que.empty()){
    ll k = que.front();que.pop();
    if(k > n)break;
    res--;
    que.push(k*10+5);
    que.push(k*10+7);
  }
  ll k = 3;
  while(k <= n)res++,k = k*10+3;
  k = 5;
  while(k <= n)res++,k = k*10+5;
  k = 7;
  while(k <= n)res++,k = k*10+7;
  cout << res << endl;





  return 0;
}

Measured memory_bytes: 768
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <complex>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
 
#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back
#define ll long long
 
const long long MAXN = 1e6 + 1;
const long long MOD = 1e9 + 7;
using namespace std;
 
typedef pair<int, int> pii;
 
 
long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}
 

int main(){
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    ll A = readInt(), B = readInt(), C = readInt();
    if (A + B + 1 >= C) {
        cout << B + C;
    } else {
        cout << B + (A + B + 1);
    }
    return 0;
}


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


int main() {
    int a, b, k;
    cin >> a >> b >> k;
    if (b - a + 1 < 2 * k) {
        for (int i = a; i <= b; i++) cout << i << endl;
        return 0;
    }
    for (int i = a; i < a + k; i++) cout << i << endl;
    for (int i = b - k + 1; i <= b; i++) cout << i << endl;
    return 0;
}


Measured memory_bytes: 256
package main

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

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var ans, cnt, sum int = 0, 0, 0

func main() {
	reader.Split(bufio.ScanWords)
	N, _ := strconv.Atoi(read())
	a, b := make([]int, N), make([]int, N)
	for i := 0; i < N; i++ {
		a[i], _ = strconv.Atoi(read())
	}
	for i := 0; i < N; i++ {
		b[i], _ = strconv.Atoi(read())
	}

	var cnt_a, cnt_b int
	for i := 0; i < N; i++ {
		if a[i] < b[i] {
			cnt_a += (b[i] - a[i]) / 2
		} else {
			cnt_b += a[i] - b[i]
		}
	}

	if cnt_a >= cnt_b {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

/*  ----------------------------------------  */

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

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

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; 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
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy []int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i] < a[j] }

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] < h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


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

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

#define rrep(i,n) for(int i =n; i >=0; --i)

#define rep_(i,m,n) for(int i =m; i <n; ++i)

#define INF 2e9

#define ll long long

//const ll MOD = 1000000007;

//const  long double PI=(acos(-1));

//const  long double EPS=0.0000000001;

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


    ll mini = INF;
    ll ans = 0;

    rep(i,N){
        ll a;cin >> a;
        mini = min(a,mini);
        if(mini == a)ans++;

    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void)
{
   int sum;
   char str[1100];
   int i;
   for(i=0;i<1100;i++){
      str[i]=0;
   }
   while(1){
      scanf("%s",str);
      if(strcmp(str,"0")==0){
         break;
      }
      sum=0;
      for(i=0;str[i]!='\0';i++){
         sum+=str[i]-'0';
      }
      printf("%d\n",sum);
   }
   return 0;

}

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

void solve(){
  int n; cin >> n;
  vector<int> f(n + 1);
  f[0] = 1;
  f[1] = 1;
  if(n <= 1){
    cout << f[n] << endl;
    return;
  }
  for(int i = 2; i <= n; i++){
    f[i] = f[i - 1] + f[i - 2];
  }
  cout << f[n] << endl;
  return;
}

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



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

int main() {
    ll h, w;
    cin >> h >> w;
    ll ans = h * w;
    for (int i = 0; i < 2; i++) {
        for (int a = 1; a < h; a++) {
            ll b = h - a;
            ll c = b / 2;
            ll s1 = a * w;
            ll s2 = (b - c) * w;
            ll s3 = c * w;
            ll M = max(max(s1, s2), s3);
            ll m = min(min(s1, s2), s3);
            ans = min(ans, M - m);
            ll d = w / 2;
            ll s4 = b * (w - d);
            ll s5 = b * d;
            M = max(max(s1, s4), s5);
            m = min(min(s1, s4), s5);
            ans = min(ans, M - m);
        }
        swap(h, w);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int N, P[100000], pos[100001];
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> P[i];
        pos[P[i]] = i;
    }
    multiset<int64_t> st = {-1, -1, N, N};
    int64_t ans = 0;
    for(int i=N; i>0; i--){
        st.insert(pos[i]);
        auto it = st.lower_bound(pos[i]);
        auto l1 = prev(it);
        auto l2 = prev(l1);
        auto r1 = next(it);
        auto r2 = next(r1);
        int64_t num = (*l1 - *l2) * (*r1 - pos[i]) + (pos[i] - *l1) * (*r2 - *r1);
        ans += i * num;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9108
/*
sonu_verma1
*/
#include <bits/stdc++.h>
// For policy based data structure
/*#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> */
using namespace std;
/*using namespace __gnu_pbds; 
typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set;*/
 
#define MD 1000000007
#define X first
#define Y second
#define pb push_back
#define debug(val, ch) cout <<val <<ch
#define FOR(i, st, en, ch) for(register int i = (st); i <= (en) ; i += (ch))
#define RFOR(i, st, en, ch) for(register int i = (st); i >= (en) ; i -= (ch))
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
 
typedef long long int ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<int, bool> pib;
typedef pair<bool, int> pbi;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
ll fun(int W,vector<vector<ll>>&dp,vector<int>&w,vector<int>&v,int i)
{
    if(W<0)
        return INT_MIN;
    if(i>=(int)w.size())
        return 0;
    if(dp[W][i]!=-1)
        return dp[W][i];
    ll ans=max(fun(W,dp,w,v,i+1),fun(W-w[i],dp,w,v,i+1)+v[i]);
    dp[W][i]=ans;
    return ans;
}
/*********************************************************************/
void test(int r)
{
    // cout<<'a';
    int n,W;
    cin>>n>>W;
    vector<int>w(n),v(n);
    int i;
    for(i=0;i<n;i++)
    {
        cin>>w[i]>>v[i];
    }
    vector<vector<ll>>dp(W+1,vector<ll>(n,-1));
    ll ans=fun(W,dp,w,v,0);
    cout<<ans<<endl;
}
/***********************************************************************/
int main()
{
    fast();
    int t=1,r;
    // cin>>t;
    for(r=1;r<=t;r++)
        test(r);
    return 0;
}

Measured memory_bytes: 85208
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ll long long
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
#define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010
#define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100
#define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000
#define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000
#define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000
#define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000
#define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000

int main(){
    int r;
    long double ans;
    cin >> r;
    ans=r*2*M_PI;
    cout << fixed << setprecision(20) << ans << endl;
    return 0;
}

Measured memory_bytes: 3748
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		    Scanner sc = new Scanner(System.in);

		    int max = 0;
		    int max_num =0;
		    int max2 = 0;
		    int n = sc.nextInt();
		    for(int i=0; i<n; i++) {
		    	int a = sc.nextInt();
		    	if(a>max) {
		    		max = a;
		    		max_num = i;
		    	}else {
		    		if(a>=max2) {
		    			max2 = a;
		    		}
		    	}
		    }
		    for(int i=0; i<n; i++) {
		    	if(i==max_num) {
		    		System.out.println(max2);
		    	}else {
		    		System.out.println(max);
		    	}
		    }
		    sc.close();

	}
}

Measured memory_bytes: 84780
def SearchEqual(s, t)
	matched = []
	for i in 0..s.length-1
		for j in 0..t.length-1
			if s[i] == t[j]
				matched << t[j]
			end
		end
	end
	matched = matched.uniq
	p matched.length
end

#input sequence of numbers S
n = gets.chomp
n = gets.chomp
n = n.split()
#input of sequence of numbers T
q = gets.chomp
q = gets.chomp
q = q.split()
#output
SearchEqual(n, q);

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

int main() {
  int N, K;
  cin >> N >> K;
  
  int ans = 1;
  for (int i = 1; i <= N; i++) {
    if (i == 1) ans *= K;
    else ans *= (K - 1);
  }
  cout << ans << endl;
}

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

namespace ConsoleApp23 {
    class Program {
        static void Main(string[] args) {
            //入力
            string s = Console.ReadLine();

            int N = int.Parse(s.Split(' ')[0]);
            int D = int.Parse(s.Split(' ')[1]);


            //検証
            Console.WriteLine(Math.Ceiling((N - 0.001f) / (float)(D * 2 + 1)));
        }
    }
}


Measured memory_bytes: 11092
fun main() {
  val (N, A, B) = readInts()
  println(Math.min(N * A, B))
}

fun gcd(a: Int, b: Int): Int = if (a < b) gcd(b, a) else if (b == 0) a else gcd(b, a % b)
fun gcd(a: Long, b: Long): Long = if (a < b) gcd(b, a) else if (b == 0L) a else gcd(b, a % b)
fun lcm(a: Int, b: Int): Int = (a * b) / gcd(a, b)
fun lcm(a: Long, b: Long): Long = (a * b) / gcd(a, b)

fun readString() = readLine()!!
fun readStrings() = readLine()!!.split(" ")
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readInts() = readLine()!!.split(" ").map { it.toInt() }
fun readLongs() = readLine()!!.split(" ").map { it.toLong() }

fun myBinarySearch(begin: Int, end: Int, isOk: (key: Int) -> Boolean): Int {
  var ng = begin
  var ok = end

  while (Math.abs(ok - ng) > 1) {
    val mid = (ok + ng) / 2
    if (isOk(mid)) {
      ok = mid
    } else {
      ng = mid
    }
  }

  return ok
}

fun <T> List<T>.myBinarySearch(isOk: (T) -> Boolean): Int {
  return myBinarySearch(-1, size) { index -> isOk(get(index)) }
}

fun <T> Array<T>.myBinarySearch(isOk: (T) -> Boolean): Int {
  return myBinarySearch(-1, size) { index -> isOk(get(index)) }
}


Measured memory_bytes: 36116
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int		main(void)
{
	map<string, int> m;
	m["SUN"] = 7;
	m["MON"] = 6;
	m["TUE"] = 5;
	m["WED"] = 4;
	m["THU"] = 3;
	m["FRI"] = 2;
	m["SAT"] = 1;
	string s;
	cin >> s;
	cout << m[s];
}


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

int main(){
  int num_1,num_2;
  int i,j;
  int OK=0;
  string ID[257];
  string ID_2;
  int flg=0; //flg = 0→施錠 flg = 1→開錠 
  cin >> num_1;
  for(i = 0 ; i < num_1 ; i++){
    cin >> ID[i];
  }

  cin >> num_2;

  for(i = 0 ; i < num_2 ; i++){
    int flg_2 = 0;
    cin >> ID_2;
    for(j = 0 ; j < num_1 ; j++){
      if(ID_2==ID[j]&&flg==0){
	flg = 1;
	flg_2 = 1;
	cout << "Opened by" << " " << ID_2 << endl;
      }else if(ID_2==ID[j]&&flg==1){
	flg = 0;
	flg_2 =1;
	cout << "Closed by" << " " << ID_2 << endl;
      }else{
	continue;
      }
    }
    if(flg_2 == 0){
      cout << "Unknown" << " " << ID_2 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const ll mod=1e9+7;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


vector<ll>premier;
void sieve(ll n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
      for (ll p=2; p<=n; p++)
       if (prime[p]){
            premier.push_back(p);
       }

       }


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    ll res=n-1;
    for(ll p=2;p*p<=n;p++){
        if(n%p==0){
            ll a=min(n/p,p);
            ll b=max(p,n/p);
            res=min(res,(a-1)+(b-1));
        }
    }
    cout<<res<<endl;
    return 0;
    }


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

using namespace std;

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

    auto n = (long long) a.length();
    auto ans = n * (n - 1) / 2 + 1LL;

    long long c[26] = {};
    for (int i = 0; i < n; ++i) {
        c[a[i] - 'a']++;
    }

    for (auto cc:c) {
        ans -= cc * (cc - 1) / 2;
    }

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

Measured memory_bytes: 640
public class Main {
	
	public void run(java.io.InputStream in, java.io.PrintStream out) {
		try (final java.util.Scanner sc = new java.util.Scanner(in)) {
			for (;;) {
				final int D = sc.nextInt();
				final int E = sc.nextInt();
				if (D == 0 && E == 0) break ;
				
				double rval = Double.MAX_VALUE;
				for (int u = 0; u <= D; ++u) {
					final int v = D - u;
					rval = Math.min(rval, Math.abs(Math.sqrt(u*u+v*v) - E));
				}
				System.out.println(rval);
			}
		}
	}

	public static void main(String[] args) {
		(new Main()).run(System.in, System.out);
	}

}

Measured memory_bytes: 26352
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 10e9;

int t[100010];
void Together() {
	int n;
	cin >> n;

	for (size_t i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		t[a]++;
	}
	int res = 0;
	for (size_t i = 1; i < 100010; i++)
	{
		int tm = t[i - 1] + t[i] + t[i + 1];
		res = max(tm, res);
	}
	cout << res << endl;

}

int main() {
	Together();
	return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int N=1e7+5;
bool jay;
int l,r,n,m,opt,x;
int a[N];
char str[N];
int main(){
	scanf("%s",str+1);
	l=1e6+1; r=1e6;
	n=strlen(str+1);
	for (register int i=1; i<=n; ++i)
	{
		r++;
		a[r]=str[i]-'a';
	}
	int jay=1;
	scanf("%d",&m);
	while (m--)
	{
		scanf("%d",&opt);
		if (opt==1) jay^=1;
		else
		{
			scanf("%d",&x);
			char ch;
			cin>>ch; 
			if (jay)
			{
				if (x==1) l--,a[l]=ch-'a';
				else r++,a[r]=ch-'a';
			}
			else
			{
				if (x==1) r++,a[r]=ch-'a';
				else l--,a[l]=ch-'a';
			}
		}
	}
	if (jay) for (register int i=l; i<=r; ++i) putchar((char)a[i]+'a');
	else for (register int i=r; i>=l; --i) putchar((char)a[i]+'a');
return 0;
}

Measured memory_bytes: 4736
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
typedef unsigned long long ull;
const int inf=103974182;
using namespace std;

int main()
{
//	freopen("input.txt","r",stdin);
	int a,b,c,x,y;
	cin>>a>>b>>c>>x>>y;
	ll ans=0;
	if(c*2<a+b)
	{
		ans+=1LL*min(x,y)*2*c;
		int t=min(x,y);
		x-=t;
		y-=t;
	}
//	cout<<x<<' '<<y<<endl;
	if(c*2<a)
	{
		ans+=1LL*x*c*2;
		x=0;
	}
	if(c*2<b)
	{
		ans+=1LL*y*c*2;
		y=0;
	}
	ans+=1LL*x*a+1LL*y*b;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,i,j,d[100010]={};
  scanf("%d",&n);
  for(i=0;n;i++){
    //printf("%d\n",n%(-2));
    d[i]=n%(-2);
    n/=-2;
  }
  for(j=0;j<i+10;j++){
    if(d[j]<0){
      d[j+1]+=(-d[j]-1)/2+1;
      d[j]=(-d[j])%2;
    }
    if(d[j]>1){
      if(j%2){
	d[j+1]+=d[j]/2;
	d[j+2]+=d[j]/2;
	d[j]=d[j]%2;
      }
      else{
	d[j+1]-=d[j]/2;
	d[j]%=2;
      }
    }
  }//printf("\n");
  //for(j=0;j<5;j++)printf("%d\n",d[j]);printf("\n");
  for(j=i+10;d[j]==0&&j;j--);
  for(j++;j;j--)printf("%d",d[j-1]);
  printf("\n");
  return 0;
}


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

struct P {double x,y,z;};
double D(P a, P b) {return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)+(a.z-b.z)*(a.z-b.z));}
bool equal(double a, double b) {return fabs(a-b)<0.0000001;}

int main() {
  int T;
  cin >> T;
  while(T--) {
    double l[3];
    for(int i=0; i<3; i++) cin >> l[i];
    int n;
    cin >> n;
    P a[n];
    for(int i=0; i<n; i++) cin >> a[i].x >> a[i].y >> a[i].z;
    for(int i=0; i<n; i++) {
      for(int j=0; j<n; j++) {
        for(int k=0; k<n; k++) {
          if(i==j||j==k||k==i) continue;
          double d1=l[2]/D(a[i],a[j]);
          double d2=l[0]/D(a[j],a[k]);
          double d3=l[1]/D(a[k],a[i]);
          if(!equal(d1,d2)||!equal(d1,d3)) continue;
          cout << i+1 << " " << j+1 << " " << k+1 << endl;
          goto end;
        }
      }
    }
  end:;
  }
  return 0;
}


Measured memory_bytes: 3204
//Har Har Mahadev
using namespace std;
#include <bits/stdc++.h>
#define booga cout << "booga" << endl
#define ll long long int
#define pb push_back
#define mp make_pair
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " -> " << a << endl;
	err(++it, args...);
}

void testcase(){
	ll n,a[200005];
	cin >> n;
	for(int i{0};i < n;i++)cin >> a[i];
	ll ans = 0;
	for(int i{1};i < n;i++){
		if(a[i] < a[i-1]){
			ans += a[i-1] - a[i];
			a[i] = a[i-1];
		}
	}
	cout << ans;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	while(t--){
		testcase();
	}
	return 0;
}


Measured memory_bytes: 5256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h> 
using namespace std;
typedef long long int lli;
const int MaxN=200000;
#define fst first
#define snd second
#define mp make_pair
	lli mcd(lli a,lli b){	
		if(a==0)return b;
		return mcd(b%a,a);
	}
	
int main(){
	//cin.tie(0),ios_base::sync_with_stdio(0);
	lli N,i,j,a,b,c,K,sum=0;
	cin>>a>>b>>c>>K;
	sum+=min(a,K);
	K-=a;
	if(K>0){
		K-=min(b,K);
		if(K>0){
			sum-=min(c,K);
			K-=min(c,K);
		}
	}
	cout<<sum;
}	
		

Measured memory_bytes: 3136
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;

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

    int t,a;
    cin >> t >> a;

    int h[n];
    double temp;

    double diff;
    int ans=1;

    double min=1e9;
    
    for(int i=0;i<n;i++) {
        cin >> h[i];
        temp=t*1000-h[i]*6;
        diff=abs(a*1000-temp);
        if(min>diff) {
            min=diff;
            ans = i+1;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int N, M;
int S[1<<18];
bool used[1<<18];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N;
    M = 1<<N;
    for(int i = 0; i < M; i++) cin >> S[i];
    sort(S, S+M, greater<int>());
    used[0] = true;
    vector<int> v;
    v.push_back(S[0]);
    for(int i = 0; i < N; i++){
        int m  = 1<<i;
        int cnt = 0;
        int sz = v.size();
        for(int j = 0; j < M; j++){
            if(!used[j] && v[cnt] > S[j]){
                cnt++;
                used[j] = true;
                v.push_back(S[j]);
                if(cnt == sz) break;
            }
        }
        if(cnt < sz){
            cout << "No" << endl;
            return 0;
        }
        sort(v.begin(), v.end(), greater<int>());
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 2676