akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include<queue>
#include<algorithm>
#include <functional>
#include<vector>
using namespace std;

string S;
int N;
char C[9];

int main() {
	cin >> S;
	N = S.length();
		for (int bit = 0; bit < (1 << (N - 1)); bit++) {
			long long sum = S[0]-'0';
			for (int i = 0; i < N - 1; i++) {
				if (bit&(1 << i)) {
					sum += S[i + 1]-'0';
					C[i] = '+';
				}
				else {
					sum -= S[i + 1]-'0';
					C[i] = '-';
				}
			}
			if (sum == 7) break;
		}
		cout<<S[0]<<C[0]<<S[1]<<C[1]<<S[2]<<C[2]<<S[3]<<"=7"<< endl;
}

Measured memory_bytes: 256
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let n: i64 = s.next().unwrap().parse().unwrap();
	let s: i64 = s.next().unwrap().parse().unwrap();

	let ans = calc(n, s);
	println!("{}", ans);
}

fn calc(n: i64, s: i64) -> i64 {
	if n > s {
		for d in divisors(n - s) {
			let b = d + 1;
			if f(b, n) == s {
				return b;
			}
		}
	}
	if n == s {
		return n + 1;
	}

	-1
}

fn f(b: i64, mut n: i64) -> i64 {
	let mut r = 0;
	while n > 0 {
		r += n % b;
		n /= b;
	}
	r
}

pub fn divisors<T>(n: T) -> Vec<T>
where
	T: num::PrimInt,
{
	let n = if n < T::zero() { T::zero() - n } else { n };
	let mut d = T::one();
	let mut divs = vec![];
	while d * d < n {
		if n % d == T::zero() {
			divs.push(n / d);
			divs.push(d);
		}
		d = d + T::one();
	}
	if d * d == n {
		divs.push(d);
	}
	divs.sort();
	divs
}


Measured memory_bytes: 2160
#include <bits/stdc++.h>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define ff first
#define setp setprecision(12)<<fixed
#define ss second
#define fori(v) for(ll i=0; i<v; i++)
#define forj(v) for(ll j=0; j<v; j++)
#define fork(v) for(ll k=0; k<v; k++)
#define forl(v) for(ll l=0; l<v; l++)
#define fort(v) for(ll t=0; t<v; t++)
#define forz(v) for(ll z=0; z<v; z++)
#define forx(v) for(ll x=0; x<v; x++)
#define ll long long
#define double long double
#define MAX (int)(5*pow(10,3) + 10)
#define pb(a) push_back(a)
// #define cout out
// #define cin in
ll inf = pow(10,18);
ll INF = inf;
ll modulo = pow(10,9) + 7;
double eps = 1e-10;
ifstream in;
ofstream out;


void deal(){
	ll k,x;
	cin>>k>>x;
	for(ll i = x-k+1; i<=x+k-1; ++i)
		cout<<i<<' ';
	
}
 
int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	deal();
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;
 
typedef long long ll;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()

int main(void)
{
  ll N;
  string ans;

  cin >> N;
  
  vector<ll> p(N);
  rep(i,N) cin >> p[i];
  
  vector<ll> org = p;
  sort(p.begin(),p.end());
  
  ll cnt = 0;
  rep(i,N){
    if(org[i]!=p[i]) cnt++;
  }
  
  if(cnt==0||cnt==2) ans = "YES";
  else ans = "NO";

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


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<P, int> PP;
typedef pair<int, PP> PPP;
struct edge { int to; int to2; int cost; };

vector<int>G[105];

signed main() {
	int n; cin >> n;
	if (n & 1) {
		for (int i = 1; i < n; i++)G[i].push_back(n);
		for (int i = 1; i < n; i++) {
			for (int j = 1; j < n; j++) {
				if (!(j == i || j == n - i))G[i].push_back(j);
			}
		}
		int cnt = 0;
		for (int i = 1; i <= n; i++) {
			rep(j, G[i].size()) {
				if (i < G[i][j])cnt++;
			}
		}
		cout << cnt << endl;
		for (int i = 1; i <= n; i++) {
			rep(j, G[i].size()) {
				if (i < G[i][j])cout << i << ' ' << G[i][j] << endl;
			}
		}
	}
	else {
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				if (!(i == j || i == n - j + 1))G[i].push_back(j);
			}
		}
		int cnt = 0;
		for (int i = 1; i <= n; i++) {
			rep(j, G[i].size()) {
				if (i < G[i][j])cnt++;
			}
		}
		cout << cnt << endl;
		for (int i = 1; i <= n; i++) {
			rep(j, G[i].size()) {
				if (i < G[i][j])cout << i << ' ' << G[i][j] << endl;
			}
		}
	}
}

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

using namespace std;

int maximaize(char table[8][8], int turn)
{
  char cookie[2] = {'o', 'x'};

  int dx[] = {0, 1, 0, -1, -1, 1, -1, 1};
  int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
  
  int maxget = 0;
  int maxgetx = -1, maxgety = -1;
  vector<int> maxgetdir;
  for(int i = 0; i < 8; i++){
    for(int j = 0; j < 8; j++){
      if(table[i][j] == '.'){
	int get = 0;
	vector<int> dir;
	for(int k = 0; k < 8; k++){
	  int nx = j + dx[k], ny = i + dy[k];
	  int cnt = 0;
	  while(1){
	    if(nx < 0 || 8 <= nx ||
	       ny < 0 || 8 <= ny ||
	       table[ny][nx] == '.'){
	      cnt = 0;
	      break;
	    } else if(table[ny][nx] == cookie[turn]){
	      dir.push_back(k);
	      get += cnt;
	      break;
	    } else if(table[ny][nx] == cookie[(turn+1)%2]){
	      cnt++;
	      nx += dx[k], ny += dy[k];
	    }
	  }
	}
	if(get > maxget && get > 0){
	  maxget = get, maxgetdir = dir;
	  maxgety = i, maxgetx = j;
	} else if(get == maxget && get > 0){
	  if(turn == 0){
	    if(maxgetx == -1 || i < maxgety || i == maxgety && j <= maxgetx) maxgety = i, maxgetx = j, maxgetdir = dir;
	  } else if(turn == 1){
	    if(maxgetx == -1 || maxgety < i || maxgety == i && maxgetx <= j) maxgety = i, maxgetx = j, maxgetdir = dir;
	  }
	}
      }
    }
  }
  if(maxget > 0){
    table[maxgety][maxgetx] = cookie[turn];
    for(int i = 0; i < maxgetdir.size(); i++){
      int nx = maxgetx + dx[maxgetdir[i]], ny = maxgety + dy[maxgetdir[i]];
      while(table[ny][nx] != cookie[turn]){
	table[ny][nx] = cookie[turn];
	nx += dx[maxgetdir[i]], ny += dy[maxgetdir[i]];
      }
    }
  }/*
  for(int i = 0; i < 8; i++){
    for(int j = 0; j < 8; j++) cout << table[i][j];
    cout << endl;
  }
  cout << endl;*/
  return maxget;
}

bool mami(char table[8][8])
{
  return maximaize(table, 0) > 0;
}

bool majo(char table[8][8])
{
  return maximaize(table, 1) > 0;
}

void game(char table[8][8])
{
  int flag = false;
  flag |= mami(table);
  flag |= majo(table);
  if(flag) game(table);
}

int main()
{
  char table[8][8];
  for(int i = 0; i < 8; i++){
    for(int j = 0; j < 8; j++) cin >> table[i][j];
  }
  game(table);
  for(int i = 0; i < 8; i++){
    for(int j = 0; j < 8; j++) cout << table[i][j];
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1192
#include <iostream>

using namespace std;

typedef long long ll;

int main()
{


    int n;
    ll sum = 0;
    cin >> n;

    for (int i=1; i<=n; i++) {
        if (i%3!=0 && i%5!=0) {
            sum += i;
        }
    }

    cout << sum;

    return 0;
}


Measured memory_bytes: 3620
#include<iomanip>
#include<cmath>
#include<cstdlib>
#include<string>
#include<sstream>
#include<vector>
#include<iostream>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<algorithm>
using namespace std;

int main(){
    long long n, m, d, nd;
    cin >> n >> m >> d;
    if(d == 0) nd = n;
    else nd = (n - d) * 2;

    cout << fixed << setprecision(10) << (double)(m - 1) * nd / n / n << endl;
}


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

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

    ll ans=1;
    for(ll i=1;i<=n;i++){
        ans*=i;
        if(ans>=1000000007) ans%=1000000007;
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
 
using namespace std;
 
#define prev(x) ((x - 1 + (M+1)) % (M+1))
#define next(x) ((x + 1) % (M+1))
 
int main(){
    int N,M,p;
    cin >> N >> M >> p;
    vector<int> d(M+1);
    for(int i = 0 ; i < M ; i++){
        cin >> d[i];
    }
    d[M] = p;
    for(int i = 0 ; i <= M ; i++){
        d[i] -= p;
        if(d[i] < 0) d[i] += N;
    }
    sort(d.begin(),d.end());
    int res = min(d[prev(0)],N-d[next(0)]);
    for(int i = 1 ; i <= M ; i++){
        int pr = d[prev(i)],ne = d[next(i)];
        int pc = (N-d[i])*2 + pr,nc = d[i]*2+(N-ne);
        res = min(res,pc);
        res = min(res,nc);
    }
    cout << res*100 << endl;
    return 0;
}

Measured memory_bytes: 3168
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String word = sc.next();
        char[] wordStr = word.toCharArray();
            if(wordStr[2] != wordStr[3]){
                System.out.println("No");
                return;
            }
            if (wordStr[4] != wordStr[5]){
                System.out.println("No");
                return;
            }
            System.out.println("Yes");
    }
}


Measured memory_bytes: 23764
#include <vector>
#include <iostream>
#include <cmath>
using namespace std;
const int MAX_RN = sqrt(1000000000)+1;

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

	vector<int> prime(MAX_RN+1,1);
	int def_n = n;
	int ct = 0;
	long long ans = def_n;
	for(int i=2;i*i<=def_n;i++){
		bool is_div = false;
		while(n%i == 0){
			n /= i;
			is_div = true;
			}
		if(is_div){
			ans *= (i-1);
			ans /= i;
			}
		}
	if(n>1){ans *= n-1;ans /= n;}
	cout << ans << endl;
	return 0;
}

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

const string YES = "Yes";
const string NO = "No";

void solve(long long H, long long W, std::vector<std::string> s){
    for(int j=0; j<H; j++){
        for(int i=0; i<W-1; i++){
            auto c1=s[j][i], c2=s[j][i+1];
            if((c1=='#' || c1=='^')&&(c2=='#' || c2=='^')){
                s[j][i]='^';
                s[j][i+1]='^';
            }
        }
    }

    for(int i=0; i<W; i++){
        for(int j=0; j<H-1; j++){
            auto c1=s[j][i], c2=s[j+1][i];
            if((c1=='#' || c1=='^')&&(c2=='#' || c2=='^')){
                s[j][i]='^';
                s[j+1][i]='^';
            }
        }
    }

    for(int j=0; j<H; j++) {
        for (int i = 0; i < W; i++) {
            if (s[j][i] == '#') {
                cout << NO << endl;
                return;
            }
        }
    }
    cout << YES << endl;
}



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


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
#define fo(i,n) for(int i=0;i<n;++i)
#define Fo(i,k,n) for(int i=k;i<n;++i)
typedef long long int lli;
int main(){
    FIO
    int n; cin>>n;
    string s; cin>>s;
    int c=0;
    fo(i,n){
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') c++;
    }
    cout<<c<<endl;
}



Measured memory_bytes: 3652
#include <bits/stdc++.h>
 
#define forn(i, n) for (llong i = 0ll; i < (llong) n; ++i)
#define fornn(i, l, r) for (llong i = (llong) l; i < (llong) r; ++i)
#define size(x) ((int) (x.size()))
 
using namespace std;
 
typedef long long llong;
const llong inf = (llong) 1e+9 + 7ll;
const llong linf = (llong) 1e+18 + 7ll;
const long double eps = (long double) 1e-9;
const long double pi = acosl((long double) -1.0);
const int alph = 26;

mt19937 mrand(random_device{} ()); 

template<typename T, typename U> inline llong umin(const T& a, const U& b) { return a < b ? a : b; }
template<typename T, typename U> inline llong umax(const T& a, const U& b) { return a > b ? a : b; }
 
static char buff[(int) 2e6 + 17]; // reads std::string
const int maxn = (int) 3e2 + 17;

struct query
{
	int l, r, x;
	query() { }
	query(int l, int r, int x) : l(l), r(r), x(x) { }
};

struct triple
{
	int r, g, b;
	triple() { }
	triple(int a, int b, int c) : r(a), g(b), b(c) { }
};

int n, q;
vector<query> Q[maxn];
int dp[maxn][maxn][maxn];
bool used[maxn][maxn][maxn];

bool read()
{
	if (scanf("%d %d", &n, &q) != 2)
		return false;

	forn (i, q)
	{
		int l, r, x;
		scanf("%d %d %d", &l, &r, &x);
		Q[r].push_back(query(l, r, x));
	}

	return true;
}

void solve()
{
	queue<triple> qq;
	qq.push(triple(0, 0, 0));
	used[0][0][0] = true;
	dp[0][0][0] = 1;
	int ans = 0;

	for (; !qq.empty(); )
	{
		auto cur = qq.front();
		qq.pop();
		int r = cur.r;
		int g = cur.g;
		int b = cur.b;
		int k = max({r, g, b});

		for (auto p : Q[k])
		{
			int cnt = 0;
			cnt += p.l <= r;
			cnt += p.l <= g;
			cnt += p.l <= b;

			if (cnt != p.x)
				dp[r][g][b] = 0;
		}

		if (k == n)
		{
			ans += dp[r][g][b];
			if (ans >= inf) ans -= inf;
			continue;
		}

		if (!used[k + 1][g][b])
		{
			qq.push(triple(k + 1, g, b));
			used[k + 1][g][b] = true;
		}

		if (!used[r][k + 1][b])
		{
			qq.push(triple(r, k + 1, b));
			used[r][k + 1][b] = true;
		}

		if (!used[r][g][k + 1])
		{
			qq.push(triple(r, g, k + 1));
			used[r][g][k + 1] = true;
		}

		dp[k + 1][g][b] += dp[r][g][b];
		if (dp[k + 1][g][b] >= inf) dp[k + 1][g][b] -= inf;
		dp[r][k + 1][b] += dp[r][g][b];
		if (dp[r][k + 1][b] >= inf) dp[r][k + 1][b] -= inf;
		dp[r][g][k + 1] += dp[r][g][b];
		if (dp[r][g][k + 1] >= inf) dp[r][g][k + 1] -= inf;
	}

	printf("%d\n", ans);
}

int main()
{
#if SEREZHKA
	freopen("file.in", "r", stdin);
#endif

	while (read())
		solve();

	return 0;
}


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

int main()
{
	int N;
	string S, T;

	cin >> N;
	cin >> S >> T;

	string ans = "";

	for(int i=0; i<N; i++){
		ans = ans + S[i] + T[i];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ll mod = 998244353;
  ll N, S;
  cin >> N >> S;
  vector<ll> A(N);
  for (ll i = 0; i < N; ++i) {
    cin >> A.at(i);
  }
  vector<ll> dp(S + 1, 0);
  dp.at(0) = 1;
  for (ll i = 0; i < N; ++i) {
    vector<ll> temp = dp;
    ll a = A.at(i);
    for (ll j = 0; j <= S; ++j) {
      temp.at(j) += dp.at(j);
      temp.at(j) %= mod;
      if (j + a <= S) {
        temp.at(j + a) += dp.at(j);
        temp.at(j + a) %= mod;
      }
    }
    dp = temp;
  }
  // for (ll i = 0; i <= S; ++i) {
  //   cout << dp.at(i) << "\n";
  // }
  cout << dp.at(S) << "\n";
}


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

int main() {
  int n,m,k;cin >> n >> m >> k;
  if(k%n==0 || k%m==0){
    cout << "Yes" << endl;
    return 0;
  }
  for(int i=0;i<=n;++i){
    for(int j=0;j<=m;++j){
      int cnt = i*m + j*n - 2*i*j;
      if(cnt == k){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<algorithm>

using namespace std;

#define LL long long

int N, M, l=1, r=0;


int main() {
	cin >> N >> M;
	r = N;
	for (int i = 0; i < M; i++) {
		int L, R;
		cin >> L >> R;
		l = max(l, L);
		r = min(r, R);
	}
	cout << max(r - l + 1, 0) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int h, n, max, min, s = 0;
  cin >> n;
  cin >> h;
  min = 0;
  max = h;
  for (int i = 1; i < n; i++) {
    cin >> h;
    if (h >= max) {
      max = h;
    } else {
      s += max - min;
      max = h;
      min = h;
    }
  }
  if (min != max) {
    s += max - min;
  }
  cout << s;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(auto i = (N) - 1; i >= 0; i -= 1)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it!= v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define rand mtrand
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cout << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,...) do { cout << #v << " = "; array_out(v , ##__VA_ARGS__);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
#endif
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = 0x1FFFFFFFFFFFFFFFLL;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >> (istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}

random_device seed_gen; mt19937_64 mtrand(seed_gen());
#define MOD 1000000007

int main(){
  ini(N);
  int a = 0;
  rep(i,4){
    a += (N % 10 == 2 ? 1 : 0);
    N /= 10;
  }
  out(a);
}

Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();
        for (int i = 0; i < s.Length; i++)
        {
            if(i % 2 == 0)
            {
                if(s[i] != 'R' && s[i] != 'U' && s[i] != 'D')
                {
                    Console.WriteLine("No");
                    return;

                }
            }
            else
            {
                if (s[i] != 'L' && s[i] != 'U' && s[i] != 'D')
                {
                    Console.WriteLine("No");
                    return;

                }
            }
        }

        Console.WriteLine("Yes");
    }
}

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

int main()
{
	int x, a, b, c;
	cin >> x;
	for (int i=1; i<=x; i++)
	{
		cin >> a >> b >> c;
		if (pow(a, 2) + pow(b, 2) == pow(c, 2))
			cout << "YES" << endl;
		else if (pow(c, 2) + pow(a, 2) == pow(b, 2))
			cout << "YES" << endl;
		else if (pow(c, 2) + pow(b, 2) == pow(a, 2))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

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

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cctype>
int main() {
    std::string s;
    std::getline(std::cin, s);
    std::transform(s.begin(), s.end(), s.begin(), [](char c) {
            return std::isupper(c) ? std::tolower(c) : std::toupper(c);
    });
    std::cout << s << std::endl;
}



Measured memory_bytes: 3224
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

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

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

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

int main(){
	string p;
	char c ='9';
	char cost[6][6];
	rep(i, 6)rep(j, 6)cost[i][j]=c;

	cost[0][1]='0';
	cost[0][2]='1';
	cost[1][3]='1';
	cost[2][1]='0';
	cost[3][5]='1';
	cost[3][4]='0';
	cost[4][2]='1';
	cost[4][5]='0';
	cost[5][1]='1';
	cost[5][2]='0';
	while(cin>>p){
		if(p[0]=='#')return 0;
		bool ok =true;
		int pos = 0;
		for(int i =0;i <p.length();i++){
			//cout <<"pos = "<<pos<<endl;
			bool flag =false;
			//cout <<"p = "<<p[i]<<endl;
			for(int j =0;j <6;j++){
				//cout<<pos<<" "<<j<<endl;
				//cout <<cost[pos][j]<<" "<<p[i]<<endl;
				if((cost[pos][j]=='0'&&p[i]=='0')||(cost[pos][j]=='1'&&p[i]=='1')){
					pos = j;
					//cout <<"iei";
					flag =true;
					break;
				}
				//cout <<"pos = "<<pos<<endl;
				//if(flag)break;
			}
			if(!flag){
				cout <<"No"<<endl;
				ok =false;
				break;
			}
		}
		if(!ok)continue;
		if(ok&&pos==5){
			cout <<"Yes"<<endl;
		}else{
			cout <<"No"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1180
#include<stdio.h>
#include<math.h>
int isprime(int x){
	int i;
	if(x == 2){
 		return 1;
	}
  	if(x<2||x%2==0){
		return 0;
	}
	i = 3;
	while( i <= sqrt(x) ){
		if(x%i==0){
			return 0;
		}
		i = i + 2;
	}
	return 1;
}
int main(){
	int n,r=0;
	int l;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&l);
		if(isprime(l)){
			r++;
		}
	}
	printf("%d\n",r);
	return 0;
}

Measured memory_bytes: 2664
#include <iostream>
#include <math.h>
#include <climits>
#include <string>
#include <utility>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

const int INF = 1000000;

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

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

const int N = 10;

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

int dx8[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int dy8[] = { -1, 0, 1, -1, 1, -1, 0, 1 };

int main()
{
	int n;
	while (true) {
		cin >> n;
		if (!n) break;
		int dp[N][N];
		REP(i,N){
			REP(j, N) {
				dp[i][j] = INF;
			}
		}
		int a, b, c;
		while (n--) {
			cin >> a >> b >> c;
			dp[a][b] = c;
			dp[b][a] = c;
		}
		REP(k, N) {
			REP(i, N) {
				REP(j, N) {
					if (dp[i][j] > dp[i][k] + dp[k][j])
						dp[i][j] = dp[i][k] + dp[k][j];
				}
			}
		}
		int time[N];
		REP(i, N) {
			time[i] = 0;
			REP(j, N) {
				if (i != j && dp[i][j] != INF) {
					time[i] += dp[i][j];
				}
			}
		}
		int mini = 0;
		REP(i, N) {
			if (time[i] < time[mini] && time[i] != 0)
				mini = i;
		}
		cout << mini << " " << time[mini] << endl;
	}
	

    return 0;
}

Measured memory_bytes: 1156
n=gets.to_i
t=[0]
(n-1).times{
  c,s,f=gets.split.map(&:to_i)
  t.map!{|tt|
    tt= s>=tt ? s : s+((tt-s+f-1)/f)*f
    tt+=c
    tt
  }
  t << 0
}

puts t

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

#define ll long long
#define ull unsigned long long
#define mii make_pair<int, int>
#define mll make_pair<ll, ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define all(v) (v).begin(), (v).end()

ofstream out("debug.txt");

const int MxN = 1e5, md = 1e9 + 7;

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

    string s, t;
    cin >> s >> t;
    int m = t.size();
    for (int i = 0; i <= s.size() - t.size(); ++i)
    {
        int temp = 0;
        for (int j = 0; j < t.size(); ++j)
            if (s[i + j] != t[j])
                temp++;
        m = min(temp, m);
    }
    cout << m << '\n';
}

Measured memory_bytes: 3648
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
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; }
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
ll n;
vector<ll> a;
vector<ll> two;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    ll temp=1;
    while(true){
        two.push_back(temp);
        if(temp>10000000000)break;
        temp*=2;
    }
    map<ll,ll> m;
    ll ans=0;
    for (int i = 0; i < n; i++)
    {
        ll temp;
        cin >> temp;
        a.push_back(temp);
        m[temp]++;
    }
    sort(ALL(a),greater<ll>());
    for(int i=0;i<n;i++){
        ll tar;
        if(!m[a[i]])continue;
        for(int j=0;j<two.size();j++){
            if(a[i]<two[j]){
                tar=two[j]-a[i];
                break;
            }
        }
        if(m[tar]>0&&tar!=a[i]){
            ans++;
            m[tar]--;
        }
        if(tar==a[i]&&m[tar]>1){
            ans++;
            m[tar]--;
        }
        m[a[i]]--;
    }
    cout << ans << "\n";
}



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


using namespace std;


// Powered by caide (code generator, tester, and library code inliner)


class Solution {
public:
  void solve(std::istream& in, std::ostream& out)
  {
    long long n, a, b;
    in >> n >> a >> b;
    vector<int> x(n);
    for(auto&& i : x) {
      in >> i;
    }
    long long ans = 0;
    for (int i = 1; i < n; i++) {
      ans += min(b, a * (x[i] - x[i - 1]));
    }
    out << ans << "\n";
  }
};

void solve(std::istream& in, std::ostream& out)
{
  out << std::setprecision(12);
  Solution solution;
  solution.solve(in, out);
}


#include <fstream>
#include <iostream>


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


  istream& in = cin;


  ostream& out = cout;

  solve(in, out);
  return 0;
}




Measured memory_bytes: 640
N = int(input())
W = list(map(int,input().split()))
a = 0
b = sum(W)
min = b
for i in range(N):
    a += W[i]
    b -= W[i]
    c = a -b
    if c < 0:
        c = -c
    if min > c:
        min = c
print(min)


Measured memory_bytes: 3060
#include <iostream>
#include <math.h>
using namespace std;

int right_triangle(int a,int b,int c)
{
	if (   a == sqrt(pow(b,2)+pow(c,2)) 
	    || b == sqrt(pow(c,2)+pow(a,2))
	    || c == sqrt(pow(a,2)+pow(b,2)))
	    return 1;
	else
		return 0;
}

int main()
{
	int a[3],n;
	cin >> n;
	for(int j=0;j<=n-1;j++){
		for(int i=0;i<=2;i++)
			cin >> a[i];
		switch (right_triangle(a[0],a[1],a[2]))
		{
		case 0:
			cout << "NO" << endl;
			break;
		case 1:
			cout << "YES" << endl;
			break;
		default:
			cout << "error" << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define all(v) v.begin(),v.end()
#define sz size()
#define mp make_pair
#define pb push_back
#define rep(p,a,b) for(ll p=a ; p<b ; p++)
#define rap(p,a,b) for(ll p=a ; p<=b ; p++)
#define per(p,a,b) for(ll p=a ; p>=b ; p--)
#define F first
#define S second
using namespace std;

typedef vector <ll> vll;
typedef vector <ld> vld;
typedef pair< ll ,ll > pll;


int main()
{
    ll t,i,j,k,ans,n;

    //cin>>t;
    t=1;
    while(t--)
    {
        cin>>n>>k;
        cout<<(n+k-1)/k;
    }
    
    return 0;
}

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

int DP[101][2<<15];
int W[2<<15];

int main(){
    int N,M;
    while(cin>>N>>M,N){
        vector<int> S(N);
        vector<int> D(M);
        for(auto &s:S)cin>>s;
        for(auto &d:D)cin>>d;
        sort(S.begin(), S.end());
        sort(D.begin(), D.end());
        fill(DP[0],DP[M+1],200000000);
        fill(DP[0],DP[1],0);
        for(int b=0;b<(1<<N);b++){
            W[b]=0;
            for(int n=0;n<N;n++){
                if(b&(1<<n))W[b]+=S[n];
            }
        }
        for(int i=1;i<=M;i++){
            for(int b=0;b<(1<<N);b++){
                DP[i][b]=min(DP[i][b],abs(W[b]-D[i-1])+DP[i-1][b]);
                for(int n=0;n<N;n++){
                    if(b&(1<<n))
                        DP[i][b]=min(DP[i][b],DP[i][b^(1<<n)]);
                }
            }
        }
        int ans=200000000;
        for(int b=0;b<(1<<N);b++){
            ans = min(DP[M][b],ans);
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 29052
import * as fs from "fs";
const input = fs.readFileSync("/dev/stdin", "utf8");

const range = (n: number) => Array.from(Array(n), (_, i) => i);

const N = BigInt(input);

const getNo = (n: bigint): string => {
  const alphabets: string[] = Array.from(Array(26), (_, i) => String.fromCharCode("a".charCodeAt(0) + i));

  const getNo = (n: bigint, l: bigint): string => {
    const m = 26n ** l;
    if (n <= m) {
      return range(Number(l)).reduce(
        (acc, _) => {
          const { num, str } = acc;
          return {
            num: num / 26n,
            str: alphabets[Number(num % 26n)] + str,
          };
        },
        { num: n - 1n, str: "" }
      ).str;
    } else {
      return getNo(n - m, l + 1n);
    }
  };

  return getNo(n, 1n);
};

console.log(getNo(N));


Measured memory_bytes: 29612
a , b = map(int, input().split())
if b==1:
    print(0)
elif b <=a:
    print(1)
elif b > a and (b - 1)%(a - 1)== 0:
    print((b - 1)// (a - 1))
elif b > a and (b - 1)%(a - 1)!= 0:
    print((b - 1)//(a - 1)+ 1)

Measured memory_bytes: 9012
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
struct RangeAddQuery {
	int n;
	vector<int>d;
	RangeAddQuery(int m) {
		for (n = 1; n < m; n <<= 1);
		d.assign(2 * n, 0);
	}
	void add(int a, int b, int x = -1, int k = 1, int l = 0, int r = -1) {
		if (r == -1)r = n;

		if (r <= a || b <= l)return;
		if (a <= l&&r <= b) {
			if (x >= 0)d[k] += (r - l)*x;
			return;
		}
		else {
			if (d[k] != 0) {
				d[2 * k] += d[k] / 2;
				d[2 * k + 1] += d[k] / 2;
				d[k] = 0;
			}
			add(a, b, x, 2 * k, l, (l + r) / 2);
			add(a, b, x, 2 * k + 1, (l + r) / 2, r);
		}
	}
	int get(int i) {
		add(i, i + 1);
		return d[n + i];
	}
};
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, q; cin >> n >> q;
	RangeAddQuery raq(n);
	rep(z, 0, q) {
		int com; cin >> com;
		if (com) {
			int i; cin >> i;
			cout << raq.get(i-1) << endl;
		}
		else {
			int s, t, x; cin >> s >> t >> x;
			raq.add(s - 1, t, x);
		}
	}
	return 0;
}

Measured memory_bytes: 4876
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;
const long long ll_max = 9223372036854775807;
const long long ll_min = -9223372036854775807;
const int int_max = 2147483647;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

// 繰り返し二乗法
ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}


#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	ll X;
	cin >> X;
	ll sum = 0;
	ll t = 0;
	while (sum < X) {
		t++;
		sum += t;
	}
	
	cout << t << endl;
	return 0;

}


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

int main(void){

  int N,A;
  cin >> N;
  map<int,int> mp{};
  
  for(int i=0;i<N;i++){
      cin >> A;
      mp[A] = i+1;
  }
  
  for(int i=0;i<N;i++){
      if(i != N-1) cout << mp[i+1] << " ";
      else cout << mp[i+1] << endl;
  }
}

Measured memory_bytes: 8232
N, M = input().split(" ")
N, M = int(N), int(M)

result_AC = [False]*N # 正答したかどうかを保存する
correct_num = 0
penalty_num = 0
penalty_list = [0]*N

for _ in range(0, M):
  p, S = input().split(" ")
  p = int(p) - 1
  # pをみて，もしresult_ACがtrueならばnext
  if(result_AC[p]):
    continue
  # そうでない場合，
  else:
    ## ACならば，result_ACをtrueにして，correct_num += 1
    if S == 'AC':
      result_AC[p] = True
      correct_num += 1
      penalty_num += penalty_list[p]
    ## WAならば，penalty_num += 1
    else:
      penalty_list[p] += 1

print(correct_num, penalty_num)


Measured memory_bytes: 4596
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
static long long INF = (1LL<<62);

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	LL N;
	LL min = INF;

	cin >> N;
	LL ans = 0;
	for(int i=0; i<N; i++){
		LL a, b;
		cin >> a >> b;
		if(b < min){
			min = b;
			ans = a;
		}
	}
	ans += min;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3748
#include <stdio.h>

int i,j,n,e,M[100][100];

int dijkstra(int n){
  int u,mincost,d[100],color[100];
 
  for(i=0;i<n;i++){
    d[i]=(1<<21);
    color[i]=0;
  }
  
  d[0]=0;
  while(1){
    mincost=(1<<21);
    u=-1;
    for(i=0;i<n;i++){
      if(mincost>d[i]&&color[i]!=2){
        u=i;
        mincost=d[i];
      }
    }
    if(u==-1){
      break;
    }
    color[u]=2;
    for(j=0;j<n;j++){
      if(color[j]!=2&&M[u][j]!=(1<<21)){
        if(d[j]>d[u]+M[u][j]){
          d[j]=d[u]+M[u][j];
          color[j]=1;
        }
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d",i);
    printf(" ");
    printf("%d\n",(d[i]==(1<<21)?-1:d[i]));
  }
}

int main(void)
{
  int k,c,u,v;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=(1<<21);
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d %d",&v,&c);
      M[u][v]=c;
    }
  }
  dijkstra(n);

  return 0;
}

Measured memory_bytes: 1832
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		long[]A = new long[N];
		long[]S = new long[N+1];
      	long[]S0 = new long[N+1];
      	long mod = 1000000007;
		string[]str = Console.ReadLine().Split();
		for(var i=0;i<N;i++){
			A[i] = long.Parse(str[i]);
		}
		for(var i=0;i<N;i++){
			long c = 1;
			for(var j=0;j<22;j++){
				if(A[i]/c%2 + S[i]/c%2==1){
					S[i+1] += c;
                }
                S0[i+1] = S0[i];
                if(S[i+1] == 0){
                	S0[i+1]++;
                }
				c *= 2;
			}
		}
		long ans = 0;
		if(S[N]==0){
			long[]D0 = new long[4000000];
			long[]DX = new long[4000000];
			long[]DL = new long[4000000];
          	for(var i=0;i<4000000;i++){
              D0[i] = 1;
            }
			for(var i=1;i<N;i++){
				if(S[i]>0){
					D0[S[i]] = (D0[S[i]] + DX[S[i]] * (S0[i] - DL[S[i]])) % mod;
                    DX[S[i]] = (DX[S[i]] + D0[S[i]]) % mod;
					DL[S[i]] = S0[i];
				} else {
					D0[0] = D0[0] * 2 % mod;
				}
			}
			for(var i=1;i<4000000;i++){
              	D0[i] = DX[i];
            }
			for(var i=0;i<4000000;i++){
				ans = (ans + D0[i]) % mod;
			}
		} else {
			long D0 = 1;
			long DX = 0;
			for(var i=1;i<N;i++){
				if(S[i]==S[N]){
					DX = (D0+DX) % mod;
				} else if(S[i]==0){
					D0 = (D0+DX) % mod;
				}
			}
			ans = D0;
		}
      	Console.WriteLine(ans);
    }
}

Measured memory_bytes: 105888
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  input!{
    n: usize,
    aa: [i64; n]
  }
  let mut aa = aa;
  aa.sort();
  let x = aa[n-1];
  let mut y = 0;
  for a in aa {
    if cmp::min(a, x - a) > cmp::min(y, x - y) {
      y = a;
    }
  }
  println!("{} {}", x, y);
}


Measured memory_bytes: 6396
n, m = map(int, input().split())
dp = [float('inf')] * 2**n
dp[0] = 0
for _ in range(m):
    a, _ = map(int, input().split())
    c = sum([2**(int(i)-1) for i in input().split()])
    # print(c)
    for s in range(2**n):
            t = s|c
            if dp[t] > dp[s] + a:
                dp[t] = dp[s] + a
ans = dp[-1]
if ans == float('inf'):
    ans = -1
print(ans)


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

n = N % 10

if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
  print('hon')
elif n == 0 or n == 1 or n == 6 or n == 8:
  print('pon')
else:
  print('bon')


Measured memory_bytes: 61776
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
#define  endl 			"\n"
#define  FOR(i, a, n)   for (ll i = a; i < n; i++)
#define  ROF(i, a, n)   for (ll i = a; i >= n; i--)
#define  all(x)         (x).begin(), (x).end()
#define  dline          cout<<"///REACHED///\n";

typedef long long ll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  4e+5+7;


void solve() {
    string a, b;
    cin >> a >> b;
    if (b == a+b[b.length()-1]) cout << "Yes";
    else cout << "No";
    cout << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
        solve();	
	return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<vector>

using namespace std;

int main(){

    int N,count2=0,count4=0;

    cin>>N;

    vector<int> s (N);
    vector<int>ans(N);

    for(int i=0;i<N;i++){

        cin>>s[i];

        if(s[i]%4==0)

            count4++;

        else if(s[i]%2==0)

            count2++;

}

if(count4>=N/2)

    cout<<"Yes"<<endl;

else if(count2==N)

    cout<<"Yes"<<endl;

else if(count2>=N-count4*2)

    cout<<"Yes"<<endl;

else{

    cout<<"No"<<endl;

}

}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b; cin>>a>>b;
  if(a==b) cout<<"Draw"<<endl;
  
  else{
  
    if(a==1) cout<<"Alice"<<endl;
   else if(b==1) cout<<"Bob"<<endl;
   else{
      if(a>b)  cout<<"Alice"<<endl;
      else cout<<"Bob"<<endl;
     
   
   
   
   
   
   
   
   
   
   
   
   }
  
  
  
  
  
  
  
  
  }
  
  
  
}


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


int main(){


    int n, i, j;

    string t;

    map<string, long long> m;

    long long k = 0;

    long long c;


    cin >> n;


    for( i = 0 ; i < n ; i = i + 1 ){

         cin >> t;

         sort( t.begin(), t.end() );

         m[t] += 1;

         }


    for( auto itr = m.begin() ; itr != m.end() ; ++itr ){

         c = itr->second;

         if( c > 1 ) k += c * ( c - 1 ) / 2;

         }


    cout << k << endl;

    
    return 0;


    }

Measured memory_bytes: 11136
# AtCoder Beginner Contest 168:C - : (Colon)

a,b,h,m = map(int,input().split())

import math
th = (60*h + m)/720*360
tm = (m/60)*360

xa,ya = a*math.cos(math.radians(th)),a*math.sin(math.radians(th))

xb,yb = b*math.cos(math.radians(tm)),b*math.sin(math.radians(tm))

dx,dy = xa-xb,ya-yb
c = math.sqrt(dx**2+dy**2)
print(c)

Measured memory_bytes: 9512
L=input()
INF=10**9+7
N=len(L)
dp1=[0]*(N+1)
dp2=[1]*(N+1)
for i in range(N):
    if L[i]=="1":
        dp1[i+1]=(3*dp1[i]+dp2[i])%INF
        dp2[i+1]=(2*dp2[i])%INF
    else:
        dp1[i+1]=(3*dp1[i])%INF
        dp2[i+1]=dp2[i]

print((dp1[N]+dp2[N])%INF)


Measured memory_bytes: 41328
#include<bits/stdc++.h>
#define int long long int
#define ld long double
#define getFaster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define rev(i,n,init) for(int i=n;i>=init;i--)
#define MAXN 200005
#define MOD2 998244353
#define MOD1 1e9+7
#define f first
#define s second
#define endl '\n'
#define pii pair<int,int>
#define piii pair<pii,int>
#define precise(i) cout<<fixed<<setprecision(i)
#define codejam cout<<"Case #"<<ii+1<<": ";
using namespace std;
const long double PI = atan(1.0)*4;
const int64_t INF=INT64_MAX;
const int32_t LOG=21;
const int MOD=MOD2;

int32_t main()
{ 
      getFaster;
      int tests=1;
      //cin>>tests;
      rep(ii,0,tests)
      {

          int r;
          cin>>r;
          ld ans=2*PI*r;
          precise(20)<<ans<<endl;
      }


      return 0;                         
}

/*
 TIPS(FOR ME):
 1.) Check for corner cases (like 0 is exception case)
 2.) Check for global memory sizes,memory refreshments and its complexity 
 3.) Check for sorting criteria (if used 1-based indexing)
 4.) Check for numbers overflow (while multiplying and doing MOD)
 5.) Check for typecasting issues like int to float( while dividing numbers)
*/

Measured memory_bytes: 3780
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		char[][] c = new char[H][W];
		for (int i = 0; i < H; i++) {
			c[i] = sc.next().toCharArray();
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < c.length; i++) {
			for (int j = 0; j < c[i].length; j++) {
				if (c[i][j] == '#') {
					sb.append('#');
					continue;
				}
				int count = 0;
				if (i + 1 < c.length && c[i + 1][j] == '#') {
					count++;
				}
				if (i - 1 >= 0 && c[i - 1][j] == '#') {
					count++;
				}
				if (j + 1 < c[i].length && c[i][j + 1] == '#') {
					count++;
				}
				if (j - 1 >= 0 && c[i][j - 1] == '#') {
					count++;
				}
				if (i + 1 < c.length && j + 1 < c[i].length && c[i + 1][j + 1] == '#') {
					count++;
				}
				if (i - 1 >= 0 && j - 1 >= 0 && c[i - 1][j - 1] == '#') {
					count++;
				}
				if (i + 1 < c.length && j - 1 >= 0 && c[i + 1][j - 1] == '#') {
					count++;
				}
				if (i - 1 >= 0 && j + 1 < c[i].length && c[i - 1][j + 1] == '#') {
					count++;
				}
				sb.append(count);
			}
			sb.append("\n");
		}
		System.out.println(sb.toString());
		sc.close();
	}
}

Measured memory_bytes: 23764
import collections
S = input()
x,y = list(map(int, input().split()))
f_nums = collections.defaultdict(int)
f_count=0

for i in range(len(S)):
    if S[i] == 'F':
        f_nums[f_count] += 1
    else:
        f_count+=1

x_f = [0 for i in range(f_count+1)]
y_f = [0 for i in range(f_count+1)]
x_count=0
y_count=0
temp_sumx=0
temp_sumy=0
temp_sumx += f_nums[0]

for i in range(f_count+1):
    if i==0:
        continue
    
    if i%2 == 0:
        x_f[i//2] = f_nums[i]
        x_count+=1
    else:
        y_f[(i-1)//2] = f_nums[i]
        y_count+=1

x_f.sort(reverse=True)
y_f.sort(reverse=True)


for i in range(x_count):
    if abs(temp_sumx-x+x_f[i]) <= abs(temp_sumx-x-x_f[i]):
        temp_sumx += x_f[i]
    else:
        temp_sumx -= x_f[i]

for i in range(y_count):
    if abs(temp_sumy-y+y_f[i]) <= abs(temp_sumy-y-y_f[i]):
        temp_sumy += y_f[i]
    else:
        temp_sumy -= y_f[i]

if x == temp_sumx and y == temp_sumy:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 4280