akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vec             vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define no_of_test(x)        int x; cin>>x; while(x--)
#define fo(i,n)    for(int i=0;i<n;i++)
#define Maximum(x,y,z) max(x,max(y,z))
#define Minimum(x,y,z) min(x,min(y,z))
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
const int mod = 1e9 + 7;
void very_fast()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int gcd(int a, int b)
{
	if (b == 0) return a;
	return gcd(b, a % b);
}
int binary_exponentation(int a, int b)
{
	int ret = 1;
	while (b)
	{
		if (b & 1) ret = (ret * a) % mod;
		b >>= 1;
		a = (a * a) % mod;
	}
	return ret;
}

int32_t main()
{
	very_fast();
	//no_of_test(x)
	{
		int n;
		cin >> n;
		if (n % 1000 == 0)
		{
			cout << 0 << endl;
		}
		else
		{
			int r = n % 1000;
			int res = 1000 - r;
			cout << res << endl;
		}

	}
	return 0;
}


Measured memory_bytes: 3652
A = [[int(i) for i in input().split()] for j in range(3)]

N = int(input())
Flag = False
for k in range(N):
    temp = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == temp:
                A[i][j] = 0
            else:
                next

if A[0][0] == 0 and A[0][1] == 0 and A[0][2] == 0:
    Flag = True
elif A[0][0] == 0 and A[1][0] == 0 and A[2][0] == 0:
    Flag = True
elif A[0][0] == 0 and A[1][1] == 0 and A[2][2] == 0:
    Flag = True
elif A[0][1] == 0 and A[1][1] == 0 and A[2][1] == 0:
    Flag = True
elif A[0][2] == 0 and A[1][2] == 0 and A[2][2] == 0:
    Flag = True
elif A[1][0] == 0 and A[1][1] == 0 and A[1][2] == 0:
    Flag = True
elif A[2][0] == 0 and A[2][1] == 0 and A[2][2] == 0:
    Flag = True
elif A[0][2] == 0 and A[1][1] == 0 and A[2][0] == 0:
    Flag = True


if Flag == True:
    print('Yes')
else:
    print('No')

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if (A == 7 && B == 5 && C == 5) cout << "YES" << endl;
  else if (A == 5 && B == 7 && C == 5) cout << "YES" << endl;
  else if (A == 5 && B == 5 && C == 7) cout << "YES" << endl;
  else cout << "NO" << endl;
  }
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1023456789
#define sacnf scanf
#define CRLF <<'\n';
#define PRPAIR(x) x.first << x.second
#define DEBUG(x) do { std::cerr <<(x)<<'\n'; } while (0)
#define rep(i,a,b) for(int i=(a);i!=(int)b-((a)>(b));(a)>(b)?--i:++i)
#define trav(it,v) for(typeof(v.begin()) it = v.begin(); it != v.end(); ++it)

using namespace std;
typedef pair<int,int> ii;
typedef pair<int,ii> pip;
typedef vector<int> vi;
typedef long long ll;

int main(){
    int n;
    scanf("%d",&n);
    int arr[n];
    rep(i,0,n){
        scanf("%d",&arr[i]);
    }
    ll c=0;
    sort(arr,arr+n);
    priority_queue<pip> q;
    q.push(pip(arr[n-2],ii(arr[n-1],arr[n-2])));
    q.push(pip(arr[n-2],ii(arr[n-2],arr[n-1])));

    c+=arr[n-1];
    if (n==2){
        cout << c;
        return 0;
    }
    for(int i = n-3; i >= 0; --i){
        pip t = q.top();
        c += t.first;
        q.pop();
        int d = arr[i];
        q.push(pip(d,ii(t.second.first,d)));
        q.push(pip(d,ii(t.second.second,d)));
    }
    cout << c;

}


Measured memory_bytes: 7184
# ABC086-C
solve() {
    read
    while read t1 x1 y1 ; do
        (( d = (t1 - t2) - (x1 > x2 ? x1 - x2 : x2 - x1) - (y1 > y2 ? y1 - y2 : y2 - y1),
           d < 0 || d % 2 )) && return 1
        read t2 x2 y2 || return 0
        (( d = (t2 - t1) - (x1 > x2 ? x1 - x2 : x2 - x1) - (y1 > y2 ? y1 - y2 : y2 - y1),
           d < 0 || d % 2 )) && return 1
    done
    return 0
}
solve < <(head -n 75001) && echo Yes || echo No


Measured memory_bytes: 684
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void yes(){
    cout << "Yes" << endl;
}

void no (){
    cout << "No" << endl;
}

ll cel (ll a, ll b){
    if (a % b == 0) return a / b;
    else return a / b + 1;
}

ll gcds(ll a, ll b){
    ll c = a % b;
    while (c != 0){
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

int main() {
    int n; cin >> n;
    if (n < 1000) cout << "ABC" << endl;
    else cout << "ABD" << endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define rep(i,b) for(int i=1;i<=b;i++)
#define drep(i,b) for(int i=b;i>=1;i--)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define pr pair<int,int>
#define ff first
#define ss second
#define int long long
#define endl '\n'
using namespace std;
const int N=2e5+5;
const int mod=1e9+7;
int n,m,k,t,x,y,z;

void solve(int ans=0) {
    cin>>x>>y>>z>>k;
    if(k<=x+y) cout<<min(k,x)<<endl;
    else cout<<x-(k-x-y)<<endl;
}

#undef int
int main() {
    ios::sync_with_stdio(false);
    //int T;cin>>T;
    //while(T--)
        solve();
}


Measured memory_bytes: 3496
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int n;
  cin>>n;
  for(int i=0;i<3;i++){
    if(n%10==7){
      cout<<"Yes\n";
      return 0;
    }
    n/=10;
  }
  cout<<"No\n";
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;
const ll inf = 1e18;

int n;
ll k;
vector<ll> a;

ll divceil(ll x, ll y) {
  if (x<0) return x/y;
  return (x+y-1)/y;
}

ll divfloor(ll x, ll y) {
  if (x<0) {
    return (x-y+1)/y;
  }
  return x/y;
}

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

  cin>>n>>k;
  a.resize(n);
  for (int i=0; i<n; i++) {
    cin>>a[i];
  }
  sort(a.begin(), a.end());
  
  ll lo = -inf - 1; ll hi = inf;

  while (hi - lo > 1) {
    ll target = (lo+hi)/2;
    ll cnt = 0;
    
    for (int i=0; i<n; i++) {
      if (a[i] < 0) {
	ll cur = (a.begin()+i) - std::lower_bound(a.begin(), a.begin()+i, divceil(-target,-a[i]));
	cnt += cur;
      } else if (a[i] == 0) {
	if (target >= 0) cnt += i;
      } else {
	ll cur = std::upper_bound(a.begin(), a.begin()+i, divfloor(target, a[i])) - a.begin();
	cnt += cur;
      }
    }

    if (cnt >= k) {
      hi = target;
    } else {
      lo = target;
    }
  }

  cout<<hi<<endl;  
  return 0;
}
// don't forget to read in the input :^)


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

int main(){

    int n;
    cin >> n;
    vector<int> w(n);
    rep(i,n){
        cin >> w[i];
    }
    int ans=100000;
    rep(i,n-1){
        w[i+1]+=w[i];
    }

    rep(i,n-1){
        int a=w[i];
        int b=w.back()-a;
        ans=min(ans,abs(a-b));
    }
    cout << ans << endl;

    return 0;
}

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

const int64_t MOD = 1e9 + 7;
struct mint
{
    int64_t x;
    mint(int64_t x = 0) : x((x % MOD + MOD) % MOD) {}
    mint operator-() const { return mint(-x); }
    mint &operator+=(const mint a)
    {
        if ((x += a.x) >= MOD)
            x -= MOD;
        return *this;
    }
    mint &operator-=(const mint a)
    {
        if ((x += MOD - a.x) >= MOD)
            x -= MOD;
        return *this;
    }
    mint &operator*=(const mint a)
    {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(int64_t n) const
    {
        if (n == 0)
            return 1;
        mint t = pow(n >> 1);
        t *= t;
        if (n & 1)
            t *= *this;
        return t;
    }
    mint inv() const { return pow(MOD - 2); }
    mint &operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream &operator>>(istream &is, const mint &a) { return is >> a.x; }
ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }

int K;
vector<vector<int>> tree;

mint dfs(int v, int parent = -1, int used = 0)
{
    mint res = K - used;
    int used_next = (parent < 0) ? 1 : 2;
    for (auto v_next : tree.at(v))
    {
        if (v_next == parent)
            continue;
        if (used_next == K)
            return 0;
        res *= dfs(v_next, v, used_next);
        used_next++;
    }
    return res;
}

void solve(int N, vector<int> a, vector<int> b)
{
    tree = vector<vector<int>>(N);
    for (int i = 0; i < N - 1; i++)
    {
        int ai = a.at(i) - 1, bi = b.at(i) - 1;
        tree.at(ai).push_back(bi);
        tree.at(bi).push_back(ai);
    }
    cout << dfs(0) << endl;
}

int main()
{
    int N;
    cin >> N >> K;
    vector<int> a(N - 1), b(N - 1);
    for (int i = 0; i < N - 1; i++)
    {
        cin >> a.at(i) >> b.at(i);
    }
    solve(N, move(a), move(b));
    return 0;
}


Measured memory_bytes: 12416
#include<iostream>

using namespace std;

int main(){

    while(1){
        int e;
        cin>> e;
        if(!e) break;

        int m=1e8;
        for(int y=0; y<=1000; y++){
            for(int z=0; z<=100; z++){
                int x=e-y*y-z*z*z;
                if(x<0) continue;
                m=min(m, x+y+z);
            }
        }

        cout<< m<< endl;

    }

    return 0;
}

Measured memory_bytes: 3084
#define _USE_MATH_DEFINES

#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max,count
#include <string>	//string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt
#include <sstream>	//stringstream,getline
#include <cmath>	//ceil,M_PI

using namespace std;

int main() {

	string S;
	cin >> S;

	if (S[2] == S[3]) {
		if (S[4] == S[5]) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

	return 0;

}

Measured memory_bytes: 3544
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();

        if(a==1 && b==2){
            System.out.println(3);
        }
        if(a==1 && b==3){
            System.out.println(2);
        }
        if(a==2 && b==1){
            System.out.println(3);
        }
        if(a==2 && b==3){
            System.out.println(1);
        }
        if(a==3 && b==1){
            System.out.println(2);
        }
        if(a==3 && b==2){
            System.out.println(1);
        }
    }
}

Measured memory_bytes: 20564
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <vector>
#include <string.h>
using namespace std;

int main() {
	int ans=0;
	char S;
	for(int i=0;i<3;i++)
	{
		cin>>S;
		if(S=='1')ans++;
	}	
	cout<<ans;
	}

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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const int INF = (1LL << 60); // 1152921504606846976
const double EPS = (1 >> 30);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1) / b);}
template<class T> inline T round(T a, T b) {return T(a / b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template <class T> inline void out(T &a) { bool flag=true; for(auto&x:a){if(flag) {flag=false;} else{ cout << ' '; } cout<<x; } cout << endl; }



//----------------------------------------------------------------
int nmax=200000; // 2*(10^5)
vvec g(nmax);





void solve()
{
    
    map<string,int> mp;
    int n;
    cin>>n;
    rep(i,n){
        string s;
        cin>>s;
        mp[s]++;
    }
    cout<<mp.size()<<endl;
    
}
//-----------------------------------------------------------------

signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15);
    int repeat = 1;
    // cin >> repeat;
    while(repeat--) solve();
}

Measured memory_bytes: 23480
using System;
class Program
{
  static void Main()
  {
    string[] input = Console.ReadLine().Split(' ');
    int N = int.Parse(input[0]);
    int D = int.Parse(input[1]);
    int ans = (N + 2*D) / (2*D + 1);
    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 13140
#include<iostream>
using namespace std;
int main(){
  int A,B,C;
  int X,Y;
  cin >> A >> B >> C >> X >> Y;
  if(X<Y){
    if(2*C<A+B && 2*C>B) cout << 2*C*X+B*(Y-X) << endl;
    if(2*C<A+B && 2*C<=B) cout << 2*C*Y << endl;
    if(2*C>=A+B) cout << A*X+B*Y << endl;
  }
  if(X>=Y){
    if(2*C<A+B && 2*C>A) cout << 2*C*Y+A*(X-Y) << endl;
    if(2*C<A+B && 2*C<=A) cout << 2*C*X << endl;
    if(2*C>=A+B) cout << A*X+B*Y << endl;
  }
  
}

Measured memory_bytes: 256
#!/usr/bin/env/ python3
#S = input()
#R = int(input())
#A, B, C = input().split()
N, M = map(int, input().split())

#N = int(input())
#A = [int(x) for x in input().split()]

#H, W = map(int, input().split())
#S = [input() for _ in range(H)]
if N <= M: print("unsafe")
else: print("safe")


Measured memory_bytes: 9144
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

int main() {
    int A, B, X;
    cin >> A >> B >> X;

    if (A + B >= X && A <= X)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")

#include <bits/stdc++.h>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pii>
#define read(FILE)  freopen(FILE, "r", stdin);
#define out(FILE) freopen(FILE, "w", stdout);
#define clr(x, y) memset(x,y,sizeof(x));
#define IO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define rep(i, m, n) for(int i=m ; i<n ; i++)
#define forr(i, m, n) for(int i=m ; i<=n ; i++)
#define endl '\n'
#define pb push_back
#define re return
const int N = 1e5 + 5;
const ll OO = 2e8;
using namespace std;

int n, cost[N], dp[N],res=0;

bool valid(int i) {
    re i < n;
}

int main() {
    //IO;
    cin >> n;
    rep(i, 0, n) cin >> cost[i];
    //memset(dp,OO, sizeof(dp));
    dp[0] = 0;
    dp[1]=abs(cost[1]-cost[0]);
    rep(i,2,n){
        int next=OO,nextawy=OO;
        next=dp[i-1]+abs(cost[i-1]-cost[i]);
        nextawy=dp[i-2]+abs(cost[i-2]-cost[i]);
        dp[i]=min(next,nextawy);
        //cout<<dp[i]<<" ";
    }
    //n--;
    cout<<dp[n-1];
    //cout<<endl;


}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t h, w, k;
    cin >> h >> w >> k;

    int64_t x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    vector ok(h + 2, vector(w + 2, false));
    for (auto i : irange(0L, h)) {
        string s;
        cin >> s;
        for (auto j : irange(0L, w)) {
            ok[i + 1][j + 1] = (s[j] == '.');
        }
    }

    array dx{-1L, 1L, 0L, 0L};
    array dy{0L, 0L, -1L, 1L};

    vector costs(4,
                 vector(h + 2, vector(w + 2, numeric_limits<int64_t>::max())));
    priority_queue<std::tuple<int64_t, int64_t, int64_t, int64_t>,
                   std::vector<std::tuple<int64_t, int64_t, int64_t, int64_t>>,
                   std::greater<>>
            q;
    for (auto i : irange(0L, 4L)) {
        costs[i][x1][y1] = 0;
        q.emplace(0L, i, x1, y1);
    }

    while (!q.empty()) {
        auto [cost, d, x, y] = q.top();
        q.pop();

        if (cost > costs[d][x][y]) {
            continue;
        }

        // cerr << d << "," << x << "," << y << endl;
        // cerr << costs[d][x][y] << endl;

        if (x == x2 && y == y2) {
            cout << costs[d][x][y] << endl;
            return 0;
        }

        for (auto d2 : irange(0L, 4L)) {
            if (d2 == d) {
                continue;
            }

            if (cost < costs[d2][x][y]) {
                costs[d2][x][y] = cost;
                q.emplace(cost, d2, x, y);
            }
        }

        auto nc = costs[d][x][y] + 1;
        for (auto i : irange(1L, k + 1)) {
            auto nx = x + i * dx[d];
            auto ny = y + i * dy[d];

            if (!ok[nx][ny]) {
                break;
            }

            if (costs[d][nx][ny] < nc) {
                break;
            }

            if (nc < costs[d][nx][ny]) {
                // cerr << "new: " << d << "," << nx << ny << endl;
                costs[d][nx][ny] = nc;
                q.emplace(nc, d, nx, ny);
            }
        }
    }

    cout << -1 << endl;
}

Measured memory_bytes: 128824
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	String [][] letters = {{" "},{" ",".",",","!","?"},{"c","a","b"},{"f","d","e"},{"i","g","h"},{"l","j","k"},{"o","m","n"},{"s","p","q","r"},{"v","t","u"},{"z","w","x","y"},{" ","A","B","C","D","E","F","G","H","I"}};
    	int [] length = {0,5,3,3,3,3,3,4,3,4};
    	
    	int n = sc.nextInt();
    	for(int i=1;i<=n;i++) {
    		String str = sc.next();
    		String [] s = str.split("0");
    		String ans = "";
    		for(String ss:s) {
    			int l = ss.length();
    			if(l>0) {
    				int x = ss.charAt(0)-'0';
        			int y = length[x];
        			ans += letters[x][l%y];
    			}
    		}
    		System.out.println(ans);
        }
    }
}


Measured memory_bytes: 31844
X = int(input())

def isPrime(x):
    if x <= 1: 
        return False

    for i in range (2, int(x**(1/2)) + 1):
        if x%i == 0:
            return False

    return True

p = X

while isPrime(p) != True:
    p += 1

print(p)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,n,j;
    double sum=0,s,p;
    char str1[20],ch[20];

    scanf("%s %s",str1,ch);

   strcat(str1,ch);

   n=strlen(str1);
    for(i=n-1,j=0; i>=0; j++,i--)
   {
       sum+=(str1[i]-48)*pow(10,j);
   }


    s=sqrt(sum);

    p=floor(s);

    //cout<<p<<endl<<s;

    if(p==s)cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

    return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  int count = 0;
  for(int i = a; i <= b; i++) {
    int n[5];
    int temp = i;
    for(int i = 0; i < 5; i++) {
      n[i] = temp % 10;
      temp = temp / 10;
    }
    if(n[0] == n[4] && n[1] == n[3]) count++;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
#import<cstdio>

template<typename ...> static inline int gc(void) { return getchar(); }
static inline void read(int &x){int k,m=0;x=0;for(;;){k=gc();if(48<=k&&k<=57){x=k-48;break;}}for(;;){k=gc();if(k<48||k>57)break;x=x*10+k-48;}}

int N, d[262144], p, x, i;

main(){
    read(N);
    for(; i < N; d[x] = ++i)read(x);
    x = N;
    for(; --i;)
        if(p){
            if((d[i] < d[i + 1]) ^ (d[i + 1] < d[x]) ^ (d[x] < d[i])){
                ++p;
                x = i + 1;
            }
        }else
            if(d[i] < d[i + 1])--x;
            else++p;
    printf("%d", p);
}


Measured memory_bytes: 896
#include "iostream"
#include "algorithm"
#include "string"

using namespace std;

const long long  int MOD = 1000000007;

int main(){
	long long int N;
	double sum;
	sum=0;
	double x[100];
	string v[100];
    cin>>N;
	for(int i=1;i<=N;i++){cin>>x[i]>>v[i];}
	for(int i=1;i<=N;i++){
		if(v[i]=="BTC"){x[i]=380000*x[i];}
			sum=sum+x[i];
		}
	cout<<sum<<endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (){
  int N;
  cin >>N;
  vector<int> v(N);
  vector<int> c(N);
  for(int i=0;i<N;i++){
    cin >>v.at(i);
  }
  for(int i=0;i<N;i++){
    cin >>c.at(i);
  }
  int count=0;
  for(int i=0;i<N;i++){
    if(v.at(i)>c.at(i)){
      count+=v.at(i)-c.at(i);
    }
  }
  cout <<count<<endl;
}
  

Measured memory_bytes: 256
/* 1_A_insertion_sort.c */

#include <stdio.h>

void trace(int A[], int N) {
    for (int i=0; i<N; i++) {
        if (i != N-1) {
            printf("%d ", A[i]);
        } else {
            printf("%d", A[i]);
        }
    }
    printf("\n");
}


void insertionsort(int A[], int N) {
    
    for (int i=1; i<N; i++) {
        int v = A[i];
        int j = i-1;

        while(j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;

    trace(A, N);

    }
}


int main() {

    int N;
    scanf("%d", &N);

    int A[N];

    for (int i=0; i<N; i++) {
        scanf("%d", &A[i]);
    }

    trace(A, N);
    insertionsort(A, N);

    return 0;
}


Measured memory_bytes: 2088
import java.util.Scanner;

public class Main{

	static int[][] d;
	static int INIT_D = Integer.MAX_VALUE;
	
	public static void initWF(int n) {
		d = new int[n][n];
		for (int i=0;i<n;i++) {
			for (int j=0;j<n;j++) {
				d[i][j] = INIT_D;
				if (i==j) d[i][j] = 0;
			}
		}
	}
	
	public static void execWF() {
		int n = d.length;
		for (int k=0;k<n;k++) {
			for (int i=0;i<n;i++) {
				if (d[i][k] == INIT_D) continue;
				for (int j=0;j<n;j++) {
					if (d[k][j] == INIT_D) continue;

					d[i][j] = Math.min(d[i][j], d[i][k]+d[k][j]);
				}
			}
		}
	}
	
	public static boolean hasNegativeLoop() {
		int n = d.length;
		for (int i=0;i<n;i++) {
			if (d[i][i]<0) return true;
		}
		return false;
	}

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int nv = scan.nextInt();
		int ne = scan.nextInt();
		
		initWF(nv);
		
		// read edge data
		for (int i=0;i<ne;i++) {
			int s = scan.nextInt();
			int t = scan.nextInt();
			int dist = scan.nextInt();
			d[s][t] = dist;
			// NOTE:MUST NOT set value in reverse direction
			//d[t][s] = dist;
		}
		
		execWF();
		
		// output result
		if (hasNegativeLoop()) {
			System.out.println("NEGATIVE CYCLE");
			return;
		}
		for (int s=0;s<nv;s++) {
			StringBuilder sb = new StringBuilder();
			for (int t=0;t<nv;t++) {
				sb.append(d[s][t]==INIT_D ? "INF" : String.valueOf(d[s][t]));
				sb.append(" ");
			}
			System.out.println(sb.substring(0,sb.length()-1));
		}
	}
	
}

Measured memory_bytes: 59752
import math

N,A,B,C,D=map(int,input().split())

if B*math.ceil(N/A)>D*math.ceil(N/C):
    print(D*math.ceil(N/C))
elif B*math.ceil(N/A)<D*math.ceil(N/C):
    print(B*math.ceil(N/A))
else:
    print(B*math.ceil(N/A))



Measured memory_bytes: 5664
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let N = read!(usize);
    let A = read![[usize]];
    let B = read![[i64]];
    let C = read![[i64]];

    let mut sum = 0_i64;
    let mut prev = N;

    for i in 0..N {
        let a = A[i] - 1;

        sum += B[a];
        if a == prev + 1 {
            sum += C[prev];
        }

        prev = a;
    }

    println!("{}", sum)
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    int a,b;
    cin>>a>>b;
    int mm = max(a+b,a-b);
    cout<<max(mm,a*b)<<endl;    
    return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
inf = 101
s = [''] * H
cnt = 0
for i in range(H):
	s[i] = input()
	cnt += s[i].count('.')
d = [[inf] * W for i in range(H)]
from collections import deque
queue = deque([[0, 0]])
d[0][0] = 0

while queue:
	x, y = queue.popleft()
	if x+1 == H and y+1 == W:
		break
	dx, dy = [-1, 0, 1, 0], [0, -1, 0, 1]
	for i in range(4):
		nx, ny = x + dx[i], y + dy[i]
		if 0 <= nx and nx < H and 0 <= ny and ny < W and s[nx][ny] != '#' and d[nx][ny] == inf:
			queue.append([nx, ny])
			d[nx][ny] = d[x][y] + 1

if d[H-1][W-1] == inf:
	print(-1)
else:
	print(cnt-d[H-1][W-1]-1)

Measured memory_bytes: 9460
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>

#define INF_LL 9000000000000000000
#define INF 2000000000

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

using namespace std;

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

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

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

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

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

int n;
int a[100];
int num[201];
ll sum;
double t;
int base, base2;

int main(void){
	cin >> n;
	sum = 0;
	fill(num, num+201, 0);
	REP(i, n){
		cin >> a[i];
		num[a[i]+100]++;
		sum+= a[i];
	}
	t = (double)sum/n;
	base = (int)ceil(t);
	base2 = (int)floor(t);
	ll res = 0;
	ll res2 = 0;
	REP(i, 201){
		res += (i-100-base)*(i-100-base)*num[i];
		res2 += (i-100-base2)*(i-100-base2)*num[i];
	}
	cout << min(res, res2) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>
#include <tuple>
#include <random>
#include <cmath>

using namespace std;

typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

const ll SIZE = 1e6 * 2 + 10, INF = 1e9 * 1e9 + 10;

ll dsu[SIZE], dist[SIZE], sz[SIZE];

bool fl = true;
vector<vector<pair<ll, ll>>> gr;
vector<ll> tps;
ll used[SIZE];

ll col[SIZE];

void dfs(int v) {
	col[v] = 1;

	for (auto to : gr[v]) {
		if (!col[to.first]) {
			dfs(to.first);
		}
		else if (col[to.first] == 1) {
			fl = false;
		}
	}

	col[v] = 2;
	tps.push_back(v);
}

void check(int v) {
	used[v] = 1;

	for (auto to : gr[v]) {
		if (!used[to.first]) {
			dist[to.first] = dist[v] + to.second;
			check(to.first);
		}
		else if (dist[to.first] != dist[v] + to.second) {
			fl = false;
		}
	}
}
int main()
{
	fastInp;

	ll n, m;
	cin >> n >> m;

	gr.resize(n);
	for (int i = 0; i < m; i++) {
		ll l, r, d;
		cin >> l >> r >> d;
		l--; r--;
		gr[l].push_back({ r, d });
	}

	for (int i = 0; i < n; i++) {
		if (!col[i]) dfs(i);
	}

	reverse(tps.begin(), tps.end());

	for (auto cur : tps) {
		if (!used[cur]) {
			check(cur);
		}
	}
	if (fl) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

Measured memory_bytes: 17840
Alice = 'A'
Bob = 'B'
Charlie = 'C'

def answer(Sa, Sb, Sc):
    currentUser = Alice
    ai, bi, ci = (0, 0, 0)
    while(True):
        if currentUser == Alice:
            if ai == len(Sa):
                return Alice
            if Sa[ai] == 'b':
                currentUser = Bob
            if Sa[ai] == 'c':
                currentUser = Charlie
            ai += 1
            continue
        if currentUser == Bob:
            if bi == len(Sb):
                return Bob
            if Sb[bi] == 'a':
                currentUser = Alice
            if Sb[bi] == 'c':
                currentUser = Charlie
            bi += 1
            continue
        if currentUser == Charlie:
            if ci == len(Sc):
                return Charlie
            if Sc[ci] == 'a':
                currentUser = Alice
            if Sc[ci] == 'b':
                currentUser = Bob
            ci += 1
            continue
            
Sa = input()
Sb = input()
Sc = input()
print(answer(Sa, Sb, Sc))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

string s, t;

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

  cin >> s >> t;

  ll slen = s.size();
  ll tlen = t.size();

  vector<vector<ll>> v(26);
  for (int i = 0; i < slen; i++) {
    v[s[i] - 'a'].push_back(i);
  }
  for (int i = 0; i < slen; i++) {
    v[s[i] - 'a'].push_back(i + slen);
  }

  ll ans = 0;
  ll prev = 0;
  for (int i = 0; i < tlen; i++) {
    int c = t[i] - 'a';
    if (v[c].size() <= 0) {
      cout << -1 << ln;
      return 0;
    } else {
      prev = *lower_bound(all(v[c]), prev) + 1;
      if (prev >= slen) {
        prev -= slen;
        ans += slen;
      }
    }
  }

  ans += prev;

  cout << ans << ln;

  return 0;
}

Measured memory_bytes: 2756
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
const int INF = 1e6;
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int n;
    cin >> n;
    int h[n];
    rep(i,n) cin >> h[i];
    int ans = 0;
    int count = 0;
    rep(i,n-1){
        if(h[i] >= h[i+1]){
            count++;
        }
        else{
            ans = max(ans,count);
            count = 0;
        }
        if(i == n-2) ans = max(ans,count);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4032
#include <array>
  #include <cstdlib>
  #include <cmath>
  #include <climits>
  #include <cfloat>
  #include <map>
  #include <utility>
  #include <set>
  #include <iostream>
  #include <memory>
  #include <string>
  #include <vector>
  #include <algorithm>
  #include <functional>
  #include <sstream>
  #include <deque>
  #include <complex>
  #include <stack>
  #include <queue>
  #include <cstdio>
  #include <cctype>
  #include <cstring>
  #include <ctime>
  #include <iterator>
  #include <bitset>
  #include <numeric>
  #include <list>
  #include <iomanip>
  using namespace std;


  typedef long long LL;
  typedef pair<int,int> pii;
  typedef pair<LL,LL> pll;

  typedef vector<int> vint;
  typedef vector<vector<int> > vvint;
  typedef vector<long long> vll, vLL;
  typedef vector<vector<long long> > vvll, vvLL;

  #define VV(T) vector<vector< T > >

  template <class T>
  void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
  }

  template <class F, class T>
  void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
  }


  #define REP(i,n) for(int i=0;i<int(n);++i)
  #define ALL(v) (v).begin(),(v).end()
  #define RALL(v) (v).rbegin(),(v).rend()
  #define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
  #define PB push


  #define MOD 1000000007LL
  #define EPS 1e-10

  struct UnionFind
  {
    vector< int > data;

    UnionFind(int sz)
    {
      data.assign(sz, -1);
    }

    bool unite(int x, int y)
    {
      x = find(x), y = find(y);
      if(x == y) return(false);
      if(data[x] > data[y]) swap(x, y);
      data[x] += data[y];
      data[y] = x;
      return(true);
    }

    int find(int k)
    {
      if(data[k] < 0) return(k);
      return(data[k] = find(data[k]));
    }

    int size(int k)
    {
      return(-data[find(k)]);
    }

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

  int N, K;
  vector<int> a;
  int dp[100010][2];

  int main()
  {
    cin >> N >> K;
    a.resize(N);
    REP(i, N) cin >> a[i];

    dp[0][0] = 1;
    dp[0][1] = 0;

    REP(n, K + 1)
    {
      if (n == 0) continue;

      REP(player, 2)
      {
        int opponent = 1 - player;
        int winner = opponent;
        REP(i, N)
        {
          int m = n - a[i];
          if (m >= 0)
          {
            if (dp[m][opponent] == player)
            {
              winner = player;
            }
          }
        }
        dp[n][player] = winner;
      }
    }

    cout << (dp[K][0] == 0 ? "First" : "Second") << endl;
    return 0;
  }


Measured memory_bytes: 1024
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265358979323846264338327950L
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

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

  int num_left = A + B;
  int num_right = C + D;

  if (num_left == num_right)
    cout << "Balanced" << endl;
  else if (num_left > num_right)
    cout << "Left" << endl;
  else
    cout << "Right" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll,ll> pll;
#define all(c) begin(c), end(c)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define rep(i, n) for (ll i = 0; i < ll(n); i++)

const ll mod = 1000000007;
struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

struct combination {
    vector<mint> fact, ifact;
    // init struct with "n" of "nCk" (maximum number in other words)
    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }
    // c(n,k) returns mint that contains nCk (mod p (= 1e9+7)) in x
    // i.e.) mint num = c(n,k), then num.x == nCk (mod p (= 1e9+7))
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }

    // nPk - permutation
    mint p(int n, int k) {
        return fact[n] * ifact[n - k];
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> c(n);
    rep(i, n) cin >> c[i];
    sort(c.begin(), c.end());

    mint ans(0);
    for (int i = 0; i < n; i++) {
        ans += mint(c[i]) * mint(2 + (n - i - 1)) * mint(4).pow(n-1);
    }
    cout << ans.x << endl;
}


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

int main(void){
  int n, m; cin >> n >> m;
  vector<int> ans;
  for(int i=0; i < n/2+1; i++){
    ans.push_back(0);
  }
  for(int i=n/2+1; i < n; i++){
    ans.push_back(m);
  }
  for(int i=0; i < n-1; i++){
    cout << ans[i] << " ";
  }
  cout << ans[n-1] << endl;
  return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <functional>

  int main() {

	  int n;
	  int a = 0;


	  std::cin >> n;

	  for (int i = 1; i < 10000000000; ++i) {
		  if (i * i <= n) {
			  a = i * i;
			  continue;
		  }
		  else {
			  break;
		  }
	  }

	  std::cout << a << std::endl;

	  return 0;
}

Measured memory_bytes: 256
/*
    author: Salam_35
    Created at :

*/

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

#define ll long long int
#define pb push_back
#define sc(n) scanf("%d",&n)
#define Max 100005
#define scan(n) scanf("%lld",&n)
#define pi acos(-1.0)
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ALL(x) x.begin(),x.end()
#define sci(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define load(array,size)  for(ll i=0 ; i<size ; i++) cin>>array[i] ;
#define load1(array,size)  for(ll i=1 ; i<=size ; i++) cin>>array[i] ;
#define INF	1LL<<19
#define pll pair<ll,ll>
#define mst(arr,value) memset(arr,value,sizeof(arr));
#define tst() int t;cin >> t;while(t--)


const ll MOD = 1e9+7;

typedef vector<ll>vec;
typedef pair<ll,ll> pii;
typedef map<ll,ll>mpll;
typedef set<ll>seet;

int main()
{
  ll n,k;
  cin >> n >> k;
  if(n>=10)cout<<k<<endl;
  else cout<<k+100*(10-n)<<endl;


}






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

int main() {
 int a,b;
  cin >> a >>b;
  if(a<=5){
    cout << '0' << endl;
  }
  else if(a>=6 && a<=12){
  cout << b/2 << endl;
  }
  else{
  cout << b << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int length;
  char string[22];
  for(int i = 0; i < 21; i++){
    string[i] = getchar();
    if(string[i] == '\n'){
      length = i;
      break;
    }
  }
  for(int i = length - 1; i >= 0; i--)putchar(string[i]);
  printf("\n");
  return 0;
}


Measured memory_bytes: 2060
import fractions 

n = int(input())
T = []
for _ in range(n):
    T.append(int(input()))

#Tの最小公倍数を求める
ans = T[0]
for i in range(1,n):
    ans = ans * T[i] // fractions.gcd(ans, T[i])
print(ans)


Measured memory_bytes: 5304
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
//main definations
#define endl "\n"
#define UI unsigned int
#define LLI long long int
#define ULLI unsigned long long int
#define PI 3.14159258
 
//codechef only
#define TC for(UI defined_i=1;defined_i<=t;defined_i++)
//int b_s(int arr[], int n, int find);
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n;
	cin>>n;
	int arr[n];
	int a_4=0, a_2=0;
	for(int i=0;i<n;i++){
		cin>>arr[i];
		if(arr[i]%4==0)
			a_4+=2;
		else if(arr[i]%2==0)
			a_2++;
	}
	/*cout<<"a_2"<<a_2<<"a_4"<<a_4;*/
	if(a_4>0 && n%2!=0)
		a_4++;
	int ans=n-a_4-a_2;
	if(ans<=0){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	
	
	
}



/*
int b_s(int arr[], int n, int find){
	int start=0, end=n-1, mid=(start+end)/2;
	while(start<=end){
		if(arr[mid]==find){
			return mid;
		}
		else if(arr[mid]<find){
			start=mid+1;
			mid=(start+end)/2;
		}
		else{
			end=mid-1;
			mid=(start+end)/2;
		}
	}
	return -1;
}*/

Measured memory_bytes: 640
n=int(input(""))
lista=input("").split(" ")
lisa=[]
listn=[]
for i in range(n+1):
    listn+=[0]
for i in lista:
    lisa+=[int(i)]
    listn[int(i)]+=1
s=0
for i in listn:
    if(i<2):
        continue
    else:
        s+=i*(i-1)/2
for i in lisa:
    print(int(s-listn[i]+1))
    
    

    
    
    
    


Measured memory_bytes: 33892
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
using namespace std;
int main() {
  int x, y;
  while (cin >> x >> y) {
    if (x == 0 && y == 0)
      return 0;
    cout << min(x, y) << ' ' << max(x, y) << endl;
  }
}

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

class Program
{
    public static long count;
    static void Main(string[] args)
    {
        long[] arr = Console.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
        long n = arr[0];
        long k = arr[1];
        //k個選ぶとき
        long sum = 0;
        while (k <= n+1)
        {
            long right = n;
            long min = 0;
            long max = 0;
            min = k * (k - 1) / 2;
            max = k * (2 * n - k + 1) / 2;
            sum += max - min + 1;
            sum %= 1000000007;
            k++;
        }
        Console.WriteLine(sum);
    }

  

}




Measured memory_bytes: 18908
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s;
    String [] Array_a = new String[n];
    String [] Array_b = new String[n];
    for(int i = 0; i <n; i++){
      s = sc.next();
      Array_a[i] = s;
      Array_b[i] = s;
    }
    System.arraycopy(Array_a,0,bubblesort(Array_a,n),0,n);
    Print_Array(Array_a, n);
    System.out.println("Stable");

    System.arraycopy(Array_b,0,selectionsort(Array_b,n),0,n);
    Print_Array(Array_b, n);
    if(Judge_stable(Array_b,Array_a,n)==true){
      System.out.println("Stable");
    }else{
      System.out.println("Not stable");
    }

  }
  static String [] bubblesort(String [] S, int n){
    String tmp;
    for(int i = 0; i<n;i++){
      for(int j = n-1; j>i;j--){
        if(S[j].charAt(1) <S[j-1].charAt(1)){
          tmp = S[j];
          S[j] = S[j-1];
          S[j-1] = tmp;
        }
      }
    }
    return S;
  }

  static String [] selectionsort(String [] S, int n){
    String tmp;
    int minj;
    for(int i =0; i<n; i++){
      minj = i;
      for(int j = i; j<n;j++){
        if(S[minj].charAt(1)>S[j].charAt(1))minj =j;
      }
      tmp = S[minj];
      S[minj] = S[i];
      S[i] = tmp;
    }
    return S;
  }

  static void Print_Array(String [] S, int n){
    for(int i = 0; i<n-1;i++){
      System.out.printf("%s ", S[i]);
    }
    System.out.println(S[n-1]);
  }

  static boolean Judge_stable(String [] S, String [] stable_array,int n){
    for(int i = 0; i<n; i++){
      if(S[i]!=stable_array[i])return false;
    }
    return true;
  }
}


Measured memory_bytes: 26376
#include <bits/stdc++.h>
using namespace std;
int main(){
	string a,b;
	cin>>a>>b;
	string v=a+b;
	stringstream s;
	s<<v;
	long long z;
	s>>z;
	double x=sqrt(z);
	long long x1=x;
	if(x-x1<=0.000001){
		cout<<"Yes"<<endl;
	}
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
dice = list(map(int, input().split()))

s = str(input())
n = len(s)

dicel = [[0 for i in range(6)] for j in range(n+1)]

for i in range(6):
  dicel[0][i] = dice[i]

for j in range(n):
  if s[j] == "N":
    dicel[j+1][0] = dicel[j][1]
    dicel[j+1][1] = dicel[j][5]
    dicel[j+1][5] = dicel[j][4]
    dicel[j+1][4] = dicel[j][0]
    dicel[j+1][2] = dicel[j][2]
    dicel[j+1][3] = dicel[j][3]
  elif s[j] == "E":
    dicel[j+1][0] = dicel[j][3]
    dicel[j+1][3] = dicel[j][5]
    dicel[j+1][5] = dicel[j][2]
    dicel[j+1][2] = dicel[j][0]
    dicel[j+1][1] = dicel[j][1]
    dicel[j+1][4] = dicel[j][4]
  elif s[j] == "S":
    dicel[j+1][0] = dicel[j][4]
    dicel[j+1][4] = dicel[j][5]
    dicel[j+1][5] = dicel[j][1]
    dicel[j+1][1] = dicel[j][0]
    dicel[j+1][2] = dicel[j][2]
    dicel[j+1][3] = dicel[j][3]
  else:
    dicel[j+1][0] = dicel[j][2]
    dicel[j+1][2] = dicel[j][5]
    dicel[j+1][5] = dicel[j][3]
    dicel[j+1][3] = dicel[j][0]
    dicel[j+1][1] = dicel[j][1]
    dicel[j+1][4] = dicel[j][4]

print(dicel[n][0])


Measured memory_bytes: 5628