akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

ll mpow(ll a, ll x, ll mod){
  ll res = 1;
  while(x > 0){
    if(x & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    x >>= 1;
  }
  return res;
}

int main(){

  int N; cin >> N;
  string S; cin >> S;
  int pcnt = 0;
  rep(i,N) if(S[i]=='1') pcnt++;

  vector<int> f(N+10,-1);
  f[0]=0; f[1]=1;
  for(int i=2;i<=N;i++){
    int now = i;
    int cnt = 0;
    rep(j,20){
      if(now&1) cnt++;
      now >>= 1;
    }
    if(f[i]==-1) f[i] = f[i%cnt]+1;
  }
  int mop=0;
  int mom=0;
  rep(i,N){
    if(S[i]=='1'){
      mop++; mom++;
    }
    if(i+1!=N){
      mop<<=1; mom<<=1;
    }
    mop %= (pcnt+1);
    if(pcnt-1) mom %= (pcnt-1);
  }
  for(int i=0;i<N;i++){
    int mo, now;
    if(S[i]=='1') {
      mo = pcnt-1;
      if(mo==0){
        cout << 0 << '\n';
        continue;
      }
      now = mom;
      now += (mo-mpow(2,N-1-i,mo));
      now %= mo;
    }
    else {
      mo = pcnt+1;
      now = mop;
      now += mpow(2,N-1-i,mo);
      now%=mo;
    }
    //cout << now << endl;

    cout << f[now]+1 << '\n';
  }
  return 0;
}


Measured memory_bytes: 4448
n = int(input())
w = [input() for i in range(n)]

def has_duplicates(seq):
    return len(seq) != len(set(seq))

for i in range(n-1):
    temp = w[i]
    temp2 = w[i+1]
    if temp[-1] != temp2[0] or has_duplicates(w) == True :
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 3060
import java.util.Scanner

fun main(args: Array<String>) {
  val cin = Scanner(System.`in`)
  val x = cin.nextInt()
  val y = cin.nextInt()


  var f = false
  for (i in 0..x) {
    if ((i * 2) + ((x - i) * 4) == y) {
      println("Yes")
      f = true
    }
  }

  if (!f) {
    println("No")
  }

  cin.close()
}

Measured memory_bytes: 36424
import sys
input=sys.stdin.readline

def main():
    N = int(input())
    A = list(map(int, input().split()))
    X = []
    for i,a in enumerate(A):
        X.append((i+1,a))
    X.sort(key=lambda x: x[1])
    for i,a in X:
        print(i, end=" ")

if __name__ == '__main__':
    main()


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

int main(){
  char alpha1, alpha2, komma;
  char current='A';

  while(cin>>alpha1>>komma>>alpha2){
    if(alpha1!=current && alpha2!=current) continue;
    if(alpha1==current) current=alpha2;
    else current=alpha1;
  }
  cout<<current<<endl;

  return 0;
}

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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector< ii >
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }

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

int32_t main(){
  DESYNC;
  int n;
  cin >> n;
  int b[n];
  int a[n];
  for(int i=0; i<n-1;  i++) cin >> b[i];
  /*
  a[n-1] = b[n-2];
  a[n-2] = b[n-2];
  for(int i=n-3; i>=0; i--){
    if(b[i] > a[i+1]) a[i] = b[i];
    else {
      //propagate
      a[i+1] = b[i];
      for(int j = i+1; j<n-1; j++){
        if(
  */
  a[0] = b[0];
  a[1] = b[0];
  for(int i=1; i<n-1; i++){
    if(b[i] < a[i]) a[i] = b[i];
    a[i+1] = b[i];
  }
  int sum =0;
  for(int i=0; i<n; i++) sum += a[i];
  cout << sum << endl;
}



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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	string s; cin>>s;
	deque<char> dq;
	for(auto ch : s){
		if(dq.empty() || dq.back() == ch)dq.push_back(ch);
		else dq.pop_back();
	}
	cout<<s.size() - dq.size()<<endl;

	return 0;
}

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

using namespace std;

#define MAX_H 110
#define MAX_W 110
typedef long long ll;

ll H,W,L;
char field[MAX_H][MAX_W];
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};

char getDir(int x){
  if(x == 0){ return 'W'; }
  if(x == 1){ return 'N'; }
  if(x == 2){ return 'E'; }
  if(x == 3){ return 'S'; }
}

int getDir(char ch){
  if(ch == 'W'){ return 0; }
  if(ch == 'N'){ return 1; }
  if(ch == 'E'){ return 2; }
  if(ch == 'S'){ return 3; }
}

bool inField(int x,int y){
  return (0 <= x && x < W && 0 <= y && y < H);
}

void solve(int x,int y,int dir){
  int d[MAX_H][MAX_W][4];
  memset(d,-1,sizeof(d));
  d[y][x][dir] = 0;

  while(L > 0){
    int nx = x + dx[dir],ny = y + dy[dir];
    if(!inField(nx,ny) || field[ny][nx] == '#'){
      int ndir = (dir+1) % 4;
      if(d[y][x][ndir] == -1){
        d[y][x][ndir] = d[y][x][dir];
      }else{
        int diff = d[y][x][dir]-d[y][x][ndir];
        if(diff > 0 && L >= diff){
          L %= diff;
        }
      }
      if(L != 0){
        dir = ndir;
      }
    }else{
      if(d[ny][nx][dir] == -1){
        d[ny][nx][dir] = d[y][x][dir]+1;
        L--;
      }else{
        L--;
        int diff = d[y][x][dir]+1-d[ny][nx][dir];
        if(diff > 0 && L >= diff){
          L %= diff;
        }
      }
      x = nx; y = ny;
    }
  }
  cout << y+1 << " " << x+1 << " " << getDir(dir) << endl;
}

bool check(char ch){
  if(ch == '.' || ch == '#'){
    return false;
  }
  return true;
}

int main(){
  int sx,sy,dir;
  while(true){
    cin >> H >> W >> L;
    if(H == 0 && W == 0 && L == 0){
      break;
    }
    for(int i = 0 ; i < H ; i++){
      for(int j = 0 ; j < W ; j++){
        cin >> field[i][j];
        if(check(field[i][j])){
          sx = j; sy = i;
          dir = getDir(field[i][j]);
          field[i][j] = '.';
        }
      }
    }
    solve(sx,sy,dir);
  }
  return 0;
}

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

int main() {
  long int a,b,c,d,x,y,ans;
  cin>>a>>b>>c>>x>>y;
  if(x>=y)d=a;
  else d=b;
  
  if((a+b)/2<c)ans=a*x+b*y;
  else if(d/2<c) ans=2*c*min(x,y)+d*abs(x-y);
  else ans=2*c*max(x,y);
  
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 1000000000000000005
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
int main(){
	int x;
	while(~getI(x)){
		if(x==1){
			puts("1");
			continue;
		}
		int ans=nINF;
		for(int i=2;i*i<=x;i++) for(int j=2;pow(i,j)<=x;j++) if(pow(i,j)>ans) ans=pow(i,j);
		printf("%d\n",ans);
	}
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long, long long> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<pair<ll,ll> > vii;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<pair<long long,long long> > vpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;

#define PI 3.141592653589793
#define mod 1000000007
#define N 100005
# define M 1005
//int N;
//# define N 2003
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }
# define INF (ll)1e17
# define A 1000000

int main()
{
  IOS;
  int n;
  cin >> n;
  vii v;
  ll a;
  ll ans[n];
  for(int i=0;i<n;i++)
  {
    cin >> a;
    v.pb(mp(a,i));
  }
  sort(v.begin(),v.end());
  //for(int i=0;i<n;i++)
    //trace2(v[i].ff,v[i].ss);
  for(int i=0;i<(v.size()/2);i++)
  {
    //trace1(v[v.size()/2].ff);
     ans[v[i].ss]=(v[v.size()/2].ff);
  }
   for(int i=v.size()/2;i<(v.size());i++)
  {
    //trace1(v[(v.size()/2)-1].ff);
     ans[v[i].ss]=(v[(v.size()/2)-1].ff);
  }
  for(int i=0;i<n;i++)
    cout << ans[i]<<"\n";

}

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


int main()
{
    string s, p;
    int ans = 0;
    cin >> s >> p;
    for (int i = 0; i < s.size(); i++)
      if (s[i] != p[i]) ans++;
    cout << ans;
}


Measured memory_bytes: 3800
n = int(input()); arr = [list(map(int,input().split())) for _ in range(n-1)]
graph = [[] for _ in range(n)]
for a,b in arr:
    graph[a-1].append(b-1); graph[b-1].append(a-1)


mod = 10**9+7
fac = [1]*(n+1)
inv = [1]*(n+1)
ifac = [1]*(n+1)
for i in range(2,n+1):
    fac[i] = fac[i-1] * i % mod
    inv[i] = (- (mod//i)*inv[(mod%i)]) % mod
    ifac[i] = ifac[i-1] * inv[i] % mod

parents = [-1]*n
children = [[] for _ in range(n)]
orders = []
stack = [0]
flags = [True] * n; flags[0] = False
while stack:
    tmp = stack.pop()
    orders.append(tmp)
    for node in graph[tmp]:
        if flags[node]:
            flags[node] = False
            children[tmp].append(node)
            stack.append(node)
            parents[node] = tmp

size = [1] * (n+1)
dp = [1] * (n+1)    
for child in orders[::-1]:
    parent = parents[child]
    size[parent] += size[child]
    dp[child] = dp[child] * fac[size[child]-1] % mod
    dp[parent] = dp[parent] * dp[child] * ifac[size[child]] % mod
_ = size.pop();_ = dp.pop()

size2 = [n-i+1 for i in size]
dp2 = [1] * n; dp2[0] = dp[0]
for parent in orders[1:]:
    child = parents[parent]
    dp2[parent] = dp2[parent] * size[parent] * dp2[child] * inv[size2[parent]-1] % mod
    
for i in range(n):
    print(dp2[i])

Measured memory_bytes: 151980
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long A,B,C,H,M,N,W;
  cin >> N;
  if (N%3==0) {cout << N*N*N/27 << ".000000000" << endl;}
  if (N%3==1) {
    A=N/3;
    cout <<A*A*A+A*A+A/3 << ".";
    B=(A*1000000000/3+37037037)%1000000000;
    if (B<100000000) {cout <<0;}
    if (B<10000000) {cout <<0;}
    if (B<1000000) {cout <<0;}
    if (B<100000) {cout <<0;}
    if (B<10000) {cout <<0;}
    if (B<1000) {cout <<0;}
    if (B<100) {cout <<0;}
    if (B<10) {cout <<0;}
    cout << B << endl;
  } 
  if (N%3==2) {
    A=N/3;
    cout <<A*A*A+A*A*2+A*4/3 << ".";
    B=(A*4000000000/3+296296296)%1000000000;
    if (B<100000000) {cout <<0;}
    if (B<10000000) {cout <<0;}
    if (B<1000000) {cout <<0;}
    if (B<100000) {cout <<0;}
    if (B<10000) {cout <<0;}
    if (B<1000) {cout <<0;}
    if (B<100) {cout <<0;}
    if (B<10) {cout <<0;}
    cout << B << endl;
  }  
}

Measured memory_bytes: 384
#define _CRT_SECURE_NO_DEPRECATE
#define rep(i, b, e) for (auto i = b; i < e; ++i)
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#ifndef __GNUC__
#include <intrin.h>
#endif // !__GNUC__
#include <vector>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstring>
#include <complex>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <functional>

int bsf(int x) {
#ifdef __GNUC__
    return __builtin_ctz(x);
#else
    unsigned long i;
    _BitScanForward(&i, x);
    return i;
#endif
}
int bsr(int x) {
#ifdef __GNUC__
    return 31 - __builtin_clz(x);
#else
    unsigned long i;
    _BitScanReverse(&i, x);
    return i;
#endif
}

using namespace std;
typedef long long int64;
const double pi = 3.14159265358979323846;
const int inf = (int)2e+9 + 2;
const int mod = (int)1e+9;
const double eps = 1e-8;
const int N = 1 << 20;

int n, m, k;
int c[4];

void solve()
{
    rep(i, 0, 4)
        cin >> c[i];
    cin >> n;
    int best1 = c[2], best2 = c[3];
    best1 = min(best1, c[0] * 4);
    best1 = min(best1, c[1] * 2);
    best2 = min(best2, best1 * 2);
    if (n & 1)
        cout << (int64)(n / 2) * best2 + best1;
    else
        cout << (int64)(n / 2) * best2;
}

int main()
{
#ifndef ONLINE_JUDGE
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
#endif // !ONLINE_JUDGE
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int test = 1;
    //cin >> test;
    for (; test; --test)
        solve();
    return 0;
}

Measured memory_bytes: 256
//
// Created by kuroneko on 2019-09-15.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>

using namespace std;

typedef long long ll;

#define INF 1000000000000009LL
#define MOD 1000000007LL

typedef int Weight;
struct Edge {
    int src, dst;
    Weight weight;
    Edge(int src, int dst, Weight weight):src(src), dst(dst), weight(weight) {}
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

int main() {
    string s; cin >> s;
    for (int i = 0; i < int(s.size()); i++) {
        if (i % 2 == 0) {
            if (!(s[i] == 'R' || s[i] == 'U' || s[i] == 'D')) {
                cout << "No" << endl;
                return 0;
            }
        } else {
            if (!(s[i] == 'L' || s[i] == 'U' || s[i] == 'D')) {
                cout << "No" << endl;
                return 0;
            }

        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

const int MAXN=100000+10;
int h[MAXN],dp[MAXN];

int main(){
	memset(dp,0,sizeof(dp));
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;++i)
		cin>>h[i];
	dp[1]=abs(h[1]-h[0]);
	for(int i=2;i<n;++i){
		if(i>k){
			dp[i]=dp[i-k]+abs(h[i]-h[i-k]);
			for(int j=i-1;j>i-k;--j)
				dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
		}
		else{
			dp[i]=abs(h[i]-h[0]);
			for(int j=i-1;j>0;--j)
				dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
		}
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt();

		int ans = 0;
		for (int i = 1; i <= n; i++) {
			int sum = 0, tmp = i;
			while (tmp > 0) {
				sum += tmp % 10;
				tmp /= 10;
			}
			if (a <= sum && sum <= b) {
				ans += i;
			}
		}
		System.out.println(ans);
		sc.close();
	}

}


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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int H, W; cin >> H >> W;
    string S[H];
    int grid[H+2][W+2]; //#が1
    rep(i, H+2) rep(j, W+2) grid[i][j] = 1;
    rep(i, H){
        cin >> S[i];
        rep(j, W){
            if(S[i][j] == '.') grid[i+1][j+1] = 0;
            else grid[i+1][j+1] = 1;
        }
    }
    bool ok = true;
    for(int i = 1; i <= H; i++){
        for(int j = 1; j <= W; j++){
            if(grid[i][j]){
                if(grid[i-1][j] == 0 && grid[i+1][j] == 0 && grid[i][j-1] == 0 && grid[i][j+1] == 0) ok = false; 
            }
        }
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
program ABC109B
    implicit none
    integer(8)::N,i,j
    integer(8)::flg=0
    character(10),allocatable,dimension(:)::W

    read(5,*)N
    allocate(W(N))

    do i=1,N
        read(5,*)W(i)
        if(i>1 .and. flg==0)then
            if(W(i-1)(len_trim(W(i-1)):len_trim(W(i-1)))/=W(i)(1:1))then
                flg=1
            else
                do j=1,i-1
                    if(W(i)==W(j))then
                        flg=1
                        exit
                    end if
                end do
            end if
        end if
    end do

    if(flg==0)then
        print'(A)',"Yes"
    else
        print'(A)',"No"
    end if
end program ABC109B

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define reg register
#define MaxN 100003

int N;
int fa[MaxN];
long long ans, cnty[MaxN], cntx[MaxN];
map<int, bool> bk[MaxN];
struct Nd {
	int x, y;
}a[MaxN];

inline int Rd() {
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') { if(ch == '-') f = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	return x * f;
}
inline int Find(int d) {
	if(fa[d] == d) return d;
	else return fa[d] = Find(fa[d]);
} 
inline bool cmp(Nd aa, Nd bb) {
	return aa.x < bb.x;
}

int main() {
	N = Rd();
	for(reg int i = 1; i <= 100000; ++i)
		fa[i] = i;
	for(reg int i = 1; i <= N; ++i)
		a[i].x = Rd(), a[i].y = Rd();
	sort(a + 1, a + 1 + N, cmp);
	for(reg int i = 1; i < N; ++i)
		if(a[i].x == a[i + 1].x)
			fa[Find(a[i].y)] = Find(a[i + 1].y);
	for(reg int i = 1; i <= 100000; ++i)
		++cnty[Find(i)];
	for(reg int i = 1; i <= N; ++i)
		if(!bk[Find(a[i].y)][a[i].x]) {
			++cntx[Find(a[i].y)];
			bk[Find(a[i].y)][a[i].x] = true;
		}
	for(reg int i = 1; i <= 100000; ++i)
		ans += cnty[i] * cntx[i];
	cout << ans - N << endl;
	return 0;
}

Measured memory_bytes: 9856
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << " : " << x << " " << endl
#define mem(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define int long long
#define gcd __gcd
const int inf = 0x3f3f3f3f;
const int maxn = 201110;
const int M = 1e9+7;
int n,m,k,q,ok;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int w,h,n,x,y,a;
    cin>>w>>h;
    std::vector<vector<int>> vec(h,vector<int>(w,0));
    cin>>n;
    for (int i=0;i<n;i++) {
        cin>>x>>y>>a;
        if (a==1) {
            for (int j=0;j<h;j++) {
                for (int k=0;k<x;k++) {
                    vec.at(j).at(k)=1;
                }
            }
        } else if (a==2) {
            for (int l=0;l<h;l++) {
                for (int m=x;m<w;m++) {
                    vec.at(l).at(m)=1;
                }
            }
        } else if (a==3) {
            for (int o=h-y;o<h;o++) {
                for (int p=0;p<w;p++) {
                    vec.at(o).at(p)=1;
                }
            }
        } else if (a==4) {
            for (int q=0;q<h-y;q++) {
                for (int r=0;r<w;r++) {
                    vec.at(q).at(r)=1;
                }
            }
        }
    }
    int count=0;
    for (int hoge=0;hoge<h;hoge++) {
        for (int piyo=0;piyo<w;piyo++) {
            //cout<<vec.at(hoge).at(piyo);
            if (vec.at(hoge).at(piyo)==0) {
                count++;
            }
        }
        //cout<<endl;
    }
    cout<<count<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#define inf 0x3f3f3f3f3f3f3f3f
#define inf 0x3f3f3f3f
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define inv(x) Power(x, mod - 2)
#define fi first
#define se second
#define MP make_pair
#define PB push_back

using namespace std;
typedef pair<int,int> Pair;
typedef long double ld;
typedef long long ll;

const int mod = 998244353, MAX = 1e5, N = 50005;
//template{{{
const long double Pi = 3.14159265358979323846l;
inline int add(int x, int y) { x += y; return x >= mod ? x - mod : x; };
inline void inc(int &x, int y) { x += y; x -= (x >= mod ? mod : 0); }
inline int mul(int x, int y) { return 1ll * x * y % mod; }
inline int Power(int x, int y) {
	int ans = 1;
	while (y) {
		if (y & 1) ans = mul(ans, x);
		x = mul(x, x), y >>= 1;
	} return ans;
}

/*char buf[1<<23],obuf[1<<23],*p1=buf,*p2=buf, *O = obuf;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
void print(int x) {
    if(x > 9) print(x / 10);
    *O++=x%10+'0';
} */

template <class T> inline T	input() {
	T x; char ch; bool flag = false;
	while (!isdigit(ch = getchar())) flag |= ch == '-';
	for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
	return flag ? -x : x;
}

template <class T> inline bool chkmin(T &x, T y) { x = x < y ? x : y; return x == y; }
template <class T> inline bool chkmax(T &x, T y) { x = x > y ? x : y; return x == y; }
template <class T> inline T gcd(T x, T y) { return !y ? x : gcd(y, x % y); }
template <class T> inline T sqrm(T x) { return (ll) x * x % mod; }
template <class T> inline T sqr(T x) { return x * x; }

struct {
	inline operator int () { return input<int>(); }
	inline operator long long () { return input<long long>(); }
	template <class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read; //}}}

int n;

int main() {
#ifdef local
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
	freopen("log", "w", stderr);
#endif

	cin >> n;
	puts(n % 10 == 7 || n / 10 % 10 == 7 || n / 100 == 7 ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 3624
var
  n,d,sln:int64;
  i:longint;
  j:char;
  s:ansistring;
BEGIN

  readln(n);
  read(s);

  sln:=low(int64);
  for i:=1 to n do
    begin
      d:=0;
      for j:='a' to 'z' do
        if (pos(j,copy(s,1,i))>0) and (pos(j,copy(s,i+1,n-i))>0) then
          d:=d+1;
      if sln<d then sln:=d;
    end;

  write(sln);

END.

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

int main() {
  vector<string> vec(100);
  int h,w;

  cin >> h >> w;

  for (int i=0; i<h; i++){
    cin >> vec.at(i);
  }

  for (int i=0; i<w+2; i++) {
    cout << '#';
  }
  cout << endl;
  for (int i =0; i < h; i++) {
    cout << '#';
    cout << vec.at(i);
    cout << '#' << endl;
  }
  for (int i=0; i<w+2; i++) {
    cout << '#';
  }
  cout << endl;
}

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// a^b mod M
long myPow(long a,long b,int M) {
    long ret = 1;
    long tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
int nCk(int n,int k,int M) {
    long ret = 1;
    int mi = min(k, n-k);
    for(int i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(int i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (int)ret;
};

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}



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

    if(A%2==1 || B%2==1 || C%2==1){
        pl(0)
        return 0;
    }

    if(A==B && B==C) {
        pl(-1)
        return 0;
    }

    ll ans = 1;
    while(1){
        ll t_A = (B+C)/2;
        ll t_B = (C+A)/2;
        ll t_C = (A+B)/2;
        A = t_A;
        B = t_B;
        C = t_C;

        if(A%2==1 || B%2==1 || C%2==1) break;
        else ans++;
    }

    pl(ans)

    return 0;
}


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

#define __STDC_FORMAT_MACROS
#define p64 PRId64

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)    FOR (i,0,n)
#define ALL(f,x,...) ([&](decltype((x)) ALL) {                          \
            return (f)(begin(ALL), end(ALL), ## __VA_ARGS__); })(x)

using namespace std;
using ll = int64_t;

// 素数判定
bool isPrime(int n)
{
    if (n < 2) return false;
    for (int i = 2; i * i <= n; i++)
    {
        if (n % i == 0) return false;
    }
    return true;
}

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

    int num = 11;
    int cnt = 1;
    while(true)
    {
        if(num % 5 == 1 && isPrime(num))
        {
            cout << num << (cnt == N ? '\n' : ' ');
            if (cnt == N) break;
            cnt++;
        }
        num++;
    }

    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    if op == '?':
        break
    elif op == '+':
        print(a + b)
    elif op == '-':
        print(a - b)
    elif op == '*':
        print(a * b)
    else:
        print(a // b)

Measured memory_bytes: 7632
#include<bits/stdc++.h>
using namespace std;
#define intt long long int
#define intu unsigned long long int
#define vi vector<int>
#define ii pair<int,int>
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define fast_io ios::sync_with_stdio(0);cin.tie(NULL);std::cout.tie(NULL);
# define PI           3.14159265358979323846 
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
int mod = 1000000007;
intt gcd(intt a, intt b) {return b ? gcd(b, a % b) : a;}
intt lcm(intt a, intt b) {return a * b / gcd(a, b); }
intt bpow(intt a,intt b) 
{
  intt res = 1;
  while (b > 0) {
    if (b & 1)res = ((res%mod) * (a%mod))%mod;
      a = ((a%mod) * (a%mod))%mod;
      b >>= 1;
  }
  return res;
}
intt fact(intt n) { 
   if ((n==0)||(n==1))
      return 1; 
   else
      return n*fact(n-1);
}
void go()
{
#ifndef ONLINE_JUDGE
  freopen("inn.txt","r",stdin);
  freopen("o.txt","w",stdout);
  #endif
}
///////////U L R D
int dx[4]={0,-1,1,0};
int dy[4]={1,0,0,-1};

template <typename T1, typename T2>
struct less_second {
    typedef pair<T1, T2> type;
    bool operator ()(type const& a, type const& b) const {
        return a.second > b.second;
    }
};

int main() 
{ 
    fast_io
    go();
    intt n,k;cin>>n>>k;
    vector<intt> arr;
    vi v(n);
    for0(i,n)
    {
      cin>>v[i];
    }
    intt sum=0,i;
    for(i=0;i<k;i++)
    {
      sum+=v[i];
    }
    intt pos=i;
    arr.pb(sum);
    for(;i<n;i++)
    {
      sum-=(v[i-k]);
      sum+=v[i];
      arr.pb(sum);
    }
    for(intt j=1;j<arr.size();j++)
    {
        if(arr[j]>arr[j-1])
          cout << "Yes" <<"\n";
        else
          cout <<"No" <<"\n";
      
    }

} 











Measured memory_bytes: 6036
#include<iostream>
#include<cstdio>
using namespace std;
int main() {
	int a, b, c, d;
	scanf("%d%d%d%d", &a, &b, &c, &d);
	//死去的回合
	int f = a / d;
	int g = c / b;
	if (a % d)f++;
	if (c % b)g++;
	if (f < g)printf("No");
	else printf("Yes");
}

Measured memory_bytes: 3724
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner kb = new Scanner(System.in);
		int n = kb.nextInt();
		
		int[]numA = new int[n];
		
		boolean exist_odd = false;
		
		for(int i=0; i< n; i++) {
			numA[i] = kb.nextInt();
			if(numA[i]%2 == 1)
				exist_odd = true;
		}
		if(exist_odd == true) 
			System.out.println(0);
		else {
			int min = Integer.MAX_VALUE;
			for(int i=0; i< n; i++) {
				int ans = 0;
				while(numA[i] %2 == 0) { 
					numA[i] /= 2;
					ans++;
				}
				min = Math.min(min, ans);
			}
			System.out.println(min);
		}
		kb.close();
	}
}

Measured memory_bytes: 22484
/*input
8 5 22
100 3 7 5 3 1
164 4 5 2 7 8
334 7 2 7 2 9
234 4 7 2 8 2
541 5 4 3 3 6
235 4 8 6 9 7
394 3 6 1 6 2
872 8 4 3 7 2
*/

//sometimes it's the people who no one imagines anything of 
//who do the things that no one can imagine.

//code author: iamxlr8

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

#define ll long long
#define endl "\n"
#define pb push_back
#define all(c) c.begin(),c.end()
#define inf 100000000000001
#define F first
#define S second
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll n,m,x;
ll cost[15],mat[15][15];

vector<ll> hell(vector<ll>v,ll pos)
{
	vector<ll>s;
	for(ll j=0;j<m;j++)
		s.pb(v[j]+mat[pos][j]);
	return s;
}

ll fun(ll pos,vector<ll>v)
{
	if(pos==n)
	{
		for(ll j=0;j<m;j++)
		{
			if(v[j]<x)
				return inf;
		}
		return 0;
	}

	return min(fun(pos+1,v),fun(pos+1,hell(v,pos))+cost[pos]);
}

void solve()
{
	cin>>n>>m>>x;
	for(ll i=0;i<n;i++)
	{
		cin>>cost[i];
		for(ll j=0;j<m;j++)
			cin>>mat[i][j];
	}
	vector<ll>v(15);
	ll ans=fun(0,v);
	if(ans==inf)
		ans=-1;
	cout<<ans;
}

int main() 
{
    off;
    ll tests=1;
    // cin>>tests;
    while(tests--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3648
S = input()
K = int(input())
N = len(S)
A = [0]*N

ans = ""
for i in range(N):
  A[i] = (ord("z") - ord(S[i]) + 1) % 26
  if i != N-1:
    if K >= A[i]:
      K -= A[i]
      ans += "a"
    else:
      ans += S[i]
  else:
    K = K % 26
    s = ord(S[i]) + K
    if s > ord("z"):
      s -= 26
    ans += chr(s)
    
print(ans)

Measured memory_bytes: 4340
#include <iostream>

using namespace std;

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

  if (K == 1) {
    cout << 0 << endl;
  } else {
    N %= K;
    long long last1 = -1;
    long long last2 = -1;
    long long last3 = -1;
    long long min = -1;
    while (true) {
      N -= K;
      if (N < 0) N = -N;
      if (min < 0 or min > N) min = N;
      if (last3 >= 0 and last2 >= 0 and last1 >= 0) {
        if (last3 == last1 and last2 == N) {
          cout << min << endl;
          break;
        }
      }
      last3 = last2;
      last2 = last1;
      last1 = N;
    }
  }
  return 0;
}


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

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

	string w;
	cin >> w;
	if (w.back() == 's') {
		cout << w+"es" << endl;
	} else {
		cout << w+"s" <<endl;
	}
}

Measured memory_bytes: 3656
#include<stdio.h>

int main(void){
    int N;
    int A, B;
    int a,sum = 0;
    int i;
    scanf("%d %d %d",&N,&A,&B);
    for (i = 1;i <= N;i++){
       a =  (i % 100000) / 10000 + (i % 10000) / 1000 + (i % 1000) / 100 + (i % 100) / 10 + (i % 10) / 1;
       if (a >= A && a <= B){
           sum += i;
       }
        /*printf("%d\n",a);*/
    }
printf("%d",sum);
}

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

#define ll long long
#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll k;
    for (int i = 1; i <= 5; i++) {
        cin >> k;
        if (k == 0) {
            cout << i << endl;
            break;
        }
    }
    return 0;
}


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

#define for0(i, n) for (int i = 0; i < (int)(n); ++i) 
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) 
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) 
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) 
#define forrc(i,l,r) for (int i= (int)(r); i>= (int)(l); --i)

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

#define all(x) (x).begin(), (x).end() 
#define rall(x) (x).rbegin, (x).rend() 


#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)


#define present(c,x) ((c).find(x) != (c).end())


#define cpresent(c,x) (find(all(c),x) != (c).end())

#define sz(a) int((a).size())

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

using namespace std;


typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;
typedef long long ll;
typedef unsigned long long int ull;

const int MOD=1000000007;

void add_self(int &a, int b){
  a+=b;
  if(a>=MOD){
    a-=MOD;
  }
}

void sub_self(int &a, int b){
  a-=b;
  if(a<0){
    a+=MOD;
  }
}

int main(){
  fastio; 
  
  int n,k;
  cin >> n >> k;
  int upto;
  vi dp(k+1);
  dp[0]=1;
  for0(i,n){
    cin >> upto;
    vector<int> fake(k+1);
    for(int j=k;j>=0;j--){
      int tmp=dp[j];
      int l=j+1;
      int r=j+min(upto,k-j);
      if(l<=r){
        add_self(fake[l],tmp);
        if(r+1<=k){
          sub_self(fake[r+1],tmp);
        }
      }
    }
    int prefix_sum=0;
    for0(j,k+1){
      add_self(prefix_sum,fake[j]);
      add_self(dp[j],prefix_sum);
    }
  }
  cout << dp[k];
}

Measured memory_bytes: 1024
import sys
import time
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = input()
    L = len(N)
    if L == 1:
        ans = int(N)
    elif set(N[1:]) == {'9'}:
        ans = int(N[0]) + 9*(L-1)
    else:
        ans = (int(N[0])-1) + 9*(L-1)
    print(ans)
if __name__ == '__main__':
    main()

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

struct UnionFind {
  vi parent, rank, count;
  UnionFind(const int nodeSize)
    : parent(nodeSize), rank(nodeSize, 1), count(nodeSize) {
    rep(i, nodeSize) parent[i] = i, count[i] = 1;
  }
  int find(int x) {
    if (parent[x] == x) return x;
    return parent[x] = find(parent[x]);
  }
  void unite(int x, int y) {
    int rx = find(x);
    int ry = find(y);
    if (rx == ry) return;
    if (rank[rx] < rank[ry]) swap(rx, ry);
    parent[ry] = rx;
    count[rx] += count[ry];
    if (rank[rx] == rank[ry]) ++rank[rx];
  }
  bool same(int x, int y) {
    return find(x) == find(y);
  }
  int num(int x) {
    return count[find(x)];
  }
};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n, m, k; std::cin >> n >> m >> k;
  UnionFind uf(n);
  vi friendCnt(n);
  vvi blocks(n);
  rep(i, m) {
    int a, b; std::cin >> a >> b;
    --a, --b;
    uf.unite(a, b);
    friendCnt[a]++, friendCnt[b]++;
  }
  rep(i, k) {
    int c, d; std::cin >> c >> d;
    --c, --d;
    blocks[c].pb(d), blocks[d].pb(c);
  }
  rep(i, n) {
    int cnt = uf.num(i) - 1 - friendCnt[i];
    for (auto v : blocks[i]) {
      cnt -= uf.same(i, v);
    }
    std::cout << cnt << (i+1 < n ? " " : "\n");
  }
}


Measured memory_bytes: 7552
def main():

    import os
    import sys
    from io import BytesIO, IOBase
    
    BUFSIZE = 8192
    
    
    class FastIO(IOBase):
        newlines = 0
    
        def __init__(self, file):
            self._fd = file.fileno()
            self.buffer = BytesIO()
            self.writable = "x" in file.mode or "r" not in file.mode
            self.write = self.buffer.write if self.writable else None
    
        def read(self):
            while True:
                b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
                if not b:
                    break
                ptr = self.buffer.tell()
                self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
            self.newlines = 0
            return self.buffer.read()
    
        def readline(self):
            while self.newlines == 0:
                b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
                self.newlines = b.count(b"\n") + (not b)
                ptr = self.buffer.tell()
                self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
            self.newlines -= 1
            return self.buffer.readline()
    
        def flush(self):
            if self.writable:
                os.write(self._fd, self.buffer.getvalue())
                self.buffer.truncate(0), self.buffer.seek(0)
    
    
    class IOWrapper(IOBase):
        def __init__(self, file):
            self.buffer = FastIO(file)
            self.flush = self.buffer.flush
            self.writable = self.buffer.writable
            self.write = lambda s: self.buffer.write(s.encode("ascii"))
            self.read = lambda: self.buffer.read().decode("ascii")
            self.readline = lambda: self.buffer.readline().decode("ascii")
    
    
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
    input = lambda: sys.stdin.readline().rstrip("\r\n")
    mod = 10**9 + 7

    import sys
    input = lambda: sys.stdin.readline().rstrip("\r\n")

    from math import gcd

    def prime_factorize(n):
        a = []
        while n % 2 == 0:
            a.append(2)
            n //= 2
        f = 3
        while f * f <= n:
            if n % f == 0:
                a.append(f)
                n //= f
            else:
                f += 2
        if n != 1:
            a.append(n)
        return a

    n = int(input())
    a = [int(x) for x in input().split()]

    primes = set()

    flag = 1

    for i in a:
        prime_factors = set(prime_factorize(i))
        for j in prime_factors:
            if j in primes:
                flag = 0
            else:
                primes.add(j)


    if flag:
        print('pairwise coprime')
        sys.exit()
                
    
    import math
    from functools import reduce
    
    def gcd(*numbers):
        return abs(reduce(math.gcd, numbers))
    
    if gcd(*a) == 1:
        print('setwise coprime')
    else:
        print('not coprime')

main()

Measured memory_bytes: 208224
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll 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(ll t) const {
    if(!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if(t & 1) a *= *this;
    return a;
  }
  // for prime mod
  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; }
mint fact(int n) {
  if(n == 1 || n == 0) return 1;
  mint res = n;
  return res * fact(n - 1);
}

struct combination {
  vector<mint> fact, ifact;
  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;
  }
  mint operator()(int n, int k) {
    if(k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

int main() {
  ll n, m, k;
  cin >> n >> m >> k;
  combination c(2e5 + 1);
  mint ans = 0;
  rep(i, n) rep(j, m) {
    mint now = i * (i + 1) / 2 * m + (n - i - 1) * (n - i) / 2 * m +
               j * (j + 1) / 2 * n + (m - j - 1) * (m - j) / 2 * n;
    now *= c(n * m - 2, k - 2);
    ans += now;
  }
  ans /= 2;
  cout << ans << endl;
}

Measured memory_bytes: 6348
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		System.out.println((br.readLine().equals("ABC"))? "ARC":"ABC");
	}
}

Measured memory_bytes: 32436
#define lp(i,n) for(int i=0;i<n;i++)
#define pau system("pause")
#include<bits/stdc++.h>

using namespace std;
int main(){
    int a;
    string s;
    cin>>a>>s;
    if(a>=3200)
        cout<<s<<endl;
    else
        cout<<"red"<<endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  char a;
  cin>>a;
  if(a<='Z')
    out("A");
  else
    out("a");
}


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


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string s,t;
    cin>>s>>t;
    cout<<t+s<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
// *st.find_by_order(index), 0-based
// order_of_key(e)

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N,X,T; cin>>N>>X>>T;
	cout<<(N+X-1)/X * T<<"\n";
	return 0;
}

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

int main()
{
long long H;scanf("%lld",&H);
long long times=0,ans=0,div=1;
while(H!=1)
{
  ans+=div;div*=2;
  H/=2;times++;
}
printf("%lld\n",ans+(long long)pow(2,times));
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using db = double;
#define pb push_back

const int mxn = 100006;

int n;
int a[mxn];

deque<pair<int,int>> q;

void shift() {
	++q.back().first;
	if (--q.front().first == 0)
		q.pop_front();
}

int main() {
	cin >> n;
	for (int i = 1; i <= n; ++i)
		scanf("%d", &a[i]);
	
	sort(a + 1, a + n + 1);
	for (int i = 1; i <= n; ++i) {
		if (i > 1)
			shift();
		if (a[i] != a[i - 1]) {
			int t = q.empty() ? 0 : (((a[i - 1] - 1) + (i - 1 - 1)) % 2) != q.back().second;
			if (t)
				if (--q.back().first == 0)
					q.pop_back();
			q.pb({a[i] - a[i - 1] + t, ((a[i] - 1) + (i - 1)) % 2});
		}
	}
	
	puts(q.front().second ^ ((n - 1 + 0) % 2) ? "First" : "Second");
	
	return 0;
}


Measured memory_bytes: 1024