akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }

int main() {
    vector<vector<int>> G{{2},{2, 5},{0, 1, 3, 6},{2, 7},{5},{1, 4, 6, 9},{2, 5, 7, 10},{3, 6, 8, 11},{7},{5, 10},{6, 9, 11, 12},{7, 10},{10}};
    vector<int> y{0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4}, x{2, 1, 2, 3, 0, 1, 2, 3, 4, 1, 2, 3, 2};
    using P = array<int, 13>;
    P v{};
    iota(v.begin(), v.end(), 0);
    v.back() = 0;
    map<P, int> A;
    auto dfs1 = [&](int a, int b, int cur, auto &&f) -> void {
        if(!A.count(v)) A[v] = cur;
        else chmin(A[v], cur);
        if(cur >= 5) return;
        for (auto &&j : G[a]) {
            if(j != b){
                swap(v[a], v[j]);
                f(j, b, cur+1, f);
                swap(v[a], v[j]);
            }
        }
        for (auto &&j : G[b]) {
            if(j != a){
                swap(v[b], v[j]);
                f(a, j, cur+1, f);
                swap(v[b], v[j]);
            }
        }
        return;
    };
    dfs1(0, 12, 0, dfs1);
    while(cin >> v[0], ~v[0]){
        for (int i = 1; i < 13; ++i) cin >> v[i];
        int ans = 21;
        auto dfs = [&](int cur, auto &&f) -> void {
            if(cur+5 >= ans) return;
            if(A.count(v)) {
                chmin(ans, A[v]+cur);
                return;
            }
            int d = 0, a = -1, b = -1;
            for (int i = 0; i < 13; ++i) {
                if(v[i]) d += abs(y[i]-y[v[i]])+abs(x[i]-x[v[i]]);
                else if(!~a) a = i;
                else b = i;
            }
            if(d+cur >= ans) return;
            for (auto &&j : G[a]) {
                if(j != b){
                    swap(v[a], v[j]);
                    f(cur+1, f);
                    swap(v[a], v[j]);
                }
            }
            for (auto &&j : G[b]) {
                if(j != a){
                    swap(v[b], v[j]);
                    f(cur+1, f);
                    swap(v[b], v[j]);
                }
            }

        };
        dfs(0, dfs);
        if(ans == 21) puts("NA");
        else cout << ans << "\n";
    }
    return 0;
}


Measured memory_bytes: 3068
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << endl;
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << "";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define wh while
#define ve vector
#define mp make_pair
#define tp tuple
#define mt make_tuple
#define pb push_back
#define pof pop_front
#define pob pop_back
#define pf push_front
#define fr front
#define ft first
#define sc second
#define tos to_string
#define len length
#define rt return
#define br break
#define con continue
#define lcm(n, m) (n * m / __gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m) - 1;i>=(int)(n);i--)
#define rev(i, m) revi(i, m, 0)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) n.begin(), n.end()
#define allr(n) n.rbegin(), n.rend()
#define sp(n) cout << fixed << setprecision(n)
#define pi 3.14159265358979323846
#define inf 1000000007
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

ve<int> dx = {0, 0, 1, -1}, dy = {1, -1, 0, 0};

int main() {
  int x, n;
  ci(x, n);
  ve<int> P(102, 0);
  rep(i, n){
    int a;
    ci(a);
    P.at(a) = 1;
  }
  int plus = x, mns = x;
  wh(true){
    if(P.at(mns) == 0){
      co(mns);
      rt 0;
    }
    else if(P.at(plus) == 0){
      co(plus);
      rt 0;
    }
    plus++;
    mns--;
  }
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <deque>
#include <string>
#include <vector>
using namespace std;
typedef vector <string> svector;
typedef vector <int> ivector;
typedef deque <string> sdeque;

int split(svector &tokens, const string &text, char delim=' '){
	int start = 0, end = 0;
	for (int i=0; i<text.size(); i++)
		if (text[i] == delim){
			end = i;
			tokens.push_back(text.substr(start, end - start));
			start = end + 1;
		}
	tokens.push_back(text.substr(start));
	return 0;
}

int sdeque_out(sdeque &A){
    int n=A.size();
    for (int i=0; i<n; i++){
        cout << A[i];
        if (i!= n-1) cout<<" ";
        else cout<<endl;
    }
    return 0;
}

int main(void){
	int n;
	string text = "";
	svector strs;
	sdeque que;
	sdeque::iterator pos;
	
	cin >> n;
	getline(cin, text);

	for (int i=0; i<n; i++){
		getline(cin, text);
		strs.clear();
		split(strs, text);

		if (strs[0]== "insert")
			que.push_front(strs[1]);
		else if (strs[0] == "delete"){
			pos = find( que.begin(), que.end(), strs[1] );
			if (pos != que.end()) que.erase(pos);
		}else if (strs[0] == "deleteFirst")
			que.pop_front();
		else if (strs[0] == "deleteLast")
			que.pop_back();
	}

	sdeque_out(que);
	return 0;
}

Measured memory_bytes: 56188
#include <iostream>
#include <queue>
using namespace std;
static const int N=100;
static const int INFTY=(1<<21);
int n,M[N][N];
int d[N];//通?距?管理??状?(color)
void bfs(int s){
    queue<int> q;//使用?准?中的queue
    q.push(s);
    for(int i=0;i<n;i++)d[i]=INFTY;
    d[s]=0;
    int u;
    while(!q.empty()){
        u=q.front();q.pop();
        for(int v=0;v<n;v++){
            if(M[u][v]==0)continue;
            if(d[v]!=INFTY)continue;
            d[v]=d[u]+1;
            q.push(v);
        }
    }
    for(int i=0;i<n;i++){
        cout<<i+1<<" "<<((d[i]==INFTY)?(-1):d[i])<<endl;
    } 
}
int main(){
    int u,k,v;
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++)M[i][j]=0;
    }
    for(int i=0;i<n;i++){
        cin>>u>>k;
        u--;
        for(int j=0;j<k;j++){
            cin>>v;
            v--;
            M[u][v]=1;
        }
    }
    bfs(0);
    return 0;
} 

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


N,X=map(int,input().split())
L = list(map(int,input().split()))
sums=[0]*(N+1)
c=0
for i in range(1,N+1):
  sums[i] = sums[i-1] + L[i-1]

s = list(filter(lambda x : x <= X,sums))
print(len(s))


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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

const double PI = 3.14159265359;
const int INF = (int)1e9;
const ll LINF = 1e18;
const int IMOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[5] = {0, 1, 0, -1};

using namespace std; 

int main(void)
{
    int n, k, s;
    cin >> n >> k >> s;
    
    irep(i, n) {
        if(i < k) {
            cout << s << " " << endl;
        } else {
            if(s != INF) {
                cout << s+1 << " " << endl;
            } else {
                cout << 1 << " " << endl;
            }
        }
    } 
    return 0;
}
/** atcoder **/



Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
const int maxn = 2e5 + 10;
const int mod = 1e9 + 7;
void solve(){
    ll n, k; cin >> n >> k;
    if(n == k-1){ cout << 1 << endl;
        return;
    }
    ll ans = 0;
    for(ll i = k; i <= n + 1; i++){
        ll minn = (i - 1) * i / 2;
        ll maxx = (2 * n - i + 1) * i / 2;
        ans = (ans + maxx - minn + 1) % mod;
    }
    cout << ans << endl;
}
int main(){
    IOS; int t = 1;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3640
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a > b){
            System.out.println("a > b");
        }else if(a < b){
            System.out.println("a < b");
        }else{
            System.out.println("a == b");
        }
    }
}


Measured memory_bytes: 26036
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 200010;
const int MAXM = 1000010;
const int MAXK = 510;
const int MAXQ = 200010;

int n, a[MAXN], l[MAXN], r[MAXN];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
    FOR(i,1,n) cin >> a[i];
    FOR(i,1,n) l[i] = max(l[i-1], a[i]);
    FORE(i,n,1) r[i] = max(r[i+1], a[i]);
    FOR(i,1,n) cout << max(l[i-1], r[i+1]) << "\n";
    return 0;
}


Measured memory_bytes: 3968
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let mut a = read_vec::<i64>();
    let b = read_vec::<i64>();

    let mut ans = 0;
    for i in 0..n {
        let mut bnum = b[i];
        let mut anum = a[i];
        a[i] -= b[i];
        ans += b[i];
        if a[i] < 0 {
            ans += a[i];
            a[i] = 0;
        }
        bnum -= anum - a[i];

        a[i + 1] -= bnum;
        ans += bnum;
        // debug!(ans, bnum);
        if a[i + 1] < 0 {
            ans += a[i + 1];
            a[i + 1] = 0;
        }
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 9972
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial
from bisect import bisect_left # bisect_left(list, value)
#from fractions import gcd

sys.setrecursionlimit(10**7)
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]

chk = [[0] * 3 for _ in range(3)]

for bi in b:
    for i, row in enumerate(A):
        for j, col in enumerate(row):
            if col == bi:
                chk[i][j] = 1

#for row in chk:
#    print(row)

# check

if chk[0][0] and chk[1][1] and chk[2][2]:
    print('Yes')
    exit()

if chk[0][2] and chk[1][1] and chk[2][0]:
    print('Yes')
    exit()

for i in range(3):
    if chk[i][0] and chk[i][1] and chk[i][2]:
        print('Yes')
        exit()

    if chk[0][i] and chk[1][i] and chk[2][i]:
        print('Yes')
        exit()

print('No')


Measured memory_bytes: 38384
#include <stdio.h>
#include <stdlib.h>

typedef struct data { int solved, penalty, id, wa[11]; } data;

int comp(const void* a, const void* b)
{
    data x=*((data*)a), y=*((data*)b);
    if (x.solved>y.solved) return -1;
    if (x.solved<y.solved) return 1;
    if (x.penalty<y.penalty) return -1;
    if (x.penalty>y.penalty) return 1;
    if (x.id>y.id) return -1;
    if (x.id<y.id) return 1;
    return 0;
}

int comp2(data* a, data* b)
{
    data x=*a, y=*b;
    if (x.solved>y.solved) return -1;
    if (x.solved<y.solved) return 1;
    if (x.penalty<y.penalty) return -1;
    if (x.penalty>y.penalty) return 1;
    return 0;
}


int main(void)
{
    data a[52];
    int M, T, P, R;
    while (scanf("%d%d%d%d", &M, &T, &P, &R), M) {
        int i, j;
        for(i=0;i<T;++i) {
            a[i].solved=a[i].penalty=0;
            a[i].id=i+1;
            for(j=0;j<P;++j) a[i].wa[j]=0;
        }
        while (R--) {
            int m, t, p;
            scanf("%d%d%d%d", &m, &t, &p, &j);
            --t, --p;
            if (j==0) {
                a[t].solved++;
                a[t].penalty+=m+a[t].wa[p]*20;
            }
            else {
                a[t].wa[p]++;
            }
        }
        qsort(a, T, sizeof(data), comp);
        printf("%d", a[0].id);
        for(i=1;i<T;++i)
            printf("%c%d", comp2(a+i-1, a+i)==0?'=':',', a[i].id);
        puts("");
    }
    return 0;
}

Measured memory_bytes: 620
function Main(input) {
	input = input.split('\n')
  	var n = input[0]
    var s = input[1]
    if(n % 2 === 1) {
      console.log('No')
    } else {
        var flag = true
    	var l = 0
        var r = n / 2
        while(r < n) {
        	if(s[l] !== s[r]) {
            	console.log("No")
              	flag = false
              	break
            }
          l++
          r++
        }
        if(flag) {
          console.log("Yes")
        }
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 9420
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
int main() {
  int n;
  cin >> n;
  vector<lli> a(n), b(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  int ans = 0;
  lli rem = 0;
  vector<pair<lli, lli>> s;
  rep(i, n) { s.push_back(make_pair(a[i] - b[i], i)); }
  sort(s.begin(), s.end());
  lli minus = 0;
  lli plus = 0;
  vector<lli> p, m;
  rep(i, n) {
    if (s[i].first < 0) {
      minus += -s[i].first;
      m.push_back(-s[i].first);
    } else if (s[i].first > 0) {
      plus += s[i].first;
      p.push_back(s[i].first);
    }
  }
  reverse(p.begin(), p.end());
  if (minus > plus) {
    cout << -1 << endl;
    return 0;
  }
  auto pi = p.begin();
  auto mi = m.begin();
  set<int> use;
  while (mi != m.end()) {
    if (*pi > *mi) {
      *pi -= *mi;
      use.insert(pi - p.begin());
      mi++;
    } else if (*pi <= *mi) {
      *mi -= *pi;
      pi++;
    }
  }
  cout << m.size() + use.size() << endl;
}


Measured memory_bytes: 5360
/* Aditya0412 */
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
#define ve vector
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpl vector < pll >
#define fi first
#define all(a)      (a).begin(),(a).end()
#define si(x)       (int)((x).size())
#define debug(x)    cout<<#x<<" is "<<(x)<<endl;cout.flush();  
#define se second 
#define endl        '\n'
#define f(i,a,b)    for(int i=a;i<b;i++)
#define mem(a,x)          memset(a,x,sizeof(a))

// === Debug macro starts here ===

int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
    os<<"["; 
    for(auto& x:v){os<<x<<", ";}
    return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
    return os<<"{"<<p.first<<", "<<p.second<<"}";
}

// === Debug macro ends here ===


// const ll mod=998244353;
const ll mod = 1000000000+7;
const ll N=1000000+6;
#define M_PI           3.14159265358979323846
void inp(ll *arr,ll n)
{
  for(int i=0;i<n;i++)
    cin>>arr[i];
}
void inp_mat(ll *arr,ll n,ll m)
{
    for(int i=0;i<n;i++)
      for(int j=0;j<m;j++)
        {
          ll x;cin>>x;
          *((arr+i*m) + j)=x;
        }
}
// syntax for inp_mat inp_mat((ll *)arr,n,m);
// int x2[]={+1,-1,+0,+0};
// int y2[]={+0,+0,+1,-1};
int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //  #ifndef ONLINE_JUDGEc
    //   freopen ("INPUT.txt" , "r" , stdin);
    //   freopen ("OUTPUT.txt", "w" , stdout);
    // #endif 
    
    int t=1;
    // cin>>t;
    while(t--)
    {
         ll n;cin>>n;
         ll arr[n];inp(arr,n);
          ll ans=0;
         for(int i=0;i<n;i++)
         {
           for(int j=i+1;j<n;j++)
           {
             for(int k=j+1;k<n;k++)
             {
               vll v;v.pb(arr[i]);v.pb(arr[j]);v.pb(arr[k]);
               sort(all(v));
               if(v[1]>v[0] and v[2]>v[1] and v[2]<v[1]+v[0])
               ans++;
             }
           }
         }
         cout<<ans;
    }    
} 

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

int main() {
	char c;
	cin >> c;

	if (c == 'a'||c=='i'||c=='u'||c=='e'||c=='o') {
		cout << "vowel" << endl;
	}
	

	else {
		cout << "consonant" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
    	if(c == '-') f = -1;
    	c = getchar();
    }
    while(c >= '0' && c <= '9') {
    	res = res * 10 +c - '0';
    	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,K;
int64 pre[MAXN],suf[MAXN],a[MAXN],sum[MAXN];
void Solve() {
    read(N);read(K);

    for(int i = 1 ; i <= N ; ++i) {
        read(a[i]);
        sum[i] = sum[i - 1] + a[i];
        pre[i] = pre[i - 1];
        if(a[i] > 0) pre[i] = pre[i] + a[i];
    }
    for(int i = N ; i >= 1 ; --i) {
        suf[i] = suf[i + 1];
        if(a[i] > 0) suf[i] = suf[i] + a[i];
    }
    int64 ans = 0;
    for(int i = 1 ; i <= N ; ++i) {
        int r = i + K - 1;
        if(r > N) break;
        int64 all = pre[i - 1] + suf[r + 1];
        if(sum[r] - sum[i - 1] > 0) all += sum[r] - sum[i - 1];
        ans = max(ans,all);
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int W=scan.nextInt();
		int H=scan.nextInt();
		int x=scan.nextInt();
		int y=scan.nextInt();
		int r=scan.nextInt();
		if(x-r>=0 && x+r<=W) {
			if(y-r>=0 && y+r<=H) {
				System.out.println("Yes");
	}
			else if(y-r<0 || y+r>H) {
				System.out.println("No");
			}
		}
		else if(x-r<0 || x+r>W) {
			System.out.println("No");
	}
		
		else if(y-r>=0 && y+r<=H) {
			if(x-r>=0 && x+r<=W) {
				System.out.println("Yes");
			}
			else if(x-r<0 || x+r>W) {
				System.out.println("No");
		}
			}
			else if(y-r<0 || y+r>H) {
				System.out.println("No");
			}
		scan.close();
}
}


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

#define pb   push_back
#define endl "\n"
#define ll   long long

#define W(t)            while(t--)
#define clr(a)          memset(a,0,sizeof(a))
#define rep(i,a,b)      for(i = a; i < b; i++)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

int main()
{
    IOS

    ll a,b,c;
    cin>>a>>b>>c;
    double ans = (1.0*a)/(1.0*c);
    ll d = b*1.0;

    if(ans<=d)
     cout<<"Yes\n";
    else
     cout<<"No\n";

     return 0;
}

Measured memory_bytes: 3644
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int socket = 1;
        int tap = 0;
        
        while(socket < B){
            socket += A - 1;
            tap++;
        }
        
        System.out.println(tap);
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pf push_front
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main()
{
   fast
   string s;
   cin>>s;
   ll i,n=s.length(),flag=0;
   for(i=0;i<n;i++)
   {
       if(i%2==0)
       {
           if(s[i]=='R' || s[i]=='U' || s[i]=='D')
           {
               continue;
           }
           else
           {
               flag=1;
               break;
           }
       }
       else
       {
           if(s[i]=='L' || s[i]=='U' || s[i]=='D')
           {
               continue;
           }
           else
           {
               flag=1;
               break;
           }

       }
   }

   if(flag)
   {
       cout<<"No"<<endl;
   }
   else
   {
       cout<<"Yes"<<endl;
   }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#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 each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int n;
	while (cin >> n, n) {
		vector<string>v(n);
		rep(i, 0, n) {
			cin >> v[i];
			int cnt(0);
			rep(j, 0, v[i].size()) {
				if (v[i][j] == '.') {
					v[i][j] = ' ';
					cnt++;
				}
			}
			if (cnt&&i) {
				v[i][cnt - 1] = '+';
				for (int j = i-1; j >= 0 && cnt -1 <v[j].length(); j--) {
					if (v[j][cnt - 1] == ' ')v[j][cnt - 1] = '|';
					else break;
				}
			}
		}
		rep(i, 0, n)cout << v[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3680
n,m=io.read():match("(.+)%s(.+)")
c={}
for i=1,m do
  c[i]=0
end
for i=1,n do
  l=1
  for f in io.read():gmatch("%d+") do
    if l>1 then
      c[f*1]=c[f*1]+1
    end
    l=l+1
  end
end
ans=0
for k,i in pairs(c) do
  if i==n*1 then
    ans=ans+1
  end
end
print(ans)

Measured memory_bytes: 256
#include<stdio.h>
#include<string>
#include <iostream>
#include<string.h>
#include <algorithm>
#include<queue>
using namespace std;


int main(){
	long long n,k;
	cin>>n>>k;
	long t;
	n=n%k;
//	if(n-k>0){
//		t=n-k;
//	}
//	else t=k-n;
//	for(;;){
//		//cout<<t<<"---\n";
//		n= abs(n-k);//1
//		if(n<=t){
//			t=n;
//			int s= abs(n-k);
//			if(s>=t){
//				break;
//			}
//		}
//		
//	}
//if(n<k){
//	n=k%n;
//}
if(k-n<n){
	n=abs(n-k);
}
	cout<<n<<endl;
	return 0;
}

Measured memory_bytes: 3564
#include <stdio.h>
int main(void){
    // Your code here!
   int f[45],i;
  
   f[0]=f[1]=1;
   for(i=2;i<45;i++)
   f[i]=f[i-1]+f[i-2];
    scanf("%d",&i);
   printf("%d\n",f[i]);
   
   return 0;
}
   
   
   


Measured memory_bytes: 2088
#include <algorithm>
#include <iostream>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define INF 100000000000
#define MAX 200001
#define MOD 1000000007

void dfs(int s, vector<int> &d, vector<int> &parent, Graph &G){
    for(auto v: G[s]){
        if(d[v] != -1) continue;
        d[v] = d[s] + 1;
        parent[v] = s;
        dfs(v, d, parent, G);
    }
}

int W = 1;
void dfs_count(int v, vector<vector<int>> &children){
    for(auto u:children[v]){
        W++;
        dfs_count(u, children);
    }
}

int main(){
    int N; 
    cin >> N;
    vector<vector<int>> G(N);
    for(int i = 0; i < N - 1; i++)
    {
        int a, b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> d(N, -1);
    vector<int> parent(N);
    d[0] = 0;
    dfs(0, d, parent, G);
    int m = d[N - 1] - 1;
    int cnt = m / 2;
    int v = N - 1;
    while(cnt > 0){
        v = parent[v];
        cnt--;
    }
    vector<vector<int>> children(N);
    for(int i = 1; i < N; i++){
        children[parent[i]].push_back(i);
    }
    dfs_count(v, children);
    int B = N - W;
    if(B > W) cout << "Fennec" << endl;
    else cout << "Snuke" << endl;
}

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

int main() {
    int X, Y;
    cin >> X >> Y;

    int mn = X * 2;
    int mx = X * 4;
    string ans = "Yes";
    if((Y % 2) != 0) {
        ans = "No";
    } else if(Y < mn || Y > mx) {
        ans = "No";
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3628
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include <iomanip>
#include<deque>
#include<stack>
#include<set>
#include <numeric>
#include <climits>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;#include <stdio.h>
const int INF = 111111111;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const int DIV = 1000000007; //10^9 + 7
const double PI = 3.14159265358979323846264338327950288;


ll gcd(ll a, ll b);

vector<pair<int, int>> edge;
vector<pair<int, int>> op;
vector<int> value;
vector<int> sum;
vector<vector<int>> link;
vector<bool> isEnd;

void traverse(int nowIndex, int parentValue) {
	// 各ノードは一度だけ探索する。
	if (isEnd[nowIndex]) return;
	isEnd[nowIndex] = true;

	sum[nowIndex] = parentValue + value[nowIndex];

	for (int i = 0; i < link[nowIndex].size(); i++)
		traverse(link[nowIndex][i], sum[nowIndex]);
}

int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	//==================================
	
	// 入力の読み込み
	int N, Q;
	cin >> N >> Q;

	link.resize(N);

	// edgeデータはN-1個
	edge.resize(N-1);
	for (int i = 0; i < edge.size(); i++) {
		int ai, bi;

		cin >> ai >> bi;

		edge[i].first = ai;
		edge[i].second = bi;

		// ノードの子供をたどれるようにしておく。
		link[ai - 1].push_back(bi - 1);
		link[bi - 1].push_back(ai - 1);
	}


	// opデータはQ個
	op.resize(Q);
	for (int i = 0; i < op.size(); i++) {
		cin >> op[i].first >> op[i].second;
	}

	value.resize(N);
	for (int i = 0; i < value.size(); i++) value[i] = 0;
	
	sum.resize(N);
	for (int i = 0; i < sum.size(); i++) sum[i] = 0;

	isEnd.resize(N);
	for (int i = 0; i < isEnd.size(); i++) isEnd[i] = false;


	// 各自の値を求める。
	for (int i = 0; i < op.size(); i++) {
		int opIndex = op[i].first - 1;
		int opValue = op[i].second;

		value[opIndex] += opValue;
	}

	// ツリーを探索して合計を求める。
	traverse(0, 0);

	// 出力
	for (int i = 0; i < sum.size(); i++)
		cout << sum[i] << ' ';


}



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

// MY TOOLS
#define let long long int
#define async ios_base::sync_with_stdio(false);cin.tie(NULL);

//


int dp[10001][101][2] ;
int mod = 1e9 + 7 ;
void self_add( int &a, int b ){
	a += b ;
	if( a >= mod ) a -= mod ;
}
int SIZE ;
int generate_top_down( string num, int idx, int sum, int D, int bound ){
	if( idx == SIZE ) return ( sum == 0 ) ? 1 : 0 ;
	int check = dp[idx][sum][bound], N = (num[idx] -'0') ;
	if( check != -1 ) return check ;
	int up_to = 9 ;
	if( bound == 1 ) up_to = N ;
	int payload = 0, new_bound ; 
	for( int digit = 0 ; digit <= up_to ; ++digit ){
		new_bound = ( N == digit ) ? bound : 0 ;
		self_add( payload, generate_top_down( num, idx+1, (sum+digit)%D, D, new_bound ) ) ;
	}
	return dp[idx][sum][bound] = payload ;
}


// main
// write your code here
int main(){
	async ;
	memset( dp, -1, sizeof(dp) ) ;
	string K ; int D ;
	cin >> K >> D ;
	SIZE = K.size() ;
	int ans = generate_top_down( K, 0, 0, D, 1 ) - 1 ;
	if( ans == -1 ) {
		cout << mod - 1 ;
	}
	else{
		cout << ans ;
	}
    return 0 ;
}


Measured memory_bytes: 110824
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

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

def LI(): return list(map(int, sys.stdin.readline().split()))

N,K = LI()

if K > (N-1)*(N-2)//2 :
    print("-1")
    exit()
nodes = []
for i in range(1,N):
    nodes.append([1,i+1])
add = (N-1)*(N-2) // 2 - K
for i in range(N-2):
    for j in range(i,N-2):
        add -= 1
        if add < 0:
            break
        nodes.append([i+2,j+3])
    else:
        continue
    break

print(len(nodes))
for node in nodes:
    x,y = node
    print(x,y)


Measured memory_bytes: 6516
#include <stdio.h>

int main(void){
int W,H,x,y,r;
scanf("%d",&W);
scanf("%d",&H);
scanf("%d",&x);
scanf("%d",&y);
scanf("%d",&r);
if(x+r<=W&&y+r<=H&&x-r>=0&&y-r>=0) printf("Yes\n");
else  printf("No\n");
return 0;
}

Measured memory_bytes: 584
a=gets.to_s
b=gets.to_s


def greaterThan(x, y, i)
  if(x[i].to_i > y[i].to_i)
    "GREATER"
  elsif(x[i].to_i < y[i].to_i)
    "LESS"
  elsif(i==x.size)
    "EQUAL"
  else
    greaterThan(x, y, i+1)
  end
end
if(a.size>b.size)then
  res = "GREATER"
elsif a.size<b.size then
  res = "LESS"
else
  res = greaterThan(a, b, 0)
end

puts(res)


Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<functional>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
typedef long long int ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<signed(n);i++)
#define EREP(i,n) for(int i=1;i<=signed(n);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
//#define EVEL 1
#ifdef EVEL
#define DEB(X) cout << #X <<":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll MOD = 1000000007;
const ll INF = 9e14;
typedef std::pair<ll,ll> P;
struct edge{ int to,cost; };
#define VMAX 100000

ll K,A,N;
ll ans=0;
ll S[3][5000];
string X;
int main(){
    cin>>N>>X;
    REP(i,N){
        if(X[i]=='R')S[0][i]++;
        if(X[i]=='G')S[1][i]++;
        if(X[i]=='B')S[2][i]++;
    }
    REP(i,N){
        S[0][i+1]+=S[0][i];
        S[1][i+1]+=S[1][i];
        S[2][i+1]+=S[2][i];
    }
    REP(i,N-2){
        ll a,b,c=0;
        if(X[i]=='R'){
            a=S[1][N-1],b=S[2][N-1];
            if(i!=0){a-=S[1][i-1],b-=S[2][i-1];}
            //j-i=k-j 2j=i+k
            for(int j=i+1;j<N;j++){
                if(2*j-i>N-1)break;
                if(X[j]!=X[2*j-i]&&X[j]!='R'&&X[2*j-i]!='R'){c++;}
            }

        }
        if(X[i]=='G'){
            a=S[0][N-1],b=S[2][N-1];
            if(i!=0)a-=S[0][i-1],b-=S[2][i-1];
            //j-i=k-j 2j=i+k
            for(int j=i+1;j<N;j++){
                if(2*j-i>N-1)break;
                if(X[j]!=X[2*j-i]&&X[j]!='G'&&X[2*j-i]!='G'){c++;}
            }
        }
        if(X[i]=='B'){
            a=S[1][N-1],b=S[0][N-1];
            if(i!=0)a-=S[1][i-1],b-=S[0][i-1];
            //j-i=k-j 2j=i+k
            for(int j=i+1;j<N;j++){
                if(2*j-i>N-1)break;
                if(X[j]!=X[2*j-i]&&X[j]!='B'&&X[2*j-i]!='B'){c++;}
            }
        }
        ans+=a*b-c;
        DEB(a)DEB(b)DEB(c)END
    }
    cout<<ans<<endl;

}
//ABC 121 D - XOR World


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


int main() {
  int K, N, x;
  cin >> K >> N;
  vector<int> A;
  for (auto i = 0; i < N ; ++i) {
    cin >> x;
    A.push_back(x);
  }
  sort(A.begin(), A.end());
  
  int max_distance = 0;
  //int max_location = 0;
  int temp1;
  for (auto i = 0; i < N-1; ++i){
    temp1 = abs(A[i] - A[i+1]);
    if (temp1 > max_distance) {
      max_distance = temp1;
      //max_location = i;
    }
  }
  temp1 = K + A[0] - A[N-1];
  if (temp1 > max_distance) {
  max_distance = temp1;
  //max_location = N-1;
  }

  int distance;
  distance = K - max_distance;
  cout << distance << endl;
}

Measured memory_bytes: 1400
#include<iostream>
#include <string>

using namespace std;

int main(){
    long long int a, b, c, k;

    cin >> a >> b >> c >> k;

    if(k <= a){
        cout << k << endl;
    }else if(k <= a + b){
        cout << a << endl;
    }else{
        cout << a - (k - (a + b)) << endl;
    }
    return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int n,k;
    in>>n>>k;
    vector<ll> h(n);
    for(auto&i:h) in>>i;
    sort(h.begin(),h.end());
    ll ans{};
    fr(i,n-min(n,k)) ans+=h[i];
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i,n) for(int (i) = 0; (i) < (int)(n); (i)++)
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) (x.begin(), x.end())

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int a, b;
    cin >> a >> b;
    if(a < 6) cout << 0 << endl;
    else if(a < 13) cout << b/2 << endl;
    else cout << b << endl;
}

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

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int A, B;
	
	cin>>A>>B;
	
	if(6 <= A && A <= 12) cout<<B/2<<endl;
	else if(A <= 5) cout<<0<<endl;
	else cout<<B<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

void merge(int n1, int n2, int L[], int R[], int data[]) {
  int i, j, k;

}

int main() {
  int n, m;
  int i, j, k;
  int tl[10000], tr[10000];
  int data[20002];
  int max;
  int temp;
  int before;

  while(1) {
    scanf("%d %d", &n, &m);
    if(n == 0 && m == 0) break;
    for(i = 0; i < n; i++) {
      scanf("%d", &tl[i]);
    }
    for(i = 0; i < m; i++) {
      scanf("%d", &tr[i]);
    }
    
    i = j = k = 0;
    while(i < n & j < m) {
      data[k++] = ((tl[i] <= tr[j]) ? tl[i++] : tr[j++]);
    }
    while(i < n) data[k++] = tl[i++];
    while(j < m) data[k++] = tr[j++];

    max = -1;
    before = 0;
    for(i = 0; i < n+m; i++) {
      temp = data[i] - before;
      if(temp > max) max = temp;
      before = data[i];
    }
    printf("%d\n", max);
  }

  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

// nCr mod を計算する O(n)
const int MAX_N = 1000010;
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX_N; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    ll x,y;
    cin>>x>>y;
    if(2*y-x<0 || 2*x-y<0 || (2*y-x)%3!=0 || (2*x-y)%3!=0){
        cout<<0<<endl;
        return 0;
    }

    ll a=(2*y-x)/3;
    ll b=(2*x-y)/3;

    COMinit();
    cout<<COM(a+b,a)<<endl;
}



Measured memory_bytes: 27032
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    map<string,int>mp;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        mp[s]++;
    }
    cout<<mp.size();
    return 0;
}

Measured memory_bytes: 19260
function main(input) {
  const n = parseInt(input, 10);
  var hako=[];
  var a = Math.floor(n/100);
  var b = Math.floor((n-a*100)/10);
  var c =n-a*100-b*10;
  hako.push(a);
  hako.push(b);
  hako.push(c);
  for(var i=0; i<3; i++){
    if(hako[i]==1){
      hako[i]=9
    }else if(hako[i]==9){
      hako[i]=1
    }
  }
  console.log(100*hako[0]+10*hako[1]+hako[2]);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

using namespace std;

#include <vector>
#include <list>
#include <string>
#include <cmath>
#define scan(x) scanf("%d", &x)
#define scanl(x) scanf("%lld", &x)

void printarray(int* arr, int n){
	for(int i=0;i<n;i++){
		printf("%d ", arr[i]);
	}
	printf("\n");
}

void printvector(vector <int> A){
	for(auto i=A.begin();i!=A.end();i++){
		cout<<*i<<" ";
	}
	cout<<endl;
}

int main(){

	#ifndef ONLINE_JUDGE
    	freopen("D:/Programming/input.txt", "r", stdin);
    	freopen("D:/Programming/output.txt", "w", stdout);
	#endif

	int k;scan(k);
	string str;
	cin>>str;
	if(str.size()<=k)cout<<str<<endl;
	else {
		str.resize(k);
		cout<<str<<"..."<<endl;
	}
	return 0;
}

Measured memory_bytes: 3696
while true
    h, w = gets.split( " " ).map { | val | val.to_i }
    break if 0 == h && 0 == w
    pa1 = [ "#", "." ]
    pa2 = [ ".", "#" ]
    h.times { | i |
        if 0 == i%2
            w.times {  | i |
                print( "#{pa1[i&1]}" )
            }
            print( "\n" )
        else
            w.times {  | i |
                print( "#{pa2[i&1]}" )
            }
            print( "\n" )
        end
    }
    print( "\n" )
end

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
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);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

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; }
template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;

ll dp[51][51][50*50+1];
int main(){

    ll n, k;
    cin >> n >> k;
    dp[0][0][0] = 1;
    for(int i = 1; i <= n; ++i){
        for(int j = 0; j <= i; ++j){
            for(int k = 2*j; k <= n*n; ++k){
                (dp[i][j][k] += (2*j+1)*dp[i-1][j][k-2*j]) %= MOD;
                (dp[i][j][k] += (j+1)*(j+1)*dp[i-1][j+1][k-2*j]) %= MOD;
                if(j == 0) continue;
                (dp[i][j][k] += dp[i-1][j-1][k-2*j]) %= MOD;
            }
        }
    }
    ppp(dp[n][0][k]);

    return 0;
}


Measured memory_bytes: 49152
/*
螟ァ螳カ螂ス螂ス逵倶ク倶ク矩擇逧?サ」遐√?
*/

#include <cstdio>
#include <iostream>
using namespace std;

int dp[1002][12][22];

void Init(){
    int cnt= 0;
    dp[1000][1][1]= cnt++;
    for(int i=999; i>0; --i){
        for(int j=10; j>0; --j){
            int k= 20;
            if( i%3!=0 && j%2==0 ) k= 19;  //蟷エ莉ス%3!=0蜷梧慮譛井サス%2==0逧?弍蟆乗怦;
            for(; k>0; --k)
                dp[i][j][k]= cnt++;
        }
    }
}

int main()
{
    //freopen("A.in","r",stdin);
    Init();
    int T;
    cin>>T;
    while(T--){
        int y,m,d;
        cin>>y>>m>>d;
        cout<< dp[y][m][d] <<endl;
    }
}

Measured memory_bytes: 0
import java.lang.String;
import java.lang.reflect.Array;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;


public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        x-= a;
        x-=(x/b)*b;
        System.out.println(x);


    }

}

Measured memory_bytes: 21716
#include <iostream>

using std::cout;
using std::endl;
using std::cin;

int main() {
	// Input
	long long  N, M; cin >> N >> M;
	// Suppose N <= M
	if(M < N) { long long t = N; N = M; M = t; }
	// Calculation
	long long ans;
	if(N == 1) {
		if(M == 1) {
			ans = 1;
		} else {
			ans = M-2;
		}
	} else {
		ans = (N-2) * (M-2);
	}
	// Output
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    x,y=map(int,input().split())
    if (x+y)%3!=0:
        print(0)
        return 0
    n=(x+y)//3
    h=x-n
    w=y-n
    if h<0 or w<0:
        print(0)
        return 0
    def fact(n,mod=10**9+7):
        ans=1
        for i in range(1,n+1):ans=(ans*i)%mod
        return ans
    def inv_n(n,mod=10**9+7):return pow(n,mod-2,mod)
    def nPr(n,r,mod=10**9+7):return inv_n(fact(n-r,mod),mod)*fact(n,mod)%mod
    def nCr(n,r,mod=10**9+7):return inv_n(fact(n-r,mod)*fact(r,mod)%mod,mod)*fact(n,mod)%mod
    print(nCr(h+w,w))

main()

Measured memory_bytes: 3064
from collections import deque
N = int(input())

G = {k: [] for k in range(N+1)}
for _ in range(N-1):
    a, b = map(int, input().split())
    # 無向グラフ
    G[a].append(b)
    G[b].append(a)

c = sorted([int(i) for i in input().split()], reverse=True)

visited = [-1] * N
cnt = 0
que = deque([1])

while que:
    i = que.popleft()
    visited[i-1] = c[cnt]
    cnt += 1

    for j in G[i]:
        if visited[j-1] == -1:
            que.append(j)

# print(visited)
print(sum(c[1:]))
print(*visited)


Measured memory_bytes: 6932
#include<iostream>
#include<algorithm>

int main()
{
	int w,a,b;
	std::cin >> w >> a >> b;
	if(a>b)
	{
		std::swap(a,b);
	}
	int ans = std::max(0,b-(a+w));
	std::cout << ans << std::endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    static Scanner scanner;

    public static void main(String[] args) {
        scanner = new Scanner(System.in);
        for (int i = 1; i <6; i++) {
            if (nextInt() == 0) {
                System.out.println(i);
            }
        }
    }

    public static void println(Object o) {
        System.out.println(o);
    }

    public static void print(Object o) {
        System.out.print(o);
    }

    public static void printf(String format, Object... o) {
        System.out.printf(format, o);
    }

    public static int nextInt() {
        return Integer.parseInt(scanner.next());
    }

    public static long nextLong() {
        return Long.parseLong(scanner.next());
    }

    public static double nextDouble() {
        return Double.parseDouble(scanner.next());
    }

    public static short nextShort() {
        return Short.parseShort(scanner.next());
    }

    public static float nextFloat() {
        return Float.parseFloat(scanner.next());
    }

    public static void printYes() {
        System.out.println("Yes");
    }

    public static void printYES() {
        System.out.println("YES");
    }

    public static void printNo() {
        System.out.println("No");
    }

    public static void printNO() {
        System.out.println("NO");
    }

    public static void nextLine() {
        scanner.nextLine();
    }

    public static double distance(double x, double y, double x2, double y2) {
        return Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
    }

    public static int MOD = 1_000_000_007;
    public static int MAX = 100000;
    public static long[] fac = new long[MAX];
    public static long[] finv = new long[MAX];
    public static long[] inv = new long[MAX];

    public static void combinit() {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    public static long combination(int n, int k) {
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

    public static long factorial(long n) {
        return n <= 0 ? 1 : n * factorial(n - 1);
    }
}

Measured memory_bytes: 29284
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	cout<<a/b<<endl;
	cout<<a-a/b*b<<endl;
	double x=a,y=b;
	cout<<fixed<<setprecision(9)<<x/y<<endl;
	return 0;
}

Measured memory_bytes: 1244