akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  int A, B,C; cin >> A >> B >> C;
  cout << C << " " << A << " " << B << endl;
  return 0;
}


Measured memory_bytes: 764
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
 
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;

ll pwr(ll base, ll p, ll mod = MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
 

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



const int N = 302;
int DP[N][N][N], n, minleft[N][4], maxleft[N][4];

bool valid(int col1, int col2, int col3, int i){
    if(col2 >= minleft[i][1])   return false;
    if(col3 < maxleft[i][1])    return false;
    if(col1 >= minleft[i][2])   return false;
    if(col2 < maxleft[i][2])    return false;
    if(col1 < maxleft[i][3])    return false;
    return true;
}


int dp(int col1, int col2, int col3){

    int idx = col3+1;
    if(idx == n+1)  return 1;
    int &ans = DP[col1][col2][col3];
    if(ans != -1)   return ans;

    ans = 0;

    {
        //paint col1
        int newcol1 = col2, newcol2 = col3, newcol3 = idx;
        if(valid(newcol1, newcol2, newcol3, idx))
            ans = (ans + dp(newcol1, newcol2, newcol3)) % MOD;
    }

    {
        //paint col2
        int newcol1 = col1, newcol2 = col3, newcol3 = idx;
        if(valid(newcol1, newcol2, newcol3, idx))
            ans = (ans + dp(newcol1, newcol2, newcol3)) % MOD;
    }

    {
        //paint col3
        int newcol1 = col1, newcol2 = col2, newcol3 = idx;
        if(valid(newcol1, newcol2, newcol3, idx))
            ans = (ans + dp(newcol1, newcol2, newcol3)) % MOD;
    }

// cout<<"dp "<<col1<<" "<<col2<<" "<<col3<<" returns "<<ans<<endl;
    return ans;
}



int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int m;
    cin>>n>>m;


    for(int i=1;i<=n;i++)
        for(int j=1;j<=3;j++){
            minleft[i][j] = MOD;
            maxleft[i][j] = -MOD;
        }

    while(m--){
        int l, r, x;
        cin>>l>>r>>x;
        minleft[r][x] = min(minleft[r][x], l);
        maxleft[r][x] = max(maxleft[r][x], l);
    }

    memset(DP, -1, sizeof(DP));
    cout<<(dp(0, 0, 0))%MOD;
    return 0;
}











Measured memory_bytes: 107904
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] p = new int[n];
        for(int i = 1 ; i <= n ; i++ ){
            p[i - 1] = sc.nextInt(); 
        }
        for(int i = 1; i <= n ; i++ ){
            for(int j = 0 ; j < n - 1 ; j++ ){
                if(p[j] > p[j + 1]){
                    int ko = p[j];
                    p[j] = p[j + 1];
                    p[j + 1] = ko;
                }
            }
        }
        int s = 0;
        for(int i = 0 ; i < k ; i++ ){
            s = s + p[i];
        }
        System.out.println(s);
    }
}

Measured memory_bytes: 38876
#import
import math
#import numpy as np
#= int(input())
#= input()
N, D = map(int, input().split())
#= list(map(int, input().split()))
#= [input(), input()]
XY = [list(map(int, input().split())) for _ in range(N)]
#= [int(input()) for _ in range(N)]
#= {i:[] for i in range(N)}

res = 0

for xy in XY:
    x = xy[0]
    y = xy[1]

    kyori = math.sqrt(x ** 2 + y ** 2)
    
    if kyori <= D:
        res += 1


print(res)

Measured memory_bytes: 45460
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得

        var ans = "NO";
        bool a1 = true;
        bool a2 = true;
        bool a3 = true;

        foreach (var s in str)
        {
            if(a1 && s == "5")
            {
                a1 = false;
            }
            else if (a2 && s == "5")
            {
                a2 = false;
            }
            else if (a3 && s == "7")
            {
                a3 = false;
            }
        }

        if(!a1 && !a2 && !a3)
        {
            ans = "YES";
        }

        Console.Write(ans);
    }
}

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

int main() {
	char S[20];
	string T;
	string p;
	string Q;
	int a = 0;
	int A = 0;
	int b = 0;
	int B = 0;
	int c = 0;
	int C = 0;
	int q, w, z;
	int n = 0;
	int x = 0;
	int y = 0;
	int ans = 0;
	cin >> n >> a >> b;
	if (n * a < b) {
		cout << n * a;
	}
	else {
		cout << b;
	}
	
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define INF 1e9
#define MAXN 100005
#define MAXM 100005
#define MOD 1000000007
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pii pair<int, int>

ll ans;
int S,W;

void solve(){
    if(S <= W) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}

int main(){
    cin >> S >> W;

    solve();
}


Measured memory_bytes: 3676
#include<cstdio>
#include<algorithm>
int sum(int n){
	int ret = 0;
	while(n){
		ret += n % 10;
		n /= 10;
	}
	return ret;
}
int main(){
	int n, ans = 100000000;
	scanf("%d", &n);
	for(int A = 1; A < n; A += 1)
		ans = std::min(ans, sum(A) + sum(n - A));
	printf("%d\n", ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,tot=0,mp[505][505];
struct node
{
    int x,y,a,b;
}e[250500];
void solve(int l,int r,int p,int q)
{
    e[++tot].x=l;
    e[tot].y=r;
    e[tot].a=p;
    e[tot].b=q;
    mp[l][r]--;
    mp[p][q]++;
}
int main() {
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            cin>>mp[i][j];
    for(int i=1;i<n;i++)
        for(int j=1;j<=m;j++)
            if(mp[i][j]&1)
                solve(i,j,i+1,j);
    for(int i=1;i<m;i++)
        if(mp[n][i]&1)
            solve(n,i,n,i+1);
    cout<<tot<<endl;
    for(int i=1;i<=tot;i++)
        cout<<e[i].x<<" "<<e[i].y<<" "<<e[i].a<<" "<<e[i].b<<endl;

}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define IOS ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define AfterDecimal(n) cout << fixed << setprecision(n);
#define ll long long int
#define ld long double
#define all(a) a.begin(), a.end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define bits(x) __builtin_popcount(x)

using namespace __gnu_pbds;
using namespace std;

// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")

//template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

#ifdef LOCAL
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << "# "<< name << " = " << arg1 << '\n';
}
template<typename Arg1, typename... Args>
void __f(const char* names, Arg1 && arg1, Args &&... args){
        const char* comma = strchr(names + 1 ,',');
        cout << "# ";
        cout.write(names, comma - names)<< " = " << arg1 << " | ";
        __f(comma + 1, args...);
}
#else
#define debug(...) 36
#endif


std::mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int ri(int a, int b) {
    return uniform_int_distribution<int>(a, b)(rng);
}

ll power(ll x, ll y, ll p){
   ll res = 1;
   x = x % p;
   while (y > 0) {
      if (y & 1)
         res = (res * x) % p;
      y = y >> 1;
      x = (x * x) % p;
   }
   return res;
}

const ll INF = (ll)(8e18);
const ll MOD = (ll)(1e9 + 7);
const ll HMOD = (ll)4222234727;
const ll Hashprime = (ll)31;

const int maxn = 100100;

int32_t main(){
    IOS;
    #ifndef ONLINE_JUDGE
    //  freopen("input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);
    #endif
    int t = 1; // cin >> t;
    while(t--){
       ll n; cin >> n;
       vector <ll> a(n + 1);
       for(ll i = 1; i <= n; i++) cin >> a[i];
       ll val = 0;
       ll ans = 0;
       for(ll i = 1; i <= n; i++){
          val = max(val, a[i]);
          ans += max(0LL, val - a[i]);
       }
       cout << ans << '\n';
    }
    #ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
}
//g++ -DLOCAL -std=c++17 -Wshadow -Wall -o "c" "comp.cpp" -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g


Measured memory_bytes: 4820
import Foundation
 
let input_line: String = readLine()!
let split: [String] = input_line.components(separatedBy: " ") //ブランクで区切られている場合
 
var a = Int(split[0])!
//String -> Intの型変換はnilが返る可能性があるので、ラップされたOptional<Int>型が返るので強制アンラップ
var b = Int(split[1])!


if ((a * b) % 2 >= 1){
    print("Odd")
}else{
    print("Even")
}



Measured memory_bytes: 13956
# -*- coding: utf-8 -*-
"""
B - Digit Sums
https://beta.atcoder.jp/contests/abc101/tasks/abc101_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(N):
    digit_sum = sum([int(d) for d in str(N)])
    return 'Yes' if N % digit_sum == 0 else 'No'


def main(args):
    N = int(input())
    ans = solve(N)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 3060
def d_five_five_everywhere(N):
    def prime_table(n):  # nまでの素数のリスト
        is_prime = [True] * (n + 1)
        is_prime[0] = is_prime[1] = False  # 0と1は素数でない
        for j in range(2, int(n**0.5) + 1):
            if not is_prime[j]:
                continue
            for k in range(j * 2, n + 1, j):
                is_prime[k] = False  # jの倍数は素数でない
        return [i for i in range(n + 1) if is_prime[i]]
    prime = prime_table(55555)  # 55555以下の素数を得る

    prime_match = []  # 素数のうち5で割った余りが1の素数のリスト(長さN)
    series_length = 0  # 数列の長さをカウントしておく(len()よりは早いだろう)
    for p in prime:
        if p % 5 == 1:
            prime_match.append(p)
            series_length += 1
        if series_length == N:
            break
    ans = ' '.join(map(str, prime_match))
    return ans

N = int(input())
print(d_five_five_everywhere(N))

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<ll>v(100001);
vector<ll> dp(100001,-1);
ll k;
ll solve(ll n)
{
    if(n<=0) return 0;
    if(dp[n]!=-1) return dp[n];
    ll ans=INT_MAX;
    for(ll j=1;j<=k;j++)
    {
        if(n-j>=0) ans=min(ans,abs(v[n]-v[n-j])+solve(n-j));
    }
    return dp[n]=ans;

}
int main()
{
    ll n;
    cin>>n>>k;
    for(ll i=0;i<n;i++)
    {
        cin>>v[i];
    }
    cout<<solve(n-1);
}


Measured memory_bytes: 9568
# Your code here!
n = gets.to_i
a = []

n.times do 
  a << gets.chomp.chars.sort.join("")
end

count = Hash.new(0)
a.each do |elem|
  count[elem] += 1
end

cnt = 0
count.values.each do |i|
    if i >= 2
        cnt += (i * (i - 1)) / 2
    end
end

p cnt

Measured memory_bytes: 32764
#include <stdio.h>

int main()
{
	int i, j, N, M, X, C[13], A[13][13];
	scanf("%d %d %d", &N, &M, &X);
	for (i = 1; i <= N; i++) {
		scanf("%d", &(C[i]));
		for (j = 1; j <= M; j++) scanf("%d", &(A[i][j]));
	}
	
	const int bit[13] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096};
	int min = 1 << 30, flag[13] = {}, tmp[13], cost;
	while (flag[N] == 0) {
		for (j = 1; j <= M; j++) tmp[j] = 0;
		for (i = 0, cost = 0; i < N; i++) {
			if (flag[i] == 1) {
				cost += C[i+1];
				for (j = 1; j <= M; j++) tmp[j] += A[i+1][j];
			}
		}
		for (j = 1; j <= M; j++) if (tmp[j] < X) break;
		if (j > M && cost < min) min = cost;
		
		for (i = 0; flag[i] == 1; i++);
		for (flag[i--] = 1; i >= 0; flag[i--] = 0);
	}
	if (min < 1 << 30) printf("%d\n", min);
	else printf("-1\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1712
#include <stdio.h>
int main(void)
{
	int data[]={0,1,2,3,4,5,6,7,8,9,5,4,3,2,1};
	int dataN =sizeof(data)/sizeof(int);
	
	int i, j, n;
	int start, end, dist, distMin, ansStart;
	scanf("%d", &n);
	for(i=0; i<n; i++)
	{
		scanf("%d %d", &start, &end);
		
		ansStart=0;
		distMin = 999;
		for(j=0; j<dataN; j++)
		{
			dist = 1;
			if(data[j]==start)
			{
				while(1)
				{
					dist++;
					if(data[(j+dist-1)%dataN] == end)break;
				}
				if(dist < distMin)
				{
					distMin  = dist;
					ansStart = j;
				}
			}
		}
		for(j=0; j<distMin; j++)
		{
			printf("%d", data[(ansStart +j)%dataN]);
			if(j<distMin-1)printf(" ");
		}
		printf("\n");
	}
	return 0;
}

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

using namespace std;

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

const double PI = 3.1415926535897932384626433832795;
const ll MOD = 1000000007;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(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);

	int n;
	cin >> n;

	vector<int> a(n);
	for (auto &v : a) {
		cin >> v;
	}

	vector<int> dp = a;
	for (int i = 1; i < n; i++) {
		dp[i] = (dp[i - 1] ^ dp[i]);
	}

	cout << (dp.back() == 0 ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<string, string> P;
const ll MOD = 1000000007LL;
ll mod_pow(ll a, ll b) {
	if (b == 0) return 1;
	if (b % 2 == 0) {
		ll x = mod_pow(a, b / 2);
		return (x*x) % MOD;
	}
	return (a*mod_pow(a, b - 1)) % MOD;
}
int main() {
	ll N, M;
	cin >> N >> M;
	ll ans = 1;
	for (ll i = 2; i*i <= M; i++) {
		int k = 0;
		while (M%i == 0) {
			k++;
			M /= i;
		}
		ll t = 1;
		for (int i = 0; i < k; i++) (t *= (N + k - 1 - i)) %= MOD;
		for (int i = 1; i <= k; i++) (t *= mod_pow(i, MOD - 2)) %= MOD;
		(ans *= t) %= MOD;
	}
	if (M > 1) (ans *= N) %= MOD;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int h, w;
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> h >> w;
    vector<string> s(h);
    int a[h + 1][w + 1] = {};
    int b[h + 1][w + 1] = {};
    for(int i = 0; i < h; i++)
    {
        string t; cin >> t;
        t += '#';
        s[i] = t;
    }
    string tmp = "";
    for(int i = 0; i <= w; i++) tmp += '#';
    s.push_back(tmp);
    for(int i = 0; i < h; i++)
    {
        int cnt = 0, pos = 0;
        for(int j = 0; j <= w; j++)
        {
            if(s[i][j] == '.') cnt++;
            else
            {
                for(int k = pos; k < j; k++) a[i][k] = cnt;
                pos = j + 1;
                cnt = 0;
            }
        }
    }
    for(int j = 0; j < w; j++)
    {
        int cnt = 0, pos = 0;
        for(int i = 0; i <= h; i++)
        {
            if(s[i][j] == '.') cnt++;
            else
            {
                for(int k = pos; k < i; k++) b[k][j] = cnt;
                pos = i + 1;
                cnt = 0;
            }
        }
    }
    // cout << endl;
    // for(int i = 0; i < h; i++)
    // {
    //     for(int j = 0; j < w; j++) cout << setw(4) << a[i][j];
    //     cout << endl;
    // }
    // cout << endl;
    // for(int i = 0; i < h; i++)
    // {
    //     for(int j = 0; j < w; j++) cout << setw(4) << b[i][j];
    //     cout << endl;
    // }
    int ans = 0;
    for(int i = 0; i < h; i++)
    {
        for(int j = 0; j < w; j++)
        {
            ans = max(ans, a[i][j] + b[i][j] - 1);
        }
    }
    cout << ans << endl;
    return 0;
}



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

#define infile "../test/sample-1.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0)
#define sz(x) ((int)(x).size())
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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


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

  int pnt = 0;
  int minpnt = 0;
  int pcnt = 0;
  int mcnt = 0;
  rep(i, n){
    if (s[i]=='('){ pnt++; pcnt++;}
    if (s[i]==')'){ pnt--; mcnt++;}
    chmax(minpnt, -pnt);
  }
  dump(minpnt);
  string res = "";
  res += string(minpnt, '(');
  res += s;
  res += string(pcnt+minpnt-mcnt, ')');

  cout << res << endl;

  return 0;
}

int test(){ //{{{
  return 0;
}
//}}}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
#ifdef PCM
  test();
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.map f

[<EntryPoint>]
let main argv =
    let [|a;b;c|] = reads int
    let r = a - b
    printfn "%i" (max 0 (c - r))
    0

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

struct start { start() {
cin.tie(0);
ios::sync_with_stdio(0);
cout << fixed << setprecision(10);
}; }start;

typedef long long ll;


int main(){
    int a,b;
    cin >> a >> b;
    
    cout << a/b << " " << a%b << " " << (double)a / (double)b << endl;
    return 0;
}


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

long long dp[101][100002];

int main(){
    long long N,W;
    cin>>N>>W;
    long long w[N+1];
    long long v[N+1];
    long long V=100000;
    w[0]=0, v[0]=0;
    for(long long i=1;i<=N;++i){
        cin>>w[i]>>v[i];
    }

    for(long long i=0;i<=N;++i){
        for(long long j=0;j<=V;++j){
            dp[i][j]=10000000000001;
        }
    }

//    for(long long j=1;j<=V;++j){
//      if(v[1]>=j){
        dp[1][v[1]]=w[1];
//      }
//    }
    dp[1][0]= 0;
    for(long long i=2;i<=N;++i){
        for(long long j=0;j<=V;++j){
            dp[i][j] = min(dp[i][j],dp[i-1][j]);
            if(j>=v[i]){
              dp[i][j]= min(dp[i][j], dp[i-1][j-v[i]] + w[i]);
            }
        }
    }


    long long ans=0;
    for(int j=1;j<=V;++j){
      if(dp[N][j]<=W) ans=j;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 82476
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

int main() {
	int n, f[100] = { 0 }, p[100][11];
	cin >> n;
	for (int i = 0; i < n; ++i) {
		for (int j = 9; j >= 0; --j) {
			int t;
			cin >> t;
			f[i] += t << j;
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < 11; ++j) {
			cin >> p[i][j];
		}
	}

	int ans = -INF;
	for (int i = 1; i < 1024; ++i) {
		int sum = 0;
		for (int j = 0; j < n; ++j) {
			int t = i & f[j];
			int cnt = 0;
			while (t > 0) {
				if (t & 1)
					cnt++;
				t >>= 1;
			}
			sum += p[j][cnt];
		}
		ans = max(ans, sum);
	}

	cout << ans << endl;

	return 0;
}

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

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

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

  string s;
  cin >> s;

  int a = 0;
  int b = 0;
  int c = 0;

  rep(i, 3) {
    if (s.at(i) == 'a') {
      a = 1;
    } else if (s.at(i) == 'b') {
      b = 1;
    } else if (s.at(i) == 'c') {
      c = 1;
    }
  }
  if (a * b * c == 1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, K;
  cin>>N>>K;
  string S;
  cin>>S;
  bool l;
  if(S[0]=='L') l = true;
  else l = false;
  int ans = 0;
  for(int i=1;i<S.size();++i){
    if(l){
      if(S[i]=='R'){
        ans++;
        l = false;
      }
    }
    else{
      if(S[i]=='L'){
        ans++;
        l = true;
      }
    }
  }
  ans++;
  int ans1 = 0;
  for(int i=0;i<S.size()-1;++i){
    if(S[i]==S[i+1]) ans1++;
  }
  int ans2 = ans1 + 2*min(K, max(0, (ans-2)/2));
  int tmpK = K;
  K -= min(tmpK, max(0, (ans-2)/2));
  ans -= 2*min(tmpK, max(0, (ans-2)/2));
  if(K==0) cout<<ans2<<endl;
  else if(ans>2) cout<<ans2+2<<endl;
  else if(ans==2) cout<<ans2+1<<endl;
  else cout<<ans2<<endl;
}



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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int N;
    Scd(N);

    vector<vector<int>> teb(N+1);

    if( N&1 ){
        for( int i = 1; i*2 <= N; i++ ){
            if( i == 1 ){
                teb[i].push_back(N);
                teb[N-i].push_back(N);
            }else{
                teb[i].push_back(N-i+1);
                teb[i].push_back(i-1);
                if( N-i != i ){
                    teb[N-i].push_back(N-i+1);
                    teb[N-i].push_back(i-1);
                }
            }
        }
        if( N > 4 ){
            teb[N].push_back(N/2);
            teb[N].push_back(N/2+1);
        }
    }else{
        for( int i = 1; i*2 < N; i++ ){
            teb[i].push_back(i+1);
            teb[i].push_back(N-i);
            teb[N-i+1].push_back(i+1);
            teb[N-i+1].push_back(N-i);
        }
        if( N!=4 ){
            teb[N/2].push_back(1);
            teb[N/2].push_back(N);
            teb[N/2+1].push_back(1);
            teb[N/2+1].push_back(N);
        }
    }

    int ans = 0;
    Repe(i,N+1,1){
        ans += teb[i].size();
    }

    printf ("%d\n", ans);
    Repe(i,N+1,1){
        for( int k : teb[i] )
            printf ("%d %d\n", i, k );
    }

    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
using namespace std;
 
int a[4];
int c[8];
int k;
 
int calc(){
    int op = c[k++];
    int ret = 0;
    if(op >= 0){
        ret = op;
    }
    else if(op >= -3){
        int x = calc();
        int y = calc();
        if(op == -1){
            ret = x + y;
        }
        else if(op == -2){
            ret = x - y;
        }
        else{
            ret = x * y;
        }
    }
    else{
        throw 0;
    }
    return ret;
}
 
void print(){
    int op = c[k++];
    if(op >= 0){
        printf("%d", op);
    }
    else{
        char ch;
        if(op == -1){ ch = '+'; }
        else if(op == -2){ ch = '-'; }
        else{ ch = '*'; }
 
        putchar('(');
        print();
        printf(" %c ", ch);
        print();
        putchar(')');
    }
}

const int brnum = 100000;
 
void solve(int i, int S, int oprem, int numrem){
    if(i == 6){
        for(int j = 0; j < 4; ++j){
            if(S >> j & 1){
                c[6] = a[j];
            }
        }
        try{
            k = 0;
            if(calc() == 10 && k == 7){
                k = 0;
for(int j=0;j<brnum;++j)putchar('(');
//                print();
printf("%d+%d+%d+%d",a[0],a[1],a[2],a[3]);
for(int j=0;j<brnum;++j)putchar(')');
                puts("");
                throw "";
            }
        }catch(int){}
        return;
    }
 
    if(oprem > 0){
        for(int op = -1; op >= -3; --op){
            c[i] = op;
            solve(i + 1, S, oprem - 1, numrem + 1);
        }
    }
 
    if(numrem > 0){
        for(int j = 0; j < 4; ++j){
            if(S >> j & 1){
                c[i] = a[j];
                solve(i + 1, S ^ 1 << j, oprem, numrem - 1);
            }
        }
    }
}
 
int main(){
    while(1){
        for(int i = 0; i < 8; ++i){
            c[i] = -9;
        }
        for(int i = 0; i < 4; ++i){
            scanf("%d", &a[i]);
        }
        if(a[0] == 0){ break; }
        try{
            solve(0, 15, 3, 0);
            puts("0");
        }catch(...){}
    }
}

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

int main()
{
  double N;
  cin >> N;
  const double PI = acos(-1);
  cout << 2 * PI * N << endl;
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  string s; cin>>s;
  if (s[0]==s[1] && s[1]==s[2]) out("Yes");
  s=s.substr(1);
  if (s[0]==s[1] && s[1]==s[2]) out("Yes");
  out("No");
  

  return 0;
}


Measured memory_bytes: 256
k, x = [int(i) for i in input().split()]

x - k + 1
x + k - 2

if(x - k + 1 >= -1000000):
    xmin = x - k + 1
else:
    xmin = -1000000

if(x + k - 1 <= 1000000):
    xmax = x + k - 1
else:
    xmax = 1000000

arr = []

for x in range(xmin, xmax+1):
    arr.append(str(x))

print(' '.join(arr))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define int long long
using namespace std;
#define PI  3.14159265358979323846
int32_t main(){
   int n,m;
   cin>>n>>m;
   int total = 0;
   for(int i=0;i<m;i++){
        int x; cin>>x;
        total += x;
   }
   if(n >= total) cout<<(n-total)<<'\n';
   else cout<<"-1\n";
}

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

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

    cout << s / 3600 << ':';
   
    s %= 3600;

    cout << s / 60 << ':';

    s %= 60;
 
    cout << s << endl;

    return 0;

}

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

#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)
#define repr(i, N) for (ll i = N-1; i >= 0; i--)
#define repr1(i, N) for (ll i = N; i > 0; i--)

#define INF 1000000007

using ll = long long;
using namespace std;

typedef pair<int,int> P;

int main(){
    ll ans=0;
    ll x;
    cin >> x;
    
    if(x <= 6)
        ans = 1;
    else if(x <= 11)
        ans = 2;
    else{
        ans = (x-1)/11*2 + (((x-1)%11 <= 5) ? 1 : 2);
    }
    
    cout << ans;
    //printf("%.15lf",ans);
    cout << "\n";
    return 0;
}


Measured memory_bytes: 256
a,b,c,x,y = [int(i) for i in input().split(" ")]

# if a+b > c:
max_num = max(x,y)
cost_1 = max_num*2*c
# print(cost_1)
min_num = min(x,y)
cost_2 = (x-min_num)*a + (y-min_num)*b + c*2*min_num

cost_3 = (x*a + y*b)
# print(cost_2)
print(min(cost_3,min(cost_1,cost_2)))
# else:
#     print(a*x + b*y)

Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<algorithm>
#define rep(i,a,b) for(i=a;i<=b;i++)
using namespace std;
const int mod=1e9+7;
const int N=25010,M=410;
int ALL;
int a[N],vis[M];
int n,m,K;

int power(int x,int y){
	int ret=1;
	for(;y;y>>=1,x=1ll*x*x%mod){
		if(y&1)	ret=1ll*ret*x%mod;
	}
	return ret;
}

struct S2{
	int dp[N][M][2];int ans;
	void solve(){
		register int i,j,k0,k1;
		dp[1][1][0]=K;dp[1][1][1]=K*(m==1);
		rep(i,2,n){
			rep(j,2,K-1){
				k0=1ll*(K-j+1)*dp[i-1][j-1][0]%mod;
				dp[i][j][0]=(dp[i][j][0]+k0)%mod;
				dp[i][j][1]=(dp[i][j][1]+1ll*(K-j+1)*dp[i-1][j-1][1]+(j>=m)*k0)%mod;
				//if(j>=n)	dp[i][j][1]=(dp[i][j][1]+k0)%mod;
			}
			k0=0;k1=0;
			for(j=K-1;j;j--){
				k0=(k0+dp[i-1][j][0])%mod;
				k1=(k1+dp[i-1][j][1])%mod;
				dp[i][j][0]=(dp[i][j][0]+k0)%mod;
				dp[i][j][1]=(dp[i][j][1]+k1)%mod;
				if(j>=m)	dp[i][j][1]=(dp[i][j][1]+k0)%mod;
			}
		}
		rep(i,1,K)	ans=(ans+dp[n][i][1])%mod;
		rep(i,1,K)	ans=1ll*ans*power(i,mod-2)%mod;
		rep(i,1,K-m)	ans=1ll*ans*i%mod;
		ans=(ALL-ans+mod)%mod;
		printf("%d\n",ans);
	}
};S2 subtask2;
		
struct S3{
	int f[N][M],g[N][M];int ans;
	void DP(int dp[N][M]){
		register int i,j,sum;
		rep(i,1,n){
			rep(j,2,K-1){
				dp[i][j]=(dp[i][j]+1ll*(K-j+1)*dp[i-1][j-1])%mod;
			}
			sum=0;
			for(j=K;j;j--){
				sum=(sum+dp[i-1][j])%mod;
				dp[i][j]=(dp[i][j]+sum)%mod;
			}
		}
	}
	void solve(){
		register int i,j,k0,k1;
		int L,R;
		memset(vis,0,sizeof(vis));
		rep(i,1,m){
			if(vis[a[i]])	break;
			vis[a[i]]=1;
		}
		L=i-1;
		memset(vis,0,sizeof(vis));
		for(i=m;i;i--){
			if(vis[a[i]])	break;
			vis[a[i]]=1;
		}
		R=m-i;
		f[0][L]=1;DP(f);
		g[0][R]=1;DP(g);
		rep(i,1,n-m+1){
			k0=0;k1=0;
			rep(j,1,K-1)	k0=(k0+f[i-1][j])%mod;
			rep(j,1,K-1)	k1=(k1+g[n-(i+m-1)][j])%mod;
			ans=(ans+1ll*k0*k1)%mod;
		}
		ans=(ALL-ans+mod)%mod;
		printf("%d\n",ans);
	}
};S3 subtask3;

int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	register int i,j;
	scanf("%d%d%d",&n,&K,&m);
	rep(i,1,m)	scanf("%d",&a[i]);
	ALL=1ll*(n-m+1)*power(K,n-m)%mod;
	//a is colorful
	j=0;
	rep(i,1,m){
		if(!vis[a[i]])	vis[a[i]]=1;
		else for(j++,vis[a[j]]=0;a[j]!=a[i];j++,vis[a[j]]=0);
		if(i-j==K)	{printf("%d\n",ALL);return 0;}
	}
	//a can be colorful
	memset(vis,0,sizeof(vis));
	rep(i,1,m){
		if(vis[a[i]])	break;
		vis[a[i]]=1;
	}
	if(i==m+1){subtask2.solve();return 0;}
	//a isnot colorful
	subtask3.solve();return 0;
}
	
	
		
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

Measured memory_bytes: 82176
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        char[] c = sc.next().toCharArray();
        Arrays.sort(c);
        boolean res = c[0] == c[1] && c[1] != c[2] && c[2] == c[3];
        System.out.println(res ? "Yes" : "No");
    }
}


Measured memory_bytes: 21716
#ABC 118 C - Monsters Battle Royale 21:58

def func(A):
    #(1)Aの最小値mを見つける
    #(2)Aの要素をmで割った余りで配列A'を作る（０は無視）
    #A'の要素が０個の場合、mが答え
    A = sorted(A)
    m = min(A)
    B = [A[0]]
    
    for i in range(1,len(A)):
        if A[i]%m != 0:
            B.append(A[i]%m)
    
    if len(B) == 1:
        print(m)
        return len(B)
    else:
        func(B)
    
n = int(input())
A = list(map(int, input().split()))
func(A)

Measured memory_bytes: 86232
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)                                                                             
#define seg_size 524288
long long dp[50][131072] = {};
int main() {
	long long n, x, y, z;
	cin >> n >> x >> y >> z;
	long long ans = 10;
	for (int i = 0;i < n - 1;++i) {
		ans *= 10;
		ans %= MAX_MOD;
	}
	dp[0][0] = 1;
	for (int i = 0;i < n;++i) {
		for (int q = 0;q < 131072;++q) {
			for (int j = 1;j <= 10;++j) {
				long long tmp = q;
				tmp *= 2;
				tmp++;
				tmp = tmp << (j - 1);
				long long geko = tmp;
				int ok = 0;
				int cnt = 0;
				while (geko != 0) {
					cnt++;
					if (cnt == z) {
						if (geko % 2 == 1) ok++;
					}
					else if (cnt == z + y) {
						if (geko % 2) ok++;
					}
					else if (cnt == x + y + z) {
						ok += geko % 2;
					}
					geko /= 2;
				}
				if (ok != 3) {
					dp[i + 1][tmp%131072] += dp[i][q];
					dp[i + 1][tmp%131072] %= MAX_MOD;
				}
			}
		}
	}
	long long geting = 0;
	for (int i = 0;i < 131072;++i) {
		geting += dp[n][i];
		geting %= MAX_MOD;
	}
	ans -= geting;
	ans += MAX_MOD;
	ans %= MAX_MOD;
	cout << ans << endl;
	return 0;
}

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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }



int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, m, p;
	cin >>n >>m >>p;
	vector<vector<pii>> r(n), r2(n);
	rep(i, m){
		int a, b, c;
		cin >>a >>b >>c;
		 r[a-1].emplace_back(b-1, -c+p);
		r2[b-1].emplace_back(a-1, -c+p);
	}
	VI used(n);
	auto dfs=[&](auto dfs, int c, int z){
		if(used[c] & z) return;
		auto& cr = z==1? r: r2;
		used[c] |= z;
		for(auto x: cr[c]) dfs(dfs, x.first, z);
	};
	
	dfs(dfs, 0, 1);
	dfs(dfs, n-1, 2);
	const ll inf = 1LL<<60;
	vector<ll> ds(n, inf);
	ds[0] =0;
	for(int i =0, nxt =1; i<n+3 && nxt>0 ; i++){
		nxt = 0;
		rep(j, n) if(used[j]==3) for(auto z: r[j]) if(used[z.first]==3){
			if(ds[j] != inf && ds[z.first] > ds[j] + z.second){
				ds[z.first] = ds[j] + z.second;
				nxt = 1;
			}
		}
		if(i>n ) {ds[0] = inf; break;}
	}
	
	if(ds[0] ==inf) cout <<"-1\n";
	else cout << max(0LL, -ds[n-1]) <<"\n";

	return 0;
	
}


Measured memory_bytes: 640
from collections import Counter as co 
n=int(input())
l=sorted(co([a%2 for a in map(int,input().split())]).most_common())
if len(l)==1:
  if l[0][0]==0:
    print(3**n-2**n)
  else:print(3**n-1)
else:
  g,k=l[0][1],l[1][1]
  print(3**n-2**g)

Measured memory_bytes: 3316
#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
#define ll long long int
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define sz(s) (ll)(s.size())
#define vvi vector<vector<ll>>
#define vi vector<ll>
#define all(a) (a).begin(),(a).end()
#define pii pair<ll,ll>
#define dbg(x,y) cout<<x<<" "<<y<<endl
#define endl '\n'
#define M 1000000007
const ll INF = 1ll<<60;

using namespace std;
//-----------------------------------------//


void solve(){
	int128_t x,k,d;
	cin>>x>>k>>d;

	// x-p*d>=0
	// p<=(x/d)

	// x+p*d<=0
	// p<=(-x/d)
	if(x<0) x=-1*x; 

	int128_t f=x/d;

	if(k>f){
		x-=f*d;
		if((k-f)%2!=0) x=x-d;
	}
	else{
		x-=k*d;
	}

	if(x<0) x=-1*x;
	cout<<x;
}



int main(){

	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
	
	int t=1;
	// cin>>t;
	while(t--){
        solve();
	}
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x;
  int sm = 0;
  cin >> x;
  REP(i,1e+9){
      sm+=i;
      if(sm>=x){
          cout << i << endl;
          return 0;
      }

  }

}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Spandan Mishra
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        EThisMessageWillSelfDestructIn5s solver = new EThisMessageWillSelfDestructIn5s();
        solver.solve(1, in, out);
        out.close();
    }

    static class EThisMessageWillSelfDestructIn5s {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.readInt();
            long[] arr = new long[n];
            long[] ai = new long[n];
            Map<Long, Integer> aj = new HashMap<>();
            for (int i = 0; i < n; i++) {
                arr[i] = in.readInt();
                ai[i] = (long) i + arr[i];
                aj.put(i - arr[i], aj.getOrDefault(i - arr[i], 0) + 1);
            }

            long ans = 0;

            for (int i = 0; i < n; i++) {
                if (aj.containsKey(ai[i]))
                    ans += aj.get(ai[i]);
            }

            System.out.println(ans);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new RuntimeException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 62776
#include<cstdio>
#include<iostream>
#include<sstream>
#include<vector>
#include<queue>
#include<string>
#include<stack>
#include<map>
#include<set>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<climits>
#include<functional>

#include<memory.h>

#define ll long long

using namespace std;


int main()
{
	string S, T;
	while (cin >> S >> T) {
		cout << T + S << endl;
	}
	return 0;
}

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

const int MAX = 100100;

int main() {
  int x;
  cin >> x;
  vector<bool> a(100100, true);
  for(int i=2; i*i<=MAX; ++i){
    if(!a[i]) continue;
    for(int j=i+i; j<=MAX; j+=i){
      a[j] = false;
    }
  }
  for(int i=x; i<=MAX; ++i){
    if(a[i]){
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

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

bool used[100];
vector<int> G[100];
int ma,mav;

void dfs(int v,int d){
	if(ma < d){
		ma = d;
		mav = v;
	}
	for(int i = 0;i < G[v].size();i++){
		if(!used[G[v][i]]){
			used[G[v][i]] = true;
			dfs(G[v][i],d + 1);
			used[G[v][i]] = false;
		}
	}
}

int main(){
	int n;
	while(cin >> n,n){
		for(int i = 0;i < 100;i++) {
			G[i].clear();
			used[i] = false;
		}
		for(int i = 0;i < n;i++){
			int a,b;
			cin >> a >> b;
			G[a - 1].push_back(b - 1);
			G[b - 1].push_back(a - 1);
		}
		ma = 0;
		for(int i = 0;i < 100;i++){
			used[i] = true;
			dfs(i,0);
			used[i] = false;
		}
		used[mav] = true;
		dfs(mav,0);
		cout << ma + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 2992
S = int(input())

y = S // 10**9
x = S % 10**9

if y != 10**9:
    print("{} {} {} {} {} {}".format(0, 0, 10**9, 1, 10**9-x, y+1))
else:
    print("{} {} {} {} {} {}".format(0, 0, 10**9, 1, 0, 10**9))

Measured memory_bytes: 3060
import scala.io.StdIn

object Main extends App {

  val n = StdIn.readLine.toInt
  val seq = StdIn.readLine.split(" ").map(_.toInt).sorted.toBuffer += 0

  val ans = {
    seq.foldLeft(0,0,0)((acc,e) => {
      val c = if(acc._1 != e) 1 else acc._2+1
      val t = if(c == 1 && acc._1 != acc._2) {
        if(acc._1 > acc._2) acc._2 + acc._3
        else acc._2 + acc._3 - acc._1
      } else { acc._3 }

      (e, c, t)
    })._3
  }

  println(ans)
}


Measured memory_bytes: 52380
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <queue>
#include <set>
#include <cassert>
using namespace std;
using ll = long long;
using plong = pair<ll,ll>;
ll MOD=998244353;

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; }

int main(){
        string S;
        cin>>S;
        if(S=="ABC"){
            cout<<"ARC"<<endl;
        }else{
            cout<<"ABC"<<endl;
        }

    
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<int,int>;

int main(){
    int n,m;
    cin >>n>>m;
    vector<P> p(m);
    rep(i,m) cin>> p[i].first >>p[i].second;
    rep(x,1000) {
        
        int nx =x/10;
        vector<int> d(1,x%10);
        while(nx){
            d.push_back(nx%10);
            nx/=10;
        }
        if(d.size()!=n)continue;
        reverse(d.begin(),d.end());
        bool ok =true;
        rep(i,m){
           if(d[p[i].first-1]!=p[i].second)ok=false;
        }
        if(ok){
            rep(i,n){
                cout<<d[i];
                if(i==n-1){cout<<endl;
                return 0;}
            }
        }
    }
    cout<<-1<<endl;
}



Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

  int a,b,c;
  cin >> a >> b >> c;

  if (b-a==c-b) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>

#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define vsort(v) sort(v.begin(),v.end())
#define asort(a,n) sort(a, a + n)
#define vi vector<int>
#define vd vector<double>

//ここからAtCoder向けdefine
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;

using namespace std;

int cnt;
vector<bool> IsPrime;

void sieve(int max){
    if(max+1 > IsPrime.size()){
        IsPrime.resize(max+1,true);
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(int i=2; i*i<=max; ++i)
        if(IsPrime[i])
            for(int j=2; i*j<=max; ++j)
                IsPrime[i*j] = false;
}

int main(){
    ios::sync_with_stdio(false);
    sieve(100000);
    int n;
    int st, ed;
    cin >> n;
    vi a;
    for(int i = 1;i <= 99999;i += 2){
        if(IsPrime[i] && IsPrime[(i + 1)/2]){
            a.push_back(i);
        }
    }
    int cnt;

    rep(i, n){
        scanf("%d%d", &st, &ed);
        cnt = 0;
        rep(j, a.size()){
            if(a[j] >= st && a[j] <= ed) cnt++;
        }
        printf("%d\n", cnt);
    }

    return 0;
}

Measured memory_bytes: 640