akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

ll beki(ll x, ll n){
  ll res = 1;
  while(n > 0){
    if(n & 1) res *= x;
    x = x * x;
    n >>= 1;
  }
  return res;
}

int main(){
  ll N, K;
  cin >> N >> K;
  vector<int> num(N+1, 0);
  for(int i = 1; i <= N; i++){
    ll n = i;
    while(n < K){
      n *= 2;
      num.at(i)++;
    }
  }
  ll x = 0;
  for(int i = 1; i <= N; i++){
    x += beki(2, num.at(1) - num.at(i));
  }
  cout << fixed << setprecision(12);
  cout << (double)x / (double)beki(2, num.at(1)) / (double)N << endl;
}

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

int main(){
  int N;
  int C[101];
  
  cin >> N;
  for(int i = 0; i < N; ++i){
    cin >> C[i];
  }
  
  sort(C, C+N, greater<int>());

  int A = 0;
  int B = 0;

  for(int i = 0; i < N; ++i) {
    if (i % 2 == 0) {
	  A += C[i];
    } else {
	  B += C[i];
    }
  }

  cout << A - B << endl;
  return 0;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(int x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

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

const int INF = 1e9+7;

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

  int H, W;
  cin >> H >> W;

  vector<vector<char>> grid(H, vector<char> (W));
  rep(i, 0, H) {
    rep(j, 0, W) {
      cin >> grid[i][j];
    }
  }

  vector<vector<int>> dp(H, vector<int> (W, INF));
  dp[H-1][W-1] = 0;
  for (int r = H-1; r >= 0; r--) {
    for (int c = W-1; c >= 0; c--) {
      char ch = grid[r][c];
      { // up
        if (r > 0) {
          if (ch == '#' && grid[r-1][c] == '.') {
            dp[r-1][c] = min(dp[r-1][c], dp[r][c] + 1);
          } else {
            dp[r-1][c] = min(dp[r-1][c], dp[r][c]);
          }
        }
      }
      { // left
        if (c > 0) {
          if (ch == '#' && grid[r][c-1] == '.') {
            dp[r][c-1] = min(dp[r][c-1], dp[r][c] + 1);
          } else {
            dp[r][c-1] = min(dp[r][c-1], dp[r][c]);
          }
        }
      }
    }
  }

  if (grid[0][0] == '.') {
    cout << dp[0][0] << endl;
  } else {
    cout << dp[0][0] + 1 << endl;
  }

  return 0;
};


Measured memory_bytes: 384
n,m=map(int,input().split())
edges=[list(map(int,input().split())) for i in range(m)]
class UnionFind:
    #def   -> foo=UnionFind(n,1)  <- 1-based index, default is 0
    #method -> foo.hoge(huga)
    __slots__ = ["_size", "_first_idx", "_parents"]
    def __init__(self, size: int, first_index: int = 0) -> None:
        self._size = size
        self._first_idx = first_index
        self._parents = [-1] * (size + first_index)
    def find(self, x: int) -> int:
        if self._parents[x] < 0:
            return x
        self._parents[x] = self.find(self._parents[x])
        return self._parents[x]
    def same(self, x: int, y: int) -> bool:
        return self.find(x) == self.find(y)
    def unite(self, x: int, y: int) -> bool:
        x, y = self.find(x), self.find(y)
        if x == y:
            return False
        if self._parents[x] > self._parents[y]:
            x, y = y, x
        self._parents[x] += self._parents[y]
        self._parents[y] = x
        return True
    def size(self, x: int) -> int:
        return -self._parents[self.find(x)]
    def group_count(self) ->int:
        return sum(1 for i in  self._parents if i<0)-self._first_idx
    def connected(self) ->bool:
        return self._parents[self.find(self._first_idx)]==-self._size
ans=0
for i in range(m):
    f=UnionFind(n,1)
    for j in range(m):
        if j!=i:f.unite(*edges[j])
    if f.group_count()==2:ans+=1

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int N;
  cin >> N;
  int num[10011];
  for (int i = 0; i <= 10010; i++) {
    num[i] = 0;
  }
  for (int i = 1; i <= 120; i++) {
    for (int j = 1; j <= 120; j++) {
      for (int k = 1; k <= 120; k++) {
        int res = (i*i) + (j*j) + (k*k) + (i*j) + (j*k) + (k*i);
        if (res > 10005) {
          continue;
        }
        num[res]++;
      }
    }
  }
  for (int i = 1; i <= N; i++) {
    cout << num[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
map<P,long long> mem;
int n;
long long a[2002];
long long dfs(int left,int right);
main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  long long ans=-1;
  for(int i=0;i<n;i++){
    ans=max(ans,dfs(i+1,i-1)+a[i]);
  }
  cout<<ans<<endl;
}
long long dfs(int left,int right){
  if(right==-1){
    right=n-1;
  }
  if(left==n){
    left=0;
  }
  if(left==right) return 0;
  if(mem[P(left,right)]!=0){
    return mem[P(left,right)];
  }
  else{
    int pl=left,pr=right;
    if(a[left]>a[right]){
      pl++;
    }
    else{
      pr--;
    }
    if(pr==-1){
      pr=n-1;
    }
    if(pl==n){
      pl=0;
    }
    if(pr==pl){
      return mem[P(left,right)]=a[pl];
    }
    else{
      return mem[P(left,right)]=max(dfs(pl+1,pr)+a[pl],dfs(pl,pr-1)+a[pr]);
    }
  }
}

Measured memory_bytes: 126196
#define _USE_MATH_DEFINES
#include<cmath>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(ll i = 0;i < n;i++)
#define FOR(i,a,b) for(ll i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

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

ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll digitsum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
int getdigit(ll a) {
	return to_string(a).size();
}
int countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}
int to_num(char c) {
	if (c >= '0' && c <= '9')return (c - '0');
	else return -1;
}


int main() {
	IOS;
	map<int, bool>mp;
	int n;
	cin >> n;
	REP(i, n) {
		ll a;
		cin >> a;
		mp[a] = !mp[a];
	}
	ll cnt = 0;
	for (auto it = mp.begin(); it != mp.end(); it++) {
		if (it->second)cnt++;
	}
	dump(cnt);
}




Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using Graph = vector<vector<pii>>;
const int MOD = 1e9 + 7;

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

    int N, R;
    cin >> N >> R;
    cout << R + 100 * max(10 - N, 0) << endl;

    return 0;
}


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

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    vector<string> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<vector<int>> d(n, vector<int>(m));
    d[0][0] = a[0][0] == '#';
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (i + j == 0) continue;
            d[i][j] = INT_MAX;
            if (i > 0) {
                int dd = d[i - 1][j];
                if (a[i][j] != a[i - 1][j]) dd++;
                d[i][j] = min(d[i][j], dd);
            }
            if (j > 0) {
                int dd = d[i][j - 1];
                if (a[i][j] != a[i][j - 1]) dd++;
                d[i][j] = min(d[i][j], dd);
            }
//            cout << i << " " << j << " " << d[i][j] << "\n";
        }
    }
    int res = d[n - 1][m - 1] + (a[n - 1][m - 1] == '#');
    cout << res / 2;

    return 0;
}

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

int main(){
    int num = 0, count = 0, now = 0, min = 2 * 100000;
    cin >> num;
    for (int i = 0; i < num; i++ ){
        cin >> now;
        if( min >= now ){
            count++;
            min = now;
        }
    }
    cout << count << endl;
    return 0;
}

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

int main(){
    string s; cin >> s;
    string s_rm_x = "";
    vector <int> x_index_cnt(200000);

    int x_cnt = 0;
    int index = 0;
    for(auto c: s){
        if(c == 'x'){
            x_index_cnt.at(index - x_cnt) += 1;
            x_cnt += 1;
            index += 1;
            continue;
        }
        s_rm_x += c;
        index += 1;
    }
    
    bool flag = true;
    if(s_rm_x.size() > 1){
        rep(i, (int)(s_rm_x.size()) / 2){
            if(s_rm_x.at(i) != s_rm_x.at(s_rm_x.size() - 1 - i)){
                flag = false;
            }
        }
    }
    if(!flag){
        cout << -1 << endl;
        return 0;
    }
    int size = s_rm_x.size();
    int ans = 0;

    if(size == 0){
        ans = 0;
    }
    else if(size == 1){
        ans = abs(x_index_cnt.at(0) - x_index_cnt.at(1));
    }
    else {
        if(size % 2 == 1){
            rep(i, size / 2 + 1){
            ans += abs(x_index_cnt.at(i) - x_index_cnt.at(size - i));
            }
        }
        else{
            rep(i, size / 2){
            ans += abs(x_index_cnt.at(i) - x_index_cnt.at(size - i));
            }
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 4300
#include<cstdio>
long long x[100005], v[100005];
long long tx[100005], tv[100005];

long long max(long long a,long long b){ return a>b?a:b; }

long long solve(int n,long long c,long long x[],long long v[]){
    long long curSum = 0;
    for(int i = 1; i <= n; i++) curSum += v[i];
    long long ans = curSum-x[n];
    long long leftSum = 0, maxn = 0;
    for(int i = n-1; i >= 0; i--){
        curSum -= v[i+1];
        leftSum += v[i+1];
        maxn = max(maxn,leftSum-(c-x[i+1]));
        ans = max(ans,curSum-x[i]);
        ans = max(ans,curSum-2*x[i]+maxn);
    }
    return ans;
}

int main(){
    int n; long long c;
    scanf("%d%lld",&n,&c);
    for(int i = 1; i <= n; i++){
        scanf("%lld%lld",&x[i],&v[i]);
        tx[n-i+1] = c-x[i];
        tv[n-i+1] = v[i];
    }
    long long ans = solve(n,c,x,v);
    for(int i = 1; i <= n; i++) x[i] = tx[i], v[i] = tv[i];
    ans = max(ans,solve(n,c,x,v));
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 4856
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

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

ll modpow(ll a, ll t) {
    if(t < 0) assert(false);
    ll ret = 1LL;
    while(t){
        if(t & 1LL){
            ret *= a;
            ret %= MOD;
        }
        a *= a;
        a %= MOD;
        t >>= 1;
    }
    return ret;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    ll a, b, x = 0, y = 0, z = 0;

    map<Pll, ll> mp;
    for(int i=0;i<n;++i) {
        cin >> a >> b;
        if(a < 0) {
            a *= -1;
            b *= -1;
        }
        if(a == 0) {
            if(b == 0) ++z;
            else ++y;
        } else {
            if(b == 0) ++x;
            else {
                ll g = gcd(a, b);
                a /= g; b /= g;
                ++mp[{a, b}];
            }
        }
    }

    ll ans = 1LL;
    vector<Pll> p;
    if(x != 0) {
        p.emplace_back(x, y);
    } else if(y != 0) {
        p.emplace_back(y, x);
    }
    for(auto itr=mp.begin(); itr!=mp.end(); ++itr) {
        tie(a, b) = (itr->first);
        // cerr << "mp: " << a << ", " << b << endl;
        if(mp.find({-b, a}) != mp.end()) {
            if(Pii(a, b) < Pii(-b, a)) {
                p.emplace_back(itr->second, mp[{-b, a}]);
            }
        } else if(mp.find({b, -a}) != mp.end()) {
             if(Pii(a, b) < Pii(b, -a)) {
                p.emplace_back(itr->second, mp[{b, -a}]);
            }
        } else {
            p.emplace_back(itr->second, 0);
        }
    }

    
    for(Pll q: p) {
        tie(a, b) = q;
        // cerr << a << " " << b << endl;
        if(b == 0) {
            ans *= modpow(2LL, a);
        } else {
            ans *= (((modpow(2LL, a) + modpow(2LL, b)) % MOD) + MOD - 1LL) % MOD;
        }
        ans %= MOD;
    }
    ans += z;
    ans %= MOD;
    ans += MOD - 1;
    ans %= MOD;
    cout << ans << endl;
}


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

int p,q,a,n,n_count;

int dfs(int total,int product,int count,int i){
  if(count>n) return 0;
  if(p/q<total/product)return 0;
  for(int j=i;j<=a;++j){
    if(product*j>a)return 0;
    if(count+1>n)return 0;
    if(p*product*j==(total*q*j+q*product))++n_count;
    // cout <<"total="<<total<<" product="<<product<<" j=="<<j<<endl;
    dfs(j*total+product,product*j,count+1,j);
  }
}

int main(){
  while(1){
    int count = 1;
    n_count=0;
    cin >> p >> q >> a >> n;
    if(!p && !q && !a && !n)break;
    int tmp=__gcd(p,q);
    p=p/tmp;
    q=q/tmp;
    if(p==1&&q<=a)++n_count;
    for(int i=1;i<=a;++i)dfs(1,i,count,i);
    cout << n_count <<endl;
  }
  return 0;
}

Measured memory_bytes: 3000
#include <stdio.h>
  
int main(void)
{   int a,b,i;
    char op;
    for(i=1;i>0;i++){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='+')
        {printf("%d\n",a+b);
        }
        else if(op=='-')
        {printf("%d\n",a-b);
        }
        else if(op=='*')
        {printf("%d\n",a*b);
        }
        else if(op=='/'){
            printf("%d\n",a/b);
        }else if(op=='?') {
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
int main()
{
  
  int n;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)
  {
  cin>>arr[i];
  }
  
  int count=0;
  sort(arr,arr+n);
  for(int i=0;i<n-2;i++)
  {
    for(int j=i+1;j<n-1;j++)
    {
       for(int k=j+1;k<n;k++)
       {
       
         if(arr[i]!=arr[k]&&arr[i]!=arr[j]&& arr[j]!=arr[k]&&arr[i]+arr[j]>arr[k])
           count++;
       }
    
    }
  
  }
  cout<<count;
}

Measured memory_bytes: 3604
import java.util.*;
public class Main {
	   public static int gcd(int x,int y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      int k = sc.nextInt(); 
      int count = 1;
      int ans = gcd(a,b);
      while(count<k){ans--;if(a%ans==0 &&b%ans==0){count++;}
                    }
	  System.out.println(ans);
  }
}

Measured memory_bytes: 23252
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <vector>
#include <numeric>
#include <string>
#include <bitset>
#include <queue>
#include <tuple>
#include <regex>
#include <cmath>
#include <map>
#include <cstring>
using namespace std;

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

	// N要素の配列
	vector<int> A(N);

	// 入力処理
	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
	}
	sort(A.begin(), A.end()); // {1, 2, 2, 5}

	int sum = 1;
	for (int j = 0; j < N-1; j++) {
		if (A.at(j) < A.at(j + 1))
			sum++;
		else
			continue;


	

	}
	cout << sum << endl;
}

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

for bi in b:
    for ci in c:
        top_bc.append(bi + ci)

top_bc = sorted(top_bc, reverse=True)

top_ak = []

for ki in top_bc[0:k]:
    for ai in a:
        top_ak.append(ai + ki)

top_ak = sorted(top_ak, reverse=True)

for top_k in top_ak[0:k]:
    print(top_k)

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

int days(int year, int month, int day) {
    int mil = 196471;
    int total = 0, max;
    for (int y = 1; y <= year; ++y) {
        for (int m = 1; m <= 10; ++m) {
            max = (y % 3 != 0 && m % 2 == 0) ? 19 : 20;
            for (int d = 1; d <= max; ++d) {
                total++;
                if (y == year && m == month && d == day)
                    return mil - total;
            }
        }
    }
}

int main(int argc, char *argv[])
{
    int n, y, m, d;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> y >> m >> d;
        cout << days(y, m, d) << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#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,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
int a[40]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int k;
int main(){
	cin>>k;
	cout<<a[k];
	return 0;
}

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

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

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    for (int i = 0; i < H; i++) cin >> S[i];

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (S[i][j] == '#') continue;
            int cnt = 0;
            for (int k = 0; k < 8; k++) {
                int x = i + dx[k];
                int y = j + dy[k];
                if (x < 0 || x >= H || y < 0 || y >= W) continue;
                if (S[x][y] == '#') cnt++;
            }
            S[i][j] = (char)('0' + cnt);
        }
    }

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cout << S[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	static int c=0;
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int A[] = new int[n];
		for(int i=0; i<n; i++){
			A[i] = sc.nextInt();
		}
		mergeSort(A, 0, n);
		System.out.print(A[0]);
		for(int i=1; i<n; i++){
			System.out.print(" "+A[i]);
		}
		System.out.println();
		System.out.println(c);
	}
	static void mergeSort(int A[], int left, int right){
		if(left+1 < right){
			int mid = (left + right)/2;
			mergeSort(A, left, mid);
			mergeSort(A, mid, right);
			merge(A, left, mid, right);
		}
	}
	static void merge(int A[], int left, int mid, int right){
		int n1 = mid - left;
		int n2 = right - mid;
		int L[] = new int[n1+1];
		int R[] = new int[n2+1];
		for(int i=0; i<n1; i++){
			L[i] = A[left + i];
		}
		for(int i=0; i<n2; i++){
			R[i] = A[mid + i];
		}
		L[n1] = R[n2] = Integer.MAX_VALUE;
		int i, j;
		i = j = 0;
		for(int k=left; k<right; k++){
			c++;
			if(L[i] <= R[j]){
				A[k] = L[i++];
			} else{
				A[k] = R[j++];
			}
		}
	}
}

Measured memory_bytes: 166076
#include <bits/stdc++.h>
#define ll long long
#define INF INT_MAX 
#define mod 1000000007
using namespace std;
int main(){
   ll N,K;
   cin >> N >> K;
   string s;
   cin >> s;
   vector<ll> R; 
   if(s[0]=='0')R.push_back(0);
   ll countzero=0,countone=0;
   for(int i=0;i<N;i++){
       if(s[i]=='1'){
           countone++;
           if(countzero>0){
               R.push_back(countzero);
               countzero=0;
           }
       }else{
           countzero++;
           if(countone>0){
               R.push_back(countone);
               countone=0;
           }
       }
    }
    if(countone>0)R.push_back(countone);
    if(countzero>0)R.push_back(countzero);
    if(s.back()=='0')R.push_back(0);
    vector<int> S(R.size(),0);
    S[0] = R[0];
    for(int i=0;i<R.size();i++){
        if(i>0)S[i] = R[i] + S[i-1];
    }
    ll ans = 0;
    for(int i=0;i<R.size();i+=2){
        int j = i+2*K;
        if(j>=R.size())j = R.size()-1;
        ll now = S[j]-S[i]+R[i];
        ans = max(ans,now);
    }
    cout << ans << endl;
}   


Measured memory_bytes: 1652
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int a[5][5],n,b[20],visit[5][5],flag=0;
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			scanf("%d",&a[i][j]);
		}
	}
	memset(visit,0,sizeof(visit));
	scanf("%d",&n);
	for(int l=1;l<=n;l++){
		scanf("%d",&b[l]);
		for(int i=1;i<=3;i++){
			for(int j=1;j<=3;j++){
				if(a[i][j]==b[l]){
					visit[i][j]=1;
					break;
				}
			}
		}
	}
	if(visit[1][1]==1&&visit[2][2]==1&&visit[3][3]==1){
		flag=1;
	}
	if(visit[1][3]==1&&visit[2][2]==1&&visit[3][1]==1){
		flag=1;
	}
	for(int i=1;i<=3;i++){
		if(visit[i][1]==1&&visit[i][2]==1&&visit[i][3]==1){
			flag=1;
		}
		if(visit[1][i]==1&&visit[2][i]==1&&visit[3][i]==1){
			flag=1;
		}
	}
	if(flag==1){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 760
S=input()

Sum = 0
for ii in range( 1, 2**(len(S)-1) ):
    temp_list = []
    temp_s = S
    itr = 1
    for jj in range( (len(S)-1) ):
        bit = (ii>>jj) & 1
        if bit:
            temp_list.append( int(temp_s[0:itr]) )
            temp_s = temp_s[itr:]
            itr = 1
        else:
            itr += 1
    Sum += sum( int(i) for i in temp_list )
    Sum += int(temp_s)
Sum += int(S)
print(Sum)


Measured memory_bytes: 3064
n = gets.chomp.to_i

score_t = 0
score_h = 0

n.times do
  card_t, card_h = gets.chomp.split(/\s/)
  if card_t > card_h
    score_t += 3
  elsif card_t < card_h
    score_h += 3
  else
    score_h += 1
    score_t += 1
  end
end

puts "#{score_t} #{score_h}"

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

using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}


long long dp[100010][2];
bool ok[100010][2];
vector<ll> A;

long long dfs(int p, int c) {
  if (p == A.size()) return c == 1 ? -1e18 : 0;

  if (ok[p][c]) {
    return dp[p][c];
  }

  long long v = c ? -A[p] : A[p];

  long long ans = dfs(p + 1, 0) + v;
  ans = max(ans, dfs(p + 1, 1) - v);


  ok[p][c] = true;
  return dp[p][c] = ans;
}


void solve(long long N, std::vector<long long> A) {
  ::A = A;
  cout << dfs(0, 0) << endl;

}

int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}


Measured memory_bytes: 8320
N = int(input())
S = [input() for i in range(N)]
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N) :
    if S[i] == 'AC' :
        AC += 1
    elif S[i] == 'WA' :
        WA += 1
    elif S[i] == 'TLE' :
        TLE += 1
    elif S[i] == 'RE' :
        RE += 1
print('AC','x',str(AC) )
print('WA','x',str(WA) )
print('TLE','x',str(TLE) )
print('RE','x',str(RE) )

Measured memory_bytes: 16320
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}

typedef long long ll;
int main(){
  ll x, ans = 0;
  cin >> x;
  ans += (x / 11) * 2;
  x = x % 11;
  if(x == 0)     cout << ans << endl;
  else if(x > 6) cout << ans + 2 << endl;
  else           cout << ans + 1 << endl;

  return 0;
}


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

int main(){
    int w, h, r, x, y, a, b;
    scanf("%d %d %d %d %d\n", &w, &h, &x, &y, &r);
    a = x + r;
    b = y + r;
    if(a>0 && a<=w && b>0 && b<=h)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}



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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    int n;
    ll k;
    cin >> n >> k;
    vector<int> p(n);
    vector<ll> c(n),s(n+1,0);
    for (int i = 0;i < n;++i) cin >> p[i],p[i]--;
    for (int i = 0;i < n;++i) cin >> c[i];
    ll ans = -1e18;
    for (int i = 0;i < n;++i) {
        int l = 0,j = i;
        ll sum = 0;
        while (1) {
            j = p[j];
            sum += c[j];
            if (l < k) ans = max(ans,sum);
            s[l] = sum;
            l++;
            if (j == i) break;
        }
        ll a = 0,kk;
        if (k >= l) {
            a = sum*(k/l-1);
            kk = k-(k/l-1)*l;
        } else {
            kk = k;
        }
        while (kk--) {
            j = p[j];
            a += c[j];
            ans = max(ans,a);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3724
Q=int(input())
Qs=[list(map(int,input().split())) for _ in range(Q)]
Prime=[0]*100001
count=0

def Isprime(i):
    for j in range(2,int(i**(0.5))+1):
        if i%j==0:
            return False
    return True

for i in range(3, 100001, 2):
    if Isprime(i) and Isprime((i+1)//2):
        Prime[i]=1
        count+=1

for i in range(1,100001):
    Prime[i]=Prime[i]+Prime[i-1]

for q in Qs:
    print(Prime[q[1]]-Prime[q[0]-1])

Measured memory_bytes: 31404
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  ll x,a,b; cin >> x >> a >> b;
  cout << (x-a)%b << endl;
}

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

int main(){
	int N, K, Q; cin >> N >> K >> Q;
	vector<int> A(N, K - Q);

	while(Q--){
		int a; cin >> a;
		++A[a-1];
	}

	for(auto &a : A){
		if(a > 0) cout << "Yes" << endl;
		else			cout << "No" << endl;
	}
}


Measured memory_bytes: 1024
// Aizu Vol-10 1060: No Story
// 2017.10.7 bal4u@uu

#include <stdio.h>
#include <math.h>

int power[100], sz;

int ptbl[] = {
         3,   5,   7,  11,  13,  17,  19,  23,  29,
   31,  37,  41,  43,  47,  53,  59,  61,  67,  71,
   73,  79,  83,  89,  97, 101, 103, 107, 109, 113,
  127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
  179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
  233, 239, 241, 251, 257, 263, 269, 271, 277, 281,
  283, 293, 307, 311, 313, 317, 331, 337, 347, 349,
  353, 359, 367, 373, 379, 383, 389, 397, 401, 409,
  419, 421, 431, 433, 439, 443, 449, 457, 461, 463,
  467, 479, 487, 491, 499, 503, 509, 521, 523, 541,
  547, 557, 563, 569, 571, 577, 587, 593, 599, 601,
  607, 613, 617, 619, 631, 641, 643, 647, 653, 659,
  661, 673, 677, 683, 691, 701, 709, 719, 727, 733,
  739, 743, 751, 757, 761, 769, 773, 787, 797, 809,
  811, 821, 823, 827, 829, 839, 853, 857, 859, 863,
  877, 881, 883, 887, 907, 911, 919, 929, 937, 941,
  947, 953, 967, 971, 977, 983, 991, 997, 0 };

void prime_factor(long long n)
{
    int i, d, sw;
    int *pp;

    sz = 0;
    if ((n & 1) == 0) {
        power[sz] = 0;
        do n >>= 1LL, power[sz]++;
        while ((n & 1) == 0);
        sz++;
    }
	if (n <= 1) return;
	for (pp = ptbl; *pp > 0; pp++) {
		if (n % *pp) continue;
		d = *pp, power[sz] = 0;
		do n /= d, power[sz]++;
	    while (n % d == 0);
		sz++;
	}
    if (n > 1) {
        int b = (int)sqrt((double)n);
		for (i = 1009, sw = 0; n > 1; ) {
            if (i > b) { power[sz++] = 1; break; }
            if (n % i == 0) {
                power[sz] = 0;
                do n /= i, power[sz]++;
                while (n % i == 0);
                sz++;
            }
            if (sw) i += 2, sw = 0;
            else    i += 4, sw = 1;
        }
    }
}

int main()
{
	long long n, ans;
	int i;

	while (scanf("%lld", &n) && n > 0) {
        prime_factor(n);
		for (ans = 1, i = 0; i < sz; i++) ans = ans * (1 + (power[i] << 1));
		ans = (ans + 1) / 2;
        printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1712
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
		string x;
		cin>>x;
		ll n;
		n=x.length();
		ll p;
		p=x[n-1];
		if(p=='2'||p=='4'||p=='5'||p=='7'||p=='9')
		{
			cout<<"hon"<<"\n";
		}
		else if(p=='0'||p=='1'||p=='6'||p=='8')
		{
			cout<<"pon"<<"\n";
		}
		else
		{
			cout<<"bon"<<"\n";
		}
	return 0;
}


Measured memory_bytes: 3580
def is_obeid(x):
    for i in range(len(x)):
        if x.count(x[i]) > 1:
            return False
        if i != 0:
            if x[i][0] != x[i - 1][-1:]:
                return False
    return True

def main():
    w = []
    N = int(input())
    for i in range(N):
        w.append(input())
    if is_obeid(w):
        print('Yes')
    else:
        print('No')

main()

Measured memory_bytes: 3060
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define ss st.st
#define sn st.nd 
/****************************/
int n;
int h[100010];
int dp[100010];
int main()
{
	ios::sync_with_stdio(0);
	cin>>n;
	rep(i,n)
	{
		cin>>h[i];
	}
	dp[0]=0;
	dp[1]=abs(h[1]-h[0]);
	rep3(i,2,n)
	{
		dp[i]=min(dp[i-2]+abs(h[i-2]-h[i]),dp[i-1]+abs(h[i-1]-h[i]));
	}
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main{
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    System.out.println(n%2!=0?(double)(n/2+1)/n:String.format("%.10f",(double)(n/2)/n));
  }
}

Measured memory_bytes: 21332
from __future__ import print_function

import sys
input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


# import re
# import array
# import copy
# import functools
# import operator

# import math
# import string
import fractions
# from fractions import Fraction
from fractions import gcd

# import collections
# import itertools
# import bisect

# import heapq
# from heapq import heappush
# from heapq import heappop
# from heapq import heappushpop
# from heapq import heapify
# from heapq import heapreplace
# from queue import PriorityQueue as pq
from queue import Queue

# from itertools import accumulate

# from collections import deque
# from collections import Counter

from operator import mul
from functools import reduce

def lcm(n,m):
    return int(n*m/gcd(n,m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


# import random
# import time

a, b, c, d = map(int, input().strip().split())
n = b - a  + 1
m1 = b // c - (a - 1) // c
m2 = b // d - (a - 1) // d
m3 = b // lcm(c, d) - (a - 1) // lcm(c, d)
ans = n - (m1 + m2 - m3)
print(ans)


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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i)
    cin >> a[i];
  sort(a.rbegin(), a.rend());

  int point[2] = {};
  for (int i = 0; i < n; ++i) {
    point[i % 2] += a[i];
  }

  cout << point[0] - point[1] << endl;
  
  return 0;
}


Measured memory_bytes: 256
N = int(input())

list1 = []
for i in range(N):
    a, b = input().split()
    b = int(b)
    list1.append([a,b,i+1])

list1.sort(key=lambda x:x[1], reverse=True)
list1.sort(key=lambda x:x[0])

for i in range(N):
    print(list1[i][2])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const int mo=998244353;
const int N=500005;
int fac[N],inv[N],n,m;
void init(){
	fac[0]=inv[0]=inv[1]=1;
	For(i,2,N-1) inv[i]=1ll*inv[mo%i]*(mo-mo/i)%mo;
	For(i,1,N-1) inv[i]=1ll*inv[i-1]*inv[i]%mo;
	For(i,1,N-1) fac[i]=1ll*fac[i-1]*i%mo;
}
int C(int x,int y){
	if (x<0||y<0||y>x) return 0;
	return 1ll*fac[x]*inv[y]%mo*inv[x-y]%mo;
}
int power(int x,int y){
	int s=1;
	for (;y;y/=2,x=1ll*x*x%mo)
		if (y&1) s=1ll*s*x%mo;
	return s;
}
int main(){
	init();
	scanf("%d%d",&n,&m);
	int ans=0;
	For(i,0,min(n,m)){
		int val=1ll*C(n,i)*C(m,i)%mo*fac[i]%mo;
		val=1ll*val*power(m+1,n-i)%mo;
		val=1ll*val*power(n+1,m-i)%mo;
		ans=(ans+(i&1?mo-val:val))%mo;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 4096
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;
int main()
{
	int a, b;
	while(scanf("%d\n %d", &a, &b)!=EOF)
	{
		int x = 1;
		for(int i = 1; i <= a; i++)
		{
			x = 2 * x;
			if(x >= (x / 2 + b))
			{
				x = x / 2;
				x = x + b;
			}
		}
		printf("%d\n", x);
	}
	return 0;
}


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

int main() {

 int A,B;
  cin >> A >> B;
 int ans=0;
  do{    
    if(A/0.08 <= ans && (A+1)/0.08 > ans && B*10<=ans && (B+1)*10 > ans  ){
      break;
    }
    ans++;
  }while(ans<1001);
  
  if(ans==1001){
    ans=-1;
  }
   
      
  cout << ans <<endl;

}

Measured memory_bytes: 256
/*بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long

void solve()
{
    ll a,b,c,n,m=0,i,j,l=0,r,k=0,kk=0,z=0,ans=0,sum=0,y=0,x,s1,sk;
    vector < ll > v;
    string s;

    cin >> n >> s;

    k = s.size();

    for(i=0;i<min(n,k);i++)
    {
        cout << s[i];
    }

    if(s.size()>n)
    {
        cout << "...";
    }

    cout << endl;

}

int main()
{
    int t;

    solve();
}
/*
5 3 1 5 14 11
4 4 3 2 1
*/


Measured memory_bytes: 3632
#include <stdio.h>

int main(void)
{
	int m;
	int cnt;
	
	while (1){
		cnt = 0;
		scanf("%d", &m);
		if (m == 0) break;
		m = 1000 - m;
		//printf("debag:%d\n", m);
		
		while (m != 0){
			if (m >= 500){
				cnt++;
				m -= 500;
			}
			else if (m >= 100){
				cnt++;
				m -= 100;
			}
			else if (m >= 50){
				cnt++;
				m -= 50;
			}
			else if (m >= 10){
				cnt++;
				m -= 10;
			}
			else if (m >= 5){
				cnt++;
				m -= 5;
			}
			else if (m >= 1){
				cnt++;
				m -= 1;
			}
		}
		printf("%d\n", cnt);
	}
	return (0);
}

Measured memory_bytes: 596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static long Calculate(string S, int pattern)
        {
            long sum = 0;
            long value = 0;
            for (int i = 0; i < S.Length; ++i)
            {
                value *= 10;
                value += S[i] - '0';
                if ((pattern & 1) != 0)
                {
                    sum += value;
                    value = 0;
                }
                pattern >>= 1;
            }
            return sum + value;
        }
        static long Solve(string S)
        {
            int N = S.Length;
            return Enumerable.Range(0, 1 << (N - 1)).Sum(i => Calculate(S, i));
        }
        static void Main(string[] args)
        {
            Console.WriteLine(Solve(Read()));
        }
    }
}


Measured memory_bytes: 11348
// Ninjo ~ khaledalam.net@gmail.com
#include <bits/stdc++.h>
using namespace std;
#define sz(A)     (int)(A).size()
#define all(B)     (B).begin(),(B).end()
#define file       freopen("input.txt", "r", stdin)
#define ios        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int main() {
//	file;
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b == c || a + c == b || c + b == a) {
		puts("Yes");
		return 0;
	}
	puts("No");
}


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

int main() {
  uint64_t Ans = 0;  // 回答：
  uint64_t N; cin >> N; // 最終の値

  rep1(i,N){
    if(i%3!=0 && i%5!=0 ){
      Ans +=i;
    }
  }
  cout << Ans << endl;
}


Measured memory_bytes: 3612
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>
#include <map>

using namespace std;
int main(int argc, const char * argv[]) {
    
    int r , d, x;
    cin >> r >> d>> x;

    for (int i=0; i<10; i++) {
        int xn = r*x-d;
        cout << xn << endl;
        x = xn;
    }
    return 0;
}

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

int main() {
    ll h, w;
    cin >> h >> w;
    if(h == 1 || w == 1) cout << 1 << endl;
    else if(h % 2 == 0 || w % 2==0)cout << (h * w) / 2 << endl;
    
    else cout << ((h * w) / 2) + 1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  cin >> A >> B;
  int a,b;
  a = A / 1000;
  b = B / 1000;
  int aa,bb;
  aa = a / 10 + (a % 10 * 10);
  bb = b / 10 + (b % 10 * 10);
  int sum=0;
  int c=0;
  if(a == b){
    for(int i = 0; i < 10; i++){
      if(1000 * a + 100 * i + aa >= A){
        for(int j = 9; j >= i; j--){
          if(1000 * a + 100 * j + aa <= B){
            sum += (j - i + 1);
            c++;
            break;
          }
        }
        if(c==1) break;
      }
    }
  }else{
    sum += (b - a - 1) * 10;
    for(int i = 0; i < 10; i++){
      if(1000 * a + 100 * i + aa >= A){
        sum += (10 - i);
        break;
      }
    }
    for(int j = 9; j >= 0; j--){
      if(1000 * b + 100 * j + bb <= B){
        sum += (j + 1);
        break;
      }
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
#define fir first
#define sec second
typedef long long ll;
////////////////////////////////////////////////////////////

template<class X> bool isPrime( X n ){
	if(n <= 0 )
		return false;
	else if( n == 1 )
		return false;
	else if( n == 2 )
		return true;
	else{
		X limit = sqrt(n)+1;
		if( n % 2 == 0 )
			return false;
		for(X i = 3 ; i <= limit ; i += 2 ){
			if( n % i == 0 )
				return false;
		}
	}
	return true;
}

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

	vector<int> v;
	int num = 0;
	while( v.size() < n ){
		if( num%10 == 1 &&  isPrime(num) ){
			v.push_back(num);
		}
		num++;
	}

	rep(i,0,n) cout << v[i] << " ";
	cout << endl;

	ret 0;
}

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

int main() {
    string s;
    cin >> s;
    int ans = 0;
    int a, b;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == 'A') {
            a = i;
            break;
        }
    }
    for (int i = s.length() - 1; i >= 0; i--) {
        if (s[i] == 'Z') {
            b = i;
            break;
        }
    }
    cout << b - a + 1 << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
signed main(){
	int n;
	cin>>n;
	if(__builtin_popcount(n)==1) return cout<<"No",0;
	cout<<"Yes\n";
	cout<<1<<" "<<2<<endl;
	cout<<2<<" "<<3<<endl;
	cout<<3<<" "<<n+1<<endl;
	cout<<n+1<<" "<<n+2<<endl;
	cout<<n+2<<" "<<n+3<<endl;
	for(int i=4;i+1<=n;i+=2)
		cout<<1<<" "<<i<<endl,
		cout<<1<<" "<<i+1<<endl,
		cout<<i<<" "<<i+1+n<<endl,
		cout<<i+1<<" "<<i+n<<endl;
	if(!(n&1)){
		for(int i=2;i<n;++i){
			if(i==3) continue;
			int j=(n^i^1);
			if(j!=3 && j<n){
				cout<<i<<" "<<n<<endl;
				cout<<j<<" "<<n+n<<endl;
				break;
			}
		}
	}	
	return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse

int d[2010][2010];

ll cnt[2010];

int main () {

    int n,x,y;cin>>n>>x>>y;

    // for (int i=1;i<=n-1;i++) {
    //     for (int j=i+1;j<=n;j++) {
    //         d[i][j]=j-i;
    //     }
    // }

    rep(i,n) {
        rep(j,n) {
            d[i+1][j+1]=abs(i-j);
        }
    }

    d[x][y]=1;
    d[y][x]=1;

    for (int i=1;i<=n;i++) {
        d[x][i]=min(d[x][i],d[x][y]+d[y][i]);
        d[y][i]=min(d[y][i],d[y][x]+d[x][i]);
    }

    rep(i,n) {
        rep(j,n) {
            d[i+1][j+1]=min(d[i+1][j+1],d[i+1][x]+d[x][j+1]);
            d[i+1][j+1]=min(d[i+1][j+1],d[i+1][y]+d[y][j+1]);
        }
    }

    rep(i,n) {
        rep(j,n) {
            cnt[d[i+1][j+1]]++;
        }
    }

    rep(i,n-1) {
        cout<<cnt[i+1]/2<<endl;
    }

}

Measured memory_bytes: 16000
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
 
using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}

template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

ll pow_mod(ll a, ll b, ll mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }

  ll x = 1;

  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

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

  ll n,m,l;
  std::cin>>n>>m>>l;

  std::vector<std::vector<ll>> dp(n,std::vector<ll>(n,MOD));

  rep(i,0,m){
    ll a,b,c;
    std::cin>>a>>b>>c;
    a--;b--;
    dp[a][b]=c;
    dp[b][a]=c;
  }

  rep(k,0,n){
    rep(i,0,n){
      rep(j,0,n){
        dp[i][j]=std::min(dp[i][j],dp[i][k]+dp[k][j]);
      }
    }
  }

  rep(i,0,n){
    rep(j,0,n){
      if(dp[i][j]<=l)dp[i][j]=1;
      else dp[i][j]=MOD;
    }
  }

  rep(i,0,n)dp[i][i]=0;

  rep(k,0,n){
    rep(i,0,n){
      rep(j,0,n){
        dp[i][j]=std::min(dp[i][j],dp[i][k]+dp[k][j]);
      }
    }
  }

  ll q;
  std::cin>>q;

  rep(_,0,q){
    ll s,t;
    std::cin>>s>>t;
    s--;t--;
    if(dp[s][t]==MOD)std::cout<<-1<<"\n";
    else std::cout<<std::max(dp[s][t]-1,0ll)<<"\n";
  }
 
  return 0;
}

Measured memory_bytes: 1280