akhauriyash/Code-Regression huggingface dataset:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

A,V = LI()
B,W = LI()
T = int(input())

if abs(A-B) <= (V-W) * T:
    print("YES")
else:
    print("NO")

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

using namespace std;

#define ll long long

ll numWays(vector<vector<char>>& grid) {
    vector<vector<ll>> dp(grid.size(), vector<ll>(grid[0].size(), 0));
    dp[0][0] = 1;

    for(int i = 0; i < grid.size(); i++)
    {
        for(int j = 0; j < grid[0].size(); j++)
        {
            if(grid[i][j] == '.')
            {
                ll n = ((i > 0 ? dp[i-1][j] : 0) % (ll)(1e9+7) + (j > 0 ? dp[i][j-1] : 0) % (ll)(1e9+7)) % (ll)(1e9+7);
                dp[i][j] = n;
                if(i == 0 && j == 0)
                    dp[0][0] = 1;
            }
        }
    }

    return dp[grid.size()-1][grid[0].size()-1];
}

int main()
{

    int H, W;
    cin >> H >> W;
    vector<vector<char>> grid(H, vector<char>(W));
    for(int i = 0; i < H; i++)
    {
        string s;
        cin >> s;
        for(int j = 0; j < W; j++)
        {
            grid[i][j] = s[j];
        }
    }

//    for(auto v: grid)
//    {
//        for(auto e: v)
//            cout << e << " ";
//        cout << endl;
//    }

    ll answer = numWays(grid);
    cout << answer << endl;

    return 0;
}



Measured memory_bytes: 9088
import sys
from bisect import *
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

n = int(input())
a = list(map(int,input().split()))
path = [[] for _ in range(n)]
for _ in range(n-1):
    u,v = map(int,input().split())
    path[u-1].append(v-1)
    path[v-1].append(u-1)

# parent = [-1]*n
ans = [0]*n
def dfs(now,parent,LIS):
    w = bisect(LIS,a[now])
    if w > 0 and LIS[w-1] == a[now]:
        flag = -2
    elif w == len(LIS):
        flag = -1
        LIS.append(a[now])
    else:
        flag = w
        record = LIS[w]
        LIS[w] = a[now]
    ans[now] = len(LIS)
    for nxt in path[now]:
        if nxt == parent:continue
        dfs(nxt,now,LIS)
    if flag == -2:
        return
    elif flag == -1:
        LIS.pop()
    else:
        LIS[w] = record
    return
# stack = [0]
# LIS = [[] for _ in range(n)]
# while stack:
#     p = stack.pop()
#     if p == 0:
#         LIS[p] = [a[p]]
#     else:
#         parray = LIS[parent[p]].copy()
#         nxt = bisect(parray,a[p])
#         if nxt == len(parray):
#             LIS[p] = parray + [a[p]]
#         else:
#             parray[nxt] = a[p]
#             LIS[p] = parray
#     for to in path[p]:
#         if to == parent[p]:continue
#         parent[to] = p
#         stack.append(to)
dfs(0,-1,[])
print('\n'.join(str(i) for i in ans))


Measured memory_bytes: 223300
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int n;
    string s;
    cin >> n >> s;
    for (int i = 0; i < (int)s.size(); i++) {
        if (s[i] + n <= 'Z') {
            s[i] += n;
        } else {
            s[i] = 'A' + n - ('Z' - s[i]) - 1;
        }
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>

int main()
{
	int W, H, x, y, r;

	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	if (r <= x && x<= W - r && r <= y && y<= H - r){
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}

	return 0;
}


Measured memory_bytes: 2680
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
  static void Main(){
    int n = int.Parse(Console.ReadLine());
    var dic = new Dictionary<string, long>(); 
    for(var i = 0;i<n;i++){
    	var aho = Console.ReadLine();
        var c = new char[10];
		for(var j = 0;j<10;j++){
        	c[j] = aho[j];
        }
     　 Array.Sort(c);
        string s = new String(c);
      
        if(dic.ContainsKey(s)){
          dic[s] += 1;
        }
      　else{
         dic.Add(s,1);    
       }
    }
    long kotae = 0;
    foreach(var va in dic.Values) {
      if(va <= 1){ continue;}
      else{
        kotae += va*(va-1)/2;
      }
    }   
    Console.WriteLine(kotae);
  }
}

Measured memory_bytes: 26584
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

h, n = na()
inf = 10**9+7
dp = [inf for i in range(h+1)]
dp[0] = 0
for i in range(n):
    a, b = na()
    for j in range(h):
        dp[min(j + a, h)] = min(dp[min(j + a, h)], dp[j] + b)
print(dp[h])


Measured memory_bytes: 42972
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;

int sqrtN = 512;
struct SqrtDecomposition{
    int N, K;
    vector <long long> data;
    vector <long long> bucketSum;

    SqrtDecomposition(int n){
        N = n;
        K = (N + sqrtN - 1) / sqrtN;
        data.assign(N, 0);
        bucketSum.assign(K, 0);
    }

    void add(int x, int y){
        data[x] += y;
        bucketSum[x / sqrtN] += y;
    }

    long long getSum(int x, int y){
        long long ans = 0;
        if(y - x < sqrtN){
            for(int i = x; i < y; i++){
                ans += data[i];
            }
            return ans;
        }
        for(int i = x / sqrtN + 1; i < y / sqrtN; i++){
            ans += bucketSum[i];
        }

        for(int i = x; i < (x / sqrtN + 1) * sqrtN; i++){
            ans += data[i];
        }
        for(int i = y / sqrtN * sqrtN; i < y; i++){
            ans += data[i];
        }
        return ans;
    }

};

long long a[200000];
pair <long long, int> sum_to_ind[200000];
int main(){
    int N;
    long long K;
    cin >> N >> K;
    for(int i = 0; i < N; i++){
      cin >> a[i];
    }

    sum_to_ind[0] = make_pair(a[0] - K, 0);
    for(int i = 1; i < N; i++){
      sum_to_ind[i] = make_pair(a[i] - K + sum_to_ind[i - 1].first, i);
    }

    sort(sum_to_ind, sum_to_ind + N);

    long long ans = 0;
    SqrtDecomposition sq(N);
    for(int i = N - 1; i >= 0; i--){
      int cur_ind = sum_to_ind[i].second;
      int bigger_inds = sq.getSum(0, cur_ind);
      if(sum_to_ind[i].first >= 0){
        ans += (cur_ind + 1 - bigger_inds);
      } else {
        ans += (cur_ind - bigger_inds);
      }
      sq.add(cur_ind, 1);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6528
using System;
namespace _0001
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int c = int.Parse(Console.ReadLine());
            int d = int.Parse(Console.ReadLine());
            int e = int.Parse(Console.ReadLine());
            int f = int.Parse(Console.ReadLine());
            int g = int.Parse(Console.ReadLine());
            int h = int.Parse(Console.ReadLine());
            int i = int.Parse(Console.ReadLine());
            int j = int.Parse(Console.ReadLine());
            int[] mountain = new int[] { a, b, c, d, e, f, g, h, i, j };
            Array.Sort(mountain);
            Console.WriteLine(mountain[9]);
            Console.WriteLine(mountain[8]);
            Console.WriteLine(mountain[7]);
        }
    }
}

Measured memory_bytes: 9360
#include <stdio.h>
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  long long int s=0;

  long long int low[n+1], high[n+1];
  low[0]=0;
  high[0]=n;
  for(int i=1; i<n+1; i++){
    low[i]=low[i-1]+i;
    high[i]=high[i-1]+n-i;
  }
//  for(int i=0; i<n+1; i++){
//    printf("%lld %lld \n", low[i], high[i]);
//  }

  for(int i=k-1;i<n+1;i++){
    s += high[i]-low[i]+1;
    s = s % 1000000007;
  }

  printf("%lld", s);
  return 0;
}


Measured memory_bytes: 4848
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound, __gcd, count, find, next_permutation
#include <bitset>    // bitset
#include <deque>     // deque
#include <iomanip>   // setprecsion
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <utility>   // pair, make_pair
#include <vector>    // vector

#include <cassert> // assert
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>  // abs, sin, cos, tan
#include <ctime> // clock

// __builtin_popcountll

using namespace std;
using Graph = vector<vector<int>>;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

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

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

void Main()
{
  ll n, k; cin >> n >> k;
  vll h(n); rep(i, n) cin >> h[i];
  vll dp(n, MAX);
  dp[0] = 0;
  for(ll i = 0;i < k;i++)
  {
    if(i + 1 >= n) break;
    dp[i + 1] = abs(h[0] - h[i + 1]);
  }
  for(ll i = 2;i < n;i++)
  {
    for(ll j = 1;j <= k;j++)
    {
      if(i - j < 0) continue;
      dp[i] = min(dp[i - j] + abs(h[i] - h[i - j]), dp[i]);
    }
  }
  fin(dp[n - 1]);
  return;
}

//前処理
int main()
{
  int ti = clock();
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  //cout << fixed << setprecision(20); //高精度少数表示
  //cout << setfill('0') << internal << setw(4); 0埋め４桁
  Main();
  printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
  return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cmath>
using namespace std;
int main(){
  double a,b;
  cin>>a>>b;
  int a1 = ceil(a/0.08);
  int a2 = floor((a+1)/0.08);
  if(a2*0.08==(a+1)) a2--;
  int b1 = ceil(b/0.1);
  int b2 = (b+1)*10 -1;
  if(a2<b1 ||b2<a1) cout<<-1<<endl;
  else{
    if(b1<a1){
      cout<<a1<<endl;
    }
    else cout<<b1<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

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

int main(void) {
	int num, i, j, h, w, sa, sb, al, ar, bl, br, ok = true;
	string s, t;
	cin >> h >> w >> num >> sa >> sb;
	cin >> s >> t;
	al = bl = 1;
	ar = h;
	br = w;
	for (i = num - 1; i >= 0; i--) {
		if (t[i] == 'U')
			ar = min(h, ar + 1);
		else if (t[i] == 'D')
			al = max(1, al - 1);
		else if (t[i] == 'L')
			br = min(w, br + 1);
		else
			bl = max(1, bl - 1);
		if (s[i] == 'U')
			al++;
		else if (s[i] == 'D')
			ar--;
		else if (s[i] == 'L')
			bl++;
		else
			br--;
		if (ar < al || br < bl) {
			ok = false;
			break;
		}
	}
	if (sa < al || ar < sa || sb < bl || br < sb)
		ok = false;
	if (ok)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}

Measured memory_bytes: 776
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;
//ここから

void solve(){
  int n;
  cin>>n;
  int cnt=0;
  map<int,int>mp;
  rep(i,n){
    int a;
    cin>>a;
    if(a>=3200)++cnt;
    else mp[a/400]++;
  }
  cout<<max(int(mp.size()),1)<<" "<<mp.size()+cnt;
}

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


Measured memory_bytes: 256
iterator = (("NS", "S"), ("NT", "T"))
var = {}

for i, j in iterator:
    var[i] = int(input())
    var[j] = [int(k) for k in input().split()]

count = 0
for T in var["T"]:
    left = 0
    right = len(var["S"])
    while(left < right):
        mid = (left + right)//2
        if var["S"][mid] == T:
            count += 1
            break
        elif var["S"][mid] <= T:
            left = mid+1
        else:
            right = mid
print(count)

Measured memory_bytes: 18908
# https://atcoder.jp/contests/agc024/tasks/agc024_b

n = gets.to_i
nums = []
n.times { nums << gets.to_i - 1 }

num_indices = Array.new(n)
nums.each_with_index { |num, idx| num_indices[num] = idx }

max_length = 0
current_length = 0
prev = -1
num_indices.each do |num|
  current_length = 0 if num < prev
  prev = num
  current_length += 1
  max_length = [current_length, max_length].max
end

puts n - max_length

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

int main(void)
{
        int i = 0, j = 0,k = 0;
        int max = 0;
        char text[ 1002 ];
        char word[ 1002 ][ 34 ];
        int count = 0;
        int flag[1002];
        int maxword = 0;
        int maxtango = 0;
        int tangocount[1002];
        char tango[1002][34];
        char longword[1][34];
        int t = 0;


        for(i = 0; i < 1001; i++)
        {
                flag[i] = 0;
                tangocount[i] = 0;
                text[i] = '\0';

        }
        for(i = 0; i < 1001; i++)
        {
                strcpy(word[i],"a");
                strcpy(tango[i],"a");
        }

        i = 0;
        gets(text);
        while(1)
        {
                while(1)
                {
                        if(text[i] == 0x20|| text[i]== 0x00 )
                        {

                                if(maxword < k)
                                {
                                        strcpy(longword[0],word[j]);
                                        maxword = k;
                                }
                                i++;
                                k = 0;
                                break;
                        }
                        word[j][k] = text[i];
                        k++;
                        i++;
                }
                if(text[i] == '\0')
                {
                        break;
                }
                j++;
        }
        count = j;
        /*
        for(i = 0;i < count;i++)
        {
                printf("%s\n", word[i]);
        }
        */
        for(i = 0; i < count; i++)
        {
                for(j = i+1; j < count; j++)
                {
                        if(strcmp(word[i],word[j]) == 0 && flag[i] == 0&&flag[j] == 0)
                        {
                                strcpy(tango[t],word[i]);
                                tangocount[t]++;
                                flag[j] = 1;
                        }
                }
                t++;
        }
        int c = 0;
        maxtango = 0;
        for(i = 0; i < t; i++)
        {
                /*printf("tango====%d\n",tangocount[i]);*/
                if(maxtango < tangocount[i])
                {
                        maxtango = tangocount[i];
                        c = i;
                }
        }

        printf("%s %s\n",tango[c], longword[0]);
        return 0;
}

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

int gcd(long a,long b){
	if(b==0) return a;
  	else return gcd(b,a%b);
}
int main() {
	int n,x;cin>>n>>x;
  	vector<int> a(n);
  	vector<int> b(n);
  	for(int i=0;i<n;i++){
      	cin>>a[i];
      	b[i]=abs(a[i]-x);
    }
  	sort(b.begin(),b.end());
  	int ans=gcd(b[1],b[0]);
  	for(int i=2;i<n;i++){
    	ans=gcd(gcd(b[i],b[i-1]),ans);
    }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define repp(i,a,b) for(ll i=a;i<=b;i++)
#define reff(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long int
#define pll pair<ll,ll>
#define fill(a,x) memset(a,x,sizeof(a))
#define mb make_pair
#define pb push_back
#define F first
#define S second
#define M 1000000007
#define sc(x) scanf("%d",&x)
#define scc(x1,x2) scanf("%d%d",&x1,&x2)
#define sccc(x1,x2,x3) scanf("%d%d%d",&x1,&x2,&x3)
#define pr(x) printf("%lld ",x)
#define dbg(a)         std::cerr<<#a<<"="<<(a)<<"\n"
#define dbg1(a,b)       std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define dbg2(a,b,c)     std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define dbg3(a,b,c,d)   std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define co cout<<"fuck"<<endl;
#define all(v) v.begin(),v.end()
const int INF = 2034567891;
const ll INF64 = 4234567890123456789ll;
long long nc3(long long v){return (v * (v - 1ll) * (v - 2ll)) / 6ll;}
long long nc2(long long v){return (v * (v - 1ll)) / 2ll;}
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
const int N = 10+2e6;
bool isprime(ll n) {
    if (n < 2) return 0;
    if (n == 2) return 1;
    if (n % 2 == 0) return 0;
    for (ll i = 3; i*i <= n; i++) if (n%i == 0) return 0;
    return 1;
}
double dist(pll p1, pll p2)
 {
    return (p1. F - p2.F)*(p1.F - p2.F) +
          (p1.S - p2.S)*(p1.S - p2.S);
 }
int main()
{
   fast;
   ll n;
   cin>>n;
   ll x0=0,y0=0,t0=0;
   ll t[n],x[n],y[n];
   ll f=0;
   rep(i,n)
   cin>>t[i]>>x[i]>>y[i];
   rep(i,n)
   {
      if(((t[i]-t0)<abs(x0-x[i])+abs(y0-y[i])) || (((t[i]-t0)-(abs(x0-x[i])+abs(y0-y[i])))&1))
      {
        f=1;
        break;
	  }
	  t0=t[i];
	  x0=x[i];
	  y0=y[i];
   }
   if(f)
   cout<<"No";
   else
   cout<<"Yes";
}

Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
using namespace std;
#define vel vector<long long>
#define vvel vector<vel>
#define int long long
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
long long p = 1000000007;
vel kai(200001, 1);
vel ink(200001, 1);
int le = (1 << 20) + 1;
vel BIT(le, 0);
vel uni(vel &list) {
	if (list.size() == 0) { return list; }
	sort(list.begin(), list.end());
	vel ql(1, list[0]);
	rep(i, list.size() - 1) {
		if (list[i] != list[i + 1]) { ql.push_back(list[i + 1]); }
	}
	list = ql;
	return ql;
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; }
	return ans % p;
}
int inv(int a) {
	return ru(a, p - 2);
}
void make_kai() {
	rep(i, 200000) { kai[i + 1] = (kai[i] * (i + 1)) % p; }
	rep(i, 200001) { ink[i] = inv(kai[i]); }
}
int com(int n, int r) {
	int ans = kai[n] * ink[r];
	ans %= p; ans *= ink[n - r]; ans %= p;
	return ans;
}
int per(int n, int r) {
	int ans = kai[n] * ink[n - r];
	ans %= p;
	return ans;
}
signed main() {
	int n, k; cin >> n >> k;
	vel v(n);
	rep(i, n) { cin >> v[i]; }
	int mx = 0;
	rep(i, n+1) {
		rep(j, n+1) {
			if (i + j <= n and i + j <= k) {
				int rmx = 0;
				vel ans(0);
				int pr = 0;
				rep(ind, i) { ans.push_back(v[ind]); pr += v[ind]; }
				rep(ind, j) { ans.push_back(v[n - 1 - ind]); pr += v[n - 1 - ind]; }
				sor(ans);
				rmx = pr;
				for (int ind = 0; ind < min(k - i - j, i + j); ind++) {
					pr -= ans[ind];
					mmax(rmx, pr);
				}
				mmax(mx, rmx);
			}
		}
	}
	cout << mx << endl;
	return 0;
}



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

using namespace std;
using ull = unsigned long long;
using ll = long long;
using lli = long long int;
using ld = long double;
using pa = pair<int, int>;
using ppa = pair<pa, int>;
#define SORT(v, n) sort(v, v + n);
#define ALL(v) v.begin(), v.end()
#define VSORT(v) sort(ALL(v))
#define GRESORT(v) sort(ALL(v), greater<ll>())
#define REVERSE(v) reverse(ALL(v))
#define overlap(v) v.erase(unique(ALL(v)), v.end())
#define debug(x) cout << #x << ": " << x << endl
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for (int i = (b - 1); i >= a; i--)
#define rrep(i, n) RFOR(i, 0, n)
#define INF INT_MAX
#define SUP INT_MIN
#define mins(a, b) a = min(a, b)
#define maxs(a, b) a = max(a, b)

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

// 8近傍
// int dy[]={0,0,1,-1,1,1,-1,-1};
// int dx[]={1,-1,0,0,1,-1,1,-1};

// const ll MOD = 1000000007;

ll pow_mod(ll a, ll b, ll mod) {
    ll tmp = 1;
    a %= mod;
    if (b > 0) {
        tmp = pow_mod(a, b / 2, mod);
        if (b % 2)
            tmp = (((tmp * tmp) % mod) * a) % mod;
        else
            tmp = (tmp * tmp) % mod;
    }
    return tmp;
}

ll gcd(ll x,ll y){
    if(x == 0) return y;
    return gcd(y%x,x);
}

void solve(){
    ll n,x;
    cin >> n >> x;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    ll cnt = 0;
    for(int i = 0; i < n; i++){
        if(a[i] > x){
            cnt += a[i] - x;
            a[i] -= a[i] - x;
        }
    }
    /*
    for(int i = 0; i < n; i++){
        if(i) cout << " ";
        cout << a[i];
    }
    cout << endl;
    */
    for(int i = 0; i < n - 1; i++){
        if(a[i] + a[i + 1] > x){
            cnt += a[i] + a[i + 1] - x;
            a[i + 1] -= a[i] + a[i + 1] - x;
        }
    }
    /*
    for(int i = 0; i < n; i++){
        if(i) cout << " ";
        cout << a[i];
    }
    cout << endl;
    */
    cout << cnt << endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 1024
nums = [int(i) for i in input().split()]
cnt_5 = 0
cnt_7 = 0

for i in range(3):
  if nums[i] == 5:
    cnt_5 += 1
  if nums[i] == 7:
    cnt_7 += 1
 
if cnt_5 == 2 and cnt_7 == 1:
  print('YES')
else:
  print('NO')

  

Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int MAX=1e5+5;



int main(){
	int N;
	cin>>N;
	ll a[MAX];
	rep(i,N)cin>>a[i];
	
	ll dp[MAX][2];
	dp[0][0]=a[0];
	dp[0][1]=a[0];
	rep1(i,N-1){
		dp[i][0]=max(dp[i-1][0]+a[i],dp[i-1][1]+a[i]);
      	if(i==1){
			dp[i][1]=max(dp[i-1][0]-2*(a[i-1])-a[i],dp[i-1][1]-2*(a[i-1])-a[i]);
        }
      	else {
			dp[i][1]=max(dp[i-1][0]-2*(a[i-1])-a[i],dp[i-1][1]+2*(a[i-1])-a[i]);
        }
	}
	ll ans=max(dp[N-1][0],dp[N-1][1]);
	cout<<ans;
}

Measured memory_bytes: 2560
#define ALL(obj) (obj).begin(), (obj).end()

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>

using namespace std;
typedef long long ll;
const ll INF = 1e18;

int N;
int K;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> N >> K;
    vector<int> p(N);

    for (int i=0; i<N; i++) {
        cin >> p[i];
    }
    
    double answer = 0.0;
    for (int j=0; j<K; j++) {
        answer += (double)(1+p[j])/2;
    }
    
    double maxd = answer;
    for (int i=K; i<N; i++) {
        double left = (double) (1+p[i-K])/2;
        double right = (double)(1+p[i])/2;
        answer += right;
        answer -= left;
        maxd = max(maxd, answer);
    }
    
    cout << fixed << maxd << endl;
    
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main()
{
    char letter, arr[]="aeiou";
    cin>>letter;
    for(int i=0; i<6; i++)
    {
        if (arr[i]==letter)
        {
            cout<<"vowel";
            return 0;
        }
    }
    cout<<"consonant";
}


Measured memory_bytes: 256
from bisect import *
import sys
input = sys.stdin.readline
n,q = map(int,input().split())
A = list(map(int,input().split()))
every2 = [[0]*(n//2 + 2) for _ in range(2)]
right = [0]*(n+1)

for i in range(n):
    odd = i&1
    every2[odd][i//2 + 1] = every2[odd][i//2] + A[i]
    right[i+1] = right[i] + A[-i-1]
# ans = [0]*q

def ok(y,x):
    M = A[-y]
    if M <= x:return False
    d = M - x
    m = x - d
    return bisect_left(A,m)+2*y-1 <= n

for i in range(q):
    X = int(input())
    W = bisect_right(A,X)
    top = n - W + 1
    bottom = 1
    while top - bottom > 1:
        mid = (top + bottom)//2
        if ok(mid,X):
            bottom = mid
        else:
            top = mid
    ans = right[bottom] + every2[1 - (n&1)][(n-1)//2 + 1 - bottom]
    print(ans)
# print('\n'.join(ans))


Measured memory_bytes: 73964
#include<bits/stdc++.h>
#include<utility>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
using namespace std;
typedef long long ll;

#define pb push_back
#define PI acos(-1.0)
#define MAX 10000007 //1e7+7
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define __FastIO  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
ll arr[100005],brr[100005];
vector<ll>V,V1;
/*------------------------------------------------------*/
void solve(ll n){

}
int main(){
  __FastIO;
  ll N,i,j,Test,M,A,B,C,X,Y,Z;
  while(cin>>A>>B){
    ll cnt=0;
    if(B==1){
      cout<<"0"<<endl;
    }
    else{
       ll empSocket=1,cnt=0;
       while(1){
         if(empSocket>=B){
           break;
         }
         else{
           empSocket+=(A)-1;
           cnt++;
         }
       }
       cout<<cnt<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())                                                
                                                                
ans = 0                                                         
for i in range(1, n + 1):                                       
    terms = n // i    # 項数                                      
    ans += terms * (i + i * terms) // 2  # 項数＊(初項＋末項)//2        
                                                                
print(ans)                                                      

Measured memory_bytes: 63348
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<math.h>

using namespace std;

typedef long long ll;

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

const ll INF = 1LL << 60;



signed main() {

	ll a;

	cin >> a;

	vector<ll>p(a), q(a);
	rep(i, a) {
		cin >> p[i];
	}
	rep(i, a) {
		cin >> q[i];
	}

	ll pa = 1, qa = 1;

	rep(i, a) {
		vector<ll>x;
		x = p;
		sort(x.begin(), x.end());
		ll tekito = 0;
		for (int j = 0; j < a - i; j++) {
			if (p[0] != x[j])tekito++;
			else break;
		}
		ll kakaka = tekito;
		for (ll j = 1; j <= a - i - 1; j++) {
			kakaka *= j;
		}
		pa += kakaka;
		p.erase(p.begin());
	}
	rep(i, a) {
		vector<ll>x;
		x = q;
		sort(x.begin(), x.end());
		ll tekito = 0;
		for (int j = 0; j < a - i; j++) {
			if (q[0] != x[j])tekito++;
			else break;
		}
		ll kakaka = tekito;
		for (ll j = 1; j <= a - i - 1; j++) {
			kakaka *= j;
		}
		qa += kakaka;
		q.erase(q.begin());
	}
	if (pa < qa) {
		cout << qa - pa;
	}
	else {
		cout << pa - qa;
	}
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int a, b, c;
	int count = 0;
	int i;
	scanf("%d %d %d", &a, &b, &c);
	for(i=a; i<=b; i++){
		if(c%i == 0) count++;
	}
	printf("%d\n", count);
	return 0;
}


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

using namespace std;

int main(){
  int h, w;
  cin >> h >> w;
  char a[h][w] = {0};
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      cin >> a[i][j];
    }
  }

  for(int i = 0; i < w+2; i++) cout << "#";
  cout << endl;

  for(int i = 0; i < h; i++) {
    cout << "#";
    for(int j = 0; j < w; j++) {
      cout << a[i][j];
    }
    cout << "#" << endl;
  }

  for(int i = 0; i < w+2; i++) cout << "#";
  cout << endl;

  return 0;
}


Measured memory_bytes: 3600
# binary_search

def is_ok(x, f):
    for d in a:
        x = x - x % d
    return f(x)


def binary_search(f, ok, ng):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if is_ok(mid, f):
            ok = mid
        else:
            ng = mid
    return ok


k = int(input())
a = tuple(map(int, input().split()))

max_ = binary_search(lambda x: x <= 2, ok=0, ng=10 ** 14 + 10)
min_ = binary_search(lambda x: x >= 2, ok=10 ** 14 + 10, ng=0)

if min_ > max_:
    print(-1)
else:
    print(min_, max_)


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

using ll = long long;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}

map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

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

  ll ans = 1;
  for(auto x: prime_factor(P)) {
    if(x.second / N >= 1) ans *= pow(x.first, x.second / N);
  }

  cout << ans << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<vector<int> >g1(n + 3), g2(n + 3);
    for(int i = 1; i <= n; i++){
        int p;
        cin >> p;
        for(int j = 1; j <= p; j++){
            int u, v;
            cin >> u >> v;
            if(v == 1){
                g1[i].push_back(u);
            }
            else{
                g2[i].push_back(u);
            }
        }
    }
    int q = 1;
    for(int i = 1; i <= n; i++){
        q = q * 2;
    }
    int ans = 0;
    for(int i = 0; i < q; i++){
        set<int>st1;
        int j = i;
        for(int k = 1; k <= n; k++){
            if(j % 2 == 1){
                st1.insert(k);
            }
            j = j/2;
        }
        set<int>st2 = st1;
        set<int>st3 = st1;
        set<int>::iterator it;
        for(it = st1.begin(); it != st1.end(); it++){
            int u = *it;
            for(int k = 0; k < g1[u].size(); k++){
                st2.insert(g1[u][k]);
            }
            for(int k = 0; k < g2[u].size(); k++){
                st3.erase(g2[u][k]);
            }
        }
        if(st1 == st2 && st1 == st3){
            int r = st1.size();
            ans = max(ans, r);
        }
    }
    cout << ans;
    return 0;
}

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

//const Long MX = ;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout.precision(10);
	cout << fixed;

	Long n;
	cin >> n;
	vector<Long> v(n,0);
	Long auxi = 0;
	for(Long i = 0; i < n; i++){
		cin >> v[i];
		auxi ^= v[i];
	}
	
	for(Long i = 0; i < n; i++){
		cout << (v[i]^auxi) << " ";
	}
	cout << "\n";
	return 0;
}


Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
 
	if ((a % 2) == 0 || (b % 2) == 0) {
		printf("Even\n");
	}
	else {
		printf("Odd\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int x,y;
  cin>>x>>y;
  Int ans=0;
  if(x==3) ans+=100000;
  if(x==2) ans+=200000;
  if(x==1) ans+=300000;
  if(y==3) ans+=100000;
  if(y==2) ans+=200000;
  if(y==1) ans+=300000;
  if(x==1&&y==1) ans+=400000;
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

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

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int n;
	ll d;
	cin >> n >> d;
	int res = 0;
	rep (i, n) {
	  ll x, y;
	  cin >> x >> y;
	  res += (d * d >= x * x + y * y);
	}
	cout << res << endl;
    
    return 0;
}



Measured memory_bytes: 3656
#include <iostream>

using namespace std;

int main(){
    int K, A, B;
    cin >> K;
    cin >> A >> B;
    for(int i=A; i <= B; i++){
        if(i%K==0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main() {
    // 入力受け取り, 入次数も管理する
int r,d,r2000;
    cin >> r >>d >> r2000;
double data[11];

data[0]=r2000;
for(int i=0;i<10;i++){
data[i+1]=r*data[i]-d;
}   

for(int i=1;i<=10;i++){
cout <<(int)data[i] << "\n";
}

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <string>
using namespace std;
#include<chrono>
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define foo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define min3(a,b,c)         min(a,min(b,c))
#define max3(a,b,c)         max(a,max(b,c))
#define min4(a,b,c,d)       min(a,min(b,min(c,d)))
#define max4(a,b,c,d)       max(a,max(b,max(c,d)))
#define max5(a,b,c,d,e)     max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e)     min(min3(a,b,c),min(d,e))
typedef pair<int, int>  pii;
typedef pair<ll, ll>  pl;
typedef vector<int>   vi;
typedef vector<ll>    vl;
typedef vector<pii>   vpii;
typedef vector<pl>    vpl;
typedef vector<vi>    vvi;
typedef vector<vl>    vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void DFS(int n);
bool isprime(ll n);
int gcd(int a,int b);
void rstgraph(int n);

const int mod = pow(10,9)+7;
const int N = 3e5, M = N;

//=======================================================================================
vi g[N];
int vis[N];
int nodes=0;
// ll ans=0;
void iluzn() {
int n,k;
cin>>n>>k;
if(n<10){
int d=100*(10-n);
cout<<k+d;
}
else
cout<<k;
  }

 
int main() {
  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t=1,i;
    // cin>>t;
     while(t--) iluzn();
    return 0;
}
int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}
bool isprime(ll n){
    if(n<=1)
        return false;
    if(n==2)
        return true;
    if(n%2==0)
        return false;
    ll rt = sqrt(n);
    for(ll i=3;i<rt;i+=2){
        if(n%i==0)
            return false;
    }
    return true;
}
int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
void ipgraph(int m){
  int u, v;
  while(m--){
    cin>>u>>v;
    g[u].pb(v);
    // g[v].pb(u);
  }
}

void DFS(int n)
{  ++nodes;
    vis[n] = 1;
    for(vector<int>::iterator i = g[n].begin(); i != g[n].end() ; i++)
    {
        if(!vis[*i])
            DFS(*i);
    }
}
void rstgraph(int n){
  int i;
  fo(i,n+1){
    g[i].clear();
    vis[i]=0;
  }
  nodes=0;
}

Measured memory_bytes: 10712
def plus(x):
    X = str(x)
    p = int(X[len(X)-1])
    if p == 0:
        return(int(X+str(p)), int(X+str(p+1)))
    elif p == 9:
        return(int(X+str(p-1)), int(X+str(p)))
    else:
        return(int(X+str(p-1)), int(X+str(p)), int(X+str(p+1)))
    
A = [[] for _ in range(10)]
for i in range(1,10):
    A[0].append(i)
    
for i in range(1,10):
    for j in A[i-1]:
        A[i].extend(plus(j))
ans = sum(A,[])
print(ans[int(input())-1])


Measured memory_bytes: 13132
object Main extends App {
    val Array(x1, y1, x2, y2) = io.StdIn.readLine.split(" ").map(_.toInt)

    val x = x2-x1
    val y = y2-y1

    val x3 = x2-y
    val y3 = y2+x
    val x4 = x1-y
    val y4 = y1+x

    println(s"$x3 $y3 $x4 $y4")

}

Measured memory_bytes: 27208
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,m = inpl()
print((n-1)*(m-1))


Measured memory_bytes: 5076
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;


public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    int n = sc.nextInt();
    int k = sc.nextInt();
    long s = sc.nextLong();
    long nine = (long)(1e9);
    long[] arr = new long[n];
    int to = k-1;
    if(s!=nine) {
      for(int i = 0; i <= to; i++) {
        arr[i] = s;
      }
      for(int i = to+1; i < n; i++) {
        arr[i] = s+1;
      }
    } else {
      for(int i = 0; i < to; i++) {
        arr[i] = s;
      }
      long sub = s-(n-k);
      if(to>=0)arr[to] = sub;
      for(int i = to+1; i < n; i++) {
        arr[i] = 1;
      }
    }
    for(long l : arr) out.print(l + " ");
    out.println();
    out.close();
  }

}


Measured memory_bytes: 40504
#include<stdio.h>

int main(void){

	int w,n;
	int a,b;
	int work;
	int num[30];
	int i;

	scanf("%d",&w);
	scanf("%d",&n);

	for(i=0;i<w;i++)
		num[i] = i+1;

	for(i=0;i<n;i++){
		scanf("%d,%d",&a,&b);

		work = num[a-1];
		num[a-1] = num[b-1];
		num[b-1] = work;

	}

	for(i=0;i<w;i++)
		printf("%d\n",num[i]);

	return 0;
}

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

int main() {

    int tmp;
    vector<int> T;
    for (int i = 0; i < 3; i++) {
        cin >> tmp;
        T.push_back(tmp);
    }

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

    cout << T[0] + T[1] << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  /* your code */
  for(i=0; i<=VMAX;i++)C[i]=0;
  
  for(i=0; i<n; i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  
  for(i=1; i<= VMAX; i++)C[i]=C[i] + C[i-1];

  for(j=1; j<=n;j++){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
  
  for(i=1;i<=n;i++){
    if(i >= 2) printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
    return 0;
}



Measured memory_bytes: 9592
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	for (int temp = a; temp <= a * b; temp += a)
	{
		if(temp % b == c){
			puts("YES");
			return 0;
		}
	}
	puts("NO");
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[n],b[n];
    vector<pair<int,int>>p(n);
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        p[i]={b[i],a[i]};
    }
    sort(p.begin(),p.end());
    int t=0;
    for(int i=0;i<n;i++){
        t+=p[i].second;
        if(t>p[i].first){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

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

#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n);i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int,int> > vii;
typedef long long ll;
typedef pair<int, int> pii;

const int N = 1e5 + 5;
const int MOD = 1e9 + 7;
int dp[N][14];
string str;
int n;

int solve(int idx , int m){
    if(idx == n)return m == 5;
    int &ret = dp[idx][m];
    if(~ret)return ret;
    ret = 0;
    if(str[idx] != '?'){
        ret = solve(idx + 1 , (m*10 + (str[idx]-'0') )% 13);
    }else{
        range(i,0,9){
            ret += solve(idx + 1 , (m*10+i)%13);
            if(ret >= MOD)ret -= MOD;
        }
    }
    return ret;
}

int main()
{

#ifndef ONLINE_JUDGE
	//freopen("in.in", "r", stdin);
	//freopen("out.in", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    cin >> str;
    n = SZ(str);
    memset(dp,-1,sizeof dp);
    cout << solve(0,0) << "\n";
return 0;
}


Measured memory_bytes: 12368
#include <iostream>

using namespace std;

int main()
{
    char b1, b2, b3;

    cin >> b1 >> b2 >> b3;

    if ((b1 == '0' || b2 == '0') && (b3 == '0')) {
        cout << "Close" << endl;
    } else {
        cout << "Open" << endl;
    }

    return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	string s[n];
	map<string,ll> pam;
	ll ans=0;
	for(ll i=0;i<n;i++)
	{
		cin>>s[i];
		sort(s[i].begin(),s[i].end());
		ans+=pam[s[i]];
		pam[s[i]]++;
	}
	cout<<ans;
}

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

char a[20], b[20], c[20];


int main(void) {

	int lena, lenb, lenc;

	scanf("%s", a);
	scanf("%s", b);
	scanf("%s", c);

	lena = strlen(a);
	lenb = strlen(b);
	lenc = strlen(c);

	if (a[lena - 1] == b[0] && b[lenb - 1] == c[0]) {
		printf("YES\n");
	}
	else {
		printf("NO\n");
	}

	return 0;

}

Measured memory_bytes: 128
#include<iostream>
#include<string>
using namespace std;
int main(){
	int ans=0,n;
	string base,str,kan;
	cin>>n;
	cin>>base;
	for(int i=0;i<n;++i){
		cin>>kan;
		str="";
		for(int j=0;j<101;++j){
			for(int k=1;k<101;++k){
				for(int l=j;l<kan.size();l+=k){
					str+=kan[l];
					if(str==base){
						break;
					}
				}
				if(str==base){
					break;
				}
				else{
					str="";
				}
			}
			if(str==base){
				break;
			}
			else{
				str="";
			}
		}
		if(str==base){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
  int a,b,c,x,y;
  unsigned long long cnt=0;
  int sa=0;
  cin >> a >> b >> c >> x >> y;
  if(x-y>0) sa=x-y;
  else sa=y-x;
  if(c*2<a+b){
    if(a<c*2&&x>y) {
      cnt+=sa*a;
      x-=sa;
    }
    if(b<c*2&&y>x) {
      cnt+=sa*b;
      y-=sa;
    }
    for(int i=0;true;i++){
      cnt+=c*2;
      y--;
      x--;
      if(x<=0&&y<=0) break;
    }
    cout << cnt << endl;
  }
  else {
    if(x>y) {
      cnt+=sa*a;
      x-=sa;
    }
    if(y>x) {
      cnt+=sa*b;
      y-=sa;
    }
    for(int i=0;true;i++){
      cnt+=a;
      cnt+=b;
      y--;
      x--;
      if(x<=0&&y<=0) break;
    }
    cout << cnt << endl;
  }
}

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

#define fir first
#define sec second

pair <int, int> data[10100];
bool my[512];

int main(void)
{
	int n, m;
	vector <int> v;
	while (cin >> n >> m, n && m){
		
		for (int i = 0; i < 10100; i++) data[i].fir = data[i].sec = 0;
		for (int i = 0; i < 512; i++) my[i] = false;
		v.clear();
		
		for (int i = 0; i < m; i++){
			cin >> data[i].fir >> data[i].sec;
			if (data[i].fir == 1) {
				my[data[i].sec] = true;
				v.push_back(data[i].sec);
			}
			if (data[i].sec == 1) {
				my[data[i].fir] = true;
				v.push_back(data[i].sec);
			}
		}
		
		int res = 0;
		for (int i = 0; i < v.size(); i++){
			for (int j = 0; j < m; j++){
				if (data[j].fir == v[i]){
					my[data[j].sec] = true;
				}
				if (data[j].sec == v[i]){
					my[data[j].fir] = true;
				}
			}
		}
		for (int i = 2; i <= n; i++){
			if (my[i]) res++;
		}
		cout << res << endl;
	}
	
	
	return 0;
}

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

int main(){
    int a, b, ans = -1;
    cin >> a >> b;
    if(a <= 9 && b <= 9)    ans = a*b;
    cout << ans << endl;
    
    return 0;
}

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

using namespace std;

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

    ll n, MOD=(ll)1e9+7;
    cin >> n;
    vector<ll> v(n);
    for(ll i=0; i<n; i++)
        cin >> v[i];
    vector<ll> suff(n);
    suff[n-1]=v[n-1];
    for(ll i=n-2; i>=0; i--)
        suff[i]=(v[i]+suff[i+1])%MOD;
    ll res=0;
    for(ll i=0; i<n-1; i++){
        ll tmp=(ll)v[i]*suff[i+1];
        tmp%=MOD;
        res=(res+tmp)%MOD;
    }
    cout << res << endl;
	return 0;
}


Measured memory_bytes: 6360
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;
 
void Main()
{
	int R;
  
  	cin >> R;
    
    printf("%f", 2.0 * R * 3.1415);
	
	
}
 
int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 3780
import java.util.Scanner;
import java.lang.Math;
public class Main{
    public static void main(String[] args){
        int n;
        double sum = 0.0, m, v, t = 0.0;
        Scanner sc = new Scanner(System.in);
        
        while(true){
            n = sc.nextInt();
            if(n == 0) break;
            double A[] = new double[n];
            for(int i =0; i<A.length; i++){
                A[i] = (double)sc.nextInt();
                sum += A[i];
            }
            m = sum / (double)A.length;
            for(int i = 0; i<A.length; i++){
                t += (A[i] - m) * (A[i] - m);
            }
            v = t / (double)A.length;
            System.out.println(Math.sqrt(v));
            sum = 0.0;
            t = 0.0;
        }
    }
}


Measured memory_bytes: 31432