akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,m;
    cin>>n>>m;
    vector<pair<ll,ll>> vp(n,make_pair(0,0));
    ll p;
    string s;
    rep(i,m){
        cin>>p>>s;
        p--;
        if(vp[p].first==0&&s=="AC") vp[p].first++;
        if(vp[p].first==0&&s=="WA") vp[p].second++;
    }
    ll cr=0,icr=0;
    rep(i,n){
        cr+=vp[i].first;
        if(vp[i].first==1) icr+=vp[i].second;
    }
    cout<<cr<<' '<<icr<<endl;
    return 0;
}

Measured memory_bytes: 1792
gets.to_i.times{
  xMax,yMax=gets.split(" ").map{|e|e.to_i}
  matatabi=[]
  gets.to_i.times{
    x1,y1,x2,y2=gets.split(" ").map{|e|e.to_i}
    matatabi.push [x1,y1,x2,y2]
    matatabi.push [x2,y2,x1,y1]
  }
  map=Array.new(yMax+1)
  map.length.times{|t|map[t]=Array.new(xMax+1, 0)}
  map[0][0]=1
  (yMax+1).times{|t1|
    (xMax+1).times{|t2|
      uFlag=true
      lFlag=true
      uFlag=false if matatabi.count([t2,t1-1,t2,t1])!=0
      lFlag=false if matatabi.count([t2-1,t1,t2,t1])!=0
      map[t1][t2]+=map[t1][t2-1] if !uFlag&&lFlag
      map[t1][t2]+=map[t1-1][t2] if uFlag&&!lFlag
      map[t1][t2]+=0 if !uFlag&&!lFlag
      map[t1][t2]+=map[t1-1][t2]+map[t1][t2-1] if uFlag&&lFlag
    }
  }
  p map[yMax][xMax] if map[yMax][xMax]!=0
  puts "Miserable Hokusai!" if map[yMax][xMax]==0
}

Measured memory_bytes: 6140
#include "bits/stdc++.h"
using namespace std;

using ll = long long int;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

#define pi 3.14159265358979323846

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 (b<a) { a=b; return 1; } return 0; }




ll cnt_rep = 0;
ll powmod(ll N, ll P, ll M){
  cnt_rep++;
  if(P == 0) return 1;
  if(P%2 == 0){
    ll t = powmod(N, P/2, M);
    return t*t % M;
  }
  return (N * powmod(N, P-1, M)) % M;
}


ll gcd(ll a, ll b){
  ll resi, g, l;
  if(a > b){
    g = a; l = b;
  }else if(b > a){
    g = b; l = a;
  }else{
    return a;
  }
  resi = g % l;
  if(resi != 0){
    return gcd(l, resi);
  }else{
    return l;
  } 
}

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

int ans = 0;
int N, M, Q;

template<typename T>
void showall(vector<T> v){
  rep(i, 0, v.size()){
    cout << v[i] << " ";
  }
  cout << endl;
}

template<typename T>
ll com(T n, T m, T mod){
  ll a = 1, b = 1, ans;
  if(n == m || m == 0){
    ans = 1;
  }else{
    for(ll i = 0;i < m; i++){
      a *= n-i;
      a %= mod;
      b *= i+1;
      b %= mod;
    }
    ans = (a * powmod(b, mod-2, mod)) % mod;
  }
  
  return ans;
}



 
int main() {
  ll N, K;
  cin >> N >> K;
  K = min(ll(42), K);
  vector<ll> A(N, 0);

  rep(i, 0, N){
    cin >> A[i];
  }



  rep(j, 0, K){
    vector<ll> light(N);
    rep(i, 0, N){
      ll l = max(ll(0), i - A[i]);
      ll r = min(N-1, i + A[i]);

      light[l]++;
      if(r+1 < N) light[r+1]--;
    }

    rep(i, 1, N) light[i] += light[i-1];
    A = light;
  }


  rep(i, 0, N){
    cout << A[i];
    if(i < N-1) cout << " ";
  }

  cout << endl;


  // cout << setprecision(8) << ans << endl;  // For double
}



Measured memory_bytes: 6428
import java.util.Scanner;

class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);	
	int max,i,j,h;
	int a[]= new int [10];

	for(i=0;i<10;i++)a[i] = sc.nextInt();

	for(i=0;i<10;i++){
	    max=i;
	    for(j=i;j<10;j++){
		if(a[max]<a[j])max=j;
	    }
	    h=a[max];
	    a[max]=a[i];
	    a[i]=h;
	}

	for(i=0;i<3;i++)System.out.println(a[i]);


    }

}

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

random_device seed_gen; mt19937_64 mtrand(seed_gen());
#define MOD 1000000007
//////////////////////////////////////////

int main(){
  ini(n,k);
  out((n+1)/2 >= k ? "YES" : "NO");
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#define ll long long
#define LIM 1000
using namespace std;
int main() {
  int n;
  cin >> n;
  cout << (int)(n / 3) << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

// sliceContain はスライスの要素に文字列が含まれていたらtrueを返す関数
func sliceContain(tSlice []string, tStr string) bool {
	for _, str := range tSlice {
		if str == tStr {
			return true
		}
	}
	return false
}

// removeDuplicate1 は重複した要素を削除して返却
// 引用: https://qiita.com/hi-nakamura/items/5671eae147ffa68c4466
func removeDuplicate1(args []string) []string {
	results := make([]string, 0, len(args))
	encountered := map[string]bool{}
	for i := 0; i < len(args); i++ {
		if !encountered[args[i]] {
			encountered[args[i]] = true
			results = append(results, args[i])
		}
	}
	return results
}

// sliceKindsCount はスライスの要素の種類の数を返す関数
func sliceKindsCount(tSlice []string) int {
	tSlice = removeDuplicate1(tSlice)

	return len(tSlice)
}

func main() {
	var lotteryNum int
	var lotteryPrize string

	fmt.Scanf("%d", &lotteryNum)

	var lotteryKinds []string
	for i := 0; i < lotteryNum; i++ {
		fmt.Scanf("%s", &lotteryPrize)
		lotteryKinds = append(lotteryKinds, lotteryPrize)
	}

	fmt.Println(sliceKindsCount(lotteryKinds))
}

Measured memory_bytes: 26188
#include<iostream>
using namespace std;
int main(){
  int N, ans; cin >> N; ans = 0;
  int A[200];
  bool jud;
  jud = false;
  for (int i=0; i<N; i++){
    cin >> A[i];
  }

  while (jud == false){
    //すべて2で割り切れるかどうかの判定
    //割り切れないものが存在したらjudをtrueに
    for (int i=0; i<N; i++){
      if (A[i]%2 == 1){
        jud = true;
      }
    }
    if (jud == true){
      break;
    }
    ans = ans + 1;
    for (int j=0; j<N; j++){
      A[j] = A[j]/2;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 5000000
int H[MAX];
int n;
void maxHeapify(int i){

  int l,r;
  int largest,tmp;
  l=left(i);
  r=right(i);

  if(n+1>l && H[l]>H[i]) largest = l;
  else largest=i;
  if(n+1>r && H[r]>H[largest]) largest=r;
  if(largest!=i){
    tmp=H[i];
    H[i]=H[largest];
    H[largest]=tmp;
    maxHeapify(largest);
  }
}
void buildMaxHeap(){
  int i;
  for(i=n/2;i+1>1;i--){
    maxHeapify(i);
  }
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
}
int parent(int i){
  return i/2;
}

int main(){
  int i;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&H[i]);
  }
  buildMaxHeap();
  for(i=1;i<=n;i++){
    printf(" %d",H[i]);
  }
  printf("\n");

  return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int32 N;
	cin >> N;
	vector<int32> A(N);
	REP(i, N) cin >> A[i];
	map<int32, int32> fr, ba;
	int32 out = 0;
	vector<int32> res;
	REP(i, N){
		if(fr[A[i]] == ba[A[i]]) out++;
		if(fr[A[N-i-1]] == ba[A[N-i-1]]) out++;
		fr[A[i]]++;
		ba[A[N-i-1]]++;
		if(fr[A[i]] == ba[A[i]]) out--;
		if(fr[A[N-i-1]] == ba[A[N-i-1]]) out--;
		if(out == 0){
			res.push_back(i+1);
		}
	}
	sort(all(res));
	REP(i, res.size()-1)
		cout << res[i] << " ";
	cout << res[res.size()-1] << endl;
}


Measured memory_bytes: 9984
#include<bits/stdc++.h>
#include <cstdio>
#include <cstring>

#define LL long long
#define pb push_back
#define MP make_pair
#define F first
#define S second
#define vecprint(vec) for (int i=0;i<vec.size();i++)printf("%d ",vec[i]);
#define all(x) x.begin(),x.end()
#define sc(x) scanf("%lld",&x)
#define scl(x) scanf("%lld",&x)
#define MEM(v,x) memset(v,x,sizeof v)

const double eps=1e-7,PI=3.1415926;
const int N=2e5+10;

using namespace std;

LL n,q,m,k,x,y,a[N],mx=-1,mn=1e9,sum,t;
char c[N];
string s,s1,s2;
map < LL , LL > mp;
vector < LL > vec;

int main(){
    sc(n),sc(m);
    a[1]=300000,a[2]=200000,a[3]=100000;a[0]=400000;
    if (n==1&&m==1)cout<<a[1]+a[1]+a[0]<<endl;
    else {
        cout<<a[n]+a[m]<<endl;
    }
    return 0;
}


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

N = INT()
print(N**3)

Measured memory_bytes: 5336
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
int a,b,c,la,n,x;
void work(int x){
	if (x==2){
		if (a) a--,la=0;
		else if (b) b--,la=1;
		else c--,la=2;
	}
	if (x==1){
		if (b) b--,la=1;
		else c--,la=2;
	}
	if (x==0) c--,la=2;
}
bool judge(){
	la=2;
	for (int i=1;i<=n;i++){
		work(la);
		if (a<0 || b<0 || c<0) return 0;
	}
	return 1;
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) {
		scanf("%d",&x);
		if (x%4==0) c++;
		else if (x%2==0) b++;
		else a++;
	} 
	if (judge()) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
#include <bitset>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    bitset<20> bit_one = bitset<20>(1);
    REP(i, N) {
        ll tmp;
        cin >> tmp;
        A[i] = tmp;
    }

    vector<bool> bits(20, false);

    bool flag = true;
    int left_idx = 0, right_idx = -1; //left_idx: 開始位置 right_idx: lに対するrのmax
    ll acum_sum = 0;
    ll ans = 0;
    while(left_idx < N) {
        // cerr << "start of loop, left_idx = " << left_idx << " right_idx = " << right_idx << " acum_sum = " << acum_sum << endl;
    
        bool update = false;

        while((bitset<21>(acum_sum + A[right_idx+1]) == (bitset<21>(acum_sum) ^ bitset<21>(A[right_idx+1])))
            && right_idx<N-1) {
            acum_sum += A[right_idx+1];
            // cerr << "left_idx = " << left_idx << " right_idx = " << right_idx << endl;
            right_idx++;
        }

        // cerr << "left_idx = " << left_idx << " right_idx = " << right_idx << endl;
        ans += right_idx - left_idx + 1;
        acum_sum -= A[left_idx++];

        // cerr << "end of loop, left_idx = " << left_idx << " right_idx = " << right_idx << " acum_sum = " << acum_sum << " ans = " << ans << endl;
    }

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


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const vector<int> v = {0, -1, 0, 1};
const vector<int> h = {-1, 0, 1, 0};

int main() {
    int H, W;
    cin >> H >> W;
    int blackCount = 0;
    vector<vector<char>> s(H+1, vector<char>(W+1));
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            cin >> s.at(i).at(j);
            if (s.at(i).at(j) == '#') blackCount++;
        } 
    }

    vector<vector<int>> dist(H+1, vector<int>(W+1, -1));
    queue<vector<int>> que;
    
    dist.at(1).at(1) = 0;
    que.push({1, 1});
    
    while (!que.empty()) {
        vector<int> current = que.front();
        int x = current.at(0);
        int y = current.at(1);
        que.pop();

        for (int i = 0; i < 4; i++) {
            int nx = x + v.at(i);
            int ny = y + h.at(i);

            if (nx < 1 || nx > H || ny < 1 || ny > W) continue;
            if (dist.at(nx).at(ny) != -1) continue;
            if (s.at(nx).at(ny) == '#') continue;
            dist.at(nx).at(ny) = dist.at(x).at(y) + 1;
            que.push({nx, ny});
        }
    }

    if (dist.at(H).at(W) == -1) {
        cout << -1 << endl;
    } else {
        cout << H * W - blackCount - (dist.at(H).at(W) + 1) << endl;
    }


    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
using namespace std;
const char* solve() {
    int n;
    cin >> n;
    for (int i = 0, a; i < n; i++) {
        cin >> a;
        if (a % 2 != 0) continue;
        if (a % 3 != 0 && a % 5 != 0) return "DENIED";
    }
    return "APPROVED";
}
int main() {
    cout << solve() << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
void debug(){cerr << "]" << endl;}
template<class H, class... T> void debug(H h, T... t) {
	cerr << to_string(h);
	if(sizeof...(t))
	cerr << ", ";
	debug(t...);
}
#ifdef _DEBUG
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", debug(__VA_ARGS__)
#else
#define dbg(...) 0
#endif
int minimumChar(string S1, string S2) 
{ 
    // Get the sizes of both strings 
    int n = S1.size(), m = S2.size(); 
    int ans = INT_MAX; 
    // Traverse the string S2 
    for (int i = 0; i < m - n + 1; i++) { 
        int minRemovedChar = 0; 
        // From every index in S2, check the number of 
        // mis-matching characters in substring of 
        // length of S1 
        for (int j = 0; j < n; j++) { 
            if (S1[j] != S2[i + j]) { 
                minRemovedChar++; 
            } 
        } 
        // Take minimum of prev and current mis-match 
        ans = min(minRemovedChar, ans); 
    } 
    // return answer 
    return ans; 
} 
 
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s,t;
  cin>>s>>t;
  cout<<minimumChar(t,s)<<"\n";
}



Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	a=(a+11)%13;
	b=(b+11)%13;
	if(a>b)cout<<"Alice";
	if(a==b)cout<<"Draw";
	if(a<b)cout<<"Bob";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<n; i++)
#define FOR(i, s, n) for(int i=s; i<n; i++)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;

int main(){
    int A, B; cin >> A >> B;
    if (A <= 8 && B <= 8){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
}

Measured memory_bytes: 256
//Binomial
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// ÉÏ ×ó ÏÂ ÓÒ
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
int n,a[N],maxv,minv,ans,val,maxvv;
int main(){
	cin>>n;
	maxv=-999;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		maxv=max(maxv,a[i]);
	}
	cout<<maxv<<' ';
	maxvv=maxv/2;
	minv=1000000000;
	for(int i=1;i<=n;i++)
	{
		if(a[i]==maxv)
			continue;
		if(maxv%2==0)
			val=abs(a[i]-maxvv);
		else
			val=min(abs(a[i]-maxvv),abs(a[i]-(maxvv+1)));
		if(val<minv)
			minv=val,ans=a[i];
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <math.h>
using namespace std;

int main() {
	int n, a, total = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (a % 2 == 1 && a > 0) {
			int k = sqrt(a);
			for (int j = 3; j <= k; j++)
				if (a % j == 0) {
					k = -1;
					break;
				}
			if (k != -1)total++;
		}
		else if (a == 2)total++;
	}
	cout << total << endl;

	return 0;
}

Measured memory_bytes: 3080
# -*- coding: utf-8 -*-
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys

def s():
    return raw_input().strip()
def n():
    return int(raw_input())
def d():
    return float(raw_input())

def ls():
    return raw_input().strip().split()
def ln():
    return map(int, raw_input().strip().split())
def ld():
    return map(float, raw_input().strip().split())

def fs():
    return [raw_input().strip() for i in xrange(input())]
def fn():
    return [int(raw_input().strip()) for i in xrange(input())]
def fd():
    return [float(raw_input().strip()) for i in xrange(input())]

N = n()
A = ln()

min = 10e8
for i in xrange(-100, 101):
    s = 0
    for a in A:
        s += (a - i) ** 2
    if s < min:
        min = s
print min



Measured memory_bytes: 4772
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cassert>
#include <random>
#include <bitset>
using namespace std;
 

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define pb push_back
#define forn(i, n) for (int i = 0; i < n; ++i)
//#define int long long

 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
 
 
const int MAXN = 2e5 + 5;
const ll MOD = 1e9 + 7;
const ll INF = INT64_MAX;


mt19937 rnd(time(0));


signed main() {
	FAST_IO;
	string s, t;
	cin >> s >> t;
	if (s == t.substr(0, s.size()) && s.size() + 1 == t.size()) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
 	return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
int main(void){
    string str;
    cin>>str;
    int i=0;
    for(int b=0;b < str.length();b++){
        i=i+int(str[b]-48);
    }
    if(i%9==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 3640
N, M = map(int, input().split())
l = []
for i in range(M):
  	l.append(list(map(int, input().split())))

def FillZero(num,f=6):
    s = ""
    s += (f - len(str(num))) * "0"
    s += str(num)
    return(s)

for i in range(M):
    l[i].append(i)

l = sorted(l, key = lambda x:(x[0],x[1]))

key0 = l[0][0]
key1 = 0
for i in range(M):
    if key0 == l[i][0]:
        key1 += 1
        l[i][1] = key1
    else:
        key1 = 1
        l[i][1] = key1
        key0 = l[i][0]

l = sorted(l, key = lambda x:x[2])

for i in range(M):
    print(FillZero(l[i][0]) + FillZero(l[i][1]))

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

string S;
char C[4] = {'A', 'C', 'G', 'T'};

int main(){
  cin >> S;
  int ans = 0, cnt = 0;
  for (int i = 0; i < S.length(); i++){
    bool flag = false;
    for (int j = 0; j < 4; j++){
      if (S[i] == C[j]) flag = true;
    }

    if (flag) cnt++;
    else{
      ans = max(ans, cnt);
      cnt = 0;
    }
  }
  cout << max(ans, cnt) << endl;


  return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<numeric>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

int main(){
  ll n, k;
  cin >> n >> k;
  ll r = n % k;
  cout << min(r, abs(r - k)) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <bitset>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <list>
#include <sstream>
#include <numeric>

#define ll long long
#define ld long double
#define ull unsigned long long
using namespace std;

const ld PI = acosl(-1.0);
const ll mod = 1000000007;
const ll inf = 9223372036854775803;
const int maxN = 6;//1000000;

int main() {
    cout.precision(10);
    cout << fixed;
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int> ans(n+1, 0);
    vector<vector<int>> adj(n+1, vector<int>());
    for (int i = 0; i < m; i++) {
        int a,b;
        cin >> a >> b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    queue<pair<int,int>> q;
    q.push({1,-1});
    while (!q.empty()) {
        int u = q.front().first;
        int p = q.front().second;
        q.pop();
        if (ans[u] > 0) {
            continue;
        }
        ans[u] = p;
        for (int i = 0; i < adj[u].size(); i++) {
            int v = adj[u][i];
            if (ans[v] == 0) {
                q.push({v, u});
            }
        }
    }
    bool good = true;
    for (int i = 1; (i <= n) && good; i++) {
        good = ans[i] != 0;
    }
    if (good) {
        cout << "Yes\n";
        for (int i = 2; i <= n; i++) {
            cout << ans[i] << "\n";
        }
    } else {
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 10828
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <numeric>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<((x))<<endl
#define fi first
#define se second

#define INF 2147483600
#define MOD 10000
#define long long long

long dp[2][2][3][10][500];
// [-][?????????????][????????????????????leading zero?][?????????digit][mod m]

long solve(string &str, int m, bool eq){
  int n=str.size();

  auto prev = dp[0];
  auto crnt = dp[1];
  fill(prev[0][0][0], prev[2][0][0], 0);

  int ini = str[0]-'0';
  repl(i,1, ini+1){
    prev[i==ini][2][i][i%m]=1;
  }

  repl(i,1,n){
    fill(crnt[0][0][0], crnt[2][0][0], 0);
    int lim=str[i]-'0';
    rep(k,10) rep(l,m){
      rep(d,10) if(k!=d) (crnt[0][k<d][d][(l*10+d)%m] += prev[0][k>d][k][l] + prev[0][2][k][l])%=MOD;
      rep(d,lim+1) if(k!=d) (crnt[d==lim][k<d][d][(l*10+d)%m] += prev[1][k>d][k][l] + prev[1][2][k][l])%=MOD;
    }
    repl(d,1,10) crnt[0][2][d][d%m]=1;
    swap(prev, crnt);
  }

  long ret=0;
  rep(i,2) if(i==0 || eq){
    rep(j,3) rep(k,10) (ret += prev[i][j][k][0])%=MOD;
  }
  return ret;
}

int main(){
  string a,b;
  int m;
  cin>>a>>b>>m;
  cout << (solve(b, m, true) - solve(a,m,false) + MOD)%MOD << endl;

  return 0;
}

Measured memory_bytes: 3644
using System;

class A4{
  public static void Main(){
    int n,q;
    n = int.Parse(Console.ReadLine());
    string[] S = new string[n];
    string[] str = Console.ReadLine().Split(' ');

    for(int i = 0;i < n;i++){
      S[i] = str[i];
    }

    q = int.Parse(Console.ReadLine());
    string[] T = new string[q];
    string[] str2 = Console.ReadLine().Split(' ');

    for(int i = 0;i < q;i++){
      T[i] = str2[i];
    }

    Console.WriteLine(Serach(S,T));

  }

  static int Serach(string[] S,string[] T){
    int count = 0,l = 0;
    bool flag = false;
    string[] memory = new string[S.Length];

    for(int i = 0;i < T.Length;i++){
      if(flag == true) l++;
      flag = false;
      for(int j = 0;j < S.Length;j++){
        if(flag == true && memory[l].CompareTo(S[j]) == 0){
          continue;
        }
        else if(S[j].CompareTo(T[i]) == 0){
          memory[l] = T[i];
          flag = true;
          count++;
          }
      }
    }
    return count;
  }
}


Measured memory_bytes: 10464
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll,ll>;
using pi = pair<int,int>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;

bool check(ll a, ll b){
    rep(i,0,21){
        if((a>>i&1) && (b>>i&1))return false;
    }
    return true;
}

signed main(){
	//cout << fixed << setprecision(10);
    int n; cin >> n;
    vl a(n+1);
    rep(i,0,n)cin >> a[i];
    ll ans = 0;
    ll l = 0 , r = 0; 
    ll now = 0;
    rep(i,1,n+1){
        while(r < n && check(now , a[r])){
            now ^= a[r++];
        }
        ans += (r - l);
        now ^= a[l++];
    }
    cout << ans << endl;
    
	return 0;
}

Measured memory_bytes: 4840
//$ darklife_12
#include <cmath>
#include <functional>
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <cstring>
#include <bits/stdc++.h>
#include <iostream>
#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define ll long long
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based
#define enterarray(a,n) for(int i=0;i<(int)(n);++i)cin>>a[i];
#define ins insert
const int MOD =998244353;
const int MX = int(2e6+9);
using namespace std;
int even(ll num){
    if(num%2==0)return 1;
    else return 0;
}
void printvector(vector<int> v){
    int i;
    for0(i,v.size())cout<<v[i]<<" ";
}
void solve()              
{
    int n,m,i,j,k;
    int a[200005],b[200005];
    int ans=0,res;
    bool flag=true;
    vector<int> v;
    string s1,s2;
    set<int> s;
    cin>>n;
    if(n%1000==0)cout<<0;
    else{
        cout<<(1000*((n/1000)+1))-n;
    }
}
 
int main()
{
    FAST;
   int t;
    t=1;
    while(t--)
    {
        solve();
       cout<<"\n";
    }
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<string>

using namespace std;

int main () {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'C') {
			for (int j = i + 1; j < s.size(); j++) {
				if (s[j] == 'F') {
					cout << "Yes";
					return 0;
				}
			}
		}
	}
	cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

int main() {
  int a;
  cin>>a;
  cout<<a*a<<endl;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
answer = 0
temp = A[0]
right = 0

for i in range(N):
    if right < N - 1:
        while temp + A[right + 1] == temp ^ A[right + 1]:
            right += 1
            temp += A[right]
            if right == N - 1:
                break
    temp -= A[i]
    answer += right - i + 1

print(answer)

Measured memory_bytes: 24840
a, b, c, d = map(int, input().split())
aa = [0 for i in range(101)]
bb = [0 for i in range(101)]
ans = 0
for i in range(a, b):
    aa[i] = 1
for i in range(c, d):
    bb[i] = 1
for i in range(101):
    if aa[i] == 1 and bb[i] == 1:
        ans += 1
print(ans)

Measured memory_bytes: 61940
list = map(int, raw_input().split())
W = list[0]
H = list[1]
x = list[2]
y = list[3]
r = list[4]
if x - r<0:
    print('No')
elif x + r>W:
    print('No')
elif y - r<0:
    print('No')
elif y + r >H:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 4640
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
ll gcd(ll a, ll b ){
    ll r, tmp;
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}
ll lcm(ll a, ll b ){
    if(a==0||b==0) return 0;
    return ((a/gcd(a,b))*b);
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    vll a(n),b(n);
    ll bgcd=1;
    REP(i,n){
        cin >> a[i];
        b[i]=a[i]/2;
        bgcd = lcm(bgcd,b[i]);
    }
    REP(i,n){
        if((bgcd/b[i])%2==0LL){
            cout << 0 << endl;
            return 0;
        }
    }
    if(bgcd>m){
        cout << 0 << endl;
    }else{
        ll ans = (m-bgcd)/(2*bgcd)+1;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <regex>
#include <stdio.h>
#include <string>

using namespace std;

int main() {
  string S;
  cin >> S;
  regex rx(R"(^A[a-z][a-z]*?C[a-z]*?[a-z]$)");
  if (regex_match(S, rx)) {
    printf("AC\n");
  } else {
    printf("WA\n");
  }
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
 
#define pb  push_back
#define mp  make_pair
#define int long long
#define itr ::iterator 
 
typedef pair<int,int>  pii;
 
const int MAX=1e6;
const int INF=1e18;
 
int N,E,T,arr[MAX],dp[MAX],tot[MAX],pre[MAX],nxt[MAX];
 
/*int cal(int ind)
{
	if(ind==N+1)
		return 0;
	if(dp[ind]!=-1)
		return dp[ind];
	dp[ind]=INF;
	for(int A=ind;A<=N;A++)
	{
		if(ok[ind][A] and ok[ind][A+1])
			continue;
		dp[ind]=min(dp[ind],pre[ind][A]+(arr[A+1]-arr[A])+cal(A+1));
	}
	return dp[ind];
}*/
 
void solve()
{
	dp[N]=T+E-arr[N];
	tot[N]=3*arr[N]+E-arr[N];
	//cout<<dp[N]<<" ha ha \n";
	//tot[N]=INF;
	for(int A=N-1;A>=1;A--)
	{
		dp[A]=pre[A]+arr[nxt[A]+1]-arr[nxt[A]]+dp[nxt[A]+1];
	   	if(nxt[A]<N)
	   	    dp[A]=min(dp[A],-3*arr[A]+tot[nxt[A]+1]);
		tot[A]=min(tot[A+1],3*arr[A]+arr[A+1]-arr[A]+dp[A+1]);
		/*for(int B=nxt[A]+1;B<=N;B++)
		{
			cout<<dp[A]<<"lol \n";
			dp[A]=min(dp[A],3*(arr[B]-arr[A])+arr[B+1]-arr[B]+dp[B+1]);
			//cout<<dp[A]<<" "<<3*(arr[B]-arr[A])<<" "<<arr[B+1]-arr[B]<<" "<<dp[B+1]<<"lol \n";
		}*/
		//cout<<A<<" "<<dp[A]<<"\n";
		//<<pre[A]<<" "<<dp[nxt[A]+1]<<"\n";
	}
	return ;
}
 
signed main()
{
	ios_base::sync_with_stdio(false);
 
	cin>>N>>E>>T;
	for(int A=1;A<=N;A++)
		cin>>arr[A];
	arr[N+1]=E;
	for(int A=1;A<=N;A++)
	{
		int low=A,high=N,mid,res=A;
		while(low<=high)
		{
			mid=(low+high)/2;
			if(T-2*(arr[mid]-arr[A])>0)
			{
				res=mid;
				low=mid+1;
			}
			else
				high=mid-1;
		}
		nxt[A]=res;
		pre[A]=T-2*(arr[res]-arr[A])+3*(arr[res]-arr[A]);
	}
	solve();
	cout<<arr[1]+dp[1];
	return 0;
}

Measured memory_bytes: 13440
from math import sqrt

x = int(input())

MAX_VAL = 10**(5+1)
prime = [1] * (MAX_VAL+1)
prime[0] = prime[1] = 0
for i in range(2, int(sqrt(MAX_VAL))+1):
    if prime[i]:
        for k in range(2*i, MAX_VAL+1, i):
            prime[k] = 0

cnt = x
while True:
    if prime[cnt]:
        print(cnt)
        break
    cnt += 1


Measured memory_bytes: 10868
#include <stdio.h>
#include <stdlib.h>

int main(void) {
	int n,i,p=1,t=0;
  int start=0;
	long long int k;
	long long int loop;
	int a[300000]={};
	int *b;
	b=(int*)malloc(sizeof(int)*300000);
	for(i=0;i<220000;i++){
		b[i]=0;
	}
	b[1]=1;
	(void)scanf("%d %lld",&n,&k);
	for(i=1;i<=n;i++){
		(void)scanf("%d",&a[i]);
	}
	for(i=0;i<k;i++){
		p=a[p];
		t++;
		if(b[p]!=0){
			start=p;
			break;
		}
		b[p]+=t;
	}
	k-=t;
	//printf("k is %lld\n",k);
	//printf("t is%d\n",t);
	//printf("start is %d\n",start);
	/*for(i=0;i<k;i++){
		p=a[p];
		b[p]+=1;
	}*/
	loop=t-b[start];
	if(start==1){
		loop++;
	}
	//printf("loop is %lld\n",loop);
	k=k%loop;
	for(i=0;i<k;i++){
		p=a[p];
	}
	printf("%d\n",p);
	free(b);
	return 0;
}
		

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

typedef long long ll;

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

ll f(ll x, int c, int d){
    ll res = x;
    res -= x / c;
    res -= x / d;
    res += x / lcm(c, d);
    return res;
}
int main()
{
    ll a, b;
    int c, d;
    cin >> a >> b >> c >> d;
    ll ans = f(b, c, d) - f(a - 1, c, d);
    cout << ans << endl;
}

Measured memory_bytes: 256
import kotlin.math.PI

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map(String::toInt) // list of ints
private fun readLongs() = readStrings().map(String::toLong) // list of longs

fun main() {
    val (N, M) = readInts()
    val H = readInts()
    val AB = (1..M).map { readInts() }.map { it.first() to it.component2() }
    val x = AB + AB.map { it.second to it.first }
    val y = x.groupBy { it.first }

    //println(y)
    val r = y.filter {
        //println("key: ${it.key}")
        it.value.asSequence().filter {
//            println(it.first to it.second)
//            println(H[it.first - 1] to H[it.second - 1])
//            println(H[it.first - 1] - H[it.second - 1])

            H[it.first - 1] - H[it.second - 1] <= 0
        }.onEach { println("it: $it") }
        .none()
    }.count()
    println(r + N - y.count())
}


Measured memory_bytes: 96616
#include <iostream>
#include <cmath>
using namespace std;
int main() 
{
    int n;
    cin >> n;
    int h[n];
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    long long dp[n];
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for (int i = 2; i < n; i++) {
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout << dp[n-1];
}

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

int main(){
    ll ans =1;
    int x;
    cin >> x;

    ll a=7;

    for(int i=1;i<=x;i++){ 
        if(a%x==0){ 
            cout << ans << endl;

            return 0;
        }
        ans++;
        a=(a*10+7)%x;

    }
    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


int main(){cout<<fixed<<setprecision(10);
		   int a,b,c;
           cin>>a>>b>>c;
           Yes(2*max(a,max(b,c))==a+b+c);
}

Measured memory_bytes: 3544
using System;

namespace ABC142
{
    class D
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            long A = long.Parse(input[0]);
            long B = long.Parse(input[1]);

            long N = CalcGCD(A, B);
            double sqrt = Math.Sqrt(N);

            long count = 1;
            long n = 2;

            bool isFirst = true;
            while (n <= sqrt)
            {
                if (N % n == 0)
                {
                    N /= n;
                    if (isFirst) { count++; isFirst = false; }
                }
                else
                {
                    isFirst = true; n++;
                }
            }
            if (N != 1) count++;
            Console.WriteLine(count);
        }

        static long CalcGCD(long a, long b)
        {
            if (b == 0) { return a; }
            return CalcGCD(b, a % b);
        }
    }
}


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

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if( a == b && b == c && a == c )
    cout << 1 << endl;
  else if( a != b && b != c && a != c )
    cout << 3 << endl;
  else
    cout << 2 << endl;
  return 0;
}

Measured memory_bytes: 256
a, b, h, m = map(int,input().split())
angle = 30*h - 5.5*m
if angle == 0:
  print(abs(b-a))
  exit()

import math
ans = (a*a + b*b - 2*a*b*math.cos(math.radians(angle)))**0.5
print(ans)

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

//ABC 082 c.cpp
int main() {
    int n;
    cin >> n;
    map<int,int> mp;
    rep(i,n){
        int j;cin >> j;
        mp[j]++;
    }
    
    int ans = 0;
    for(auto v : mp){
        if(v.second >= v.first) ans += v.second-v.first;
        else ans += v.second;
    }

    cout << ans << endl;
}

Measured memory_bytes: 7944
#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
    char c,k;
    int ans=0;
    scanf("%c",&c);
    printf("%c",c);
    while(scanf("%c",&c)!=-1){
        if(c==' '||c=='\n')break;
        ans++;
        k=c;
    }
    printf("%d%c",ans-1,k);
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 21 21:43:51 2019

@author: Yamazaki Kenichi
"""

s = int(input())
#T = [-1 for i in range(s+1)]
#T[0],T[1] = 1,1
#def fib(n):
#    if T[n] != -1:
#        return T[n]
#    else:
#        T[n] = fib(n-2) + fib(n-1)
#        return T[n]
#print(fib(s))

F = [1,1]
for i in range(s):
    F.append(F[-2]+F[-1])
print(F[s])


Measured memory_bytes: 5616
using System;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] inputs = new string[n];
            bool result = true;

            for(int i= 0;i < n; i++)
            {
                inputs[i] = Console.ReadLine();
            }

            for(int i= 0; i<n-1; i++)
            {
                if (!Judge(inputs, i, n)) {
                    result = false;
                    break;
                }

            }

            if (result) Console.WriteLine("Yes");
            else Console.WriteLine("No");


        }

        static bool Judge(string[] strs, int index, int n)
        {
            char[] chr1 = strs[index].ToCharArray();
            char[] chr2 = strs[index + 1].ToCharArray();
            for(int i = 0;i < n; i++)
            {
                if (strs[index] == strs[i] && index != i) return false;
            }
            return chr1[chr1.Length - 1] == chr2[0];
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N;
    cin >> N;
    cout << 800 * N - N / 15 * 200 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<list>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;


struct edge
{
	long long to; long long len;
	bool operator<(const edge& rhs) const {
		return len > rhs.len;
	}
};

int main() {
	string s;
	cin >> s;
	ll ans = 0;
	ll cnt = 0;
	REP(i, 0, SIZE(s)) {
		if (s[i] == 'W') {
			ans += i - cnt;
			cnt++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
const int nax=1e4;

void solve(){
    int k,a,b;
    cin>>k>>a>>b;
    int l1=b/k;
    int l2=(a-1)/k;
   // cout<<l1<<" "<<l2<<endl;
    if(l1 > l2) cout<<"OK\n";
    else cout<<"NG\n";
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int tc;
 //   cin>>tc;
    tc=1;
    while(tc--){
        solve();
    }
return 0;
}


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

using namespace std ; 

const int N = 1e5 + 7 ; 

int n;
int a[N] , b[N] ,c [N]; 
int L , m ; 
int nei[N] ; 

int fat[N][28] ; 

int main(){
    ios_base::sync_with_stdio(0) ; 
    cin.tie(0) ; 
    //freopen("in.in" , "r" , stdin) ;
    cin>>n ; 
    int l = 0  , l1 = 0 ; 
    for(int i = 1 ;i <= n;i++){
        cin>>a[i] ;
        l = a[i] ; 
        a[i]-= l1  ; 
        l1 = l ; 
    }  
    cin>>L ; 
    int mx = 1 ;
    int sum = 0 ;  
    int j = 1 ; 
    a[1] = 0 ; 
    for(int i = 1 ;i <= n ;i++){
        if( i > 1)
            sum-=a[i] ;
        while( j + 1 <= n && sum + a[j+1] <= L ){
            sum+=a[j+1] ; 
            j++ ;
        }
        nei[i] = j ; 
        fat[i][0] = j ; 
    }
    for(int i = 1 ; i < 26 ; i++){
        for(int j = 1 ; j <= n ;j++){
            fat[j][i] = fat[ fat[j][i-1] ][i-1] ; 
        }
    }
    cin>>m ;
    while(m--){
        int l , r; 
        cin>>l >>r ; 
        if(l > r) swap(l , r) ;
        int ans = 0  ;
        for(int i = 25 ; i >=0 ; i-- ){
            if(fat[l][i] < r)
            {
                l = fat[l][i] ; 
                ans+=(1<<i) ; 
            }
        }
        cout<< ans+1<<"\n" ; 
    }
    return 0 ;
}

Measured memory_bytes: 13312
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

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

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

int main()
{
	for(;;){
		char str[3][8];
		rep(i, 3){
			scanf("%s", str[i]);
			if(str[i][0] == '0')
				return 0;
		}
		
		const int sy[] = {0, 1, 2, 0, 0, 0, 0, 0};
		const int sx[] = {0, 0, 0, 0, 1, 2, 0, 2};
		const int dy[] = {0, 0, 0, 1, 1, 1, 1, 1};
		const int dx[] = {1, 1, 1, 0, 0, 0, 1,-1};
		int winner = 0;
		rep(i, 8){
			int y = sy[i], x = sx[i];
			int b = 0, w = 0;
			rep(j, 3){
				b += str[y][x] == 'b';
				w += str[y][x] == 'w';
				y += dy[i];
				x += dx[i];
			}
			if(b == 3){
				winner = 1;
				break;
			}
			if(w == 3){
				winner = 2;
				break;
			}
		}
		
		if(winner == 0)
			puts("NA");
		else
			puts(winner == 1 ? "b" : "w");
	}
}

Measured memory_bytes: 944