akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
ll N, K;
string S;
bool field[200010];
bool Last = true;
bool ans[200001];
int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> K >> S;
    if(N % 2 == 0) Last = false;
    for(int i = 0; i < N; i++) {
        field[i] = S[i] == 'A';
    }
    for(int i = 0; i < N; i++) {
        if(i & 1) field[i] ^= true;
    }
    int idx = 0;
    for(idx = 0; idx < N; idx++) {
        //cerr << idx << " " << K << " " << field[idx] << endl;
        if(K == 0) break;
        K--;
        if(field[idx]) {
            field[idx] = false;
            idx--;
            continue;
        }
    }
    //cerr << idx << endl;
    //for(int i = 0; i < N; i++) cerr << field[i];
    //cerr << endl;
    if(K == 0) {
        for(int i = 0; i + idx < N; i++) {
            ans[i] = field[i+idx];
        }
        for(int i = N-idx; i < N; i++) {
            ans[i] = Last;
        }
    } else {
        for(int i = 0; i < N; i++) {
            ans[i] = Last;
        }
        if(K % 2 == 1 and N % 2 == 1) {
            ans[0] ^= true;
        }
    }
    for(int i = 0; i < N; i++) {
        if(i & 1) ans[i] ^= true;
        if(ans[i]) cout << "A";
        else cout << "B";
    }
    cout << endl;
    return 0;
}


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

int remain(int w[], int n, int k, int p) {
	int i, j = 0;
	int sum = 0;
	for (i = 0; i < n; ++i) {
		if (sum + w[i] <= p) {
			sum += w[i];
		} else {
			j++;
			if (j >= k || w[i] > p) {
				break;
			}
			sum = w[i];
		}
	}
	return (n - i);
}

int main()
{
	int w[100000];
	int n, k;
	scanf("%d %d", &n, &k);
	int sum = 0;
	for (int i = 0; i < n; ++i) {
		scanf("%d", &w[i]);
		sum += w[i];
	}

	int l = 0, r = sum, mid;
	while (l != r) {
		mid = (l + r) / 2;
		if (remain(w, n, k, mid) > 0) {
			l = mid + 1;
		} else {
			r = mid;
		}
	}
	cout << l << endl;
}

Measured memory_bytes: 1600
import java.util.Scanner;

public class Main{
	private static Scanner scan;
	public static void main(String[] args) {
		scan = new Scanner(System.in);
		while(scan.hasNext()){
			double v,t,y,f;
			int N;
			v = Double.parseDouble(scan.next());
			t = v / 9.8;
			y = 4.9 * Math.pow(t,2);
			f = (y + 5.0)/ 5.0;
			N = (int)Math.ceil(f);
			System.out.println(N);
		}
		System.exit(0);
	}

}

Measured memory_bytes: 12000
n=int(input())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
c=list(map(int, input().split()))

ans = b[a[0]-1]
for i in range(1,n):
    ans += b[a[i]-1]
    if a[i] == a[i-1]+1:
        ans += c[a[i-1]-1]
 
print(ans)

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

const auto EPS = 1e-10;
const auto INF = 100000000;
const auto MOD = 1000000007;

int H, W, h, w;
int ans[500][500];

int main(){
    cin >> H >> W >> h >> w;
    rep(i,H) rep(j,W) ans[i][j] = 1;
    int cnt = 0;
    for(int hh = h-1; hh < H; hh += h) {
        for(int ww = w-1; ww < W; ww += w) {
            cnt++;
            ans[hh][ww] = -1*h*w;
        }
    }
    if(cnt*h*w < H*W-cnt) {
        cout << "Yes" << endl;
        rep(i,H){
            rep(j,W){
                cout << ans[i][j];
                if(j != W-1) cout << " ";
                else cout << endl;
            }
        }
        return 0;
    }
    int dif = cnt*h*w-(H*W-cnt);
    if(H%h != 0) {
        dif++;
        for(int hh = 0; hh < H; hh += h) {
            ans[hh][0] += dif;
        }
        for(int hh = h-1; hh < H; hh += h) {
            ans[hh][w-1] -= dif;
        }
    } else if(W%w != 0) {
        dif++;
        for(int ww = 0; ww < W; ww += w) {
            ans[0][ww] += dif;
        }
        for(int ww = w-1; ww < W; ww += w) {
            ans[h-1][ww] -= dif;
        }
    } else {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    rep(i,H) {
        rep(j,W) {
            cout << ans[i][j];
            if(j != W-1) cout << " ";
            else cout << endl;
        }
    }
}
































Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, a, b, c, d;
  
  cin >> N;
  d=N%10;
  N/=10;
  c=N%10;
  N/=10;
  b=N%10;
  N/=10;
  a=N%10;
  
  if ((a==b && b==c)||(b==c && c==d)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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


        signed main() {
             string s;
             cin>>s;
             if(s=="AAA"||s=="BBB")cout<<"No";
             else cout<<"Yes";

        
        
        


      }


        


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

X,N = map(int,S().split())
p = LI()
p = sorted(p)

for i in range(N+2):
    if not (X-i in p):
        print(X-i)
        exit()
    if not (X+i in p):
        print(X+i)
        exit()

Measured memory_bytes: 61824
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
const int MAXN = 2e6 + 7;
inline int add(int x, int y) {int res = x + y; if (res >= mod) res -= mod; return res;}
inline int mul(int x, int y) {ll res = (ll)x * y; res -= res / mod * mod; return res;}
int fac[MAXN], inv[MAXN];
int ksm(int a, int b)
{
    int res = 1;
    while (b)
    {
        if (b & 1) res = mul(res, a);
        a = mul(a, a);
        b /= 2;
    }
    return res;
}
inline int C(int n, int m) {return mul(fac[n], mul(inv[m], inv[n - m]));}
int main()
{
    int x, y; scanf("%d%d", &x, &y);
    int a = (2 * y - x) / 3, b = (2 * x - y) / 3;
    if (a * 3 != 2 * y - x || b * 3 != 2 * x - y || a < 0 || b < 0) 
    {
        puts("0");
        return 0;
    }
    int N = 2000000;
    fac[0] = 1; for (int i = 1; i <= N; i++) fac[i] = mul(fac[i - 1], i);
    inv[N] = ksm(fac[N], mod - 2); for (int i = N; i; --i) inv[i - 1] = mul(inv[i], i);
    printf("%d\n", C(a + b, b));
    return 0;
}

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

int main()
{
  int a, b;
  cin >> a >> b;
  if (a < b) {
    cout << "a < b" << endl;
  } else if (a == b) {
    cout << "a == b" << endl;
  } else {
    cout << "a > b" << endl;
  }

  return 0;
}

Measured memory_bytes: 3072
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int K, S;
	cin >> K >> S;
	int ans = 0;
	REP(i, K + 1)
	{
		if (i > S) break;
		REP(j, K + 1)
		{
			int k = S - i - j;
			if (0 <= k && k <= K)
				ans++;
		}
	}
	print(ans);
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


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

int main()
{
    ll N;
    cin >> N;
    ll fst = 0, snd = 0, now;
    int fidx;
    rep(i, N)
    {
        cin >> now;
        if (fst <= now)
        {
            snd = fst;
            fst = now;
            fidx = i;
        }
        else if (snd < now)
        {
            snd = now;
        }
    }
    rep(i, N)
    {
        if (i == fidx)
            cout << snd << "\n";
        else
            cout << fst << "\n";
    }
    cout << flush;

    return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
    ll n;
    cin >> n;
    ll a[n], b[n], c[n];
    for (ll i = 0; i < n; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }
    for (ll i = 1; i < n; i++) {
        a[i] += max(b[i - 1], c[i - 1]);
        b[i] += max(c[i - 1], a[i - 1]);
        c[i] += max(b[i - 1], a[i - 1]);
    }
    cout << max(max(a[n - 1], b[n - 1]), c[n - 1]) << endl;
    return 0;
}

Measured memory_bytes: 2560
n,d=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
def dis(a,b):
    ret=0
    for x,y in zip(a,b):
        ret+=(x-y)**2
    return int(ret**(1/2))**2==ret
ans=0
for i in range(n):
    for j in range(i+1,n):
        if dis(l[i],l[j]):ans+=1
print(ans)

Measured memory_bytes: 3064
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

typedef vector<vector<int>> G;
G graph;

int color[100050];

//二部グラフ判定
bool dfs(int u, int c) {
	//色ぬって
	color[u] = c;

	//隣接した頂点へ遷移
	for (int i = 0; i < graph[u].size(); i++) {

		//隣接した頂点を取得
		int v = graph[u][i];

		//色が塗ってあって、しかも同じいろなら二部グラフでない
		if (color[v] == c) {
			return false;
		}

		//色が塗ってないなら、色を反転して遷移
		if (color[v] == 0 && !dfs(v, -c)) {
			return false;
		}
	}

	//全部の頂点巡れたら二部グラフ
	return true;
}

int main() {

	LL n, m; cin >> n >> m;
	graph = G(n);

	for (int i = 0; i < m; i++) {
		int x, y; cin >> x >> y;
		x--; y--;
		graph[x].push_back(y);
		graph[y].push_back(x);
	}

	LL B = 0, W = 0;
	if (dfs(0, 1)) {
		for (int i = 0; i < n; i++) {
			if (color[i] == 1) {
				B++;
			}
			else if (color[i] == -1) {
				W++;
			}
		}
		//任意の白から黒に辺が張られる
		cout << B * W - m << endl;
	}
	else {
		//最後が完全グラフになる。
		//もともとm本あって、完全グラフにするには
		cout << ((n*(n - 1) / 2)) - m << endl;
	}

	return 0;
}

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

int main()
{
    unsigned long long int h;
    unsigned long long int w;
    unsigned long long int mul;

    cin >> h >> w;
    if (h == 1 || w == 1)
    {
        cout << 1;
        return (0);
    }

    mul = h * w;
    if (mul%2==0)
        cout << mul / 2;
    else
        cout << mul / 2 + 1;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools, bisect
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def S(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]

alphabets = "abcdefghijklmnopqrstuvwxyz"

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

def main():
    N, K = LI()
    A = LI()

    for i in range(K, N):
        print("Yes" if A[i] > A[i - K] else "No")


if __name__ == '__main__':
    main()

Measured memory_bytes: 97848
#include <iostream>
#include <cstdio>
#include <string.h>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

int main(){
    long long n;
    map<long long, long long> dl;
    map<long long, long long> dr;

    cin >> n;

    long long a[n + 1];

    for(long long i = 1; i <= n; i++){
        cin >> a[i];
    }

    long long l[n + 1], r[n + 1];

    long long maxv = 0;

    for(long long i = 1; i <= n; i++){
        l[i] = i + a[i];
        r[i] = i - a[i];
        maxv = max(r[i], maxv);
    }

    //printf("maxv %lld\n", maxv);

    for(long long i = 1; i <= n; i++){
        dl[l[i]] = 0;
        dr[r[i]] = 0;
    }
    
    for(long long i = 1; i <= n; i++){
        dl[l[i]]++;
        dr[r[i]]++;
    }

    /*for(long long i = 1; i <= n; i++){
        printf("dl %lld l %lld \n", dl[l[i]], l[i]);
        printf("dr %lld r %lld\n", dr[r[i]], r[i]);
    }*/

    long long count = 0;

    long long c, d;

    for(long long x = 2; x <= maxv; x++){
        c = dl[x];
        d = dr[x];
        if(c > 0 and d > 0){
            count = count + c * (d);
        }

        
    }

    printf("%lld\n", count);
    

    

    return 0;
}

Measured memory_bytes: 51000
#include <cstdio>
	int m, n;
int GCD(int m, int n)
{
    while( 1 )
    {
        m = m % n;
		if( m == 0 )
			return n;
		n = n % m;

        if( n == 0 )
			return m;
    }
}
int LCM( int m, int n )
{
		
	return ((m / GCD(m, n)) * n); // lcm = m * n / gcd(m,n)
}
int main()
{
	while(scanf("%d%d",&m,&n)!=EOF)
	{

		printf("%d %d\n",GCD(m,n),LCM(m,n));
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define lli long long int
#define intMax 2147483647
#define INFTY (1<<30)
using namespace std;

int main(){
    int n, m;

    cin >> n >> m;
    int a[m];

    for(int i=0; i<m; i++){
        cin >> a[i];
        n = n-a[i];
    }
    if(n<=-1) n=-1;
    cout << n << endl;
}

Measured memory_bytes: 3668
#include <stdio.h>
#include <string.h>

int main()
{
    char str[200], str1[200], str2[200];
    int m, h;
    
    while(static_cast<void>(scanf("%s", str)), strcmp(str, "-")) 
    {
            scanf("%d", &m);
            for (int i = 0; i < m; i++)
            {
                scanf("%d", &h);
                sprintf(str1, "%s", &str[h]); 
                strncpy(str2, str, h); 
                str2[h] = '\0'; 
                sprintf(str, "%s%s", str1, str2); 
            }
            printf("%s\n", str);
        }
    
    return 0;
}



Measured memory_bytes: 2748
n,m = map(int,input().split())
if n%2 == 0:
  na = n//2
  m1 = m//2
  m2 = m-m1
  for i,j in enumerate(range(n,n-m2,-1)):
    print(i+1,j)
  for i in range(na,na-m1,-1):
    print(i,n-i+2)
  
else:
  for i,j in enumerate(range(n,n-m,-1)):
    print(i+1,j)

Measured memory_bytes: 9264
import collections

N=int(input())
A=[]
for _ in range(N):
	A.append(input())
M=int(input())
B=[]
for _ in range(M):
	B.append(input())
A=sorted(A)
B=sorted(B)
ans=0
X=collections.Counter(A)
Y=collections.Counter(B)
for i,j in X.items():
	tmp=j
	for p,q in Y.items():
		if i==p:
			tmp=j-q
	ans=max(ans,tmp)
print(ans)

Measured memory_bytes: 3316
n = input()
km = int(input())
dp1 = [[0] * (4) for _ in range(len(n) + 1)]
dp2 = [[0] * (4) for _ in range(len(n) + 1)]
dp1[0][0] = 1
for i in range(len(n)):
    for j in range(4):
        if n[i] == '0':
            dp1[i + 1][j] += dp1[i][j]
            dp2[i + 1][j] += dp2[i][j]
        else:
            dp2[i + 1][j] += dp1[i][j]
            dp2[i + 1][j] += dp2[i][j]
        if j < 3:
            for k in range(1, ord(n[i]) - ord('0')):
                dp2[i + 1][j + 1] += dp1[i][j]
            if n[i] != '0':
                dp1[i + 1][j + 1] += dp1[i][j]
            for k in range(1, 10):
                dp2[i + 1][j + 1] += dp2[i][j]
print(dp1[len(n)][km] + dp2[len(n)][km])

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int gcd(int x,int y)
{
    if(y==0)
        return x;
        return gcd(y,x%y);
}
int main()
{
    int x,y;
    cin>>x>>y;
    int g = gcd(x,y);
    cout<<(x+1)+(y+1)-(g+1)<<endl;
    return 0;
}



Measured memory_bytes: 3108
#include <stdio.h>

int main(){
  int n,k;
  scanf("%d%d",&n,&k);
  
  int cnt[200], i,j;
  for(i=0; i<n; ++i) cnt[i]=0;
  
  for(i=0; i<k; ++i){
    int d;
    scanf("%d",&d);
    for(j=0; j<d; ++j){
      int a;
      scanf("%d",&a);
      a--;
      cnt[a]++;
    }
  }
  
  int ans = 0;
  for(i=0; i<n; ++i){
    if(cnt[i]==0) ans++;;
  }
  
  printf("%d\n",ans);
}

Measured memory_bytes: 1692
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
using namespace std;
const ll maxn = 1e6 + 7;
const ll mod = 1e9 + 7;
const ll mod1 = 123456789;
const int maxx = 1005;
ll q, t, n, m, T, k, ans, a[maxn], b[maxn], f[maxx][maxx];
priority_queue<ll> pr;
string s, str;
char ss[maxx][maxx];
map<ll, ll> mp;
void sol()
{
    cin >> n;
    ll mx = 1e16;
    for(int i = 0; i < n; i ++)
    {
        cin >> a[i];
    }
    for(int i = n - 1; i >= 0; i--)
    {
        for(int j = i; j >= 0; j --)
        {
            if(i == n - 1)f[i][j] = (j == 0 ? a[i] : 0);
            else
                f[i][j] = min(a[i] + f[i+1][a[i] > 100 ? j + 1 : j], j > 0 ? f[i+1][j-1] : mx);
        }
    }
    cout << f[0][0];
}

char ch;
string gach[10000007];
struct dang
{
    ll val, sl;
};
dang st[maxn];
bool lt(const dang &x, const dang &y)
{
    return x.val < y.val;
}


void test()
{
    //ll c[maxn], d[maxn];
    cin >> n;
    ans = 0;
    for(int i = 1; i <= n; i ++)
    {
        for(int j = 1; j <= n; j ++)
        {
            for(int l = 1; l <= n; l ++)
            {
                int p = __gcd(i, j);
                ans += __gcd(p, l);
            }
        }
    }
    cout << ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    test();
}


Measured memory_bytes: 316160
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>a>>b;
	c=0;
	while(a>0){
		a/=b,c++;
	}
	cout<<c<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  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;
  }
};

mint factorial(ll n) {
  mint answer = 1;
  while (n > 1) {
    answer *= n;
    n--;
  }
  return answer;
}

mint combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

mint permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

// setprecision(8) 桁数指定
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

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

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

vector<ll> Eratosthenes(const ll N) {
  bool is_prime[1000000 + 1];
  vector<ll> P;
  for (ll i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  for (ll i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (ll j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
  return P;
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  int a, b;
  cin >> a >> b;
  if (a >= 13) {
    cout << b << endl;
  } else if (a >= 6) {
    cout << b / 2 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, m = map(int, readline().split())
    a = [input() for _ in range(n)]
    b = [input() for _ in range(m)]

    for row in range(n - m + 1):
        for col in range(n - m + 1):
            cur = [a[r][col:col + m] for r in range(row, row + m)]
            if cur == b:
                return print("Yes")

    print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 67312
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")
*/


#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << x << endl;
#else 
    #define dbg(x)
#endif

#define int long long
#define pb push_back
#define ppb pop_back()
#define mp make_pair
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
       
    str s;
    cin >> s;
    int n = siz(s);
    int s1  = 0;
    fi(0, n) 
        s1 += s[i] == 'p';
    cout << n / 2 - s1 << '\n';      
}

Measured memory_bytes: 3784
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <functional>
#include <cmath>
#include <array>
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
 
using namespace std;
typedef long long ll; typedef vector<int> VI;
typedef pair<int,int> pii;
const int mod = (int)1e9+7;


int main()
{
	
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, a;
	cin >>n >>a;
	VI x(n);
	rep(i,n) cin >> x[i];
	int smp=0, smm=0;
	rep(i,n){ if(a-x[i]<0) smm += a-x[i]; else smp += a-x[i];}
	int KJ =  max(abs(smp), abs(smm)) + 100;
	vector<ll> cp( KJ*2, 0);
	cp[KJ] = 1;
	auto np = cp;
	rep(i, n){
		rep2(j, KJ + smm - 2,  KJ + smp + 2) if(cp[j]>0){
			np[j + a -x[i]] += cp[j];
		}
		cp = np;
	}
	
	cout << cp[KJ] - 1 <<endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include<vector>
#include <iomanip>
#define mod 1000000007   
using namespace std;
double dp[3001][3001];
double solve(vector<double>& ar,int i,int x)
{  if(x==0)
  {
  return 1;
  }
    if(i==0)
    {
        return 0;
    }
    
    if(dp[i][x]>-0.9)
    {
        return dp[i][x];
    }
   return dp[i][x]=ar[i]*solve(ar,i-1,x-1)+(1-ar[i])*solve(ar,i-1,x);
}
int main() {
    int n;
    cin>>n;
    vector<double> ar(n+1);
    for(int i=0;i<3001;i++)
    {
        for(int j=0;j<3001;j++)
        {
            dp[i][j]=-1;
        }
    }
    for(int i=1;i<=n;i++)
    {
        cin>>ar[i];
    }
    cout<<fixed<<setprecision(10)<<solve(ar,n,(n+1)/2);
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

#define PI (2*acos(0.0))
#define eps 1e-9
#define pb push_back
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define show(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi] << " "; cout << endl;
#define showpair(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi].first << " " << v[fi].second << endl;
#define ff first
#define ss second
#define fu cout << "lol" << endl;
#define precision(n) cout << fixed << setprecision(n);
#define lb lower_bound
#define up upper_bound
#define vscan for(i = 0;i<n;i++){cin>>in; v.pb(in);}
#define all(a) a.begin(), a.end()
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define mem(a,val) memset(a,val,sizeof(a))
#define loop(i,n) for(i = 0; i < n; i++)
#define TC() ull T; cin>>T; while(T--)
#define IN(x) {scanf("%d",&x);}
#define LL(x) {scanf("%lld",&x);}
#define CC(x) {scanf("%c",&x);}
#define pfl(x) printf("%d\n",x)
#define pfll(x) printf("%lld\n",x)
#define newl puts("")
#define space printf(" ")
#define MOD 1000000007
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL);

const int N = 1e5 + 100;
int arr[N];
int n;
int dp[N];

int f(int id){
    if(id == n-1) return 0;
    if(dp[id] != -1) return dp[id];
    int ret = INT_MAX;
    ret = f(id+1) + abs(arr[id+1] - arr[id]);
    if(id+2 < n) ret = min(ret, f(id+2) + abs(arr[id+2] - arr[id]));
    return dp[id] = ret;
}

int main()
{
    int i = 0, j = 0, cs = 0, in;
    cin>>n;
    for(i = 0; i < n; i++) cin>>arr[i];
    mem(dp,-1);
    cout << f(0) << endl;
    return 0;
}


Measured memory_bytes: 4096
def execute_process(orders) #orders???????¬??????????
  list = []
  length = orders.length
  for i in 0..(length-1)
    if orders[i][0] == "insert"
      list.unshift(orders[i][1].to_i)
    elsif  orders[i][0] == "delete"
      first_order_number = list.index(orders[i][1].to_i)
      if first_order_number == nil
        next
      else
        list.delete_at(first_order_number)
      end
    elsif orders[i][0] == "deleteFirst"
      list.shift
    elsif orders[i][0] == "deleteLast"
      list.pop()
    else
      puts "error!"
    end
  end
  return list
end


n = gets.chomp.to_i
orders = []
n.times do
  order = gets.chomp.split
  orders.push(order)
end

output = execute_process(orders)
puts output.join(' ')

Measured memory_bytes: 429432
#include<stdio.h>

int main(){
  double max,min,data;
  max=min=-1;
  while(scanf("%lf",&data)!=EOF){
    if(min>data){
      min=data;
    }else if(max==-1&&min==-1){
      max=min=data;
    }else if(max<data){
      max=data;
    }
  }
  printf("%.1f\n",max-min);
 return 0;
}

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

template <typename T>
vector<T> make_vector(size_t sz)
{
	return vector<T>(sz);
}

template <typename T, typename... U>
auto make_vector(size_t sz, U... tail)
{
	return vector<decltype(make_vector<T>(tail...))>(sz, make_vector<T>(tail...));
}

template <typename T>
void fill_vector(vector<T> &v, T init)
{
	fill(v.begin(), v.end(), init);
}

template <typename T, typename U>
void fill_vector(vector<U> &vec, T init)
{
	for (auto &v : vec)
	{
		fill_vector<T>(v, init);
	}
}

int main()
{
	int64_t n, m, s, t, inf = (1LL << 60);
	cin >> n >> m;
	auto ps = make_vector<pair<int64_t, int64_t>>(m);
	for (auto &p : ps)
	{
		cin >> p.first >> p.second;
		p.first--;
		p.second--;
	}
	cin >> s >> t;
	s--;
	t--;

	auto g = make_vector<pair<int64_t, int64_t>>(3, n, 0);
	for (auto &p : ps)
	{
		g[0][p.first].push_back({1, p.second});
		g[1][p.first].push_back({2, p.second});
		g[2][p.first].push_back({0, p.second});
	}

	auto dist = make_vector<int64_t>(3, n);
	fill_vector<int64_t>(dist, inf);

	priority_queue<pair<int64_t, pair<int64_t, int64_t>>, vector<pair<int64_t, pair<int64_t, int64_t>>>, greater<>> pq;
	dist[0][s] = 0;
	pq.push({dist[0][s], {0, s}});

	while (!pq.empty())
	{
		int64_t d = pq.top().first;
		int64_t i = pq.top().second.first;
		int64_t v = pq.top().second.second;
		pq.pop();

		if (dist[i][v] < d)
		{
			continue;
		}

		for (auto &p : g[i][v])
		{
			int64_t j = p.first;
			int64_t u = p.second;

			if (dist[j][u] <= dist[i][v] + 1)
			{
				continue;
			}

			dist[j][u] = dist[i][v] + 1;
			pq.push({dist[j][u], {j, u}});
		}
	}

	cout << ((dist[0][t] == inf) ? -1 : (dist[0][t] / 3)) << endl;

	return 0;
}

Measured memory_bytes: 21336
def main():
    import sys

    input = sys.stdin.readline

    n = int(input())

    xl = [tuple(map(int, input().split())) for _ in range(n)]
    xl.sort(key=lambda xl: sum(xl))

    ret = 0
    prev_right_edge = - 10 ** 10

    for x, l in xl:
        if (x - l) < prev_right_edge:
            # remove
            pass
        else:
            ret += 1
            prev_right_edge = x + l

    print(ret)


if __name__ == '__main__':
    main()


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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  string S, T;
  cin >> S >> T;

  map<char, char> Sm, Tm;
  bool yes = true;
  for (int i = 0; i < S.length(); ++i) {
    char s = S[i];
    char t = T[i];
    if (Sm.count(s)) {
      if (Sm[s] != t) yes = false;
    }
    if (Tm.count(t)) {
      if (Tm[t] != s) yes = false;
    }
    Sm[s] = t;
    Tm[t] = s;
  }

  cout << (yes ? "Yes" : "No") << "\n";

  return 0;
}

Measured memory_bytes: 916
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <bitset>
#include <cmath>
#include <iomanip>

typedef  long long ll;

using namespace std;

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

    cout << n * (n + 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
s=input()
ans=1
old=s[0]
for i in range(1,len(s)):
    if len(old)==1:
        if s[i]==old:
            old="xx"
        else:
            old=s[i]
            ans+=1
    elif len(old)>1:
        ans+=1
        old=":"
    #print(i,s[i],ans,old)
    

print(ans)
        

Measured memory_bytes: 3500
#include<bits/stdc++.h>
using namespace std;
    static const double pi = 3.141592653589793;
 typedef pair<int64_t,int64_t> P;
struct UnionFind{
 int N;
 vector<int> parent;
 vector<int> siz;
 
 UnionFind(int N) : parent(N), siz(N, 1){
  for (int i = 0; i < N; i++) parent[i] = i;
 }
 
 int root(int x){
  if(parent[x] == x) return x;
  else return parent[x] = root(parent[x]);
 }
 
 void unite(int x, int y){
  x = root(x), y = root(y);
  if(x == y) return;
  if(siz[x] < siz[y]) swap(x, y);
  parent[y] = x;
  siz[x] += siz[y];
  siz[y] = 0;
 }
 
 bool same(int x, int y){
  return root(x) == root(y);
 }
 
 int size(int x){
  return siz[root(x)];
 }
};
 
int main(){
int N,M;
  cin>>N>>M;
  UnionFind uf(N);
  int x=0;
   vector<int>op(N);
  for(int i=0;i<M;i++)
  {
  int a,b,c;
    cin>>a>>b>>c;
  a--;
    b--;
    uf.unite(a,b);
  }
  for(int i=0;i<N;i++)
  {
  op.at(uf.root(i))=1;
  
  }
    for(int i=0;i<N;i++)
  {
  x=x+op.at(i);
  
  }
  cout<<x;
}




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


public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int num = Integer.parseInt(scanner.nextLine());

		Dice[] dices = new Dice[num];
		boolean flag = true;

		loop: for (int i = 0; i < num; i++) {
			dices[i] = new Dice(scanner.nextLine());
			for (int j = 0; j < i; j++) {
				/*System.out.println(Arrays.toString(dices[i].a) + " -> "
						+ Arrays.toString(dices[j].a));*/
				if (dices[i].equals(dices[j])) {
					flag = false;
					break loop;
				}
			}
		}
		System.out.println(flag ? "Yes" : "No");
	}
}

class Dice {
	int[] a = new int[6];

	Dice(String s) {
		String[] b = s.split(" ");
		for (int i = 0; i < 6; i++) {
			a[i] = Integer.parseInt(b[i]);
		}
	}

	public void roll(char c) {
		int temp;
		switch (c) {
		case 'E':
			temp = a[0];
			a[0] = a[3];
			a[3] = a[5];
			a[5] = a[2];
			a[2] = temp;
			break;
		case 'N':
			temp = a[0];
			a[0] = a[1];
			a[1] = a[5];
			a[5] = a[4];
			a[4] = temp;
			break;
		case 'W':
			temp = a[0];
			a[0] = a[2];
			a[2] = a[5];
			a[5] = a[3];
			a[3] = temp;
			break;
		default:
			temp = a[0];
			a[0] = a[4];
			a[4] = a[5];
			a[5] = a[1];
			a[1] = temp;
			break;
		}
	}

	public boolean equals(Dice d) {
		char[] c = { 'E', 'E', 'E', 'N', 'W', 'W', 'W', 'S' };
		boolean flag = false;
		loop: for (int i = 0; i < 24; i++) {
			/*System.out.println(Arrays.toString(a) + "========"
					+ Arrays.toString(d.a));*/
			if (Arrays.equals(a, d.a)) {
				flag = true;
				break loop;
			}
			d.roll(c[i % 8]);
		}
		return flag;
	}
}


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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)

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

signed main(){
	// your code goes here
	int a=read(),b=read(),c=read();
	if(b-a==c-b) cout << "YES";
	else cout << "NO";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    string s,t,u; cin >> s >> t >> u;
    cout << char(s[0]-0x20) << char(t[0]-0x20) << char(u[0]-0x20) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int weight[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

void solve()
{
	int w;
	while(cin >> w)
	{
		bool flag[10];
		int sumcount = 0;
		for(int i = 0; i < 10; ++i)
		{
			flag[i] = false;
		}
		for(int i = 9; i >= 0; --i)
		{
			if(w >= weight[i])
			{
				w -= weight[i];
				flag[i] = true;
				++sumcount;
			}
		}
		int count = 0;
		for(int i = 0; i < 10; ++i)
		{
			if(flag[i] && sumcount > count + 1)
			{
				cout << weight[i] << " ";
				++count;
			}
			else if(flag[i] && sumcount == count + 1)
			{
				cout << weight[i];
			}
		}
		cout << endl;
	}
}

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

Measured memory_bytes: 0
import Data.List

combs _ [] = []
combs 1 xs = [[x] | x <- xs]
combs n (x:xs) = [x:y | y <- combs (n-1) xs] ++ combs n xs

main = getContents >>= print . calender_colors . read' . lines
 where read' (nm:cs) = (map read (words nm), map (map read . words) cs)

calender_colors :: ([Int],[[Double]]) -> Double
calender_colors ([n,m],cs)
 | m < 2 = 0.0
 | otherwise = maximum (map total cs')
 where
  cs' = combs m cs
  total cs = sum [distance c1 c2| c1<-cs, c2<-cs, c1<c2]
  distance [l1,a1,b1] [l2,a2,b2] = (l2-l1)^2 + (a2-a1)^2 + (b2-b1)^2

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

struct town{
    ll x,y,id;
};

struct edge{
    ll u, v, cost;
};

bool comp_c(const edge& e1, const edge& e2){
    return e1.cost < e2.cost;
}
bool comp_x(const town& t1, const town& t2){
    return t1.x < t2.x;
}
bool comp_y(const town& t1, const town& t2){
    return t1.y < t2.y;
}

int k,n, nn, dd;
int d[15];

int main(){
    cin >> n >> k;
    for(int i = 0; i < k; i++){
        cin >> dd;
        d[dd] = INT_INF;
    }
    nn = n;
    bool flag;
    while(true){
        while(true){
            if(d[n%10] == INT_INF){
                break;
            }
            if(n < 10){
                cout << nn << endl;
                return 0;
            }
            n/= 10;
        }
        ++nn;
        n = nn;
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

// auto mod int

const i64 MOD = 998244353LL;

struct mint {
  long long x;
  mint(long long 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 { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(long long 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 { return mint(*this) /= a; }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

// Factorials over ModInts.
struct Factorials {
  // factorials and inverse factorials.
  vector<mint> fact, ifact;

  // n: max cached value.
  Factorials(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < MOD);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }

  // Combination (nCk)
  mint C(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }

  // Permutation (nPk)
  mint P(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[n - k];
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  i64 N, M, K;
  cin >> N >> M >> K;
  Factorials fs(N);
  mint ans;
  for (int i = 0; i <= K; ++i) {
    ans += fs.C(N - 1, i) * mint(M) * mint(M - 1).pow(N - 1 - i);
  }
  cout << ans << endl;
}


Measured memory_bytes: 6328
s = gets.chomp
all = 0
arr = ""
["", "+"].repeated_permutation(s.length) do |plus|
(s.length).times do |i|
      arr << plus[i]
     arr << s[i]
 end
 all += arr.split("+").map(&:to_i).inject(0){|sum,aa| sum +=  aa}
 #p arr
 arr = ""
end
p all /2


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

typedef long long ll;

const int maxn=1e5+10;
const int inf=1e9+7;



int main()
{
	ll a,b,c;
	scanf("%lld%lld.%lld",&a,&b,&c);
	ll ans=a*(b*100+c)/100;
	printf("%lld\n",ans);
}

Measured memory_bytes: 3828
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n;
    while (cin >> n) {
        if (n == 0) return 0;
        vector<int> id;
        // create vector the number of element is 4001
        // initialize all elements with -1
        vector<long long> sale(4001, -1);
        int x, y, z;

       for (int i=0; i < n; i++) {
           cin >> x >> y >> z;
           if (sale[x] == -1) {
               sale[x] = 0;
               id.push_back(x);
           }
           sale[x] += (long long) y * z;
       }
       bool na = true;
       for (int i=0; i < (int)id.size(); i++){
           if (sale[id[i]] >= 1000000) {
               cout << id[i] << endl;
               na = false;
           }
       }
       if (na) cout << "NA" << endl;
    }
}

Measured memory_bytes: 1256
n=int(input())
a=list(map(int,input().split()))
k=0
p=0
for i in range(n):
    if a[i]%2==0:
        k+=1
        if a[i]%3==0 or a[i]%5==0:
            p+=1
if k==p:
    print('APPROVED')
else:
    print('DENIED')



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

int main(){

  string str;
  int n,a[100],b[100];

  cin >> n;

  for(int i=0;i<n;i++){
    cin >> str;
    int x = 0,y = 0;
    for(int i=0;i<str.size();i++){
      a[i] = str[i] - '0';
      b[i] = str[i] - '0';
    }

    sort(a,a+8);
    sort(b,b+8);
    reverse(b,b+8);

    for(int i=0;i<8;i++){
      x *= 10;
      y *= 10;
      x += a[i];
      y += b[i];
    }

    cout << y-x << endl;
  }
}

Measured memory_bytes: 1220
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cctype>
#include<cstring>

using namespace std;

int main(void){

  string s;
  cin >> s;

  if(s.size()<6){
    cout << "INVALID" << endl;
    return 0;
  }

  bool num=false,low=false,up=false;
  for(int i=0;i<s.size();i++){
    num|=isdigit(s[i]);
    low|=islower(s[i]);
    up|=isupper(s[i]);
  }

  if(!num || !low || !up){
    cout << "INVALID" << endl;
    return 0;
  }

  cout << "VALID" << endl;

  return 0;
}

Measured memory_bytes: 1180