akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;

ll N;
ll a,b;
int main(){
    cin>>a>>b;
    cout<<(a-1)*(b-1)<<endl;
    return 0;
}

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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    mat<int> s = mmat(m);
    int k;
    rep (i, m) {
        cin >> k;
        s[i] = ivec(k);
    }
    vec p = ivec(m);

    int ans = 0;
    rep (i, pow(2, n)) {
        bool ok = true;
        rep (j, s.size()) {
            int cnt = 0;
            repall (k, s[j])
                cnt += ((i >> (k - 1)) & 1);
            if (cnt % 2 != p[j]) {
                ok = false;
                break;
            }
        }
        if (ok) ans++;
    }
    print(ans);

    return 0;
}


Measured memory_bytes: 512
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

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

#define MAX_N 200000

ll cnt[MAX_N + 1];
vector<int> g[MAX_N + 1];

void dfs(int par, int u, ll sum) {
    cnt[u] += sum;
    for (int v : g[u]) {
        if (v == par)
            continue;
        dfs(u, v, cnt[u]);
    }
}

int main() {
    int n, q, a, b, p, x;
    cin >> n >> q;
    for (int i = 0; i < n - 1; ++i) {
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    while (q--) {
        cin >> p >> x;
        cnt[p] += x;
    }
    dfs(0, 1, 0);
    for (int i = 1; i <= n; ++i) {
        cout << cnt[i];
        if (i < n)
            cout << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 24320
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))
#define Endl endl

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int ceil_(int a, int b) { return (a + (b - 1)) / b; }
int positive_surplus(int &a) { return (a + MOD) % MOD; }
int bpm(int x, unsigned int y) {
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
template <class T>
void cumulative_sum(T &container) {
  for (int i = 0; i < container.size() - 1; i++) container[i + 1] += container[i];
}
class ECrestedIbisVsMonster {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    int H, N;
    cin >> H >> N;
    vector<vector<int>> dp(N + 10, vector<int>(H + 10, INF));
    vector<int> A(N);
    vector<int> B(N);
    rep(i, N) {
      cin >> A[i];
      cin >> B[i];
    }
    rep(i, N) dp[i][0] = 0;
    rep(i, N) {
      rep(j, H + 1) {
        dp[i + 1][j] = dp[i][j];
      }
      rep(j, H) {
        dp[i + 1][min(H, j + A[i])] = min(dp[i + 1][min(H, j + A[i])], dp[i + 1][j] + B[i]);
      }
    }
    cout << dp[N][H] << endl;
  }
};


signed main() {
  ECrestedIbisVsMonster solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 79488
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main() {
    int W, a, b; cin >> W >> a >> b;

    if (b>a+W) cout << b-(a+W) << endl;
    else if (a>b+W) cout << a-(b+W) << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  int countA=0,countB=0;
  cin>>s;
  for(int i=0;i<3;i++)
  {
    if(s[i]=='A')
      countA++;
    else countB++;
  }
  if(countA==2||countB==2)
    cout<<"Yes";
    else cout<<"No";
  return 0;
}

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

#define M 1000000
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
  return 0;
}

long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1+(key%(M-1)); }

int find(char str[]){
  int key, i, h;
  key = getKey(str);
  for(i = 0 ; ; i++){
    h = (h1(key) + i * h2(key))%M;
    if(strcmp(H[h], str) == 0 ) return 1;
    else if(strlen(H[h]) == 0 ) return 0;
  }
  return 0;

}

int insert(char str[]){
  /* your task */
  int key, i, h;
  key = getKey(str);
  for(i = 0 ; ; i++){
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h], str) == 0 ) return 1;
    else if(strlen(H[h]) == 0 ){
      strcpy(H[h], str);
      return 0;
    }
  }
  return 0;
}

  int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';

    scanf("%d", &n);

    for ( i = 0; i < n; i++ ){
      scanf("%s %s", com, str);

      if ( com[0] == 'i' ){
        insert(str);
      } else {
        if (find(str)){
          printf("yes\n");
        } else {
          printf("no\n");
        }
      }
    }

    return 0;
  }


Measured memory_bytes: 15384
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;

int main()
{
    int n, m;
    cin >> n;
    vector<string> s(n);
    rep(i, n) {
        cin >> s.at(i);
    }
    
    cin >> m;
    vector<string> t(m);
    rep(i, m) {
        cin >> t.at(i);
    }

    vector<bool> seen(n, false), teen(m, false);
    int ans = 0;
    rep(i, n) {
        if (seen[i]) continue;
        seen[i] = true;
        int temps = 1, tempt = 0;

        for (int j = i + 1; j < n; j++) {
            if (seen[j]) continue;

            if (s[i] == s[j]) {
                temps++;
                seen[j] = true;
            }
        }

        rep(k, m) {
            if (teen[k])  continue;

            if (s[i] == t[k]) {
                tempt++;
                teen[k] = true;
            }
        }

        ans = max(ans, temps - tempt);
    }

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


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;

int main()
{
	int n, p;
	scanf("%d", &n);
	int s[20001], b[20001];
	for(int i=0; i<n; i++){
		b[n-1-i]=1+(n+1)*i;
	}
	for(int i=0; i<n; i++){
		scanf("%d", &p);
		p--;
		s[p]=500000000+i;
	}
	for(int i=0; i<n; i++){
		printf("%d ", s[i]-b[i]);
	}
	printf("\n");
	for(int i=0; i<n; i++){
		printf("%d ", b[i]);
	}
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
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; }

const long long INF = 1LL << 60;

// 入力
int N;
long long h[100010];

// DP テーブル
long long dp[100010];

int main() {
    int N; cin >> N;
    for (int i = 0; i < N; ++i) cin >> h[i];

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 100010; ++i) dp[i] = INF;

    // 初期条件
    dp[0] = 0;

    // ループ
    for (int i = 1; i < N; ++i) {
        chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if (i > 1) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }

    // 答え
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 5220
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <stack>
#include <queue>
#include <math.h>
#include <bitset>
#include <set>

using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;

#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n-1;i>=s;i--)
#define repe_r(i,s,n)for(int i = n;i>=s;i--)

int main() {
	string s; cin >> s;

	ll cnt1 = 0;
	rep(i, 0, s.size()) {
		if (i & 1) {
			if (s[i] == '1')cnt1++;
		}
		else {
			if (s[i] == '0')cnt1++;
		}
	}

	ll cnt2 = 0;
	rep(i, 0, s.size()) {
		if (i & 1) {
			if (s[i] == '0')cnt2++;
		}
		else {
			if (s[i] == '1')cnt2++;
		}
	}

	cout << min(cnt1, cnt2) << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

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

void solve() {
    int n;
    cin >> n;
    VI a(n);
    REP(i,0,n) cin >> a[i];
    LL sum = 0;
    REP(i,0,n) sum += a[i];
    LL ans = -1;
    LL sum2 = 0;
    REP(i,0,n-1) {
        sum2 += a[i];
        LL diff = abs(sum2 - (sum - sum2));
        if (ans < 0) ans = diff;
        ans = min(ans, diff);
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 1024
#include<math.h>
#include<iostream>

using namespace std;

int main(){
   int a,b,c,d,k,l,m,n;
   
   cin >> a >> b >> c >> d;

   k = (c-1)/b; //高橋くんの攻撃回数
   l = c%b;
   m = (a-1)/d; //青木くんの攻撃回数
   n = a%d;

   if (k > m){
       cout << "No" << endl;
   }

   if (k <= m) {

       cout << "Yes" << endl;
   }

   return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<cassert>
using namespace std;
int inf = 1000000000;

int main(void) {
  int w, h;

  vector< vector<int> > ans;
  for(int i=1; i<=150; i++){
    for(int j=i+1; j<=150; j++){
      vector<int> tmp(3);
      tmp[0] = i*i+j*j;
      tmp[1] = i;
      tmp[2] = j;
      ans.push_back(tmp);
    }
  }
  sort(ans.begin(), ans.end());


  while( cin >> h >> w ){
    if( w == 0 && h == 0 ) break;
    int t = w*w + h*h;
    for(int i=0; i<ans.size(); i++){
      if( ans[i][0] < t ) continue;
      if( ans[i][0] == t && ans[i][1] <= h ) continue;

      cout << ans[i][1] << " " << ans[i][2] << endl;
      break;
    }

  }


  return 0;
}


// EOF

Measured memory_bytes: 3500
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N, C, K;
	cin >> N >> C >> K;
	int T[100000];
	rep(i, N) cin >> T[i];
	sort(T, T + N);

	int kotae = 0;
	int deru = T[0];
	int kazu = 1;
	rep1(i, N - 1) {

		if (C <= kazu || (deru != -1 && deru + K < T[i])) {
			kotae++;
			deru = T[i];
			kazu = 1;
		}
		else {
			kazu++;
		}
	}
	if (kazu) kotae++;

	co(kotae);



	Would you please return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main()
{
    int res = 0, val = 0;
    for (int i = 0; i < 3; i++)
    {
        cin >> val;
        if (val == 5 || val == 7)
        {
            res += val;
        }
        else
        {
            break;
        }
    }

    if (res == 17)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3568
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] pos = new int[5];
        int k;
        String result;

        for (int i = 0; i < 5; i++)
            pos[i] = sc.nextInt();

        k = sc.nextInt();

        if (pos[4] - pos[0] <= k)
            result = "Yay!";
        else
            result = ":(";

        System.out.println(result);
    }
}

Measured memory_bytes: 23760
from collections import deque
n, q = map(int,input().split())
d = [[] for i in range(n)]
for i in range(n-1):
    ai, bi = map(int,input().split())
    d[ai-1].append(bi-1)
    d[bi-1].append(ai-1)
#point
px = [0 for i in range(n)]
for i in range(q):
    pi,xi = map(int,input().split())
    px[pi-1] += xi
sp = [0 for i in range(n)]
s = deque()
s.append(0)
visited = [False for i in range(n)]
while len(s) > 0:
    x = s.popleft()
    visited[x] = True
    sp[x] += px[x]
    for xc in d[x]:
        if not visited[xc]:
            s.append(xc)
            sp[xc] += sp[x]
for i in range(n):
    print(sp[i])


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

int main(void){
    int A, B, C;
    cin >> A >> B >> C;

    int tmp = A*10+B+C;
    if(B*10+C+A > tmp)
        tmp = B*10+C+A;
    if(C*10+A+B > tmp)
        tmp = C*10+A+B;
    cout << tmp << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define SHORYAKU
int yakusuu(int);

int main(void){
  int n,ab=2,count=1; // count=1はa*b=1の分(yakusuu(1)が機能しないため)
  if(scanf("%d",&n) == EOF) return 1;
  
#ifdef SHORYAKU // Nが750000以上だった場合、750000までの計算を省略します^q^
  if(n>=750000){
    count=10261678;
    ab=750000;
  }
#endif
  for(;ab<n;ab++){
    count += yakusuu(ab); // cはa*bが決まれば一通りに特定される "a*b=k"を満たすa,bの組はkの約数と等しい
  }
  printf("%d\n",count);
  return 0;
}

int yakusuu(int n){ // nの約数の数を返す
  int i,count=2; // 2は 1とn自身
  for(i=2; n/i >= i; i++){ // iは約数の候補
    if(n%i == 0) {
      if(n/i == i) count++;
      else count+=2;
    }
  }
  return count;
}

Measured memory_bytes: 1700
with Ada.Text_IO;
with Ada.Integer_Text_IO;
with Ada.Float_Text_IO;
use Ada.Text_IO;
use Ada.Integer_Text_IO;
use Ada.Float_Text_IO;

procedure hoge is
 s: Integer;
 w: Integer;
begin
 get(s);
 get(w);
 if s>w then
  put_Line("safe");
 else
  put_Line("unsafe");
 end if;
end hoge;

Measured memory_bytes: 3676
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;
long gcd(long n,long m){
  long nn,mm;
  if(n >= m){
	nn = n;
	mm = m;
  }
  else{
	nn = m;
	mm = n;
  }
  long amari = nn % mm;
  if(amari == 0){
	return mm;
  }
  else{
	return gcd(mm,amari);
  }
  return 0;
}
int main(){
  long n,x,ii,tmp;
  vector<long> xi;
  //cout << gcd(15,6) << endl;
  cin >> n >> x;
  xi.resize(n);

  for(ii=0;ii<n;ii++){
	cin >> tmp;
	xi[ii] = abs(x-tmp);
  }
  long start = xi[0];
  long min;
  for(ii=1;ii<n;ii++){
	tmp = gcd(start,xi[ii]);
	//cout << tmp << endl;
	if(start > tmp){
	  start = tmp;
	}
  }
  cout << start << endl;
  return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#pragma GCC optimize("Os")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(ll i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
using namespace std;
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
void vok()
{
    FAST
    FO
    FI
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        freopen("error.txt","w",stderr);
    #endif
}
int main()
{
    vok();
    map<ll,ll> m;
    ll arr[]={1,3,6};
    loop(i,1,101)
    {
        loop(j,i,101)
        {
            loop(k,j,101)
            {
                ll temp=(i*i)+(j*j)+(k*k)+(i*j)+(j*k)+(i*k);
                set<ll> s;
                s.insert(i);
                s.insert(j);
                s.insert(k);
                m[temp]+=arr[s.size()-1];
            }
        }
    }
    int n;
    IN n;
    loop(i,1,n+1)
    {
        OUT m[i]<<endl
    }
    return 0;
}

Measured memory_bytes: 6028
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
using namespace std;
int main(){
    long long n,ans1,ans2;
    cin >> n;
    for(long long i=sqrt(n); i>0; i--){
        if(n%i==0){
            ans1=i;
            break;
        }
    }
    ans2=n/ans1;
    cout << ans1+ans2-2 << endl;
}

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

int main(void)
{
    char line[20];
    fgets(line, 20, stdin);
    int n = atoi(line);

    int **S;
    int *S_i;
    S = malloc(sizeof(int *) * n);
    S_i = malloc(sizeof(int) * n * 200000);
    int i;
    for (i = 0; i < n; i++) {
        S[i] = S_i + i * 200000;
    }
    int *idx;
    idx = calloc(n, sizeof(int));

    char *a;
    a = line;
    while (*a >= '0') a++;
    int q;
    q = atoi(a + 1);

    int op, t, x;

    while (q--) {
        fgets(line, 20, stdin);
        op = atoi(line);
        a = line + 2;
        t = atoi(a);
        i = idx[t];
        if (op == 0) {
            while (*a >= '0') a++;
            x = atoi(a + 1);
            S[t][i] = x;
            idx[t] += 1;
        }
        else if (i != 0) {
            if (op == 1) printf("%d\n", S[t][i-1]);
            else idx[t] -= 1;
        }
    }

    free(S);
    free(S_i);
    free(idx);

    return 0;
}


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

void solve(int L, int R, int d)
{
    cout << R / d - (L - 1) / d << endl;
}

int main()
{
    int L;
    cin >> L;
    int R;
    cin >> R;
    int d;
    cin >> d;
    solve(L, R, d);
    return 0;
}


Measured memory_bytes: 3592
let () =
  let rec duel taro hana = function
      0 -> (taro, hana)
    | i ->
       let hd, tl = Scanf.scanf "%s %s\n" (fun x y -> x, y) in
       if hd > tl then duel (taro + 3) hana (i-1)
       else if hd = tl then duel (taro + 1) (hana + 1) (i-1)
       else duel taro (hana + 3) (i-1)
  in
  let n = read_int () in
  duel 0 0 n
  |> (fun (x, y) -> Printf.printf "%d %d\n" x y) ;;


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	int64_t kai;
	std::cin >> kai;
	int a[n];
	for (int i = 0; i < n; i++) a[i] = ri();
	std::sort(a, a + n);
	int64_t sum[n + 1];
	sum[0] = 0;
	for (int i = 0; i < n; i++) sum[i + 1] = sum[i] + a[i];
	
	int l = 0, r = 200001;
	while (r - l > 1) {
		int m = l + (r - l) / 2;
		int64_t k = 0;
		for (int j = 0; j < n; j++) {
			int num = a + n - std::lower_bound(a, a + n, m - a[j]);
			k += num;
		}
		if (k < kai) r = m;
		else l = m;
	}
	int64_t res = 0;
	for (int i = 0; i < n; i++) {
		int start = std::lower_bound(a, a + n, r - a[i]) - a;
		kai -= n - start;
		res += sum[n] - sum[start] + (int64_t) (n - start) * a[i];
	}
	assert(kai >= 0);
	res += (int64_t) kai * l;
	std::cout << res << std::endl;
	
	return 0;
}




Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int, int> PII;
int main()
{
	// freopen("in.txt", "r", stdin);
	int l, r, d;
	cin >> l >> r >> d;
	int ans = 0;
	for (int i = l; i <= r; i++) {
		if (i % d == 0)ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(long int I=X;I<Y;I++)
#define REP(I,X) for(long int I=X;I>=0;I--)
#define INF 1000000007
using namespace std;

int main(){
  int N,A;
  cin >> N;
  set<int> s;
  FOR(i,0,N){
    cin >> A;
    if(s.count(A))s.erase(A);
    else s.insert(A);
  }
  cout << s.size() << endl;
}


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

class Program
{
    static int max = 0;
    static void Main(string[] args)
    {
        int[] arr = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        int n = arr[0];
        int m = arr[1];
        int q = arr[2];
        var arrList = new List<int[]>();
        for (int i = 1; i <= q; i++) {
            int[] arrTwo = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
            arrList.Add(arrTwo);
        }
        addList(1, m, n, new List<int>(), arrList);
        Console.WriteLine(max);


    }


    static void addList(int start,int end ,int len , List<int> list , List<int[]> arrList)
    {
        if(list.Count() == len)
        {
            int sum = 0;
            foreach(int[] arr in arrList)
            {
                if (list[arr[1] - 1] - list[arr[0] - 1] == arr[2]) sum += arr[3];
            }
            if (max < sum) max = sum;
            return;
        }
        for(int i = start; i <= end; i++)
        {
            List<int> copyList = new List<int>(list);
            copyList.Add(i);
            addList(i, end, len ,copyList , arrList);
        }
    }






}



Measured memory_bytes: 23000
/*
  AOJ #2874
  title:
  @kankichi573
 */
#include <stdio.h>
#include <string.h>
int   work[1000],n;

int main()
{
  int i,a,r;
  
  memset(work,0,sizeof(work));
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&a);
      r = a % (n-1);
      if(work[r]>0)
	{
	  printf("%d %d\n",a,work[r]);
	  break;
	}
      work[r]=a;
    }

  return(0);
}



Measured memory_bytes: 2100
#include<stdio.h>

int main(){
  int n,m,i;
  int a[10000000];
  int b[10000000];
  scanf("%d",&n);
  for(i=0;i<n-1;i++){
    scanf("%d",&a[i]);
    b[a[i]-1]++;
  }
  
 for(i=0;i<n;i++){
   printf("%d\n",b[i]);
 }
}

Measured memory_bytes: 3296
#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout<<x<<" "<<endl;
#define gg(x,y) cout<<x<<" & "<<y<<" "<<endl
#define jam(t) cout<<"Case #"<<t<<": "
#define ggg(x,y,z) cout<<x<<" & "<<y<<" & "<<z<<" "<<endl
#define all(x) x.begin(),x.end()
#define input_from_file  freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 400005
#define bitcnt(x) __builtin_popcountll(x)

using namespace std;
ll a[sz];
void solve(){
  unordered_map <ll,ll> mb;
  ll n;
  cin >> n;
  for(ll i=1;i<=n;i++){
    ll x;
    cin >> x;
    a[i] = x;
   // ma[x+i]++;
    mb[i-x]++;
  }
  ll ans = 0;
  for(ll i=1;i<=n;i++){
    ans += mb[i+a[i]];
  }
  g(ans);
}
int main()
{
#ifndef ONLINE_JUDGE
input_from_file
#endif
 
    FASTIO
    cin.tie(NULL);
    fflush(stdout);
    ll t = 1;
  //  cin >> t;
    for(ll tcase = 1;tcase <= t;tcase++){
      solve();
        
    }
return 0;
}

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

int n;
vector<int> g[100005];
int d[100005];
int c[100005];
int v[100005];
int mx,rt,ans,cnt;

void dfs(int x,int p){
    int res=0;
    v[x]=c[++cnt];
    for(int i=0;i<g[x].size();i++){
        int y=g[x][i];
        if(y!=p){
            dfs(y,x);
            ans+=min(v[x],v[y]);
        }
    }
}

bool cmp(int x,int y){
    return x>y;
}

int main(){

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

    cin>>n;
    for(int i=1;i<n;i++){
        int a,b;
        cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
        d[a]++;
        d[b]++;
    }
    for(int i=1;i<=n;i++){
        cin>>c[i];
        if(d[i]>mx){
            mx=d[i];
            rt=i;
        }
    }
    sort(c+1,c+1+n,cmp);
    dfs(rt,-1);
    cout<<ans<<endl;
    for(int i=1;i<=n;i++){
        cout<<v[i]<<' ';
    }
    cout<<endl;

    return 0;
}

Measured memory_bytes: 3584
S = input()
s = list(S)
p = 1
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
            continue
        else:
            p = 0
    else:
        if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
            continue
        else:
            p = 0
if p == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
long long mod=(long long)1e09+7;
int inf=1<<29;
long long llinf=1ll<<60;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct

int main(void){
    int n,m,i,j,st[100],sh[100],t,h,s,at,ah;
    while(1){
        n=in();
        m=in();
        if(!n)break;
        t=h=0;
        rep(i,n){
            st[i]=in();
            t+=st[i];
        }
        rep(i,m){
            sh[i]=in();
            h+=sh[i];
        }
        at=ah=inf;
        rep(i,n){
            rep(j,m){
                if(t-st[i]+sh[j]==h-sh[j]+st[i]&&st[i]+sh[j]<at+ah){
                    at=st[i];
                    ah=sh[j];
                }
            }
        }
        if(at==inf)print(-1);
        else print2(at,ah);
    }
    return 0;
}


Measured memory_bytes: 2068
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <vector>
using namespace std;

const int N = 200005;

long long a[N],b[N];
long long c[N],d[N];

bool f[35];

int main()
{
    int n;
    
    scanf("%d",&n);
    
    for (int i = 0;i < n;i++)
    {
        scanf("%lld",&a[i]);
    }
    
    for (int i = 0;i < n;i++)
    {
        scanf("%lld",&b[i]);
    }
    
    for (int i = 0;i <= 30;i++)
    {
        long long t = ((long long)1 << i);
        
        for (int j = 0;j < n;j++)
        {
            c[j] = a[j] % (2 * t);
            d[j] = b[j] % (2 * t);
        }
        
        sort(d,d+n);
        
        for (int j = 0;j < n;j++)
        {
            long long y = 2 * t - c[j];
            long long x = t - c[j];
            
            int p1 = lower_bound(d,d+n,x) - d;
            int p2 = lower_bound(d,d+n,y) - d;
            
            if (d[p2] >= y) p2--;
            if (p2 >= n) p2--;
            //if (p1 >= n) p1--;
            
            if (p2 >= p1 && (p2 - p1 + 1) % 2) f[i] = !f[i];
            
            y = 4 * t - c[j];
            x = 3 * t - c[j];
            
            p1 = lower_bound(d,d+n,x) - d;
            p2 = lower_bound(d,d+n,y) - d;
            
            if (d[p2] >= y) p2--;
            if (p2 >= n) p2--;
            //if (p1 >= n) p1--;
            
            if (p2 >= p1 && (p2 - p1 + 1) % 2) f[i] = !f[i];
        }
    }
    
    long long ans = 0;
    
    for (int i = 0;i <= 30;i++)
    {
        if (f[i]) ans |= ((long long)1 << i);
    }
    
    printf("%lld\n",ans);
    
    return 0;
}


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

ll MOD = 1E+9 + 7;

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

    ll ans = 0, mink=0, maxk=0;

    for (int k=1; k<K; k++) {
        mink += k-1;
        maxk += N-k+1;
    }

    for (int k=K; k<=N+1; k++) {
        mink += k-1;
        maxk += N-k+1;
        ans += (maxk - mink + 1);
        ans %= MOD;        
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

using int64 = long long;

int64 calc(int64 h, int64 w) {
    int64 res = INT_MAX;

    for (int i=1; i<h; i++) {
        int64 a = i * w;

        int64 rest_h = h - i;
        {
            int64 b = ceil(rest_h/2.0) * w;
            int64 c = floor(rest_h/2.0) * w;

            int64 s_max = max(a, max(b,c));
            int64 s_min = min(a, min(b,c));
            res = min(res, s_max - s_min);
        }

        {
            int64 b = ceil(w/2.0) * rest_h;
            int64 c = floor(w/2.0) * rest_h;
            int64 s_max = max(a, max(b,c));
            int64 s_min = min(a, min(b,c));
            res = min(res, s_max - s_min);
        }
    }
    return res;
}

int main() {
    int64 h, w;
    cin >> h >> w;
    
    int64 ans = calc(h,w);
    ans = min(ans, calc(w,h));


    cout << ans << endl;
}

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

int main(){
    int N;
    cin>>N;
    set<int> S;
    for(int i=0;i<N;i++){
      int a;
      cin>>a;
      if(S.count(a)){
        S.erase(a);
      }
      else{
        S.insert(a);
      }
      
    }
    cout<<S.size()<<endl;
    
    return 0;
}


Measured memory_bytes: 8104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back

int main(){
	string s;
   	cin>>s;
   	for(int i=0;i<s.size();i++){
   		cout<<"x";
   	}
    return 0;
}

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

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

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

int main(){
    bool flag=false;
    ll ans=0,sum=0;

    ll x,y;
    cin>>x>>y;
    ll abx = abs(x);
    ll aby = abs(y);

    if(x<=y){
        if(abx*aby == x*y){
            ans = y-x;
        }else ans = abs(aby-abx)+1;
    }else{
        if(abx*aby == x*y){
            ans = x-y+2;
            if(x==0 || y==0)--ans;

        }
        else ans = abs(abx-aby)+1;
    }

    cout<<ans<<endl;

    //cout <<fixed<<setprecision(16)<< << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int i,j;
	int a[28];
	for(i=0;i<28;i++){
		scanf("%d",&a[i]);
	}
	for(i=1;i<31;i++){
		for(j=0;j<28;j++){
			if(i==a[j]){
				break;
			}
			else if(i!=a[j]&&j==27){
				printf("%d\n",i);
			}
		}
	}
	return 0;
}


Measured memory_bytes: 2720
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int k = scanner.nextInt();
        int n = scanner.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++){
            array[i] = scanner.nextInt();
        }

        int min = k;
        for (int i = 0; i < n - 2; i++){
            //反時計回りを試す
            //
            int temp = 0;
//            if (i == n -1){
//                temp = array[n-1] - array[0];
//            }
//            else{
                temp = array[i];
                temp += k - array[i+1];
//            }

//            System.out.println(temp);
            if (temp < min){
                min = temp;
            }
        }

        boolean isFirst = true;

        for (int i = 0; i < n; i++){
            int temp = 0;
            if (isFirst){
                temp = array[n-1] - array[0];
                isFirst = false;
            }else{
                temp = k - array[i];
                temp += array[i-1];
            }


//            System.out.println(temp);
            if (temp < min){
                min = temp;
            }
        }
//        System.out.println();
        System.out.println(min);





    }
}

Measured memory_bytes: 80980
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

long long int INF = 1000000007;

long long int fact(long long int N){
	long long int ret = 1;
	for(long long int i = 1; i <= N; i++){
		ret = (ret * i) % INF;
	}
	return ret;
}

int main(){
	
	long long int N, M;
	
	cin >> N >> M;
	
	if(abs(N - M) >= 2){
		cout << "0" << endl;
		return 0;
	}
	
	long long int ans = fact(N) * fact(M) % INF;
	
	long long int hoge = 2;
	
	if(N == M){
		ans *= hoge;
		ans %= INF;
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;

int main(){
  int n, u, v;cin>>n>>u>>v;u--;v--;
  vector<vector<int>> vertex(n);
  vector<bool> visited(n, false);
  rep(i, n-1){
  	int a, b;cin>>a>>b;a--;b--;
    vertex[a].push_back(b);
    vertex[b].push_back(a);
  }
  vector<int> dis_u(n), dis_v(n);
  queue<pair<int, int>> que;
  que.push(make_pair(v, 0));
  while(!que.empty()){
  	pair<int, int> p=que.front();que.pop();
    dis_v[p.first]=p.second;
    visited[p.first]=true;
    for(auto &e: vertex[p.first]){
      if(!visited[e])que.push(make_pair(e, p.second+1));
    }
  }
  while(!que.empty())que.pop();
  fill(visited.begin(), visited.end(), false);
  que.push(make_pair(u, 0));
  while(!que.empty()){
  	pair<int, int> p=que.front();que.pop();
    dis_u[p.first]=p.second;
    visited[p.first]=true;
    for(auto &e: vertex[p.first]){
      if(!visited[e])que.push(make_pair(e, p.second+1));
    }
  }
  int ans=-1;
  rep(i, n){
    int a=dis_v[i];
    int b=dis_u[i];
    if(a-b<0)continue;
  	ans=max(ans, b+(a-b)-1);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 6784
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)

int main() {
  int n,r;cin>>n>>r;
  if(n>=10){
    cout << r << endl;
  } else {
    cout << r+100*(10-n) << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
 int N;
 cin >> N;
 
 int A[210];

 for(int i=0; i < N; ++i) cin >> A[i];

int res = 0;
int count = 0;
while(true){
    bool exist_odd = false;
    for(int i=0; i < N; ++i){
        if(A[i] % 2 != 0) exist_odd = true;

    }
    if(exist_odd) break;

    for(int i=0; i < N; i++){
        A[i] /= 2;
    }
count += 1;
}

cout << count;

 return 0;
}

Measured memory_bytes: 256
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	string str;
	cin >> str;
	if( str[0]==str[1] && str[1]==str[2] ){
		cout<<"Yes"<<endl;
	}else if( str[1]==str[2] && str[2] == str[3] ){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

const long long INF = 1e17+7;
const long long MOD = 1e9+7;
const double PI=acos(-1);

using namespace std;

int main(){
	int n,m,k;
	cin >> n >> m >> k;
	vector<long long> a(n+1,0),b(m+1,0);
	for(int i=1;i<=n;i++){
		int temp;
		cin >> temp;
		a[i]=temp+a[i-1];
	}
	cout << endl;
	for(int i=1;i<=m;i++){
		int temp;
		cin >> temp;
		b[i]=temp+b[i-1];
	}
	cout << endl;
	int ans=0;
	for(int i=0;i<=n;i++){
		long long sum=a[i];
		if(sum>k)break;
		long long target=k-sum;
		int start=0;
		int end=b.size();
		int now=(end+start)/2;
		while(1){
			if(b[now]==target)break;
			if(b[now]>target){
				end=now;
			}else if(b[now]<target){
				start=now;
			}
			now=(end+start)/2;
			if(end-start<=1)break;
		}
		ans=max(ans,now+i);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define PI 3.14159265358979323846264338327950288
#define mt make_tuple


void love() {
	int n; cin>>n;
	int arr[n];
	for(int i = 0; i<n; i++) cin>>arr[i];

	sort(arr, arr+n);

	ll ans = 0 ;
	for(int i = 0; i<n; i++) {
		
		for(int j = i+1; j<n; j++) {
			bool chk = true;
			for(int k = j+1; k<n and chk; k++) {
				int a = arr[i];
				int b = arr[j];
				int c = arr[k];

				if(a + b > c and b + c > a and c + a > b) ans++;
				else {
					chk = false;
					break;
				}
			}
		}
	}

	cout<<ans<<endl;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	love();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
int N = 0, M = 0;
int main(void){
    while(std::cin >> N >> M){
        if(N==0 && M==0) return 0;
        std::vector<int> mas(N, 0);
        for(int i=0; i<N; ++i){
            std::cin >> mas[i];
        }

        std::vector<int> me(M, 0);
        for(int i=0; i<M; ++i){
            std::cin >> me[i];
        }

        int point = 0;
        int cnt = 0;
        for(int i=0; i<M; ++i){
            cnt++;
            point += me[i];
            point += mas[point];
            if(point >= N) break;
        }
        std::cout << cnt << std::endl;
    }
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
#define rep(i,cc,n) for(int i=cc;i<n;++i)
int main() {
    int N, M;
    cin >> N >> M;
    long sum = 0;
    priority_queue<long> queue;
    rep(i, 0, N){
        long a;
        cin >> a; 
        queue.push(a);
    }
    rep(j, 0, M){
        long b = queue.top();
        queue.pop();
        queue.push(b/2);
    }
    rep(k, 0, N){
        sum += queue.top();
        queue.pop();
    }
    cout << sum << endl;
}

Measured memory_bytes: 1400
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<queue>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cctype>
#include<climits>
using namespace std;

#define REP(i,a,n) for(ll i = a ; i < n ; i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;

ll n,m;
ll S[100002],T[100002];
ll p[100002];
ll table[2][100002];

void solve(){
}

int main(){
  while(scanf("%d%d",&n,&m) != EOF){
    rep(i,n){
      scanf("%lld%lld",&S[i],&T[i]);
    }
    rep(i,m){
      scanf("%lld",&p[i]);
    }
    sort(p,p+m);

    memset(table,0,sizeof(table));
    REP(i,1,m){
      if(i % 2 == 0){
        table[0][i] = table[0][i-1];
        table[1][i] = table[1][i-1] + (p[i] - p[i-1]);
      }
      else{
        table[0][i] = table[0][i-1] + (p[i] - p[i-1]);
        table[1][i] = table[1][i-1];
      }
    }

    ll res = 0;
    rep(i,n){
      bool swapFlg = false;

      if(S[i] > T[i]){
        swap(S[i],T[i]);
        swapFlg = true;
      }

      ll *iterS = upper_bound(p,p+m,S[i]);
      ll *iterT = lower_bound(p,p+m,T[i]);
      ll s = iterS - p;
      ll t = iterT - p;

      if(s == t){
        res += llabs(S[i] - T[i]);
        continue;
      }
      //error shori

      bool left,right;

      if(swapFlg){
        left = ((t - s) % 2 == 0);
        right = true;
      }
      else{
        right = ((t - s) % 2 == 0);
        left = true;
      }

      ll ans = 0;
      if(left) ans += p[s] - S[i];
      if(right) ans += T[i] - p[t-1];

      if(s % 2 != 0){
        if(left) ans += table[0][t-1] - table[0][s];
        else ans += table[1][t-1] - table[1][s];
      }
      else{
        if(!left) ans += table[0][t-1] - table[0][s];
        else ans += table[1][t-1] - table[1][s];
      }

      res += ans;
    }
    cout<<res<<endl;
  }
}

Measured memory_bytes: 4748
A,B,C=map(int,input().split())

Q=0
if A==B and B==C and C==A:
    if A%2==1 or B%2==1 or C%2==1:
        print(0)
    elif  A%2==0 or B%2==0 or C%2==0:
        print(-1)
else:
    for i in range(100):
        if A%2==1 or B%2==1 or C%2==1:
            print(Q)
            break
        else:
            A,B,C=(B+C)//2,(C+A)//2,(A+B)//2
            Q+=1

    


Measured memory_bytes: 9176