akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> using iodef_rng_t = typename enable_if<decltype(declval<C>().begin(), true_type{})::value && !is_same<C, string>::value>::type;
template<class C, class = iodef_rng_t<C>> istream& operator>>(istream& in, C& c) { for (auto& v : c) { in >> v; } return in; }
template<class C, class = iodef_rng_t<C>> ostream& operator<<(ostream& out, const C& c) { int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
template<class T> void trace_(const char* s, const T& v) { cerr << s << "=" << v; }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { for (; *s != ','; ++s) { cerr << *s; } cerr << "=" << v << ","; trace_(++s, vs...); }
#define TRACE(...) (cerr << "\033[2m\033[33m", trace_(#__VA_ARGS__, __VA_ARGS__), cerr << "\033[0m\n")
#else
#define TRACE(...)
#endif

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    vector<int> xs(n);
    cin >> xs;
    int64_t ans = 0;
    for (int i = 1; i < n; i++) {
        int64_t d = xs[i] - xs[i-1];
        ans += min(d * a, static_cast<int64_t>(b));
    }
    cout << ans << '\n';
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int>pr;
int N,M;
int fld[100][100],sub[50][50];
vector<pr>ans;
bool check(int y,int x){
    for(int i=0;i<M;i++){
        for(int j=0;j<M;j++){
            if(sub[i][j]==-1)continue;
            if(fld[y+i][x+j]!=sub[i][j])return false;
        }
    }

    return true;
}
void solve(){
    int y,x;
    for(int i=M-1;i>=0;i--){
        for(int j=M-1;j>=0;j--){
            if(sub[i][j]!=-1){
                y=i;
                x=j;
            }
        }
    }

    for(int i=0;i+M<=N;i++){
        for(int j=0;j+M<=N;j++){
            if(!check(i,j))continue;
            ans.push_back(pr(y+i,x+j));
            return;
        }
    }
}
void change(){
    int to[50][50];
    for(int i=0;i<M;i++){
        for(int j=0;j<M;j++){
            to[i][j]=sub[j][M-i-1];
        }
    }

    for(int i=0;i<M;i++){
        for(int j=0;j<M;j++){
            sub[i][j]=to[i][j];
        }
    }
}
int main(){
    while(cin>>N>>M,N||M){
        ans.clear();
        for(int i=0;i<N;i++)
            for(int j=0;j<N;j++)
                cin>>fld[i][j];

        for(int i=0;i<M;i++)
            for(int j=0;j<M;j++)
                cin>>sub[i][j];

        for(int i=0;i<4;i++){
            solve();
            change();
        }

        sort(ans.begin(),ans.end());
        if(ans.size()==0)cout<<"NA"<<endl;
        else{
            pr p=ans[0];
            cout<<p.second+1<<" "<<p.first+1<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1252
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}
//まずは愚直に全探索！！

int N;
int C[550], S[550], F[550];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    cin >> N;
    rep(i, N - 1) {
        cin >> C[i] >> S[i] >> F[i];
    } 
    rep(i, N) {
      int k = i;
      int cnt = 0;
      while(k != N - 1) {
          cnt = max(cnt, S[k]);
          cnt = ((cnt + F[k] - 1) / F[k]) * F[k] + C[k];
          k ++;
      } 
      cout << cnt << endl;
    }
	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int ans;

        if (N == 0) {
            System.out.println(X);
            return;
        }

        List<Integer> p = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            p.add(sc.nextInt());
        }

        for (int i = 0; i < N + 2; i++) {
            if (!p.contains(X - i)) {
                System.out.println(X - i);
                return;
            } else if (!p.contains(X + i)) {
                System.out.println(X + i);
                return;
            }
        }
    }
}

Measured memory_bytes: 35820
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  cin >> str;
  int i;
  int m,b;
  while(str!="-"){
    cin >> m;
    for(i=0;i<m;i++){
      cin >> b;
      str=str.substr(b,str.size()-b)+str.substr(0,b);
    }
    cout << str << endl;
    cin >> str;
  }
  
}


Measured memory_bytes: 3216
#include <stdio.h>

int main(){
	int a,b,i,keta;
	while(scanf("%d %d",&a,&b) != EOF){
		keta = 1;
		for(i = 10;;i *= 10) {
			if((a + b) / i) keta++;
			else {
				printf("%d\n",keta);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <time.h>

#define rep(num)      for (long long _ = 0; _ < num; _++)
#define loop(i, num)  for (long long i = 0; i < num; i++)

using namespace std;

int n;

vector<bool> vis;

vector<vector<int>> nei, dis;

void dfs(int from, int len, int mem) {
    
    vis[from] = 1;
    
    dis[mem][from] = len;
    
    loop (i, nei[from].size()) {
        
        if (!vis[nei[from][i]]) {
            
            dfs(nei[from][i], len + 1, mem);
            
        }
        
    }
    
}

int main() {
    
    cin >> n;
    
    nei.resize(n + 1);
    
    vis.resize(n + 1);
    
    dis.resize(2, vector<int>(n + 1, 1e9));
    
    loop (i, n - 1) {
        
        int p1, p2;
        
        cin >> p1 >> p2;
        
        nei[p1].push_back(p2);
        
        nei[p2].push_back(p1);
        
    }
    
    dfs(1, 0, 0);
    
    loop (i, n + 1) {
        
        vis[i] = 0;
        
    }
    
    dfs(n, 0, 1);
    
    int f = 0, s = 0;
    
    for (int i = 1; i <= n; i++) {
        
        if (dis[0][i] > dis[1][i]) {
            
            ++s;
            
        } else {
            
            ++f;
            
        }
        
    }
    
    if (s >= f) {
        
        cout << "Snuke" << endl;
        
    } else {
        
        cout << "Fennec" << endl;
        
    }
    
}


Measured memory_bytes: 11256
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;


int main(){
    string s, t;
    cin >> s >> t;

    ll ans = 0;
    rep(i, s.size())if(s[i] != t[i])ans++;

    cout << ans << endl;

}


Measured memory_bytes: 3912
#include <bits/stdc++.h>
#define int long long
#define rng(i, l, r) for (size_t i = (l); i < (r); ++i)
#define rep(i, n) rng(i, 0, n)
#define gnr(i, l, r) for (size_t i = (r)-1; i >= (l); i--)
#define per(i, b) gnr(i, 0, b)
#define ALL(obj) (obj).begin(), (obj).end()    //1,2,3,...
#define rALL(obj) (obj).rbegin(), (obj).rend() //...,3,2,1

using namespace std;

const int INF = 1e18;
void solve()
{

    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("./sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);

    int H, W, N;
    cin >> H >> W >> N;
    int a[N];
    rep(i, N) cin >> a[i];

    int masu[H][W];

    vector<int> color;
    rep(i, N)
    {
        rep(j, a[i])
        {
            color.push_back(i + 1);
        }
    }

    int count = 0;
    for (int h = 0; h < H; h++)
    {
        if (h % 2 == 0)
        {
            for (int w = 0; w < W; w++)
            {
                masu[h][w] = color[count];
                count++;
            }
        }
        else
        {
            for (int w = W - 1; 0 <= w; w--)
            {
                masu[h][w] = color[count];
                count++;
            }
        }
    }

    for (int h = 0; h < H; h++)
    {
        for (int w = 0; w < W; w++)
        {
            cout << masu[h][w];
            if (w == w - 1)
                continue;
            cout << " ";
        }
        cout << endl;
    }
}

signed main()
{
    solve();
    return 0;
}


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

using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(a > 0) {
        c -= b;
        if(c <= 0) break;
        a -= d;
    }
    if(c <= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

typedef double db;
typedef long long ll;
typedef pair<int,int> PII;

int main(){
  int n,cnt=0;cin>>n;
  vector<int> p(n);
  rep(i,n)cin>>p[i];
  rep(i,n){
  if(p[i]!=i+1){cnt++;}
  }
  if(cnt<=2)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int num[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
bool uru(int checkyear){if(checkyear%4==0){if(checkyear%100!=0||checkyear%400==0)return true;}return false;}
int gcd( int x, int y ){return y ? gcd(y, x%y) : x;}
signed main()
{
int x=0,y=0,z=0,w=0,n=0,m=0;
std::cin >> x>>y;
if(x<10&&y<10)std::cout << x*y << '\n';
else std::cout << -1 << '\n';
}


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

using namespace std;
using LL = long long;

const int MOD = 1e9+7;

class Edge{
public:
    LL from,to, value;
    Edge(int f,int t, int c){
        from = f;
        to = t;
        value = c;
    }
};

int main(){
    int a,L;
    while(cin >> a >> L){
        if(a == 0 && L == 0)return 0;
        map<int, int> mp;
        mp[a] = 0;
        for(int i = 1;;i++){
            string s = to_string(a);
            sort(s.begin(), s.end());
            int mi = stoi(s);
            reverse(s.begin(), s.end());
            int ma = stoi(s) * pow(10, L - s.size());
            if(mp.find(ma - mi) == mp.end()){
                mp[ma - mi] = i;
                a = ma - mi;
            }else{
                cout<<mp[ma - mi]<<" "<<ma - mi<<" "<<i - mp[ma - mi]<<endl;
                break;
            }
        }
    }
}



Measured memory_bytes: 3420
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N, M, Q = getNM()
query = [getList() for i in range(Q)]

# 数列Aについて得点計算
def counter(array):
    cnt = 0
    for i in range(Q):
        A_b = array[query[i][1] - 1]
        A_a = array[query[i][0] - 1]
        c = query[i][2]
        point = query[i][3]

        if A_b - A_a == c:
            cnt += point
    return cnt

ans = 0
# 重複組み合わせを生成
def rep_comb_pow_2(i, array):
    global ans
    if i == N:
        opt = counter(array)
        ans = max(ans, opt)
        return

    # 1スタート
    last = 1
    if len(array) > 0:
        last = array[-1]

    for j in range(last, M + 1):
        new_array = array + [j]
        rep_comb_pow_2(i + 1, new_array)

# 実行
rep_comb_pow_2(0, [])

print(ans)

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

int main() {
  int n;
  string s = "YES";
  cin >> n;
  vector<int> a(n);
  for(int i = 0;i < n;i++){
  	cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  for(int i = 0;i < n-1;i++){
    if(a.at(i)==a.at(i+1)){
      s = "NO";
      goto label;
    }
  }
  label:cout << s << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h> 
#define ll long long
#define F first
#define FF first.first
#define FS first.second
#define S second
#define pb push_back
using namespace std;
const ll N=1000006, INF=1e16;
 
ll n, q=1, e, a[N], f[N], c[N], o, k, t, x, y, z, u, h, mx, mn, ans, Ans;
pair<ll,ll> p[N];
string s;
vector<int> v[N];
map <string, int> m;
 
main(){ios_base::sync_with_stdio(false), cin.tie(0);
   	
	cin>>s;
	n=s.size();
	
	a[0]=(s[0]-'0');
	for (int i=1; i<n; i++){
		a[i]=(a[i-1]*10+(s[i]-'0'))%2019;
//		cout<<a[i]<<endl;
	}
	o=1;
	f[0]++;
	for (int i=n-1; i>=0; i--){
		(a[i]*=o)%=2019;
		(o*=10)%=2019;
//		cout<<a[i]<<" ";
		f[a[i]]++;
	}
	for (int i=0; i<2019; i++){
//		if(f[i])cout<<i<<" "<<f[i]<<endl;
		ans+=f[i]*(f[i]-1)/2;
	}
	cout<<ans;
}

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

int main(){
    int a, b;
    while(cin>>a >>b){
        if(a==0 && b==0)break;
        for(int i=0;i<a;i++){
            for(int j=0;j<b;j++){
                if(i==0 || j==0 || i==a-1 || j==b-1){
                    cout<<'#';
                }else{
                    cout<<'.';
                }
            }
            cout<<endl;
        }
        cout<<endl;
    }
    return 0;
}



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

int main()
{
    int a , b;
    cin>>a>>b;
    string str;
    cin>>str;
    bool flag = true;
    if(str[a]!='-')
    flag = false;
    for(int i = 0; i < str.size(); i++)
    {
        if(a==i) continue;
        if(str[i]=='-') flag = false;
    }
    if(flag)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  ll n;
  cin >> n;
  vector<ll> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }

  reverse(all(a));
  reverse(all(b));
  ll prev = 0;
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ll curr = a[i] + prev;
    curr %= b[i];
    ll add = curr == 0 ? 0 : b[i] - curr;
    ans += add;
    prev += add;
  }

  cout << ans << ln;

  return 0;
}


Measured memory_bytes: 1792
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   

int main(){
    std::ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    if(n==1){
    	if(m==1){
    		cout<<1<<endl;
    	}
    	else{
    		cout<<m-2<<endl;
    	}
    	return 0;
    }
    swap(n,m);
    if(n==1){
    	if(m==1){
    		cout<<1<<endl;
    	}
    	else{
    		cout<<m-2<<endl;
    	}
    	return 0;
    }
    ll ans=(n-2)*(m-2);
    cout<<ans<<endl;
    return 0;  
    
}



Measured memory_bytes: 256
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Ans[2] = {"Yes", "No"};
string ANS[2] = {"YES", "NO"};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

int Root(int x, vector<int> &root)
{
    if (x == root[x]) return x;
    return root[x] = Root(root[x], root);
}

void Merge(int v, int u, vector<int> &root, vector<int> &sz)
{
    v = Root(v, root), u = Root(u, root);
    if (v == u) return;
    if (sz[v] < sz[u])
    {
        sz[u] += sz[v];
        root[v] = u;
    }
    else
    {
        sz[v] += sz[u];
        root[u] = v;
    }
}

int ok(int x, int n)
{
    return 0 <= x && x < n;
}

void bfs(int v, vi &dist, vector<vi> &graph)
{
    fill(all(dist), -1);
    dist[v] = 0;
    vi q = {v};
    for (int i = 0; i < q.size(); i++)
    {
        for (auto u : graph[q[i]])
        {
            if (dist[u] == -1)
            {
                dist[u] = dist[q[i]] + 1;
                q.push_back(u);
            }
        }
    }
}


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s, t;
    cin >> s >> t;
    cout << t << s;
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,L; cin>>N>>L;
  vector<string> S(N);
  for (int i=0;i<N;i++){cin>>S[i];}
  sort(S.begin(),S.end());
  for (int i=0;i<N;i++){
    cout<<S[i]; 
  }
}

Measured memory_bytes: 256
#[derive(Copy, Clone, Debug)]
struct Num {
    d: i64,
    count: i64,
}

impl std::ops::Add for Num {
    type Output = Num;

    fn add(self, other: Num) -> Num {
        let new_d = self.d + other.d;
        if new_d >= 10 {
            Num {
                d: new_d - 9,
                count: self.count + other.count + 1,
            }
        } else {
            Num {
                d: new_d,
                count: self.count + other.count,
            }
        }
    }
}

fn dfs(d: i64, c: i64) -> Num {
    if c == 1 {
        Num { d: d, count: 0 }
    } else if c % 2 == 0 {
        let temp = dfs(d, c / 2);
        temp + temp
    } else {
        let temp = dfs(d, c / 2);
        Num { d: d, count: 0 } + temp + temp
    }
}

fn main() {
    let n = read::<usize>();
    let mut entries = vec![];
    for _ in 0..n {
        let v = read_vec::<i64>();
        entries.push((v[0], v[1]));
    }
    let mut results = vec![];
    let mut c_sum = 0i64;
    for (d, c) in entries {
        results.push(dfs(d, c));
        c_sum += c;
    }
    let mut cur = results[0];
    for i in 1..n {
        cur = cur + results[i];
    }
    println!("{}", c_sum + cur.count - 1);
}

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: 13376
#include <bits/stdc++.h>
using namespace std;

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

int main() {
  ll h, w, n;
  cin >> h >> w >> n;

  vector<ll> a;
  for (ll i = 0; i < n; ++i) {
    ll x;
    cin >> x;
    for (ll j = 0; j < x; ++j) {
      a.push_back(i+1);
    }
  }

  vector<vector<ll>> g(h, vector<ll>(w));
  for (ll i = 0; i < h; ++i) {
    for (ll j = 0; j < w; ++j) {
      if (i % 2 == 0) {
        g[i][j] = a[i*w+j];
      } else {
        g[i][w-j-1] = a[i*w+j];
      }
    }
  }

  for (ll i = 0; i < h; ++i) {
    for (ll j = 0; j < w-1; ++j) {
      cout << g[i][j] << " ";
    }
    cout << g[i][w-1] << endl;
  }

  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    int n;
    cin >> n;
    ll A, B, a, b;
    cin >> A >> B;
    while (--n) {
        cin >> a >> b;
        ll k = max((A+a-1)/a, (B+b-1)/b);
        A = a*k;
        B = b*k;
    }
    cout << A+B << endl;
}


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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

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);}

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

int main(){
    bool flag=false;
    ll ans=0,sum=0;

    int n,m;
    int b[3][3]={};
    int ap[3][3]={};

    rep(i,3){
        rep(j,3){
            cin>>b[i][j];
        }
    }

    cin >>n;
    rep(i,n){
        int a;
        cin>>a;

        rep(i,3){
            rep(j,3){
                if(b[i][j]==a)ap[i][j]=1;
            }
        }
    }

    rep(i,3){
        if(ap[i][0]==1 && ap[i][1]==1 && ap[i][2]==1)flag=true;
        if(ap[0][i]==1 && ap[1][i]==1 && ap[2][i]==1)flag=true;
    }

    if(ap[0][0]==1 && ap[1][1]==1 && ap[2][2]==1)flag=true;
    if(ap[0][2]==1 && ap[1][1]==1 && ap[0][2]==1)flag=true;

    //cout <<fixed<<setprecision(16)<< << endl;
    //cout<<ans<<endl;
    
    if(flag)cout << "Yes" <<endl;
    else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{

int a,b,c;
int t[100100],x[100100],y[100100];
int n;
cin>>n;
t[0]=0;
x[0]=0;
y[0]=0;
for(int i=1;i<=n;i++)
    cin>>t[i]>>x[i]>>y[i];
    
for(int i=1;i<=n;i++)
    {c=max(x[i]+y[i]-x[i-1]-y[i-1],x[i-1]+y[i-1]-x[i]-y[i]); 
    if((t[i]-t[i-1]-c)%2!=0 or c>t[i]-t[i-1]) {cout<<"No";
                                               return 0;}}
cout<<"Yes";   

system("pause");
return 0;
}

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

int main() {
    int a[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> a[i][j];
        }
    }
    int N; cin >> N;
    vector<vector<bool> > kekka(3, vector<bool>(3, false));
    for (int i = 0; i < N; i++) {
        int b; cin >> b;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (a[i][j] == b) kekka[i][j] = true;
            }
        }
    }
    bool ans = false;
    for (int i = 0; i < 3; i++) {
        if (kekka[i][0] && kekka[i][1] && kekka[i][2]) {
            ans = true;
            break;
        }
        if (kekka[0][i] && kekka[1][i] && kekka[2][i]) {
            ans = true;
            break;
        }
    }
    if (kekka[0][0] && kekka[1][1] && kekka[2][2]) ans = true;
    if (kekka[0][2] && kekka[1][1] && kekka[2][0]) ans = true;
    if (ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
#define VERNIY st();int ver=0,niy=0,hbk=0
//#pragma GCC optimize("0fast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <float.h>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <functional>
#include <sstream>
typedef unsigned long long LLU;
typedef long long LL;
using namespace std;
#define Lfmax DBL_MAX
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
typedef vector<int> vd;
typedef vector<pair<int,int> > vpd;
typedef pair<int,int> pd;
typedef queue<int> qd;
typedef queue<pair<int,int> > qpd;
typedef priority_queue<int> maxpqd;
typedef priority_queue<int, vector<int>, greater<int> > minpqd;
#define fr front
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; ++a)
#define forineq(a,b,c) for(int a=b ; a<=c ; ++a)
#define forde(a,b,c) for(int a=b ; a>=c ; --a)
#define UPC(oo) (oo>='A' && oo<='Z')
#define LWC(oo) (oo>='a' && oo<='z')
#define DGT(oo) (oo>='0' && oo<='9')
#define UPCVOC(oo) (oo=='A' || oo=='E' || oo=='I' || oo=='U' || oo=='O')
#define LWCVOC(oo) (oo=='a' || oo=='e' || oo=='i' || oo=='u' || oo=='o')
#define filein(oo) freopen(oo,"r",stdin);
#define fileout(oo) freopen(oo,"w",stdout);
#define setarr(a,b,c) memset(a,b,sizeof(c))

template<class Ver>
inline void in(Ver &a){cin>>a;}
template<class Ver,class Niy>
inline void in(Ver &a, Niy &b){cin>>a>>b;}
template<class Ver,class Niy, class Hbk>
inline void in(Ver &a, Niy &b, Hbk &c){cin>>a>>b>>c;}

template<class Ver>
inline void out(Ver a){cout<<a<<"\n";};
template<class Ver,class Niy>
inline void out(Ver a,Niy b){cout<<a<<" "<<b<<"\n";};
template<class Ver,class Niy, class Hbk>
inline void out(Ver a, Niy b, Hbk c){cout<<a<<" "<<b<<" "<<c<<"\n";};

inline void debug(){cout<<"asd"<<endl;}
template<class Ver>
inline void debug(Ver a){cout<<"--- "<<a<<endl;};
template<class Ver,class Niy>
inline void debug(Ver a,Niy b){cout<<"--- "<<a<<" "<<b<<endl;};
template<class Ver,class Niy, class Hbk>
inline void debug(Ver a,Niy b,Hbk c){cout<<"--- "<<a<<" "<<b<<" "<<c<<endl;};

#define grav 9.8
#define pi 3.14159265

void st()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}

double getSquare(double a)
{
	return a*a;	
}

double getDistance(pair<double,double> a, pair<double,double> b)
{
	return sqrt(getSquare(a.fi-b.fi)+getSquare(a.sec-b.sec));
}

int main()
{
	VERNIY;
	pair<double,double> a,b;
	in(a.fi,a.sec);
	in(b.fi,b.sec);
	cout<<fixed<<setprecision(6)<<getDistance(a,b)<<endl;
	return 0;
}



Measured memory_bytes: 3248
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e9+9
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

string s;

int main(){
	while (cin >> s){
		if (s == "#")break;
		vector<string> vs;
		double angle = 0;
		for (int i = 0; i < s.size(); i++){
			if (s.find("north", i) == i){
				vs.push_back("north");
			}
			else if (s.find("west", i) == i){
				vs.push_back("west");
			}
		}
		for (int i = vs.size() - 1; i >= 0; i--){
			int co = vs.size() - 1 - i;
			//cout << co << endl;
			if (co == 0){
				if (vs[i] == "west")angle += 90;
			}
			else{
				if (vs[i] == "west"){
					angle += (90 / pow(2, co));
				}
				else{
					angle -= (90 / pow(2, co));
				}
			}
		}
		int div = 1;
		while (angle - (int)angle >= EPS){
			div *= 2;
			angle *= 2;
		}
		if (div == 1)cout << angle << endl;
		else cout << (int)angle << "/" << div << endl;
	}
}

Measured memory_bytes: 1308
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <map>
#include <stdio.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++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll MOD = (ll)pow(10.0, 9.0) + 7;
pint dx[4] = { {0, 1}, {0, -1}, {1, 0}, {-1, 0} };
char da[4] = { 'R', 'L', 'D', 'U' };
char dad[4] = { 'L', 'R', 'U', 'D' };
ll min(ll a, ll b)
{

	return (a < b) ? a : b;
}
ll max(ll a, ll b) { return (a > b) ? a : b; }

ll N;


float Ceil(float a) {

	if (a == (int)a)
		return a;
	else
		return (int)a + 1.0;

}

int main() {
	ll N, K;

	cin >> N >> K;

	double ans = 0.0;

	for (double i = 1.0; i <= min(K-1, N); i++) {

		ans += (1.0 / (double)N) * pow(0.5, Ceil(log2((double)K / (double)i)));

	}
	

	if (K-1 < N) {
		ans += (double)(N-K+1) * (1.0/(double)N);

	}


	printf("%.11f", ans);

	
	return 0;

}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d", $x, $y);

for ($i=0; $i <= $x; $i++) {
  $t = $i * 2;
  $k = ($x - $i) * 4;
  if (($t + $k) == $y) {
    echo 'Yes';exit;
  }
}
echo 'No';


Measured memory_bytes: 16148
#include<bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(0);

int main()
{
  Hello;
  
  long int a, b, d=0;
  cin>>a>>b;
  long int c[a];
  
  for(int i=0; i<a; i++)
  {
    cin>>c[i];
  }
  sort(c,c+a);
  
  for(int i=0; i<a-b; i++)
  {
    d+=c[i];
  }
  
  cout<<d;
  
  return 0;
}

Measured memory_bytes: 1792
a = [-1, -1, -1]

def search():
    for i in range(M):
        s, c = map(int, input().split())
        if N == 3 and s == 1 and c == 0:
            return False

        if N == 2 and s == 1 and c == 0:
            return False

        if a[s-1+3-N] != -1 and a[s-1+3-N] != c:
            return False

        a[s-1+3-N] = c

    return True


N ,M = map(int, input().split())

if search():
    if a[2] == -1:
        a[2] = 0

    if a[1] == -1:
        if N == 2:
            a[1] = 1
        else:
            a[1] = 0

    if a[0] == -1:
        if N == 3:
            a[0] = 1
        else:
            a[0] = 0



    ans = a[0]*100 + a[1]*10 + a[2]
    print(ans)

else:
    print(-1)


Measured memory_bytes: 3064
fun main(args: Array<String>) {
  val K = readLine()!!.split(" ")[1].toInt()
  val list = readLine()!!.split(" ").map{it.toInt()}
  val listt = list.sorted()
  var count = 0
  var ans = 0
  while (count < K) {
    ans = ans + listt[count]
    count ++
  }
  println(ans)
}

Measured memory_bytes: 40500
let N = Int(readLine()!)!
let A = readLine()!.split(separator: " ").map { Int($0)! }.sorted()

var dp: [Bool] = .init(repeating: true, count: A.max()! + 1)
var count = 0
for i in 0..<A.count {
  if i > 0 && A[i] == A[i-1] {
    dp[A[i]] = false
    continue
  }
  var current = A[i] * 2
  while current <= A.last! {
    dp[current] = false
    current += A[i]
  }
}
for num in A {
  if dp[num] {
    count += 1
  }
}
print(count)

Measured memory_bytes: 18636
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


constexpr lint mod = 1e9 + 7;
inline lint emod(lint a, lint p = mod) { return (a % p + p) % p; }
inline lint invm(lint a, lint p = mod) { a %= p; return a == 1 ? 1 : -p / a * invm(p % a) % p; }

V<lint> fact, ifact;
void init_table(int n) {
  fact.assign(n + 1, 1), ifact.assign(n + 1, 1);
  for (int i = 2; i < n + 1; ++i) fact[i] = i * fact[i - 1] % mod;
  ifact[n] = invm(fact[n]);
  for (int i = n; i > 2; --i) ifact[i - 1] = i * ifact[i] % mod;
}

lint comb(lint n, lint r) {
  if (r < 0 or r > n) return 0;
  return fact[n] * ifact[r] % mod * ifact[n - r] % mod;
}

lint mulcomb(lint n, lint r) {
  if (n < 1 or r < 0) return 0;
  return fact[r + n - 1] * ifact[r] % mod * ifact[n - 1] % mod;
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  lint n, k; cin >> n >> k;
  init_table(n + k);
  cout << emod(mulcomb(k, n)) << '\n';
}


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

int main(void){
    int N,a=0;

    cin >> N;
    if(N<0||999<N)
        return 0;
    a=N%10;
    if(a==0||a==1||a==6||a==8){
        cout << "pon" << endl;
    }
    else if(a==2||a==4||a==5||a==7||a==9){
        cout << "hon" << endl;
    }
    else if(a==3){
        cout << "bon" << endl;
    }
    return 0;

}

Measured memory_bytes: 3568
/*************************************************************************
  > File Name: sands.cpp
  > Author: PumpkinYing
  > Created Time: 2018/11/28 14:38:06
 ************************************************************************/

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))
#define prii pair<int,int>
#define prdd pair<double,double>
#define rep(i,l,r) for(int i = l;i < r;i++)
#define rep_(i,l,r) for(int i = l;i <= r;i++)
typedef long long ll;

const int maxn = 1000010;
ll c[1010];
int vis[maxn];
ll t[maxn];

int main() {
	int n,k;
	scanf("%d%d",&n,&k);
	rep_(i,1,n) {
		scanf("%lld",&c[i]);
		c[i] += c[i-1];
	}
	int cnt = 0;
	rep_(i,1,n) {
		rep_(j,i,n) {
			t[cnt++] = c[j]-c[i-1];
		}
	}

	ll ans = 0;
	for(int b = 50;b >= 0;b--) {
		int tmp = 0;
		for(int i = 0;i < cnt;i++) {
			if(!vis[i] && ((1LL<<b)&t[i])) tmp++;
		}
		if(tmp >= k) {
			ans += (1LL<<b);
			for(int i = 0;i < cnt;i++) {
				if(((1LL<<b)&t[i]) == 0) vis[i] = 1;
			}
		}
	}

	printf("%lld\n",ans);
	return 0;
}


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

#define NOANSWER "UNRESTORABLE"

int             check_hint(char *key, char *hint)
{
        int i = 0;

        while (hint[i])
        {
                if (key[i] != '?' && key[i] != hint[i])
                        return (0);
                i++;
        }
        return (1);
}

void    print_answer(char *key, char *hint, int first)
{
        int i;

        for (i = 0; i < first; i++)
        {
                if (key[i] == '?')
                        write(1, "a", 1);
                else
                        write(1, &key[i], 1);
        }
        while (*hint)
        {
                write(1, hint, 1);
                hint++;
                i++;
        }
        while (key[i])
        {
                if (key[i] == '?')
                        write(1, "a", 1);
                else
                        write(1, &key[i], 1);
                i++;
        }
        write(1, "\n", 1);
}



int             main(void)
{
        char    key[51];
        char    hint[51];
        int             first = -1;
        int             max;
        int             i;

        scanf("%s%s", key, hint);
        max = strlen(key) - strlen(hint);
        for (i = 0; i <= max; i++)
        {
                if (check_hint(&key[i], hint))
                        first = i;
        }
        if (first == -1)
        {
                printf("%s\n", NOANSWER);
                return (0);
        }
        print_answer(key, hint, first);
        return (0);
}

Measured memory_bytes: 1640
using System;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine(FiveAntennas());
    }

    private static string FiveAntennas()
    {
        int[] antennas = new int[5];
        int k = 0;

        readData(antennas, ref k);

        for (int i = 0; i < antennas.Length - 1; i++)
        {
            for (int j = i + 1; j < antennas.Length; j++)
            {
                if (antennas[j] - antennas[i] > k) return ":(";
            }
        }
        return "Yay!";
    }

    /// <summary>
    /// データを読み込む
    /// </summary>
    private static void readData(int[] antennas, ref int k)
    {
        for (int i = 0; i < antennas.Length; i++)
        {
            antennas[i] = int.Parse(Console.ReadLine());
        }

        k = int.Parse(Console.ReadLine());
    }
}




Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#define PI 3.1415926535
using namespace std;
int main()
{
    int n,k,temp,len;
    string s,out;
    double a,b,h,m,jiao,first,second,third,forth,fifth;
    double ans=1.114514;
    cin>>a>>b>>h>>m;
    //先处理hour，顺时针相对0的度数
    first=30.0*h;
    //second是相对0分，分针走了多少度，
    second=6*m;
    //分针走了，时针也要走，算上时针走的
    third=m/2;
    //forth是真正的时针度数
    forth=first+third;
    //fifth是最终夹角
    fifth=abs(forth-second);
    if(fifth>=180)
        fifth=360-fifth;
    if(fifth==0)
        ans=abs(a-b);
    else if(fifth==180)
        ans=a+b;
    else
    {
        jiao=(PI/180)*fifth;
        ans=sqrt(a*a+b*b-2*a*b*cos(jiao));
    }

    cout.precision(12);
    cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 4080
import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )

getParm :: IO [Int]
getParm = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  [a,b] <- getParm
  print $ numOfPlndrm a b

numOfPlndrm
  :: Int -> Int -> Int
numOfPlndrm a b = length . filter id . map isP $ [a .. b]

isP
  :: Int -> Bool
isP n = n == revInt n

revInt
  :: Int -> Int
revInt = read . C.unpack . C.reverse . C.pack . show

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

int main(){
    int n;
    cin >> n;
    int a[n];
    cin >> a[0];
    int sum = a[0];
    for(int i=1;i<n;i++){
        cin >> a[i];
        sum ^= a[i];
    }
    for(int i=0;i<n;i++)cout << (sum^a[i]) << " ";
}

Measured memory_bytes: 4372
//be naame khodaa
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
#define F first
#define S second
#define pb push_back

inline int in(){int x, y; y = scanf("%d", &x); return x;}

const int N = 200002;

int par[N], sz[N];

int root(int v) { return par[v] == -1 ? v : par[v] = root(par[v]); }

bool merge(int u, int v) {
	u = root(u);
	v = root(v);
	if(u == v)
		return false;
	if(sz[u] < sz[v])
		swap(u, v);
	sz[u] += sz[v];
	par[v] = u;
	return true;
}

int main(){
	int n = in();
	fill(par, par + n, -1);
	fill(sz, sz + n, 1);
	for(int q = in(); q; q--)
	{
		if(in() == 0)
			merge(in(), in());
		else
			cout << (root(in()) == root(in())) << "\n";
	}
		
    return 0;
}




Measured memory_bytes: 3308
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
        n: usize,
        m: usize,
        pys: [(usize, usize); m],
    }

    let mut vs = vec![vec![]; n];

    for (i, &(p, y)) in pys.iter().enumerate() {
        vs[p - 1].push((y, i));
    }

    for v in &mut vs {
        v.sort();
    }

    let mut a = vec![(0, 0); m];
    for (p, v) in vs.iter().enumerate() {
        for (c, &(_y, i)) in v.iter().enumerate() {
            a[i] = (p + 1, c + 1);
        }
    }

    for (p, c) in a {
        println!("{:>06}{:>06}", p, c);
    }
}


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

int main() {
  int N;
  cin>>N;
  vector<int> high(N);
  for(int i=0;i<N;i++){
    cin>>high.at(i);
  }
  
  vector<int> cost(N);
  cost.at(0)=0;
  cost.at(1)=abs(high.at(1)-high.at(0));
    for(int i=2;i<N;i++){
      cost.at(i)=min(cost.at(i-1)+abs(high.at(i)-high.at(i-1)),cost.at(i-2)+abs(high.at(i)-high.at(i-2)));
    }
  
  cout<<cost.at(N-1);
    
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{

  int H,W,i,j;
  scanf("%d %d", &H, &W);

 while(H != 0 || W != 0){
 for(i = 1; i <= H; i++){
  for(j = 1; j <= W; j++){
  printf("#");
 } 
  printf("\n");
 } 
 scanf("%d %d", &H, &W);
 printf("\n");
 }

 return 0;
}  

Measured memory_bytes: 572
#include <iostream>
using namespace std;
void ABC60(void);
void ABC61(void);
void ABC62(void);
void ABC63(void);
void ABC64(void);
void ABC65(void);
void ABC66(void);
void ABC67(void);
void ABC68(void);
void ABC69(void);

int main(void){
    ABC61();
}

void ABC61(void){
    int a,b,c;
    cin>>a>>b>>c;
    if(c>=a&&c<=b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define cal(x,y) ((x+=y)%=mo)
using namespace std;
const int N=5050,mo=1e9+7;
inline int gi() {
  char ch=getchar(); int q=0,x=0;
  while(ch<'0'||ch>'9') q=(ch=='-'?1:q),ch=getchar();
  while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
  return q?(-x):x;
}
int head[N],nn[N<<1][2],f[N][N],siz[N],tmp[N],g[N],cnt;
#define link(u,v) (nn[++cnt][1]=v,nn[cnt][0]=head[u],head[u]=cnt)
void dfs(int x,int fa){
  f[x][1]=1,siz[x]=1;
  for (int t=head[x],y; t; t=nn[t][0])
    if ((y=nn[t][1])!=fa){
      dfs(y,x);
      for (int i=1; i<=siz[x]+siz[y]; ++i)
	tmp[i]=0;
      for (int i=1; i<=siz[x]; ++i)
	for (int j=1; j<=siz[y]; ++j){
	  cal(tmp[i],mo-1ll*f[x][i]*f[y][j]%mo*g[j]%mo);
	  cal(tmp[i+j],1ll*f[x][i]*f[y][j]%mo);
	}
      siz[x]+=siz[y];
      for (int i=1; i<=siz[x]; ++i)
	f[x][i]=tmp[i];
    }
  return;
}
int main(){
  int n=gi(),u,v;
  for (int i=1; i<n; ++i)
    u=gi(),v=gi(),link(u,v),link(v,u);
  g[0]=g[1]=1;
  for (int i=2; i<=n; ++i)
    g[i]=1ll*g[i-2]*(i-1)%mo;
  for (int i=1; i<=n; i+=2)
    g[i]=0;
  dfs(1,0);
  int ans=0;
  for (int i=1; i<=n; ++i)
    cal(ans,1ll*f[1][i]*g[i]%mo);
  cout<<ans;
  return 0;
}

Measured memory_bytes: 98560