akhauriyash/Code-Regression huggingface dataset:
from math import gcd
N = int(input())
A = list(map(int,input().split()))

g = 0
for a in A:
    g = gcd(g,a)
if g > 1:
    print('not coprime')
    exit()

MAXN = 10**6+10
sieve = [i for i in range(MAXN+1)]
p = 2
while p*p <= MAXN:
    if sieve[p] == p:
        for q in range(2*p,MAXN+1,p):
            if sieve[q] == q:
                sieve[q] = p
    p += 1

st = set()
for a in A:
    tmp = set()
    while a > 1:
        tmp.add(sieve[a])
        a //= sieve[a]
    for p in tmp:
        if p in st:
            print('setwise coprime')
            exit()
        st.add(p)
print('pairwise coprime')

Measured memory_bytes: 132124
n, m = map(int, input().split())

if n >=3 and m>=3:
    print((n-2)*(m-2))
elif n==1 and m==1:
    print(1)
elif n ==1 and m>=2:
    print(m-2)
elif n>=2 and m==1:
    print(n-2)
else:
    print(0)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {

char X ;
cin >> X; 

if (X=='A')cout<<"A"<<endl;
else if (X=='B')cout<<"A"<<endl;
else if (X=='C')cout<<"A"<<endl;
else if (X=='D')cout<<"A"<<endl;
else if (X=='E')cout<<"A"<<endl;
else if (X=='F')cout<<"A"<<endl;
else if (X=='G')cout<<"A"<<endl;
else if (X=='H')cout<<"A"<<endl;
else if (X=='I')cout<<"A"<<endl;
else if (X=='J')cout<<"A"<<endl;
else if (X=='K')cout<<"A"<<endl;
else if (X=='L')cout<<"A"<<endl;
else if (X=='N')cout<<"A"<<endl;
else if (X=='M')cout<<"A"<<endl;
else if (X=='O')cout<<"A"<<endl;
else if (X=='P')cout<<"A"<<endl;
else if (X=='Q')cout<<"A"<<endl;
else if (X=='R')cout<<"A"<<endl;
else if (X=='S')cout<<"A"<<endl;
else if (X=='T')cout<<"A"<<endl;
else if (X=='V')cout<<"A"<<endl;
else if (X=='W')cout<<"A"<<endl;
else if (X=='X')cout<<"A"<<endl;
else if (X=='Y')cout<<"A"<<endl;
else if (X=='Z')cout<<"A"<<endl;

else cout<<"a"<<endl;

}


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

int main() {
    long long n, a, b;
    std::cin >> n >> a >> b;

    if (a > b || (n == 1 && a != b)) {
        std::cout << 0 << std::endl;
    } else if (a == b || n <= 2) {
        std::cout << 1 << std::endl;
    } else {
        std::cout << (n - 1) * b + a - (n - 1) * a - b + 1 << std::endl;
    }

    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

string repeat(char c, int t) {
  string ret = "";
  for (int i = 0; i < t; i++) ret += c;
  return ret;
}

void solve() {
  int n; cin >> n;
  int cnts[50][26] = {};
  rep(i, n) {
    string s; cin >> s;
    for (int j = 0; j < s.size(); j++)
      cnts[i][s[j] - 'a']++;
  }
  string ans = "";
  for (int j = 0; j < 26; j++) {
    int cnt = __INT_MAX__;
    for (int i = 0; i < n; i++) {
      // debug3(j, i, cnts[i][j]);
      if (cnts[i][j] == 0) {
        cnt = 0;
        break;
      } else {
        cnt = min(cnt, cnts[i][j]);
      }
    }
    // debug2(j, cnt);
    ans += repeat((char)('a' + j), cnt);
  }
  outl(ans);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 256
import java.util.Scanner;

 
public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int z = sc.nextInt();

		System.out.println(z + " " + x + " " + y);
		sc.close();
		
	}
	
}

Measured memory_bytes: 21844
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define rep(i,j,n) for(int i = (j); i < (n); i++)
#define rep0(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i < (n); i++)

int main(){
    int n;
    cin >> n;
    vector<int> l(n);
    rep0(i,n)cin >> l[i];
    int ans = 0;
    rep0(i,n-2) rep(j,i+1,n-1) rep(k,j+1,n){
        int a,b,c;
        if(l[i] == l[j] || l[i] == l[k] || l[j] == l[k])continue;
        a = l[i] + l[j] - l[k];
        b = l[i] - l[j] + l[k];
        c = -l[i] + l[j] + l[k];
        if(a>0 && b>0 && c>0) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define bgn begin()
#define sz size()
#define en end()
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define pri priority_queue
#define Pri priority_queue<int,vector<int>,greater<int>>
#define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>>
#define all(a)  (a).begin(),(a).end()
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second


signed main(){
  string t;
  cin >> t;
  int ans = 0;
  string a = "";
  fo(i,t.size()){
    if(t.substr(i , 2) == "PD"){
      a.pb('P');
      a.pb('D');
      i++;
    }
    else if(t[i] == 'D')
      a.pb('D');
    else if(t[i] == '?')
      a.pb('D');
    else if(t[i] == 'P')
      a.pb('P');
  }
  cout << a << endl;
}

Measured memory_bytes: 3920
#include "bits/stdc++.h"
using namespace std;
#define fst first
#define scd second
int gcd(int x, int y)
{
	if(y == 0)
	{
		return x;
	}
	else
	{
		return gcd(y, x % y);
	}
}
signed main()
{
	int k, ans = 0;
	scanf("%d", &k);
	for(int i = 1; i <= k; ++i)
	{
		for(int j = 1; j <= k; ++j)
		{
			for(int l = 1; l <= k; ++l)
			{
				ans += gcd(gcd(i, j), l);
			}
		}
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 3820
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;
 
int main(){
    int n;
    cin >> n;
    int all[100010];
    for(int i = 0; i < 100010; i++){
        all[i] = 0;
    }
    ll ans = 0;
    for(int i = 0; i < n; i++){
        int temp;
        cin >> temp;
        ans += temp;
        all[temp]++;
    }
    int q;
    cin >> q;
    int b[q],c[q];
    for(int i = 0;i < q; i++){
        int temp1,temp2;
        cin >> temp1 >> temp2;
        b[i] = temp1;
        c[i] = temp2;
        int count = all[temp1];
        ans = ans + (temp2-temp1) * count;
        all[temp2] += all[temp1];
        all[temp1] = 0;
        cout << ans << endl;
    }
}

Measured memory_bytes: 4804
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		double[][] p = new double[20][2];
		int n = 0;
		
		while(scan.hasNext()){
			String s[] = scan.next().split(",");
			p[n][0]=Double.parseDouble(s[0]);
			p[n][1]=Double.parseDouble(s[1]);
			n++;
		}
		
		double a = 0;
		
		for(int i = 0; i < n; i++){
			double x1 = p[i][0];
			double y1 = p[i][1];
			double x2 = p[(i + 1) % n][0];
			double y2 = p[(i + 1) % n][1];
			a += x1 * y2 - x2 * y1;
		}
		System.out.println(Math.abs(a / 2));
	}
}

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

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define ll long long
#define P pair<int, int>

using namespace std;

int N, K;
int main() {
  cin >> N >> K;
  cout << (N%K!=0) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int L, R;
  cin >> L >> R;
  if (R - L >= 2019)
  {
    cout << 0 << endl;
    return 0;
  }
  int ans = 2019;
  FOR(i, L, R)
  {
    FOR(j, i + 1, R + 1)
    {
      int a = i % 2019;
      int b = j % 2019;
      ans = min(ans, a * b % 2019);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
/* You got a dream , you gotta protect it . */
/* Sometimes you win , sometimes you learn . */
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lp(i , N) for(ll i = 0; i < ll (N) ; i++)
#define debug(x) cout<<" [ " << #x << " is: " << x << " ] "<<endl;
using namespace std;
typedef long long ll;
typedef long double ld;
const long double EPS = 1e-6;
const long double pi = acos(-1);
int main(){
    FAST
    string s , t;
    cin >> s >> t;
    ll a , b;
    cin >> a >> b;
    string u;
    cin >> u;
    if(u == s){
        cout << --a << ' ' << b << endl;
    }
    else cout << a << ' ' << --b << endl;
    return 0;
}


Measured memory_bytes: 256
from collections import defaultdict

def factorization(n):
    if n == 1: return []
    res = []
    x = n
    y = 2
    while y * y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
    if x > 1: res.append(x)
    return res

N = int(input())

D = defaultdict(int)

for i in range(1, N + 1):
    F = factorization(i)
    for f in F:
        D[f] += 1

cnt_75 = 0
cnt_25 = 0
cnt_15 = 0
cnt_5 = 0
cnt_3 = 0

for v in D.values():
    if v + 1 >= 75:
        cnt_75 += 1
    if v + 1 >= 25:
        cnt_25 += 1
    if v + 1 >= 15:
        cnt_15 += 1
    if v + 1 >= 5:
        cnt_5 += 1
    if v + 1 >= 3:
        cnt_3 += 1

ans = 0

ans += cnt_75
ans += cnt_25 * (cnt_3 - 1)
ans += cnt_15 * (cnt_5 - 1)
ans += cnt_5 * (cnt_5 - 1) // 2  * (cnt_3 - 2)

print(ans)

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

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 2147483647;
const ll INFL = 9223372036854775807;
const ll mod = 1000000007;






int main() {
	ll n, k;
	cin >> n >> k;
	VVLL v(n, VLL(2));
	REP(i, n)cin >> v[i][1] >> v[i][0];
	REP(i, n)v[i][1]--;

	sort(ALL(v));
	reverse(ALL(v));

	VLL tmp;
	VLL a(n, 0);
	ll ans = 0;
	ll res = 0;
	ll cnt = 0;
	
	REP(i, k) {
		if (a[v[i][1]] == 0) {
			a[v[i][1]] = v[i][0];
			cnt++;
			res += v[i][0];
		}
		else {
			res += v[i][0];
			tmp.push_back(min(a[v[i][1]], v[i][0]));
			a[v[i][1]] = max(a[v[i][1]], v[i][0]);
		}
	}

	ans = res + cnt * cnt;

	reverse(ALL(tmp));

	ll l = tmp.size();
	
	ll b = 0;
	if (l == 0) {
		cout << ans << endl;
		return 0;
	}
	FOR(i, k, n) {
		if (a[v[i][1]])continue;
		res -= tmp[b];
		res += v[i][0];
		a[v[i][1]] = 1;
		cnt++;
		b++;
		ans = max(ans, res + cnt * cnt);
		if (b == l)break;
	}

	cout << ans << endl;




	return 0;
}

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

#define ll long long
#define MOD 1000000007

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

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

	int k;
	cin>>k;
	ll int res=0;
	for(int a=1;a<=k;a++) {
		for(int b=1;b<=k;b++) {
			for(int c=1;c<=k;c++) {
				res+=gcd(gcd(a,b),c);
			}
 		}
	}
	cout<<res<<endl;
	
	return 0;
}

Measured memory_bytes: 3652
#include <CodeforcesSolutions.h>
#include <ONLINE_JUDGE <solution.cf(contestID = "1364",problemID = "A",method = "GET")>.h>
"""
    Author : thekushalghosh
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def solve():
    s,w = invr()
    print("unsafe" if w >= s else "safe")
            
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1] + 1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
    return(q)

def power_two(n):
    if n == 1:
        return(True)
    sttr = str(n)
    len_str = len(sttr)
    sttr = list(sttr)
    num = 0
    if (len_str == 1 and sttr[len_str - 1] == '1'): 
        return(False)
    while (len_str != 1 or sttr[len_str - 1] != '1'):
        if ((ord(sttr[len_str - 1]) - ord('0')) % 2 == 1):
            return(False)
        j = 0; 
        for i in range(len_str):  
            num = num * 10 + (ord(sttr[i]) - ord('0')); 
            if (num < 2): 
                if (i != 0):  
                    sttr[j] = '0'
                    j += 1
                continue
  
            sttr[j] = chr((num // 2) + ord('0'))
            j += 1; 
            num = (num) - (num // 2) * 2
        len_str = j
    return(True)

def getLeftmostBit(n): 
    m = 0
    while (n > 1) : 
        n = n >> 1
        m += 1
    return(m)
def getNextLeftmostBit(n, m) : 
    temp = 1 << m 
    while (n < temp) : 
        temp = temp >> 1
        m -= 1
    return m
def bitcounter(n) :
    m = getLeftmostBit(n) 
    return _countSetBits(n, m) 
def _countSetBits(n, m) :
    if (n == 0) : 
        return 0
    m = getNextLeftmostBit(n, m)
    if (n == (1 << (m + 1)) - 1) : 
        return ((m + 1) * (1 << m))
    n = n - (1 << m)
    return (n + 1) + bitcounter(n) + m * (1 << (m - 1)) 

def log_two(n): 
    return(math.log(n) / math.log(2))

#-----------------------------------------------------------------------#
        
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
    
main()


Measured memory_bytes: 63080
#include <iostream>
#include <string>
#include <fstream>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
    int k, s;
    cin >> k >> s;

    int count = 0;
    for (int x = 0; x <= k; x++)
    {
        for (int y = 0; y <= k; y++)
        {
            if (x + y <= s && x + y + k >= s) count++;
        }
    }

    cout << count << endl;
    return 0;    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <deque>
using namespace std;

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

  stack<int> slope;
  deque<int> L;
  int A = 0;
  vector<int> down;
  int j = 0;
  for (int i = 0; i < area.size(); i++) {
    if (area[i] == '\\') {
      slope.push(i);
      down.push_back(i);
      j++;
    } else if (area[i] == '/') {
      if (slope.empty()) {
        down.clear();
        j = 0;
        continue;
      }

      L.push_back(i - slope.top());
      A += i - slope.top();

      while (j > 0) {
        j--;

        if (slope.top() < down[j]) {
          down.erase(down.begin() + j);
          int plus = L.back();
          L.pop_back();
          plus += L.back();
          L.pop_back();
          L.push_back(plus);
        } else if (j == 0) { break; }
      }

      j = down.size();

      slope.pop();
    }
  }

  cout << A << endl;
  if (!L.empty()) {
    cout << L.size() << " ";
  } else {
    cout << L.size() << endl;
  }
  while (!L.empty()) {
    if (L.size() == 1) {
      cout << L.front() << endl;
    } else {
      cout << L.front() << " ";
    }
    L.pop_front();
  }

  return 0;
}


Measured memory_bytes: 3252
#include <bits/stdc++.h>
using namespace std;
int main(){
	int m, d;
	cin >> m >> d;
	int ans = 0;
	for(int i = 1; i <= m; i++){
		for(int j = 20; j <= d; j++){
			int a = j / 10;
			int b = j % 10;
			if(a >= 2 && b >= 2 && a * b == i) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define x first
#define y second
#define ll long long
#define dl double
#define pii pair<int,int>
#define pb push_back
#define all() begin(),end()
#define nl '\n'
#define adm(a,b,m) ((a+b)%m)
#define gum(a,b,m) ((a*1LL*b)%m)
#define lo(i,j,n) for(int i=j;i<n;i++)
ll a[200010],n,b[200010];
ll f(ll k){
	ll an=0;
	lo(i,0,n){
		k++;
		an+=abs(a[i]-k);
	}
	return an;
}
int main(){
	cin>>n;
	lo(i,0,n){
		cin>>a[i];
		b[i]=a[i]-(i+1);
	}
	sort(b,b+n);
	ll m=b[n/2];
	if(!(n&1))m=(m+b[n/2-1])/2;
	cout<<f(m)<<nl;
}


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

int64_t gcd(int64_t a, int64_t b) {
    if (b == 0ll)
        return a;

    return gcd(b, a % b);
}

int64_t lcm(int64_t a, int64_t b) {
    return a * b / gcd(a, b);
}
 
 
int main(){
  int64_t a,b,c,d;
  cin >>a>>b>>c>>d;
  int64_t cd = lcm(c,d);
  
int64_t cue = b/c;
int64_t csita;
  if(a%c ==0ll)
    csita = a/c;
  else
    csita = a/c+1ll;
  
int64_t due = b/d;
int64_t dsita;  
  if(a%d ==0ll)
    dsita = a/d;
  else
    dsita = a/d+1ll;
  
int64_t cdue =b/cd;
int64_t cdsita;
  if(a%cd ==0ll)
    cdsita = a/cd;
  else
    cdsita = a/cd+1ll;
  
  int64_t wareru = (cue-csita+1ll)+(due-dsita+1ll)-(cdue-cdsita+1ll);
  int64_t ans = b-a+1ll-wareru;
  cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
ll N;
double x[100000], d[100000];
ll M,K;
ll a[100000];
vector<int> mul(vector<int> X, vector<int> Y){
    vector<int> Z(N-1,0);
    rep(i,0,N-1){
        Z[i]=X[Y[i]];
    }
    return Z;
}
vector<int> pow(vector<int> X, ll n){
    vector<int> Z(N-1,0);
    if(n==0){
        rep(i,0,N-1) Z[i]=i;
        return Z;
    }
    Z=pow(X,n/2);
    Z=mul(Z,Z);
    if(n%2) Z=mul(X,Z);
    return Z;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N;
    rep(i,0,N)cin>>x[i];
    rep(i,0,N-1) d[i]=x[i+1]-x[i];
    cin>>M>>K;
    rep(i,0,M) cin>>a[i];
    vector<int> v(N-1,0);
    rep(i,0,N-1) v[i]=i;
    rep(i,0,M){
        swap(v[a[i]-2], v[a[i]-1]);
    }
    vector<int> p(N-1,0);
    rep(i,0,N-1){
        p[v[i]]=i;
    }
    p=pow(p,K);
    vector<double> ans(N-1,0);
    rep(i,0,N-1){
        ans[p[i]]=d[i];
    }
    ll res=x[0];
    rep(i,0,N){
        if(i==0) cout <<setprecision(15)<<x[0]<<"\n";
        else {
            res+=ans[i-1];
            cout <<setprecision(15)<<res<<"\n";
        }
    }
}

Measured memory_bytes: 51568
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC145B
{
    class Program
    {
        static void Main(string[] args)
        {
            //var inputArr = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            

            //int ans = 0;
            string ans = "No";

            if (N % 2 == 1) ans = "No";
            else if (S.Substring(0,N/2)==S.Substring(N/2))
            {
                ans = "Yes";
            }


            Console.WriteLine(ans);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11220
import numpy as np


def main():
	n, d = [int(x) for x in input().split()]
	l = []
	for val in range(n):
		l.append([int(x) for x in input().split()])
	a = np.array(l)
	
	l = []
	for i, v1 in enumerate(a):
		for v2 in a[i:]:
			D = np.linalg.norm(v1 - v2)
			l.append(D)
	res = map(lambda x: float.is_integer(x), l)
	print(len([f for f in list(res) if f == True]) - n)

if __name__ == "__main__":
	main()


Measured memory_bytes: 12872
// https://atcoder.jp/contests/dp/tasks/dp_b
#include <bits/stdc++.h>
using namespace std;

#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
const ll INF = 1LL<<60;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

vector<ll> weight(110);
vector<ll> value(110);
vector<vector<ll>> dp(110,vector<ll>(101000,0));

int main() {
    // 入力
    ll N,W;cin>>N>>W;
    for( ll i = 0; i < N; i++ ) 
        cin >> weight.at(i) >> value.at(i);

    for (ll i = 0; i < N; ++i) {
        for (ll sum_weight = 0; sum_weight <= W; sum_weight++)
        {
            if( sum_weight - weight[i] >= 0) {
                chmax(dp.at(i+1).at(sum_weight),dp.at(i).at(sum_weight - weight[i])+value.at(i));
            }
            chmax(dp.at(i+1).at(sum_weight),dp.at(i).at(sum_weight));
        }
    }

    // for (ll i = 0; i < N; ++i) {
    //     for (ll sum_weight = 0; sum_weight <= W; sum_weight++)
    //     {
    //         cout << dp.at(i).at(sum_weight) << ' ';
    //     }
    //     cout << endl;
    // }
    cout << dp[N][W] << endl;

    return 0;
}



Measured memory_bytes: 90884
#include <stdio.h>
#include <iostream>
#include <set>
#include <bitset>
#include <map>
#include <stack>
#include <algorithm>
#include <math.h>
#include <queue>
#include <vector>
#include <string.h>
#define mem(x,b) memset(x,b,sizeof(x))
#define mp(a,b) make_pair(a,b)
#define debug(a) cout<<a<<endl
#define maxn 200005
using namespace std;
typedef long long ll;
typedef double db;
const int mod=1e9+7;
int a[maxn];
int main()
{
	int a,b;
    scanf("%d%d",&a,&b);
    printf("%d\n",a*b);
    return 0;
}


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

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

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

  int n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());

  string ans = "No";
  if(n%3 == 0) {
    // X,X, ... ,X | Y,Y, ... ,Y | X^Y,X^Y, ... ,X^Y
    if(a[0] == a[n/3-1] && a[n/3] == a[2*n/3-1] && a[2*n/3] == a[n-1] && (a[0]^a[n/3]) == a[2*n/3]) {
      ans = "Yes";
    }
    // 0,0, ... ,0 | x,x, ... ,x
    if(a[0] == 0 && a[0] == a[n/3-1] && a[2*n/3] == a[n-1]) {
      ans = "Yes";
    }
  } else {
    // 0,0, ... ,0
    if(a[n-1] == 0) {
      ans = "Yes";
    }
  }

  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char ch[5];
    cin>>ch;
    int y = ((ch[0]-'0')*10)+(ch[1]-'0');
    int m = ((ch[2]-'0')*10)+(ch[3]-'0');
    if((y>0 && y<=12)&&(m>0 && m<=12))cout<<"AMBIGUOUS\n";
    else if(m>0 && m<=12)cout<<"YYMM\n";
    else if(y>0 && y<=12)cout<<"MMYY\n";
    else cout<<"NA\n";
}


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


Measured memory_bytes: 128
#!/usr/bin/env python
# -*- coding:utf-8 -*-

from __future__ import division, print_function, absolute_import, unicode_literals

card = {}
s = input()
card['a'] = s
s = input()
card['b'] = s
s = input()
card['c'] = s

turn = card['a'][0]
card['a'] = card['a'][1:]
while True:
    if len(card[turn]) == 0:
        print(turn.upper())
        break
    tmp = card[turn][0]
    card[turn] = card[turn][1:]
    turn = tmp


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

int main() {
int N;
  cin>>N;
  vector<int> S(N);
  for(int i=0; i<N; i++){
     cin>>S.at(i);
  }
  sort(S.begin(),S.end());
  cout<<S.at(N-1)-S.at(0)<<endl;
}
    

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
  int M,D;
  cin >> M >> D;
  int cnt=0;
  for(int i=1;i<=M;i++){
    for(int j=1;j<=D;j++){
      int a=j/10,b=j%10;
      if(a<=1 || b<=1)continue;
      if(a*b==i)cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
dic = {i: 0 for i in range(1, N+1)}
ac_count = 0
wa_count = 0
for i in range(M):
    p, S = input().split()
    p = int(p)
    if S == 'WA' and dic[p] >= 0:
        dic[p] += 1
    elif dic[p] >= 0:
        ac_count += 1
        wa_count += dic[p]
        dic[p] = -1
print(ac_count, wa_count)


Measured memory_bytes: 15084
#include<bits/stdc++.h>
using namespace std;
const int N=1E5+7;
int arr[N];
struct stu{
	int a,b;
}s[N];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)	scanf("%d",&arr[i]);
	sort(arr+1,arr+1+n);
	int ans=0;
	for(int i=1;i<=n-2;i++)
		for(int j=i+1;j<=n-1;j++)
			for(int k=j+1;k<=n;k++)
				if(arr[i]<arr[j]+arr[k]&&arr[j]<arr[k]+arr[i]&&arr[k]<arr[i]+arr[j]) ans++;
	
	printf("%d",ans);
	return 0;
}

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

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

inline void Main() {
  int64_t n; cin >> n;
  int64_t r = 0;
  repi(i, 1, n+1) {
    r += ((1+n/i)*(n/i)*i)/2;
  }
  cout << r << endl;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a;
    cin >> a;
    vector<int> A(a);
    vector<int> B(a);
    for(int i=0;i<a;i++)
        cin >> A.at(i);
    for(int i=0;i<a;i++)
        cin >> B.at(i);
    int asum = 0;
    int bsum = 0;
    for(int i = 0;i<a;i++){
        if(A.at(i) > B.at(i)){
            asum += A.at(i);
            bsum += B.at(i);
        }

    }
    cout << asum - bsum << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#define P 1000000007
int n, d, ans;
char s[200005];
int main(){
	scanf("%d%s", &n, s + 1);
	for (register int i = 1; i <= (n << 1); ++i)
		if ((i & 1) ^ (s[i] == 'B')) s[i] = 'R'; else s[i] = 'L';
	ans = 1;
	for (register int i = 1; i <= (n << 1); ++i)
		if (s[i] == 'L') ++d;
		else{
			if (!d) return printf("0\n"), 0;
			ans = 1ll * ans * d % P, --d;
		}
	if (d) return printf("0\n"), 0;
	for (register int i = 1; i <= n; ++i) ans = 1ll * ans * i % P;
	printf("%d\n", ans);
}


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

const int Maxn = 105;

int n;
int X[Maxn], Y[Maxn], H[Maxn];

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d %d %d", &X[i], &Y[i], &H[i]);
    for (int cx = 0; cx <= 100; cx++)
        for (int cy = 0; cy <= 100; cy++) {
            int st = -1;
            bool ok = true;
            int mn = 2000000007;
            for (int i = 0; i < n && ok; i++)
                if (H[i] > 0) {
                    int my = H[i] + abs(cx - X[i]) + abs(cy - Y[i]);
                    if (st != -1 && st != my) ok = false;
                    st = my;
                } else mn = min(mn, H[i] + abs(cx - X[i]) + abs(cy - Y[i]));
            if (ok)
                if (st == -1) st = mn;
                else if (mn < st) ok = false;
            if (ok) {
                printf("%d %d %d\n", cx, cy, st);
                return 0;
            }
        }
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from collections import deque
N=int(input())

graph=[[] for _ in range(N+1)]
for _ in range(N-1):
  a,b=map(int,input().split())
  graph[a].append(b)
  graph[b].append(a)
#print(graph)

dist_f=[-1]*(N+1)
d=0
queue=[1]
while queue:  
  new_queue=set()
  for u in queue:
    dist_f[u]=d
    for v in graph[u]:
      if dist_f[v]==-1:
        new_queue.add(v)
        
  queue=list(new_queue)
  d+=1
#print(dist_f)

dist_s=[-1]*(N+1)
d=0
queue=[N]
while queue:  
  new_queue=set()
  for u in queue:
    dist_s[u]=d
    for v in graph[u]:
      if dist_s[v]==-1:
        new_queue.add(v)
        
  queue=list(new_queue)
  d+=1
#print(dist_s)

cnt_f,cnt_s=0,0
for i in range(1,N+1):
  if dist_f[i]<=dist_s[i]:
    cnt_f+=1
  else:
    cnt_s+=1

#print(cnt_f,cnt_s)
if cnt_f>cnt_s:
  print("Fennec")
else:
  print("Snuke")

Measured memory_bytes: 29400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    string s;
    cin>>s;
    int n=s.size();
    ll ans=0;
    for (int i=0;i<1<<n-1;i++) {
        ll sm=0;
        int p=0;
        for (int j=0;j<n-1;j++)
            if (i&1<<j) {
                sm+=stoll(s.substr(p,j+1-p));
                p=j+1;
            }
        sm+=stoll(s.substr(p));
        ans+=sm;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> X(N + 1);
  for (int i = 1; i <= N; ++i)
    cin >> X[i];
  int M;
  cin >> M;
  vector<int> A(M + 1);
  for (int i = 1; i <= M; ++i)
    cin >> A[i];

  for (int i = 1; i <= M; ++i)
    if (A[i] == N && X[A[i]] < 2019)
      ++X[A[i]];
    else if (A[i] != N && X[A[i]] + 1 != X[A[i] + 1])
      ++X[A[i]];

  for (int i = 1; i <= N; ++i)
    cout << X[i] << endl;
}


Measured memory_bytes: 3108
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [W, H, N] = input[0].map(Number);

  let top = H;
  let bottom = 0;
  let left = 0;
  let right = W;

  for (let i = 1; i <= N; i++) {
    const [x, y, a] = input[i].map(Number);

    switch (a) {
      case 1: {
        left = Math.max(x, left);
        break;
      }
      case 2: {
        right = Math.min(x, right);
        break;
      }
      case 3: {
        bottom = Math.max(y, bottom);
        break;
      }
      case 4: {
        top = Math.min(y, top);
        break;
      }
    }
  }

  const height = Math.max(0, top - bottom);
  const width = Math.max(0, right - left);

  return height * width;
};

console.log(main(read()));


Measured memory_bytes: 29572
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))
#define INF 1000000000
typedef long long ll;

bool visted[100009];

int main() {
    int K;
    cin >> K;
    
    mem(visted,false);
    
    deque<pair<int,int>> q;
    q.push_front({1,1});
    
    while(true) {
        pair<int,int> t = q.front(); q.pop_front();
        
        if(visted[t.first]) continue;
        visted[t.first] = true;
        if(t.first==0){
            cout1(t.second);
            return 0;
        }
        q.push_front( { t.first*10%K, t.second} );
        q.push_back( { (t.first+1)%K, t.second+1} );
    }
    
}

Measured memory_bytes: 1152
typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;

int main() {
    ll n;
    std::cin >> n;
    vector<ll> x(n),y(n);
    vector<char> u(n);
    unordered_map<ll,vector<pair<ll,ll>>> m;
    unordered_map<ll,vector<pair<ll,ll>>> m2;
    vector<vector<pair<ll,ll>>>  vx(200010),vy(200010);
    for (int i = 0; i < n; i++) {
        std::cin >> x[i]>>y[i]>>u[i];
        m[x[i]+y[i]].push_back({x[i],i});
        m2[x[i]-y[i]].push_back({x[i],i});
        if(u[i]=='U'||u[i]=='D') vx[x[i]].push_back({y[i],i});
        if(u[i]=='R'||u[i]=='L') vy[y[i]].push_back({x[i],i});
    }
    ll ans = 1e15;
    for (auto e : m) {
        sort(e.second.begin(),e.second.end());
        ll llim = -1;
        ll ulim = -1;
        for (auto ee : e.second) {
            auto ni = ee.second;
            if(ulim==-1&&u[ni]=='U')continue;
            if(llim==-1&&u[ni]=='L')continue;
            if(u[ni]=='U'){
                ans = min(ans, (ulim-y[ni])*10 );
            }
            if(u[ni]=='L'){
                ans = min(ans, (x[ni]-llim)*10 );
            }
            if(u[ni]=='R'){
                ulim = y[ni];
            }
            if(u[ni]=='D'){
                llim = x[ni];
            }
        }
    }
    for (auto e : m2) {
        sort(e.second.begin(),e.second.end());
        ll llim = -1;
        ll dlim = -1;
        for (auto ee : e.second) {
            auto ni = ee.second;
            if(dlim==-1&&u[ni]=='D')continue;
            if(llim==-1&&u[ni]=='L')continue;
            if(u[ni]=='D'){
                ans = min(ans, (y[ni]-dlim)*10 );
            }
            if(u[ni]=='L'){
                ans = min(ans, (x[ni]-llim)*10 );
            }
            if(u[ni]=='R'){
                dlim = y[ni];
            }
            if(u[ni]=='U'){
                llim = x[ni];
            }
        }
    }
    
    for (int i = 0; i < 200010; i++) {
        sort(vx[i].begin(),vx[i].end());
        sort(vy[i].begin(),vy[i].end());
        
        ll moyoue = -1;
        for (auto e : vx[i]) {
            auto ni = e.second;
            if(u[ni]=='D'){
                if(moyoue!=-1){
                    ans = min(ans, (y[ni]-moyoue)*5 );
                }
            }else if(u[ni]=='U'){
                moyoue = y[ni];
            }
        }
        ll moyomig = -1;
        for (auto e : vy[i]) {
            auto ni = e.second;
            if(u[ni]=='L'){
                if(moyomig!=-1){
                    ans = min(ans, (x[ni]-moyomig)*5 );
                }
            }else if(u[ni]=='R'){
                moyomig = x[ni];
            }
        }
    }
    
    if(ans==1e15){
        std::cout << "SAFE" << std::endl;
        return 0;
    }
    
    std::cout << ans << std::endl;
}


Measured memory_bytes: 56692
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

n, a, b = getlist()

ma = str(min(a,b))
mi = str(max(a+b-n, 0))

print(" ".join([ma,mi]))

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>//小数点以下表示
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;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main(){
    int n;
    cin>>n;
    int a[n];
    bool b=true;
    rep(i,n){
        cin>>a[i];
        if(a[i]%2==0){
            if(a[i]%3!=0&&a[i]%5!=0){
                b=false;
            }
        }
    }
    if(b){
        cout<<"APPROVED"<<endl;
    }
    else{
        cout<<"DENIED"<<endl;
    }
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] a) {
		try (Scanner s = new Scanner(System.in)) {
			Stack<String> stack = new Stack<>();
			String text = s.nextLine();
			String[] strings = text.split("");
			for (String c : strings) {
				if (c.equals("B")) {
					if (stack.isEmpty() == false) {
						stack.pop();
					}
				} else {
					stack.push(c);
				}
			}
			stack.stream().forEach(System.out::print);
		}
	}
}


Measured memory_bytes: 28756
n, k = STDIN.read.split(' ').map(&:to_i)

case
when k > n
  out = 'NO'
else
  max = case
  when n % 2 == 0
    n / 2
  when n % 2 == 1
    n / 2 + 1
  end

  out = if k <= max
    'YES'
  else
    'NO'
  end
end

puts out


Measured memory_bytes: 1788
import sys
sys.setrecursionlimit(10 ** 7)

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

K = ir()
A = lr()[::-1]
domain = [2, 2] #現在の最小と最大
for i in range(K):
    x = A[i]
    left = domain[0]; right = domain[1]
    if x > right * 2 - 1:
        print(-1)
        exit()
    left += (-left) % x
    right -= right % x
    right += x - 1
    if left > right:
        print(-1)
        exit()
    domain = [left, right]

print(*domain)
# 05

Measured memory_bytes: 14428
import sys
#from collections import defaultdict, deque, Counter
#from bisect import bisect_left
#import heapq
#import math
#from itertools import groupby as gb
#from itertools import permutations as perm
#from itertools import combinations as comb
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
n,r = map(int, stdin.readline().rstrip().split())
#AB = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]

if n >= 10:
    print(r)
else:
    print(r+100*(10-n))


Measured memory_bytes: 2940
N=int(input())
List_v=list(map(int,input().split()))
List_c=list(map(int,input().split()))
List_m=[]
for i in range (N):
    List_m.append(List_v[i]-List_c[i])
count=0
for j in range(N):
    if List_m[j]>=0:
      count+=List_m[j]
print(count)

Measured memory_bytes: 3064
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))

INF = 10**5

# DP = [INF] * ((10**5)+10)
DP = [None] * ((10**5)+10)
# DP = [None] * (N+1)
DP[0] = 0

for i in range(1, N):
    a = []
    for j in range(1, K+1):
        if 0 <= i-j < N:
            v = DP[i-j] + abs(H[i-j] - H[i])
            a.append(v)
    DP[i] = min(a)


# print(DP)
print(DP[N-1])

Measured memory_bytes: 53984
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt(),min=999999;
    String buffa="",buffb="";
    for(int i=1;i<n;i++) {
    	int a=i,b=n-i,sum=0;
    	buffa=String.valueOf(a);
    	buffb=String.valueOf(b);
    	for(int j=0;j<buffa.length();j++)sum+=Integer.valueOf(buffa.substring(j, j+1));
    	for(int j=0;j<buffb.length();j++)sum+=Integer.valueOf(buffb.substring(j, j+1));
    	min=Math.min(sum, min);
    	//if(sum==1)System.out.println(buffa+"+"+buffb+":"+sum);
    }
    System.out.println(min);
  }
}


Measured memory_bytes: 44680
#include<bits/stdc++.h>
using namespace std;
int dp[100005];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int cost=1e6,now;
        cost=min(cost,dp[i-1]+1);
        for(int j=1,now=6;now<=i;j++,now*=6)
                cost=min(cost,dp[i-now]+1);
        for(int j=1,now=9;now<=i;j++,now*=9)
                cost=min(cost,dp[i-now]+1);
        dp[i]=cost;
    }
    printf("%d",dp[n]);
}


Measured memory_bytes: 640
/**
 * 
 */
import java.util.*;
/**
 * @author akira
 *
 */
class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		final int MAX_N = 50000;
		Scanner scan = new Scanner(System.in);
		int n;
		boolean[] prime = new boolean[MAX_N + 1];
		for(int i = 0;i < prime.length;i++){
			prime[i] = true;
		}
		ArrayList<Integer> al = new ArrayList<Integer>();
		prime[0] = prime[1] = false;
		for(int i = 0;i <= MAX_N;i++){
			if(prime[i]){
				al.add(i);
				for(int j = 2 * i;j <= MAX_N;j+=i){
					prime[j] = false;
				}
			}
		}
		int[][] dp = new int[3][MAX_N + 1];
		dp[0][0] = 1;
		for(int i = 0;i < al.size();i++){
			for(int j = 0;j < 2;j++){
				for(int k = 0;k <= MAX_N - al.get(i);k++){
					dp[j + 1][k + al.get(i)] += dp[j][k];
				}
			}
		}
		while(true){
			n = scan.nextInt();
			if(n == 0){
				break;
			}
			System.out.println("" + dp[2][n]);
		}
		
	}

}

Measured memory_bytes: 33056
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int k,n,l[50],i,S;
  cin >> n >> k;
  for(i=0;i<n;i++){
    cin >> l[i];
  }
  sort(l,l+n,greater<int>());
  for(i=0;i<k;i++){
    S+=l[i];
  }
  cout << S << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [int(s) for s in input().rstrip().split(' ')]
k = 1
for i in range(N):
  if A[i] % 2 == 0:
    if A[i] % 3 != 0 and A[i] % 5 != 0:
      k = 0
if k == 1:
  print("APPROVED")
elif k == 0:
  print("DENIED")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll N;

void solve()
{
	if(N%2){
		cout << 0 << '\n';
		return;
	}else{
		ll res = 0;
		ll den = 10;
		while(den <= N){
			res += N/den;
			den *= 5;
		}
		cout << res << '\n';
	}
}

int main()
{
	cin >> N;
	solve();
	return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
using namespace std;
using ll=long long;
#define mod  1000000007


int main(void){
    int n,x[200000],y[200000];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x[i];
        y[i]=x[i];
    }
    sort(y,y+n);
    for(int i=0;i<n;i++){
        if(x[i]<=y[n/2-1]){
            cout<<y[n/2]<<endl;
        }else{
            cout<<y[n/2-1]<<endl;
        }
    }

}


Measured memory_bytes: 3712
///#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
///#define double long double
#define all(x) (x).begin(), (x).end()
#define finout(x) freopen(x".in", "r", stdin); freopen(x".out", "w", stdout);
#define X first
#define Y second

using namespace std;
const int MOD = 1e9 + 7;

typedef pair <int, int> pii;
typedef vector <int> vi;
inline int ni() {int x; cin >> x; return x;}
template <class T>
inline T nt() {T x; cin >> x; return x;}
inline void print(){}
template<typename T, typename ...TAIL>
inline void print(const T &t, TAIL... tail) {cout << t; print(tail...);}
inline void input() {return;}
template<typename T, typename ...TAIL>
inline void input(T &t, TAIL&... tail) {cin >> t; input(tail...);}

const int N = 2 * 1e5 + 1;
const int inf = 1e18 + 7;
const double PI = 3.14159265359;


int cost[N];
int best[N];

signed main () {
    ios_base::sync_with_stdio(NULL);  cin.tie(0); cout.tie(0);
    int n, x;
    cin >> n >> x;
    vi v;
    int res = 0;
    for (int i = 0; i < n; i++) {
        v.push_back(ni());
        res += v[i];
        cost[i] = v[i];
    }
    for (int j = 0; j < n; j++) {
        for (int i = 0; i < n; i++) {
            if (cost[i] > v[(i - j + n) % n]) {
                cost[i] = v[(i - j + n) % n];
            }
        }
        int ans = 0;
        for (int i = 0; i < n; i++) {
            ans += cost[i];
        }
        ans += j * x;
        res = min(res, ans);
    }
    cout << res << '\n';
    return 0;
}


















Measured memory_bytes: 3556
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
 
    long long ans = 0;
    int MaxNum = 0;
    for (int i = 0; i < N; i++)
    {
        //MaxNumを使い回すことで計算を抑える
        MaxNum = max(MaxNum, A[i]);
        int Bi = MaxNum;
        ans += Bi - A[i];
    }
 
    cout << ans << endl;
}


Measured memory_bytes: 3956
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
long long int powint(long long int a, long long int b) {
	assert(b >= 0);
	if (b == 0)return 1;
	if (b == 1)return a;
	long long int ans = 1;
	long long int aa = powint(a, b / 2);
	ans *= aa*aa;
	if (b % 2)ans *= a;
	return ans;
}
long long int getkai(long long int a) {
	if (a < 0)a = -a;
	if (!a)return powint(2, 60);
	long long int kai = 1;
	while (!(a % 2)) {
		kai *= 2;
		a /= 2;
	}
	return kai;
}

long long int getans(const long long int s, const long long int d) {
	long long int kai(getkai(s));
	while (1) {
		if (s + kai == d)return 1;
		else if (s + kai < d) {
			return 1+getans(s + kai, d);
		}
		else {
			kai /= 2;
		}
	}
	
}

int main() {
	int N; cin >> N;
	while (N--) {
		long long int S, D; cin >> S >> D;
		long long int ans = getans(S, D);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3064