akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <iomanip>
#include <numeric>

using namespace std;

typedef long long LL;
typedef unsigned int UI;

#define rSort(a) 		sort(a.rbegin(),a.rend())
#define Sort(a) 		sort(a.begin(),a.end())
#define Reverse(a) 		reverse(a.begin(),a.end())
#define Sum(a)  		accumulate(a.begin(), a.end(), 0)
#define REP(i, n) 		for(UI i = 0;i < n;i++)
#define REPR(i, n) 		for(UI i = n;i >= 0;i--)
#define FOR(i, m, n) 	for(UI i = m;i < n;i++)
#define pb(i) 			push_back(i)

#define MOD  			(LL)1e9 + 7;
//#define INF  			(LL)1 << 62;

const int INF=100000009;

int N, A, B, C;
vector<int>l;

int dfs(int cur, int a, int b, int c) {
	if (cur == N) {
		if (min(a, min(b, c)) > 0)
			return abs(a - A) + abs(b - B) + abs(c - C) - 30;
		else
			return INF;
	}
	int ret0 = dfs(cur + 1, a, b, c);
	int ret1 = dfs(cur + 1, a + l[cur], b, c) + 10;
	int ret2 = dfs(cur + 1, a, b + l[cur], c) + 10;
	int ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10;

	return min(min(ret0, ret1), min(ret2, ret3));
}

int main(int argc, const char * argv[]) {

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

	cin >> N >> A >> B >> C;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		l.push_back(a);
	}
	cout << dfs(0, 0, 0, 0) << endl;

	return 0;

}

Measured memory_bytes: 256
#ifndef Local
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx")
#endif

#include <bits/stdc++.h>
using namespace std;

#define popCnt(x) (__builtin_popcountll(x))
#define sz(x) ((int)(x.size()))
#define all(v) begin(v), end(v)
typedef long long Long;
typedef long double Double;

template <class U, class V>
istream& operator>>(istream& is, pair<U, V>& p) {
  is >> p.first >> p.second;
  return is;
}

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (auto& x : v) {
    is >> x;
  }
  return is;
}

template <class T>
ostream& operator<<(ostream& os, vector<T>& v) {
  for (auto& x : v) {
    os << x << " ";
  }
  return os;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
  freopen("test.in", "r", stdin);
#else
#define endl '\n'
#endif

  int x, n;
  cin >> x >> n;
  vector<int> p(n);
  cin >> p;
  sort(all(p));

  int res = -1e3;
  for (int i = -1e3; i < 1e3; ++i) {
    if (binary_search(all(p), i)) continue;
    if (abs(i - x) < abs(x - res)) {
      res = i;
    }
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 3640
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

void get(Args...)(ref Args args)
{
    import std.traits, std.meta, std.typecons;

    static if (Args.length == 1) {
        alias Arg = Args[0];
        
        static if (isArray!Arg) {
            args[0] = readln.split.to!Arg;
        } else static if (isTuple!Arg) {
            auto input = readln.split;
            static foreach (i; 0..Fields!Arg.length) {
                args[0][i] = input[i].to!(Fields!Arg[i]);
            }
        } else {
            args[0] = readln.chomp.to!Arg;
        }
    } else {
        auto input = readln.split;
        assert(input.length == Args.length);

        static foreach (i; 0..Args.length) {
            args[i] = input[i].to!(Args[i]);
        }
    }
}

void get_lines(Args...)(size_t N, ref Args args)
{
    import std.traits, std.range;

    static foreach (i; 0..Args.length) {
        static assert(isArray!(Args[i]));
        args[i].length = N;
    }

    foreach (i; 0..N) {
        static if (Args.length == 1) {
            get(args[0][i]);
        } else {
            auto input = readln.split;
            static foreach (j; 0..Args.length) {
                args[j][i] = input[j].to!(ElementType!(Args[j]));
            }
        }
    }
}

void main()
{
    int N; get(N);
    long[] AS; get(AS);
    foreach (i; 1..N) AS[i] += AS[i-1];
    int i, j = 1, k = 2;
    long p(int i) { return AS[i]; }
    long q(int i) { return AS[j] - AS[i]; }
    long r(int k) { return AS[k] - AS[j]; }
    long s(int k) { return AS[$-1] - AS[k]; }
    auto res = long.max;
    while (j < N-1) {
        while (i < j-1 && abs(p(i) - q(i)) > abs(p(i+1) - q(i+1))) ++i;
        while (k < N-2 && abs(r(k) - s(k)) > abs(r(k+1) - s(k+1))) ++k;
        res = min(res, max(p(i), q(i), r(k), s(k)) - min(p(i), q(i), r(k), s(k)));
        ++j;
    }
    writeln(res);
}

Measured memory_bytes: 11116
#include<iostream>
#include<vector>
#include<numeric>

using namespace std;

int FindRoot(std::vector<int> &L, int x){
  return (x == L[x]) ? x : L[x] = FindRoot(L, L[x]);
}

int main(){
  int N, M, K;
  cin >> N >> M >> K;

  vector<int> L(N);
  vector<int> C(N, 1);
  std::iota(L.begin(), L.end(), 0);
  
  vector<int> friendNum(N);
  for(int i=0, A, B; i<M; i++){
    cin >> A >> B;
    --A;
    --B;
    ++friendNum[A];
    ++friendNum[B];
    A = FindRoot(L, A);
    B = FindRoot(L, B);
    if (A != B) C[B] += C[A];
    L[A]  = B;
  }
  
  for(int i=0; i<N; i++) friendNum[i] = C[FindRoot(L, i)] - friendNum[i];
  
  for(int i=0, C, D; i<K; i++){
    cin >> C >> D;
    --C;
    --D;
    if(FindRoot(L, C) == FindRoot(L, D)){
      --friendNum[C];
      --friendNum[D];
    }
  }
  
  for(int i=0; i<N; i++) cout << friendNum[i]-1 << " ";
  
  return 0;
}

Measured memory_bytes: 2560
def isPrime(n):
    for i in range(2, n):
        if i * i > n:
            return 1
        if n % i == 0:
            return 0
    return 1
 
ans = 0
n = int(input())
for i in range(n):
    x = int(input())
    ans = ans + isPrime(x)
 
print(ans)


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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	ll n;
	cin >> n;
	string s;
	cin >> s;
	ll cnt = 1;
	for(int i = 1; i < n; i++) {
		if(s[i] != s[i - 1]) {
			cnt++;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 512
open Printf
open Scanf

let id x = x

let n = scanf "%d" id

let f n =
    let r = ref 0 in
    for i = 1 to n do
        if n mod i = 0 then incr r    
    done;
    !r
    
let () =
    let r = ref 0 in
    for i = 1 to n do
        if i mod 2 = 1 && f i = 8 then incr r
    done;
    printf "%d\n" !r


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<ll mod>
struct RollingHash{
	vector<ll> hash, power;

	RollingHash(const string &s, ll base=10007){
		int sz=s.size();
		hash.resize(sz+1);
		power.resize(sz+1);
		power[0]=1;
		for(int i=0; i<sz; i++){
			power[i+1]=power[i]*base%mod;
			hash[i+1]=(hash[i]*base+s[i])%mod;
		}
	}

	ll get(int l, int r) const{ // [l, r)
		ll ret=hash[r]-hash[l]*power[r-l]%mod+mod;
		if(ret>=mod) ret-=mod;
		return ret;
	}

	ll concat(ll h1, ll h2, int len2) const{ //h1+h2
		ll ret=h1*power[len2]%mod+h2;
		if(ret>=mod) ret-=mod;
		return ret;
	}
};
int main()
{
	int n; cin>>n;
	string s; cin>>s;
	const ll MOD1=1e9+7;
	const ll MOD2=1e9+9;
	RollingHash<MOD1> rh1(s);
	RollingHash<MOD2> rh2(s);
	int ans=0;
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			if(s[i]!=s[j]) continue;
			int l=1, r=min(j-i, n-j)+1;
			while(r-l>1){
				int m=(l+r)>>1;
				ll h1=rh1.get(i, i+m)-rh1.get(j, j+m), h2=rh2.get(i, i+m)-rh2.get(j, j+m);
				if(h1==0 && h2==0) l=m;
				else r=m;
			}
			ans=max(ans, l);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <cassert>

using namespace std;

typedef long long ll;
int n;
ll a, b, c, d;
#define F first
#define S second
typedef pair<ll, ll> P;

int main(void) {
  scanf("%d%lld%lld%lld%lld", &n, &a, &b, &c, &d);
  vector<P> v;
  v.push_back({a, a});
  for (int i = 0; i < n-1; i++) {
    vector<P> nv, vv;
    // printf("%d size: %zd\n", i, v.size());
    for (auto&& r : v) {
      // printf("[%lld, %lld]\n", r.F, r.S);
      if ((r.F-(n-1-i)*d <= b && b <= r.S+(n-1-i)*d)) {
        if (r.F-d <= b && b <= r.S+d) {
          nv.push_back({r.F - d, r.S - c});
          nv.push_back({r.F + c, r.S + d});
        } else if (r.S < b) {
          nv.push_back({r.F + c, r.S + d});
        } else {
          nv.push_back({r.F - d, r.S - c});
        }
      }
    }
    sort(nv.begin(), nv.end());
    /*
    for (auto&& r : nv) {
      printf("%lld %lld\n", r.F, r.S);
    }
    //*/
    for (int j = 0; j < int(nv.size()); j++) {
      ll r = nv[j].S;
      auto it = upper_bound(nv.begin()+j, nv.end(), P(r, 999999999999999999ll));
      --it;
      // printf("%d: %zd\n", j, it-nv.begin());
      vv.push_back({nv[j].F, it->S});
      j = it - nv.begin();
      /*
      int k;
      for (k = j; k < int(nv.size()); k++) {
        if (nv[k].F <= r && r <= nv[k].S) {
          r = nv[k].S;
        } else {
          break;
        }
      }
      assert(k != j);
      vv.push_back({nv[j].F, r});
      j = k - 1;
      */
    }
    /*
    puts("-------------------");
    for (auto&& r : vv) {
      printf("%lld %lld\n", r.F, r.S);
    }
    //*/
    v = std::move(vv);
  }
  bool ok = false;
  for (auto&& r : v) {
    if (r.F <= b && b <= r.S) {
      ok = true;
    }
  }
  puts(ok ? "YES" : "NO");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int mod = 1000000007;
/* struct for mod Calculation*/
struct mint {
    ll x;
    mint(ll x = 0):x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
struct combination {
    // vector size : n + 1
    vector<mint> fact, ifact;
    // precaliculation O(n)
    combination(int n):fact(n+1), ifact(n+1) {
        assert(n < mod);
        // 0! = 1;
        fact[0] = 1;
        // 1! = 0! * 1 ... n! = (n-1)! * n
        for (int i = 1; i <= n; i++) fact[i] = fact[i-1] * i;
        // 1/n! = n!^(-1)
        ifact[n] = fact[n].inv();
        // (n-1)!^(-1) = n!^(-1) * n ... 0!^(-1) = 1!^(-1) * 1
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i] * i;
    }
    // combination O(1)
    // nCk = n! / (k! * (n-k)!)
    //     = n! * k!^(-1) * (n-k)!^(-1)
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n-k];
    }
};
/* global variables */
/* function */
/* main */
int main(){
    int N, K;
    cin >> N >> K;
    combination c = combination(4000);

    for (int i = 1; i <= K; i++) {
        mint ans = 0;
        mint a = c(N - K + 1, i);
        mint b = c(K - 1, i - 1);
        ans += a * b;
        cout << ans << '\n';
    }
}

Measured memory_bytes: 256
#include <stdio.h>

void print_array(const int* array, int num) {
	int i;
	for (i = 0; i < num; i++) {
		printf(" %d" + !i, array[i]);
	}
	putchar('\n');
}

int main(void) {
	int N;
	int A[128];
	int i, j;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	print_array(A, N);
	for (i = 1; i < N; i++) {
		int v = A[i];
		for (j = i - 1; j >= 0 && A[j] > v; j--) A[j + 1] = A[j];
		A[j + 1] = v;
		print_array(A, N);
	}
	return 0;
}



Measured memory_bytes: 2124
let rec ignore_n n l = match n with
    | 0 -> l 
    | n -> ignore_n (n-1) (List.tl l) 

let rec diff_rev f l =
    let rec g acc = function
    | x :: y :: [] -> (f x y) :: acc
    | x :: y :: tl -> g ((f x y) :: acc) (y :: tl)
    | _ -> assert false
    in g [] l


let () =
    Scanf.scanf "%d %d\n" @@ fun n m ->
        let arr = Array.init m (fun _ -> Scanf.scanf " %d" (fun x -> x)) in
        if n >= m
        then print_endline "0"
        else arr
            |> Array.to_list
            |> List.sort (-)
            |> diff_rev (-)
            |> List.sort (-)
            |> ignore_n (n-1)
            |> List.fold_left (+) 0
            |> fun x -> Printf.printf "%d" (-x)


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

int main(){
	ll n,m;
	cin >> n >> m;
	vector<ll> x(m);
	rep(i,m) cin >> x[i];
	sort(x.begin(),x.end());
	vector<ll> sa(m-1);
	rep(i,m-1) sa[i] = x[i+1] - x[i];
	sort(sa.rbegin(),sa.rend());
	if(n > m){
		cout << 0 << endl;
		return 0;
	}
	ll ans = x[m-1] - x[0];
	rep(i,n-1) ans -= sa[i];
	cout << ans << endl;
    return 0;
}



Measured memory_bytes: 4732
def resolve():
    '''
    code here
    '''
    N, M = [int(item) for item in input().split()]
    A = [int(item) for item in input().split()]
    
    cnt = 0
    A_sum = sum(A)
    for a in A:
        if 1 / (4 * M) * A_sum <= a:
            cnt += 1

    if cnt >= M:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3064
n = int(input())
s = 0
minb = float("inf")
f = False
for _ in range(n):
  a, b = map(int, input().split())
  if a > b:
    f = True
    minb = min(b, minb)
  s += a
if f:
  print(s - minb)
else:
  print(0)

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<int,int> P;
int const INF=1001001001;
ll const LINF=1001001001001001001;
ll const MOD=1000000007;

struct unionFind{
    int* par;                       //親
    int* rank;                      //木の深さ
    int* scale;                     //木のサイズ
    unionFind(int n);
    ~unionFind();
    int find(int x);                //木の根を求める
    void unite(int x,int y);        //xとyの属する集合を併合
    bool same(int x,int y);         //xとyが同じ集合に属するか否か
    int size(int x);                //xの属する集合のサイズ
};

unionFind::unionFind(int n){
    par=new int[n];
    rank=new int[n];
    scale=new int[n];
    for(int i=0;i<n;i++){
        par[i]=i;
        rank[i]=0;
        scale[i]=1;
    }
}

unionFind::~unionFind(){
    delete[] par;
    delete[] rank;
    delete[] scale;
}

int unionFind::find(int x){
    if(par[x]==x) return x;
    return par[x]=find(par[x]);
}

void unionFind::unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y) return;
    if(rank[x]<rank[y]){
        par[x]=y;
        scale[y]+=scale[x];
    }else{
        par[y]=x;
        scale[x]+=scale[y];
        if(rank[x]==rank[y]) rank[x]++;
    }
}

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

int unionFind::size(int x){
    x=find(x);
    return scale[x];
}

int N,M;
int A[200000], B[200000];

int main(){
    cin>>N>>M;
    rep(i,M) cin>>A[i]>>B[i];

    unionFind uf(N+1);
    rep(i,M){
        uf.unite(A[i],B[i]);
    }
    
    int ans=0;
    repn(i,N){
        ans=max(ans,uf.size(i));
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 7212
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>

using namespace std;
int main() {

	int n;
	long long a[100000];
	int A = 0;
	

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n, greater<long long>());
	
	for (int i = 0; i < n; i++) {
		if (i + 1 == n)break;
		if (A==0 && a[i] == a[i + 1]) {
			A = a[i];
			i++;
		}
		else if (a[i] == a[i + 1]) {
			cout << A * a[i] << endl;
			return 0;
		}

	}
	cout << 0 << endl;

	return(0);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

VI a, ans, dp;
vector<VI> g;
stack<pair<int, int>> s;
void dfs(int now, int par) {
    auto itr = lower_bound(all(dp), a[now]);
    s.emplace(itr - dp.begin(), *itr);
    *itr = a[now];
    ans[now] = lower_bound(all(dp), mod) - dp.begin();
    each(to, g[now]) {
        if (to == par)continue;
        dfs(to, now);
    }
    auto [idx, val] = s.top(); s.pop();
    dp[idx] = val;
}
int main() {
    init();

    int n; cin >> n;
    a.resize(n); cin >> a;
    g.resize(n);
    FOR(i, 0, n - 1) {
        int x, y; cin >> x >> y;
        --x, --y;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    ans.resize(n), dp.resize(n, mod);
    dfs(0, -1);
    each(i, ans)cout << i << "\n";
}


Measured memory_bytes: 35332
inp = list(input())
flag = True
if inp.pop(0) != "A":
    flag = False
if inp[1:-1].count("C") != 1:
    flag = False
else:
    inp.remove("C")
if not "".join(inp).islower():
    flag = False
if flag:
    print("AC")
else:
    print("WA")


Measured memory_bytes: 2940
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class ABC107_1 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int ii = in.nextInt();

            out.println(N - ii + 1);
        }

    }
}



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

using namespace std;
#define ll long long
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;
typedef pair<int,int>           PI;
typedef pair<ll,ll>             PL;
typedef vector<PI>               vip; 
typedef vector<int>             vi;
typedef vector<vi>              vvi;

struct edge{
    PI to;
    int cost;

};

struct node{
    PI v;
    int cost;
    bool operator<(const node & right) const{
        return cost > right.cost;
    }

};

const int INF = 1e9+100;



int main (){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    map<PI, vector<edge> > graph;//pi key
    map<PI, int> dist;//keyにpairをとりたいので必然的にmap
    for(int i = 0; i < m; i++){
        int a,b,c;
        cin >> a >> b >> c;
        --a;
        --b;
        graph[{a,c}].push_back({{b,c}, 0});
        graph[{b,c}].push_back({{a,c}, 0});
        graph[{a,0}].push_back({{a,c}, 1});
        graph[{b,0}].push_back({{b,c}, 1});
        graph[{a,c}].push_back({{a,0}, 0});
        graph[{b,c}].push_back({{b,0}, 0});
    }
    for(auto x: graph){
        dist[x.first] = INF;
    }

    dist[{n-1,0}] = INF;
    priority_queue<node> que;

    que.push({{0,0}, 0});
    while(!que.empty()){
        node now = que.top();
        que.pop();
        if(dist[now.v] < now.cost) continue;

        for(auto x: graph[now.v]){
            if(dist[x.to] > now.cost + x.cost){
                dist[x.to] = now.cost + x.cost;
                que.push({x.to, dist[x.to]});
            }
        }
    }
    if(dist[{n-1,0}] < INF) cout << dist[{n-1,0}] << endl;
    else cout << -1 << endl;





    return 0;
}

Measured memory_bytes: 95392
import java.util.Scanner;

  public class Main {

    public static void main(String[] args) {
      int x = Integer.parseInt(new Scanner(System.in).nextLine());
      int c500 = x/500;
      int r500 = x%500;
      int c5 = r500/5;
      System.out.printf("%d\n",c500*1000+c5*5);
    }
  }

Measured memory_bytes: 23252
#include <iostream>
using namespace std;
int c[10][10];

int main() {
    int N; cin >> N;
    for (int i = 1; i <= N; i++) {
        if (i % 10 == 0) continue;
        int l = i, r;
        while (l > 9) l /= 10;
        r = i % 10;
        c[l-1][r-1]++;
    }
    int ans = 0; 
    for (int i = 0; i < 9; i++) {
        for (int j = 0; j < 9; j++) {
            ans += c[i][j] * c[j][i];
        }
    }
    cout << ans << endl;
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  char c; cin >> c;
  cout << char(c + 1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 50005
#define re register
#define ll long long
#define P 998244353
using namespace std;
bool m1;
int n,m,K;
inline void Rd(int &res){
	re char c;res=0;
	while(c=getchar(),c<48);
	do res=(res<<3)+(res<<1)+(c^48);
	while(c=getchar(),c>47);
}
struct Point{
	double x,y;
	Point operator+(const Point&a)const{return (Point){x+a.x,y+a.y};}
	Point operator-(const Point&a)const{return (Point){x-a.x,y-a.y};}
	Point operator*(const double&v)const{return (Point){x*v,y*v};}
	double operator*(const Point&a)const{return x*a.x+y*a.y;}
	double operator^(const Point&a)const{return x*a.y-y*a.x;}
	double len(){return sqrt(x*x+y*y);}
}p1,p2,p,p0;
bool m2;
int main(){
	scanf("%lf%lf%lf%lf",&p0.x,&p0.y,&p1.x,&p1.y);
	Point p3=p1-p0;
	double l=p3.len();
	int q;Rd(q);
	while(q--){
		scanf("%lf%lf",&p2.x,&p2.y);
		double l1=(p3^(p2-p0))/l;
		if(fabs(l1)<1e-7){
			Point p01=p1-p0;
			Point p02=p2-p0;
			double res=p01*p02;
			if(res+1e-8<0){puts("ONLINE_BACK");continue;}
			Point p10=p0-p1;
			Point p12=p2-p1;
			res=p10*p12;
			if(res+1e-8<0)puts("ONLINE_FRONT");
			else puts("ON_SEGMENT");
		}
		else if(l1>0)puts("COUNTER_CLOCKWISE");
		else puts("CLOCKWISE");
	}
	return 0;
}


Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};


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

    unsigned long n;
    cin >> n;
    vector<unsigned long> a(n);
    unsigned long ans = 1;
    unsigned long before = 1;
    unsigned long N = 1;
    rep(i,18){
        N*=10;
    }
    rep(i,n){
        cin >> a[i];
        if(a[i]==0){cout << 0 << endl; return 0;}
    }
    rep(i,n){
        before  = ans;
        ans*= a[i];
        if(ans/a[i] != before)dame
        if(ans>N) dame
    }
    cout << ans << endl;

    return 0;
}

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

using ll = long long;
using p = pair<ll, ll>;
constexpr ll INF = 1LL << 62;

int main(void) {
  ll A, B, C;
  cin >> A >> B >> C;
  if (A == B && A == C) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int L = Integer.parseInt(sc.next());
		int a = N * L;
		int b = N * (N - 1) / 2;
		
		if(L >= 0) {	
			int result = a + b - L;
			System.out.println(result);
		}else if(L < 0) {
			int last = L + N -1;
			if(last < 0) {
				int res = a + b - last;
				System.out.println(res);
			}else {
				System.out.println(a + b);
			}
		}
	}

}


Measured memory_bytes: 21716
/* # */

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <deque>
#include <map>
#include <iomanip>
#include <functional>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <cstring>
//#pragma warning(disable:4996)

using namespace std;


/** Type Define **/
typedef long long int           ll;
typedef pair<int, int>          pii;
typedef pair<ll, ll>            pll;
typedef vector<string>          vs;
typedef vector<bool>            vb;
typedef vector<int>             vi;
typedef vector<long long>		vl;
typedef vector<vi>              vvi;
typedef vector<vl>				vvl;
typedef vector<char>            vch;
#define		it(x)  x.begin() 
#define		all(x)  x.begin(), x.end()
#define		pb(x)   push_back(x)
constexpr int           inf = 0x3f3f3f3f;
constexpr long long 	INF = 9123456789123456789;
constexpr long long     MOD = 1000000007LL;
/*************************************************/
void sol() {
    int k, a, b;
    cin >> k >> a >> b;

    int chk = 0;
    while (chk <= b) {
        if (chk >= a && chk <= b) {
            cout << "OK\n";
            return;
        }
        
        chk += k;
    }

    cout << "NG\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cin.tie(nullptr);
    int T(1);
    while (T--)
        sol();


    return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end());
using namespace std;
#define INF 2000000000
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;

int main(){
	int a , b , c , x ;
	cin >> a >> b >> c >> x;
	int ans = 0 ;
	for(int i = 0 ; i <= a ; i++){
		for(int j = 0 ; j <=b ; j++){
			for(int k = 0 ; k<= c; k++){
				if(500*i + 100 * j + 50 * k == x ){
					ans++;
				}
			}
		}
	}
	cout<<ans<<endl;
}


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

using namespace std;
typedef long long ll;

struct edge{
    ll to,c;
};

edge e[maxn];
ll h[maxn],nxt[maxn];
ll a[maxn],n,m,p,s,t,dis[maxn],sz[maxn];
ll inf,ans;

void add_edge(ll x,ll y,ll z)
{
    e[p].to=y;e[p].c=z;nxt[p]=h[x];h[x]=p;sz[x]++;p++;
    e[p].to=x;e[p].c=0;nxt[p]=h[y];h[y]=p;sz[y]++;p++;
}

bool bfs()
{
    queue <ll> q;
    for (ll i=1;i<=n+1;i++) dis[i]=-1;
    dis[s]=0;
    q.push(s);
    while (!q.empty()){
        ll cur=q.front();q.pop();
        for (ll i=h[cur];i!=-1;i=nxt[i])
        {
            ll tt=e[i].to;
            if (dis[tt]==-1&&e[i].c>0){
                dis[tt]=dis[cur]+1;
                q.push(tt);
            }
        }
    }
    return (dis[t]!=-1);
}

ll findf(ll x,ll flow)
{
    if (x==t) return flow;
    ll a;
    for (ll i=h[x];i!=-1;i=nxt[i])
    {
        ll tt=e[i].to;
        if (dis[tt]==dis[x]+1&&e[i].c>0&&(a=findf(tt,min(flow,e[i].c)))){
            e[i].c-=a;
            e[i^1].c+=a;
            return a;
        }
    }
    return 0;
}

ll dinic()
{
    ll tmp,ans;ans=0;
    while (bfs()){
        tmp=findf(s,inf);
        ans+=tmp;
    }
    return ans;
}

int main()
{
    scanf("%d",&n);
    s=0;t=n+1;ans=0;
    inf=n*(ll)1000000000;
    memset(h,-1,sizeof(h));
    for (int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        if (a[i]>0){
            ans+=a[i];
            add_edge(i,t,a[i]);
        }
        else if (a[i]<0) add_edge(s,i,-a[i]);
    }
    for (int i=1;i<=n;i++)
        for (int j=1;i*j<=n;j++)
            add_edge(i,i*j,inf);
    printf("%lld\n",ans-dinic());
    return 0;
}


Measured memory_bytes: 12544
def main():
    k = int(input())
    inputs = input().split(' ')
    start = int(inputs[0])
    end = int(inputs[1])
    
    if start == end:
        if start % k == 0:
            print('OK')
        else:
            print('NG')

    else:
        if (start % k == 0) or (end % k == 0):
            print('OK')
        else:
            if (end - start) >= k:
                print('OK')
            else:
                for i in range(start, end):
                    if i % k == 0:
                        print('OK')
                        break
                    elif i == end - 1:
                        print('NG')
                        break
                    else:
                        pass

if __name__ == '__main__':
    main()

Measured memory_bytes: 9212
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
ll calc(ll n,ll k){
    if(n%k==0) return n/k;
    else return n-k;
}
vector<ll> divisor(ll n){
    vector<ll> div;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            if(i!=1) div.push_back(i);
            if(i*i!=n) div.push_back(n/i);
        }
    }
    return div;
}
void Main(){
    ll n;cin>>n;
    vector<ll> div1=divisor(n);
    vector<ll> div2=divisor(n-1);
    for(auto i:div1){
        ll n2=n;
        while(n2>=i) {
            n2=calc(n2,i);
            if(n2%i==1) {
                ans++;
                break;
            }
            if(n2%i>1) {
                break;
            }
        }
    }
    ans+=div2.size();
    cout<<ans<<endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

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

int top, S[1000];

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

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

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

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

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

	return 0;
}


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

int main(){
  int N;
  cin >>N;
  
  bool suc = 0;
  
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      if(N == i*j){
        suc = 1;
      }
    }
  }
  
  if(suc) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define sidha(i,a,b) for(int i=a;i<b;i++)
#define vi vector<int> 
#define pb push_back
#define st string
#define pairi pair<int,int>
#define m 1000000007 

bool isPrime(int n){
	if(n<=1) return false;
	if(n<=3) return true;
	if(n%2==0 || n%3==0) return false;
	for(int i=5;i*i<=n;i+=6){
		if(n%i==0 || n%(i+2)==0) return false;
	}
	return true;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
	int n;cin>>n;
	int arr[n][2];
	int c=0;
	for(int i=0;i<n;i++){
		cin>>arr[i][0]>>arr[i][1];
	}
	sidha(i,0,n){
		if(arr[i][0]==arr[i][1]){
			c++;
		}
		else{
			c=0;
		}

		if(c==3){
			cout<<"Yes"<<endl;
			exit(0);
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3640
//#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;

// ?????¬???????????¬??????
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), c.end()

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


// ??°?????????????????¬??????
typedef int 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 :
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;


int main() {
  int H, W;
  while(true) {
    scanf("%d %d", &H, &W);
    if(H==0 && W==0) break;
    rep(i, H) {
      rep(i, W) printf("#");
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

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

int main(){
    string S;
    cin >> S;
    if(S.at(2) == S.at(3) && S.at(4) == S.at(5)) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } };
    ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ( $ next : expr ) => { };
    ( $ next : expr , ) => { };
    ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) };
    ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) };
    ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) };
    ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

#[allow(unused_macros)]
macro_rules! chmax {
    ( $ x : expr , $ y : expr ) => { if $ x < $ y { $ x = $ y ; true } else { false } };
}

fn main() {
    input! {
        n: usize,
        m: usize,
        xy: [(usize1, usize1); m]
    }
    let mut g = vec![vec![];n];
    for &(x, y) in xy.iter() {
        g[x].push(y);
    }

    let mut max = 0u64;
    let mut dp = vec![None;n];
    for i in 0..n {
        chmax!(max, rec(&g, &mut dp, i));
    }
    println!("{}", max);
}

fn rec(g: &[Vec<usize>], dp: &mut [Option<u64>], c: usize) -> u64 {
    if let Some(src) = dp[c] {
        return src;
    }
    let mut max = 0u64;
    for &v in &g[c] {
        chmax!(max, rec(g, dp, v) + 1);
    }
    dp[c] = Some(max);
    max
}

Measured memory_bytes: 18684
N = int(input())
H = map(int, input().split())
before = 99999
ans = 0
tmp = -1
for h in H:
    if before >= h:
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 0
    before = h
ans = max(ans, tmp)
print(ans)


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

int main() {
int n,b[100000]={0},c=0;
cin>>n;
for(int i=0;i<n;i++){
    int a;
    cin>>a;
    b[a]++;
}
for(int i=2;i<100000;i++){
    int d=b[i-2]+b[i-1]+b[i];
    if(c<d){
        c=d;
    }
}
cout<<c<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#define M_PI 3.14159265358979

int main()
{
	double r, l, S, pi;

	pi = M_PI;

	scanf ("%lf", &r);

	l = 2 * r * pi;
	S = r * r * pi;

	printf ("%lf %lf\n", S, l);

	return 0;
}


Measured memory_bytes: 2052
N = int(input())
a = []
for i in range(N):
    b = int(input())
    a.append(b)

c = sorted(a)
a1 = c[-1] 
a2 = c[-2]

for j in range(N):
    if a[j]==a1:
        print(a2)
    else:
        print(a1)

Measured memory_bytes: 14112
#include <stdio.h>

int main(void){
    int n,T,sum;
    int t[200000];
    int i;
    int base,crnt,prev;
    scanf("%d %d",&n,&T);
    for(i=0;i<n;i++){
        //t[i]はi番目の人がボタンを押すタイミング
        scanf("%d",&t[i]);
    }
    base=0;
    crnt=0;
    while(1){
        int prev=base;
        //隣接する配列の差がTよりも大きくなるまで
    while((t[crnt]-t[prev]<T)){
        if(crnt==n-1){
            sum+=(t[crnt]-t[base])+T;
            printf("%d\n",sum);
            return 0;
        }
        //最初はcrntのみ
        if(crnt==prev){
            crnt++;
        }else{
        crnt++;
            prev++;
        }
        
    }
        sum+=(t[prev]-t[base])+T;
        base=crnt;
        prev=crnt;
    }
    printf("%d\n",sum);
}


Measured memory_bytes: 896
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define fi first
#define se second
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return M_PI;
}
typedef set<int> set_i;
typedef set<string> set_s;
int main(){
	int n;
	cin>>n;
	fu(0,n){
		vi a(3,0);
		cin>>a[0]>>a[1]>>a[2];
		sort(a.rbegin(), a.rend());
		if(a[0]*a[0]==a[1]*a[1]+a[2]*a[2]) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

Measured memory_bytes: 1188
import java.util.*;
class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int k=0;
    while(n>0)
    {
      int d=n%10;
      if(d==7){
        k=1;
        System.out.println("Yes");
        break;
      }
      else
        n/=10;
    }
    if(k==0)
      System.out.println("No");
  }
}


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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll A, B, Q;
    cin >> A >> B >> Q;
    vector<ll> s(A), t(B), x(Q);
    REP(i, A) cin >> s[i];
    REP(i, B) cin >> t[i];
    REP(i, Q) cin >> x[i];

    REP(i, Q)
    {
        ll dist = LONG_MAX;
        auto iterS = upper_bound(s.begin(), s.end(), x[i]);
        auto iterT = upper_bound(t.begin(), t.end(), x[i]);
        vector<int> indexS, indexT;
        if (iterS == s.begin()) indexS.push_back(0);
        else if (iterS == s.end()) indexS.push_back(A - 1);
        else
        {
            int index = distance(s.begin(), iterS);
            indexS.push_back(index);
            indexS.push_back(index - 1);
        }
        if (iterT == t.begin()) indexT.push_back(0);
        else if (iterT == t.end()) indexT.push_back(B - 1);
        else
        {
            int index = distance(t.begin(), iterT);
            indexT.push_back(index);
            indexT.push_back(index - 1);
        }
        REP(j, 2)
        {
            for (auto si = indexS.begin(); si != indexS.end(); ++si)
            {
                for (auto ti = indexT.begin(); ti != indexT.end(); ++ti)
                {
                    if (j == 0) dist = min(dist, abs(x[i] - s[*si]) + abs(s[*si] - t[*ti]));
                    else dist = min(dist, abs(x[i] - t[*ti]) + abs(s[*si] - t[*ti]));
                }
            }
        }
        cout << dist << endl;
    }
}


Measured memory_bytes: 3712
n,m= gets.split(" ").map(&:to_i)
min = 0
max = n
m.times do
    l,r= gets.split(" ").map(&:to_i)
    if l > min
        min = l
    end
    if r < max
        max = r
    end
end

puts [max - min + 1,0].max

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

int main() {
  int n, q, t = 0;
  cin >> n >> q;
  vector<string> names(n); 
  vector<int> times(n);
  queue<int> que;
  REP(i, n) {
    cin >> names[i] >> times[i];
    que.push(i);
  }
  
  while (!que.empty()) {
    auto idx = que.front();
    que.pop();
    if (times[idx] <= q) {
      t += times[idx];
      cout << names[idx] << " " << t << endl;
    } else {
      t += q;
      times[idx] -= q;
      que.push(idx);
    }
  }
}



Measured memory_bytes: 6040
#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,s[200];
    int ans = 0;

    Scd(n);
    Rep(i,n){
        Scd(s[i]);
        ans += s[i];
    }
    sort(s,s+n);

    if( ans % 10 == 0 )
    Rep(i,n+1){
        if( i == n ) {
            ans = 0;
            break;
        }
        if(s[i]%10) {
            ans-=s[i];
            break;
        }
    }

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

    return 0;
}



Measured memory_bytes: 256