akhauriyash/Code-Regression huggingface dataset:
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

ld dp[3000][3000];

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n;
  cin >> n;
  vld p(n);
  rep(i, n){
    cin >> p[i];
  }
  dp[0][0] = 1;
  rep(i, n){
    rep(j, i+1){
      dp[i+1][j] += dp[i][j] * (1.l-p[i]);
      dp[i+1][j+1] += dp[i][j] * p[i];
    }
  }
  ld ans = 0;
  rep(i, n+1){
    if(i > n-i){
      ans += dp[n][i];
    }
  }
  print(ans);
}


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

int main(){
  int n,k,d;
  cin >> n >> k;
  int tmp = 0;
  map<int,int> un;
  for(int i=0; i<k; i++){
    cin >> d; 
    un[d] = 1;
  }
  bool flag;
  for(int i=1; i<=100000; i++){
    flag = false;
    if(n<=i){
      string s = to_string(i);
      for(int j=0; j<s.size(); j++){
        if(un.count((int)(s.at(j)-48))==1){flag = true;}
      }
      if(flag){continue;}
      else{cout << i << endl;return 0;}
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	unsigned long long sum=0;
	string s;
	cin>>s;
	for(int i=0; i<s.size(); i++)
		sum+=(int)s[i]-48;
	if(sum%9==0)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 3764
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_mut)]
#![allow(unused_assignments)]
use proconio::input;
use proconio::marker::Usize1;
use std::collections::*;
use std::cmp::*;
use std::f64::consts::*;

const MOD: u64 = 1000000007;
const INF: usize = std::usize::MAX / 4;

fn main() {
    input! {
        S: String,
        T: String,
    }

    let A: Vec<char> = S.chars().collect();
    let B: Vec<char> = T.chars().collect();

    if A.len() + 1 != B.len() {
        println!("No");
        return;
    }

    for (a, b) in A.iter().zip(B.iter()) {
        if a != b {
            println!("No");
            return;
        }
    }

    println!("Yes");
}


Measured memory_bytes: 2124
//
//	Created by shamim_nik
//

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,
		tree_order_statistics_node_update> indexed_set;

#define br printf("\n")
#define pi acos(-1)

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

//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int a, b, c, d;
	cin >> a >> b >> c >> d;
	do {
		a -= d;
		c -= b;
		if (c <= 0) {
			cout << "Yes" << endl;
			return 0;
		} if(a <= 0) {
			cout << "No" << endl;
			return 0;
		}
	} while(1);
	return 0;
}

Measured memory_bytes: 3612
from collections import defaultdict
d = defaultdict(list)
n, m = map(int, input().split())
for _ in range(m):
    a, b = map(int, input().split())
    d[a].append(b)

# アクセスを高速にするためにsetに変換
for a in d.keys():
    d[a] = set(d[a])


def solve(n, d):
    for a in d[1]:
        if n in d[a]:
            return 'POSSIBLE'
    return 'IMPOSSIBLE'


print(solve(n, d))


Measured memory_bytes: 70920
#include <iostream>
#include <cstring>
 
using namespace std;
 
int main() {
   int k=0,i,n;
   char s[101];
   cin.getline(s,101); ///citirea unui sir de caractere
   n=strlen(s); ///retin lungimea sirului de caractere
   for(i=0;i<=n/2-1;i++){
     ///  cout<<s[i]<<" "<<s[n-i-1]<<endl;
       if(s[i]!=s[n-i-1]){
           
           k++;
       }
   }  
   cout<<k;
   
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main() 
{
  int l; cin >> l;
  double ans = (double)(l*l*l)/27;
  cout << fixed << setprecision(12) << ans << endl;
  system("pause");
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m;i>n;i--)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vecpr(K,L1,L2,N) vector<pair<L1,L2>> K(N)
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define mod 1000000007
#define MAX 510000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a)
int main(){
  lli A=INF,B=INF,C=INF,D=INF,E,F,N,M,K,sum=0,num=0,cnt=1,next=0;
  cin >> N;
  A=(double)ceil(-1+pow(1+8*N,0.5));
  A/=2;
  if(A*(A+1)/2<N)A++;
  Out(A);
}


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

int main()
{
    ll n,i,j,c;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    c=0;
    for(i=0;i<n;i++)
    {
       for(j=i+1;j<n;j++)
       {
          ll x=a[i]+a[j];
          ll y=lower_bound(a,a+n,x)-a;
          c+=(y-j-1);
       }
    }
    cout<<c<<endl;
}


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;

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() {
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;

    vector<vector<int>> graph(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    vector<int> d(n, -1);
    queue<int> q;
    d[0] = 0;
    q.push(0);

    while (!q.empty()) {
        int v = q.front();
        q.pop();

        for (int nv : graph[v]) {
            if (d[nv] != -1)
                continue; // skip if already visited
            d[nv] = v;
            q.push(nv);
        }
    }

    for (int i = 1; i < n; i++) {
        if (d[i] == -1) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    for (int i = 1; i < n; i++) {
        cout << d[i] + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 10288
import math
N = int(input())
h = list(map(int, input().split()))
ans = 0
while sum(h) > 0:
    i = 0
    while i < N and h[i] == 0:
        i += 1
    if i < N:
        ans += 1
        while i < N and h[i] > 0:
            h[i] -= 1
            i += 1
print(ans)


Measured memory_bytes: 73792
#include <iostream>
#include <map>
using namespace std;
map<int,int> P;
int main()
{
	int X, N;
	cin >> X >> N;
	for (int i = 0; i < N; i++)
	{
		int tmp;
		cin >> tmp;
		P.insert(make_pair(tmp-X, 0));
	}
	for (int i = 0; i < 101; i++)
	{
		if (P.find((-1)*i) == P.end() && P.find(i) == P.end()) {
			cout << X - i << endl;
			break;
		}
		if (P.find(i) == P.end()) {
			cout << X + i << endl; 
			break;
		}
		if (P.find((-1)*i) == P.end()) {
			cout << X - i << endl;
			break;
		}
	}
}

Measured memory_bytes: 3644
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,m = LI()
    s = LIR(m)
    p = LI()
    ans = 0
    for i in range(m):
        s[i] = sum([1<<(j-1) for j in s[i][1:]])
    for b in range(1<<n):
        for i in range(m):
            if bin(s[i]&b).count("1")&1 != p[i]:
                break
        else:ans += 1
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 40176
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 998244353;

long long int cnt[110000];

int main(){
	int N;
	cin >> N;
	for(int i = 0; i < N; i++){
		long long int D;
		cin >> D;
		cnt[D] += 1;
		if(i == 0 && D != 0){
			cout << 0 << endl;
			return 0;
		}
	}
	if(cnt[0] != 1){
		cout << 0 << endl;
		return 0;
	}
	long long int ans = 1;
	for(int i = 1; i <= N; i++){
		if(cnt[i] == 0){
			continue;
		}
		for(int j = 0; j < cnt[i]; j++){
			ans *= cnt[i - 1];
			ans %= MOD;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iso646.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

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

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

const ll N_MAX = 1e10;

int main() {
    ll a, b, c, d, k;
    cin >> a >> b >> c >> d >> k;
    ll m = c * 60 + d - a * 60 - b;
    cout << m - k << endl;

    return 0;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

const ll inf = 1LL<<60;

ll N, M, p;

// void shortest_path(int s){
//     for(int i=0; i<n; ++i) d[i] = inf;
//     d[s] = 0;

//     int cnt = 0;
//     while(cnt <= m){
//         ++cnt;
//         bool update = false;
//         for(int i=0; i<m; ++i){
//             Edge e = edge[i];
//             if(d[e.from] != inf && d[e.to] > d[e.from]+e.cost){
//                 d[e.to] = d[e.from] + e.cost;
//                 update = true;
//             }
//         }
//         if(!update) break;
//     }
    
// }

// bool find_negative_loop(){
//     for(int i=0; i<n; ++i) d[i] = 0;

//     for(int i=0; i<n; ++i){
//         for(int j=0; j<m; ++j){
//             Edge e = edge[j];
//             if(d[e.to] > d[e.from] + e.cost){
//                 d[e.to] = d[e.from] + e.cost;

//                 if(i == n-1) return true;
//             }
//         }
//     }

//     return false;
// }

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

    cin >> N >> M >> p;
    vector<ll> a(M), b(M), c(M);
    for(int i=0; i<M; ++i){
        cin >> a[i] >> b[i] >> c[i];
        --a[i]; --b[i]; c[i] = -c[i]+p;
    }

    vector<ll> d(N, inf);
 
    d[0] = 0;
    for(int loop=0; loop<N; ++loop){
        for(int i=0; i<M; ++i){
            if(d[a[i]] == inf) continue;
            d[b[i]] = min(d[b[i]], d[a[i]]+c[i]);
        }
    }
 
    ll ans = -d[N-1];
 
    vector<bool> nega(N, false);
 

    for(int loop=0; loop<N+5; loop++){
        for(int i=0; i<M; i++){
            if(d[a[i]] == inf) continue;
            if(d[b[i]] > d[a[i]]+c[i]){
                d[b[i]] = d[a[i]]+c[i];
                nega[b[i]] = true;
            }
 
            if(nega[a[i]]) nega[b[i]] = true;
        }
    }

    if(nega[N-1] == true || d[N-1] == inf){
        cout << -1 << endl;
        return 0;
    }

    cout << max(0LL, ans) << endl;
	
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <time.h>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}


struct UnionFind {
	vector<int> par, rank, cnt;
	UnionFind(int n) : par(n), rank(n, 0), cnt(n, 1){
		for(int i=0; i<n; ++i) par[i] = i;
	}
 
	int find(int x) {
		if (x == par[x]) return x;
		return par[x] = find(par[x]);
	}
 
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return;
 
		if (rank[x] < rank[y]) swap(x, y);
 
		par[y] = x;
		cnt[x] += cnt[y];
		if (rank[x] == rank[y]) rank[x]++;
	}
 
	bool same(int x, int y) {
		return find(x) == find(y);
	}
 
	int size(int x) {
		return cnt[find(x)];
	}
};


int main(){
    int N,M; cin >> N >> M;
    vector<int> a(N),b(N);
    vector<pair<int,int> > v(N);
    priority_queue<int> pq;
    for (int i = 0; i < N; i++){
        int a,b; cin >> a >> b;
        v[i] = {a,b};
    }
    sort(v.begin(),v.end());
    int index = 0;
    long long ans = 0;
    for (int i = 1; i <= M; i++){
        while (v[index].first <= i){
            pq.push(v[index].second);
            index++;
        }
        if (pq.size()){
            ans += pq.top();
            pq.pop();
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 2428
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <limits.h>
#include <string.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pi> vii;

typedef long long int lld;

#define F first
#define S second

#define ERR 1e-9

#ifndef ONLINE_JUDGE
        #define var(x) cerr << #x << ": " << x << "\n";
#endif // ONLINE_JUDGE

int main(){
    #ifndef ONLINE_JUDGE
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE


    string S, T;

    cin >> S >> T;
    bool sol;

    for(int i=0; i<S.size(); i++){
        sol = true;
        if(S[i] != T[i]){
            //var(S[i]);
            char s = S[i], t = T[i];
            for(int j=0; j<S.size(); j++){
                if(S[j] == t){
                    if(j < i){ sol = false; break; }
                    S[j] = s;
                }else if(S[j] == s){
                    if(j < i){ sol = false; break; }
                    S[j] = t;
                }
            }
        }
        if(!sol){ break; }
    }

    if(sol)cout << "Yes";
    else cout << "No";
    return 0;
}


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

#define slld(longvalue) scanf("%lld", &longvalue)

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >

#define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define pb(x) push_back(x)

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

#define mod 1000000009


using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

ll arr[103];
int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

    while(cin >> n >> m)
    {
        ll tot = 0;

        for(i = 1; i <= n; i++) slld(arr[i]), tot += arr[i];

        sort(arr + 1, arr + 1 + n);

        ll vote = tot / (4 * m);

        if(tot % (4 * m)) vote++;

        ll cnt = 0;

        for(i = n; i >= 1; i--)
        {
            if(arr[i] >= vote) cnt++;

            if(cnt == m) break;
        }

        if(cnt == m) cout << "Yes" << endl;
        else cout << "No" << endl;


    }


}



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

int main()
{
    int i,n,m,j,k,l;
    scanf("%d %d",&n,&m);
    long long int x=1,y=1;
    for(i=1;i<=n;i++)
    {
        x=(x*i)%1000000007;

    }
    for(i=1;i<=m;i++)
    {
        y=(y*i)%1000000007;

    }
    long long int sum=0;
    if(m==n)
    {
        sum+=(x*y*(abs(m-n)+2))%1000000007;
    }else if((m==n+1)||(n==m+1))
    {
        sum+=(x*y)%1000000007;
    }
    printf("%lld",sum);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define vi vector<int>
#define Vi vector<vector<int>>
#define ll long long
#define P pair<int,int>
#define vp  vector<P>
#define vb vector<bool>
#define mod 1000000009
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	vb is_correct(n+1,0);
	vi ans(n+1,0);
	int ac_count=0,wr_count=0;
	for(int i=0;i<m;i++){
		int p;string res;
		cin>>p>>res;
		if(res=="AC"){
			is_correct[p]=1;
		}else{
			ans[p]+=!is_correct[p]?1:0;
		}
	}
	for(int i=1;i<=n;i++){
		if(is_correct[i]){
			ac_count++;
			wr_count+=ans[i];
		}
	}
	cout<<ac_count<<" "<<wr_count<<endl;
	return 0;
}

Measured memory_bytes: 640
import java.util.*;
import java.math.*;
import java.lang.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int r = sc.nextInt();
		int d = sc.nextInt();
		int x = sc.nextInt();

		for (int i = 1; i <= 10; i++) {
			x = r * x - d;
			System.out.println(x);
		}
	}

}


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

int main(){
  int N;
  string comb = "No";
  cin >> N;
  for (int i = 0; i < N/4 + 1;i++)
    for (int l = 0; l < N/7 + 1;l++)
      if (4*i + 7*l == N) comb = "Yes";
  cout << comb << endl;
}

Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d", $n);

if (strlen($n) !== 3) {
	echo 'No';
	exit();
}

$first = substr($n, 0, 1);
$last = substr($n, strlen($n)-1, 1);

echo ($first === $last)  ? 'Yes' : 'No';

?>

Measured memory_bytes: 4984
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<63)-1
bool f(int X,int Y,int Z){
    if(Z<=Y+1) return Z*(Y+1)<X*Y;
    else{
        int P=Z-Y-1;
        if(P%2==0){
            int Q=Y+1+P/2;
            return Q*Q<X*Y;
        }
        else{
            int Q=Y+1+P/2,R=Q+1;
            return Q*R<X*Y;
        }
    }
}
int binary(int X,int Y){
    int left=0,right=X-1;
    while(left+1<right){
        int mid=(left+right)/2;
        if(f(X,Y,mid)) left=mid;
        else right=mid;
    }
    int ret=left;
    if(f(X,Y,right)) ret=right;
    return ret;
}
signed main(){
    int Q; cin>>Q;
    rep(i,0,Q){
        int A,B; cin>>A>>B;
        cout<<binary(A,B)+binary(B,A)<<endl;
    }
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
 
    int[] ar = new int[3];
    ar[0] = sc.nextInt();
    ar[1] = sc.nextInt();
    ar[2] = sc.nextInt();
    Arrays.sort(ar);
    System.out.println(ar[2]*10+ar[1]+ar[0]);
  }
}

Measured memory_bytes: 22484
#include<algorithm>
#include<complex>
#include<cstdio>
#include<iostream>
#include<queue>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)
template<class T> T at(vector<T> v, int i) {return v[i % v.size()];}

#define X real()
#define Y imag()

typedef long double D;
typedef complex<D> P;
struct L{P a, b;};
typedef vector<P> Pol;

const D EPS = 1e-8;
const D PI = acos(-1);

int sig(D a, D b = 0) {return a < b - EPS ? -1 : a > b + EPS ? 1 : 0;}
bool near(P a, P b) {return norm(a - b) < EPS;}

namespace std {
  bool operator<(P a, P b) {return sig(a.X, b.X) ? a.X < b.X : a.Y < b.Y;}
  bool operator<(L a, L b) {return !near(a.a, b.a) ? a.a < b.a : a.b < b.b;}
}

D sr(D a) {return sqrt(max(a, (D)0));}

// 外積
D det(P a, P b) {return a.X * b.Y - a.Y * b.X;}

// 線分のベクトル
P vec(L a) {return a.b - a.a;}

// 線分abに対する点cの位置
enum CCW{FRONT = 1, RIGHT = 2, BACK = 4, LEFT = 8, ON = 16};
int ccw(P a, P b, P c) {
  if (a == c || b == c) return ON;
  int s = sig(det(b - a, c - a));
  if (s) return s > 0 ? LEFT : RIGHT;
  return (a < b) == (b < c) ? FRONT : (c < a) == (a < b) ? BACK : ON;
}

bool iLSs(L a, L b) {return sig(det(vec(a), b.a - a.a)) * sig(det(vec(a), b.b - a.a)) < 0;}

// 交点
P pLL(L a, L b) {return a.a + vec(a) * (det(vec(b), b.a - a.a) / det(vec(b), vec(a)));}

// 多角形の面積
D aPol(Pol vp) {
  D ret = 0;
  rep (i, vp.size()) ret += det(vp[i], at(vp, i + 1));
  return ret / 2;
}

// 凸包カット
Pol convexCut(Pol p, L l) {
  vector<P> q;
  rep (i, p.size()) {
    if (ccw(l.a, l.b, p[i]) != RIGHT) q.push_back(p[i]);
    L s = {p[i], at(p, i + 1)};
    if (iLSs(l, s)) q.push_back(pLL(l, s));
  }
  return q;
}

// ボロノイ図構築各母点についてのボノロイ頂点が反時計回りに与えられる
vector<Pol> makeVolonoi(vector<P> vp, Pol plane) {
  vector<Pol> res;
  Pol tplane;
  rep (i, vp.size()) {
    tplane = plane;
    rep (j, vp.size()) if (i != j) {
      P p = (vp[i] + vp[j]) / (D)2;
      L l = {p, p + (vp[j] - vp[i]) * P(0, 1)};
      tplane = convexCut(tplane, l);
    }
    res.push_back(tplane);
  }
  return res;
}

int main() {
  while (true) {
    int n, m;
    cin >> n >> m;
    if (n == 0 && m == 0) break;
    Pol pol(n);
    vector<P> lords(m);
    rep (i, n) cin >> pol[i].X >> pol[i].Y;
    rep (i, m) cin >> lords[i].X >> lords[i].Y;;
    vector<Pol> volonoi = makeVolonoi(lords, pol);
    rep (i, m) printf("%.12Lf\n", aPol(volonoi[i]));
  }
  return 0;
}

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

using namespace std;

class dsu {
	vector<int> fa;
	public:
		dsu(int n) {
			fa.resize(n);
			iota(fa.begin(), fa.end(), 0);
		}

		int find(int x) {
			return x == fa[x] ? x : fa[x] = find(fa[x]);
		}

		bool same(int x, int y) {
			return find(x) == find(y);
		}

		void connect(int x, int y) {
			if(same(x, y)) {
				return;
			}

			x = find(x);
			y = find(y);

			fa[x] = y;
		}
};

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

	int n;
	cin >> n;

	int k, l;
	cin >> k >> l;

	dsu dsu(n);

	for(int i = 0; i < k; ++i) {
		int u, v;
		cin >> u >> v;
		--u;
		--v;
		dsu.connect(u, v);
	}

	vector<int> c;
	c.assign(n, -1);

	int tot = 0;

	for(int i = 0; i < n; ++i) {
		if(c[dsu.find(i)] == -1) {
			c[dsu.find(i)] = tot++;
		}

		c[i] = c[dsu.find(i)];
	}

	vector<vector<int> > G;
	G.resize(n);

	for(int i = 0; i < l; ++i) {
		int u, v;
		cin >> u >> v;
		--u;
		--v;
		
		G[u].emplace_back(v);
		G[v].emplace_back(u);
	}

	vector<bool> vis;
	vis.assign(n, false);

	vector<int> cnt;
	cnt.resize(tot);

	vector<int> st;

	function<void(int)> dfs = [&] (int u) {
		vis[u] = true;
		++cnt[c[u]];
		st.emplace_back(u);

		for(auto v : G[u]) {
			if(!vis[v]) {
				dfs(v);
			}
		}
	};

	vector<int> ans;
	ans.resize(n);

	for(int i = 0; i < n; ++i) {
		if(!vis[i]) {
			st.clear();

			dfs(i);

			for(auto x : st) {
				ans[x] = cnt[c[x]];
			}

			for(auto x : st) {
				cnt[c[x]] = 0;
			}
		}
	}

	for(auto x : ans) {
		cout << x << ' ';
	}

	cout << '\n';

	return 0;
}

Measured memory_bytes: 11512
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#define int long long
using namespace std;
const int bas=1013;
struct data {
	int a,b,c,d;
	friend bool operator <(data a,data b) {
		return a.a==b.a?(a.b==b.b?(a.c==b.c?a.d<b.d:a.c<b.c):a.b<b.b):a.a<b.a;
	}
} zhuan[1010];
map<data,int> mp;
data make(int a,int b,int c,int d) {
	return (data) {
		a,b,c,d
	};
}
data nxt(data x) {
	return make(x.b,x.c,x.d,x.a);
}
void inc(data x,int val) {
	for(int i=1; i<=4; ++i) {
		mp[x]+=val;
		x=nxt(x);
	}
}
int ans,n;
void solve(int a,int b) {
	data x=zhuan[a],y=zhuan[b];
	for(int i=1; i<=4; ++i) {
		y=nxt(y);
		data r1=make(x.b,x.a,y.a,y.d);
		data r2=make(x.c,x.b,y.d,y.c);
		data r3=make(x.d,x.c,y.c,y.b);
		data r4=make(x.a,x.d,y.b,y.a);
		if(!mp[r1]||!mp[r2]||!mp[r3]||!mp[r4])continue;
//		cout<<mp[r1]<<' '<<mp[r2]<<" "<<mp[r3]<<' '<<mp[r4]<<endl;
//		cout<<r4.a<<' '<<r4.b<<r4.c<<r4.d<<endl;
		int res=1;
		res*=mp[r1];
		inc(r1,-1);
		res*=mp[r2];
		inc(r2,-1);
		res*=mp[r3];
		inc(r3,-1);
		res*=mp[r4];
		ans+=res;
		inc(r1,1);
		inc(r2,1);
		inc(r3,1);
	}
}
signed main() {
	scanf("%lld",&n);
	for(int i=1; i<=n; ++i) {
		scanf("%lld%lld%lld%lld",&zhuan[i].a,&zhuan[i].b,&zhuan[i].c,&zhuan[i].d);
		inc(zhuan[i],1);
	}
	for(int i=1; i<=n; ++i) {
		inc(zhuan[i],-1);
		for(int j=1+i; j<=n; ++j) {
			inc(zhuan[j],-1);
			solve(i,j);
			inc(zhuan[j],1);
		}
	}
	cout<<ans;
}

Measured memory_bytes: 25344
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

setrecursionlimit(10**6)
n, m = map(int, raw_input().split())
edges = [[] for _ in range(n)]

for i in range(m):
  u, v, s = map(int, raw_input().split())
  u, v = u-1, v-1
  edges[u].append((s, v))
  edges[v].append((s, u))

def quit(x):
  print(x)
  exit()

cond = [[None] * n for _ in range(2)]
cond[0][0] = 0

INF = 10**16

visited = [False] * n

def walk(x):
  if visited[x]:
    return
  visited[x] = True
  for s, y in edges[x]:
    for sig in range(2):
      if cond[sig][x] is not None:
        p = cond[sig][x]
        if cond[1-sig][y] is None or cond[1-sig][y] == s - p:
          cond[1-sig][y] = s - p
        else:
          quit(0)
    walk(y)

walk(0)

for i in range(n):
  if cond[0][i] is not None and cond[1][i] is not None:
    x = (cond[1][i] - cond[0][i]) // 2
    for j in range(n):
      if cond[0][j] is not None and cond[0][j] + x <= 0:
        quit(0)
      if cond[1][j] is not None and cond[1][j] - x <= 0:
        quit(0)
      if cond[0][j] is not None and cond[1][j] is not None and x + cond[0][j] != cond[1][j] - x:
        quit(0)
    quit(1)

pmin = min(p for p in cond[0] if p is not None)
nmin = min(p for p in cond[1] if p is not None)

print(max(0, nmin + pmin - 1))


Measured memory_bytes: 138376
"use strict"
function main(input) {

	let tmp = null
	let boo = false
	let i = 0

	input = input.split('\n')
	input[0] = input[0].split('')
	input[1] = input[1].split('')

	while(boo == false && i < input[0].length )
	{
		tmp = input[0].pop()
		input[0].unshift(tmp)
		if(input[0].join('')==input[1].join(''))
		{
			boo = true
			console.log('Yes')
			break
		}else{

		}
	i++

	}
	if(!boo) console.log('No')

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

int main(){
    int n;
    string s;
    cin >> n >> s;
    for (int i = n-1; i >= 0; i--){
        for (int j = n-1; j >= 0; j--){
            if (s[i] == s[j]){
                dp[i][j] = dp[i+1][j+1]+1;
            }
            
        }
    }
    int ans = 0;
    rep(i,n) rep(j,n) {
        if (i >= j) continue;
        int c = min(j-i,dp[i][j]);
        ans = max(ans,c);
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 98048
#include <vector>
#include <queue>
#include <cstdio>
using namespace std;

typedef long long Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

Weight minimumSpanningForest(const Graph &g) {
  int n = g.size();
  priority_queue<Edge> Q;
  for(int u=0;u<n;u++) for(auto &e: g[u]) if (u < e.dst) Q.push(e);
  UnionFind uf(n);

  Weight total = 0;
  Edges F;
  while (F.size() < n-1 && !Q.empty()) {
    Edge e = Q.top(); Q.pop();
    if (uf.unionSet(e.src, e.dst)) {
      F.push_back(e);
      total += e.weight;
    }
  }
  return total; //pair<Weight, Edges>(total, F);
}

int main(){
	int N,M,a,b,c;
	scanf("%d%d",&N,&M);
	Graph G(N);
	vector<int>C(N,1<<30);
	for(;M--;){
		scanf("%d%d%d",&a,&b,&c);
		G[a].emplace_back(a,b,c);
		G[b].emplace_back(b,a,c);
		C[a]=min(C[a],c+1);
		C[b]=min(C[b],c+2);
	}
	for(int i=0;i<2*N;i++)C[(i+1)%N]=min(C[(i+1)%N],C[i%N]+2);
	for(int i=0;i<N;i++){
		G[i].emplace_back(i,(i+1)%N,C[i]);
		G[(i+1)%N].emplace_back((i+1)%N,i,C[i]);
	}
	printf("%lld\n",minimumSpanningForest(G));
}

Measured memory_bytes: 40172
#include <stdio.h>
#include <math.h>
#include <string.h>
#define pai 3.1415926535

int main(void) {
	int N;
	scanf("%d", &N);
	long long int  L[86];
	L[0] = 2;
	L[1] = 1;
	for (int i = 2; i <= N; i++) {
		L[i] = L[i - 1] + L[i - 2];
	}
	printf("%lld", L[N]);

	return 0;

}

Measured memory_bytes: 128
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)

    if op == '?':
        break

    if op == '+':
        print(a + b)
    
    if op == '-':
        print(a - b)
        
    if op == '*':
        print(a * b)
    
    if op == '/':
        print(a // b)
        

Measured memory_bytes: 7636
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
#from decimal import *

X, N = MAP()
p = LIST()

if N == 0:
	print(X)
	exit()

if not X in p:
	print(X)
	exit()

i = 1
while 1:
	if not X-i in p:
		print(X-i)
		exit()
	elif not X+i in p:
		print(X+i)
		exit()
	i += 1


Measured memory_bytes: 10056
#include<bits/stdc++.h>
#define MOD 1000000007
using namespace std;


typedef unsigned int uint;
typedef unsigned long int lu;
typedef unsigned long long llu;
typedef long int ld;
typedef long long lld;
typedef vector<int> vint;
typedef vector<unsigned int> vuint;
typedef vector<unsigned long int> vlu;
typedef vector<unsigned long long> vllu;
typedef vector<long int> vld;
typedef vector<long long> vlld;
typedef priority_queue<int> p_qd;
typedef vector<char> vchar;


int main()          
{
    int n;
    cin>>n;
    vlu nums;
    llu x=0;
    while(n--)
    {
        lu temp;
        cin>>temp;
        nums.push_back(temp);
        x= (x^temp);
    }
    for(int i=0;i<nums.size();i++)
        cout<<(x^nums[i])<<" ";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 5272
#include <stdio.h>

int main(void)
{
    int a,b=0,c=0,i;
    for(i=0;i<3;i++){
        scanf("%d",&a);
        if(a==5)b++;
        else if(a==7)c++;
    }
    puts(b==2&&c==1?"YES":"NO");
    return 0;
}

Measured memory_bytes: 128
a, b, c, d = map(int, input().split())

dp = [[1 for i in range(d+1)] for j in range(c+1)]

mod = 998244353

for y in range(c+1):
    if y < a:
        continue
    for x in range(d+1):
        if x < b:
            continue
        if y == a and x == b:
            continue
        py = 0
        px = 0
        m = 0
        if y > a:
            py = dp[y-1][x] * x
        if x > b:
            px = dp[y][x-1] * y
        if y > a and x > b:
            m = dp[y-1][x-1] * (y-1) * (x-1)
        dp[y][x] = py + px - m
        dp[y][x] %= mod


print(dp[c][d])


Measured memory_bytes: 147036
import java.util.Scanner;

public class Main {

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

		int ans = 0;
		for (int i = a; i <= b; i++) {
			boolean can = true;
			String x = String.valueOf(i);
			for (int j = 0; j < x.length() / 2; j++) {
				if (x.charAt(j) != x.charAt(x.length() - j - 1)) can = false;
			}
			if (can) ans++;
		}

		System.out.println(ans);


		sc.close();
	}

}


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

using namespace std;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  while(a != 0 && c != 0)  {
    c -= b;
    if(c <= 0){cout << "Yes" << endl; break;} 
    a -= d;
    if(a <= 0){cout << "No" << endl; break;} 
  }
}


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

int main(){
	int N;
	long long int s;
	cin >> N;
	for(int i = 1;i <= N;i++){
		
		cin >> s;
		cout << "Case " << i << ":" << endl;

		for(int j = 10;j;j--){
			s *= s;
			stringstream ss;
			ss << s;
			string a = ss.str();
			int asize = a.size();
			//a.size()ÍÂÏ
			for(int k = 0;k < 8 - asize;k++){a = "0" + a;}

			ss.str("");
			ss << a.substr(2,4);
			long long int b;
			ss >> b;
			s = b;
			cout << b << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair<ll,ll>; using vp = vector<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
/////////


void solve(){
  ins(S);
  ll N = sz(S);
  vl cnt(26 , 0);
  each(x , S){
    cnt[x - 'a']++;
  }
  ll ans = N * (N - 1) / 2 + 1;
  each(x , cnt){
    ans -= 1LL * x * (x - 1) / 2;
  }
  out(ans);


}

Measured memory_bytes: 720
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <set>
#include <queue>

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

const float PI = 3.1415926;
static const int INFTY = (1<<30);

using namespace std;

typedef long long ll;
typedef long double ld;

int main() {
  vector<int> v;
  int n;
  rep(i,10){
    cin >> n;
    v.push_back(n);
  }
  sort(v.begin(), v.end(), greater<int>());
  cout << v[0] << endl;
  cout << v[1] << endl;
  cout << v[2] << endl;
  

  return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

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

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

  cout << ((a == b && a == c && b == c) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define F first
#define S second
#define SHN 1e9
#define lSHN 1e18
using namespace std;
int d[45][410][410];
int n,ai,bi;
int a[45][3];
int res=SHN;
int main()
{
	cin >>n>>ai>>bi;
	for (int i=0;i<n;i++)
	{
		cin >>a[i][0]>>a[i][1]>>a[i][2];
		for (int j=0;j<=405;j++)
		{
			for (int k=0;k<=405;k++)
			{
				if (!j && !k) d[i][j][k]=0;
				else d[i][j][k]=SHN;
			}
		}
	}
	d[0][a[0][0]][a[0][1]]=a[0][2];
	for (int i=1;i<n;i++)
	{
		for (int j=0;j<=405;j++)
		{
			for (int k=0;k<=405;k++)
			{
				d[i][j][k]=d[i-1][j][k];
				if (j<a[i][0] || k<a[i][1]) continue;
				d[i][j][k]=min(d[i][j][k],d[i-1][j-a[i][0]][k-a[i][1]]+a[i][2]); 
			}
		}
	}
	for (int i=0;i<=405;i++)
	{
		for (int j=0;j<=405;j++)
		{
			if (!i || !j) continue;
			if (j*ai!=i*bi) continue;
			res=min(res,d[n-1][i][j]);
		}
	}
	cout <<(res==SHN ? -1 : res);
	return 0;
} 

Measured memory_bytes: 26880
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
int main(){
  ll a,c=LONG_MAX,d=0,e=0;cin>>a;
  vector<ll>b(a);
  rep(i,a){
    cin>>b[i];
    d+=b[i];
  }
  for(ll i=a-1;i>=1;i--){
    d-=b[i];
    e+=b[i];
    c=min(max(d,e)-min(d,e),c);
  }
  cout<<c;
  }


Measured memory_bytes: 25216
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

int main(){
  int N, M;
  map<string, int> cards;
  string word;

  // Redカードを読み同じ単語の数をMapとして保存
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> word;
    if(!cards.count(word)){
      cards[word] = 1;
    }else{
      cards[word]++;
    }
  }

  // Blueカードを読み同じ単語の数をマイナスする
  cin >> M;
  for(int i = 0; i < M; i++){
    cin >> word;
    if(!cards.count(word)){
      cards[word] = -1;
    }else{
      cards[word]--;
    }
  } 

  // 最大値の検出
  int result = 0;
  for(auto itr = cards.begin(); itr != cards.end(); itr++){
    //cout << "Key = " << itr->first << ", val = " << itr->second << endl;
    result = max(result, itr->second);
  }

  cout << result;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

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

	ll d = a[0] + (k - a[n - 1]);

	for (int i = 1; i < n; i++)
	{
		d = max(d, a[i] - a[i - 1]);
	}

	println(k - d);
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
const ll mod = 1000000000 + 7;


int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  if (a==b && b == c) cout << "Yes" << endl;
  else cout << "No" << endl;;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




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


	int n;
	int a[100];
	cin >> n;
	rep(i, n)cin >> a[i];

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


	int ans = 0;
	int di = 1 << 30;

	rep(i,n) {
		int d = abs(s - a[i]);
		if (d < di) {
			di = d;
			ans = i;
		}
	}
	cout << ans << endl;


	return 0;
}

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

ll modPow(ll a,ll n){
  if(n==1) return a%MOD;
  if(n%2==1) return (a*modPow(a,n-1))%MOD;
  ll x=modPow(a,n/2);
  return (x*x)%MOD;
}

ll modInv(ll a){
  return modPow(a,MOD-2);
}

ll modFact(ll n){
  if(n==0 || n==1) return 1;
  return (n*modFact(n-1))%MOD;
}

ll modComb(ll n,ll r){
  ll x=1;
  for(int i=n;i>=n-r+1;i--){
    x=(x*i)%MOD;
  }
  return (x*modInv(modFact(r)))%MOD;
}

int main(){
  int n,a,b;
  cin >> n >> a >> b;
  ll x=modPow(2,n)-1;
  x=(x-(modComb(n,a)+modComb(n,b))%MOD)%MOD;
  if(x<0) x+=MOD;
  cout << x << endl;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a),i##_end_ = (b);i<=i##_end_;i++)
#define ROF(i,a,b) for(int i = (a),i##_end_ = (b);i>=i##_end_;i--)
#define MST(a,x) memset(a,x,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define ll long long
#define PB push_back
#define PH push
#define MP make_pair
#define FT first
#define SD second
#define N 100005
#define M 100005
#define INF 1000000007
#define MOD 1000000007
#define MOD2 1000000009
#define eps 1e-8
#define DEBUG_
#ifdef DEBUG_
#define DEBUG(...) fprintf(stderr,__VA_ARGS__)
#else
#define DEBUG(...)
#endif // DEBUG
using namespace std;

ll a[N];
int n;
int ok(int x)
{
    int i = 1;
    ll now = a[x];
    while(i<=n&&a[i]<=2*now)
    {
        if(i!=x)now+=a[i];
        i++;
    }
    return i == n+1;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    while(cin>>n)
    {
        FOR(i,1,n)cin>>a[i];
        sort(a+1,a+n+1);
        int l = 0,r = n;
        while(l<r-1)
        {
            int mid = (l+r)>>1;
            if(ok(mid))r = mid;
            else l = mid;
        }
        cout<<n-r+1<<endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ll = long long int;
using vec = vector<int>;
using P = pair<int,int>;
const int INF = 1e9+7;

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

  int c = 0;
  rep(i,n) {
    ll x, y; cin >> x >> y;
    if (x*x + y*y <= d*d) {
      c++;
    }
  }

  cout << c << endl;
}


Measured memory_bytes: 3648