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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Yes or No
void yesno(bool ok, string yes = "Yes", string no = "No") {
  cout << (ok ? yes : no) << endl;
}

// Paste snippets here!!
// 約数を全列挙する
template <class INT_T>
vector<INT_T> enum_divisors(INT_T n){
  vector<INT_T> div;
  for(int i=1;i<(int)sqrt(n)+1;i++){
    if(n%i==0){
      div.push_back(i);
      if(i!=(n/i)) div.push_back(n/i);
    }
  }
  return div;
}
//

void solve(long long N) {
  ll ret = 0;
  rep(i,1,N+1){
    if(i%2==1) if(enum_divisors(i).size()==8) ret++;
  }
  cout << ret << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  cout.precision(12);
  long long N;
  std::cin >> N;
  solve(N);
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
using ll = long long;
using ull = unsigned long long;

int main() {
  int n,m;
  cin>>n>>m;
  vector<vector<int>> blub;
  vector<int> cond(m);
  rep(i, m) {
    int k;
    cin>>k;
    vector<int> sw(k);
    rep(j, k) {
      int t;
      cin>>t;
      t--;
      sw[j] = t;
    }
    blub.push_back(sw);
  }
  rep(i,m) {
    cin>>cond[i];
  }
  int ans = 0;
  for(int b = 0; b < (1 << n); b++) {
    vector<int> asws;
    rep(i, n) {
      if (b & (1 << i)) {
        asws.push_back(i);
      }
    }
    bool elg = true;
    rep(i, m) {
      int on = 0;
      rep(j, asws.size()) {
        if (contains(blub[i], asws[j])) on++;
      }
      if (on % 2 != cond[i]) elg = false;
    }
    if (elg) {
      ans++;
    }
  }
  cout << ans;
}


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

int main() {
  long int K, X, max, min;
  cin >> K >> X;
  if(X - K + 1 >= -1000000){
    min = X - K + 1;
  }else{
    min = -1000000;
  }
  if(X + K - 1 <= 1000000){
    max = X + K - 1;
  }else{
    max = 1000000;
  }
  for(int i = min; i < max + 1; i++){
    cout << i;
    if(i != K + X - 1){
      cout << " ";
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
ll r,g;
cin>>r>>g;
cout << 2 * g - r << endl;
}

Measured memory_bytes: 3596
n,h=map(int,input().split())
att=[]
for i in range(n):
    att.append(list(map(int,input().split())))
att=sorted(att,reverse=True)

sel=[]
M=att[0][0]
for i in range(n):
    if att[i][1]>M:
        sel.append(att[i])

sum=0
turn=0
att=sorted(sel,reverse=True,key=lambda x: x[1])

for i in range(len(att)):
    sum += att[i][1]
    turn += 1
    if sum >= h:
        break
if sum < h:
    turn += (h-sum)//M
    if (h-sum)%M!=0:
        turn += 1
print(turn)

Measured memory_bytes: 30424
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cctype>
using namespace std;
int main(){
    string x,y,z;cin>>x>>y>>z;
    cout << (char)toupper(x[0])<<(char)toupper(y[0])<<(char)toupper(z[0])<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int h, w;
    cin >> h >> w;
    vvint a(h, vint(w));
    rep(i, h) rep(j, w) cin >> a[i][j];
    
    vvint ans;
    rep(i, h) rep(j, w) {
        if (a[i][j] % 2 == 0) continue;
        vint ans_t(4, 0);
        if (j <= w-2 && a[i][j+1] % 2 == 1) {
            a[i][j]--; 
            a[i][j+1]++;
            ans_t = {i+1, j+1, i+1, j+2}; 
        }
        else if (i <= h-2 && a[i+1][j] % 2 == 1) {
            a[i][j]--; 
            a[i+1][j]++; 
            ans_t = {i+1, j+1, i+2, j+1}; 
        }
        else if (j <= w-2) {
            a[i][j]--; 
            a[i][j+1]++; 
            ans_t = {i+1, j+1, i+1, j+2}; 
        }
        else if (i <= h-2) {
            a[i][j]--; 
            a[i+1][j]++; 
            ans_t = {i+1, j+1, i+2, j+1}; 
        }
        if (ans_t[0] != 0) ans.push_back(ans_t);
    }

    int n = ans.size();
    cout << n << endl;
    rep(i, n) {
        rep(j, 4) {
            cout << ans[i][j];
            if (j < 3) cout << " ";
            else cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 9904
import math
a ,b ,x = list(map(int,input().split()))
if a**2 * b / 2 >= x:
    l = 2*x/a/b
    cos_m = (b**2+l**2)**(1/2)
    arccos1 = math.acos(l/cos_m)
    print(math.degrees(arccos1))
else:
    L = 2/a**2 *(a**2*b -x)
    Cos_m =(L**2 +a**2)**(1/2)
    arccos2 = math.acos(a/Cos_m)
    print(math.degrees(arccos2))


Measured memory_bytes: 3060
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { x.modm(y.modpow(mod - 2)); }

void main()
{
	auto N = RD;
	
	foreach (i; 0..N)
		write("a");
	writeln();

	void f(long n, char c)
	{
		foreach_reverse (i; 1..n)
		{
			string pre;
			foreach (j; 0..i)
				pre ~= c;
			pre ~= cast(char)(c+1);

			debug writeln("i:", i);
			void g(string str, long remain, char d)
			{
				if (remain == 0)
				{
					writeln(pre ~ str);
					return;
				}

				foreach (i; 'a'..cast(char)(d+1))
				{
					g(str ~ i, remain-1, cast(char)max(d, i+1));
				}
			}
			g("", N-i-1, cast(char)(c+2));
		}
	}
	f(N, 'a');

	stdout.flush;
	debug readln;
}

Measured memory_bytes: 2556
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;

int main(){
  double  W,H,x,y;
  cin >> W >> H >> x >> y;
  int flag = 0;
  if(x == W/2 && y == H/2) flag = 1;
  cout << W * H / 2 << " " << flag << endl;
}


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

using namespace std;

int main() {
    int k,x,i;
    cin>>k>>x;
    set<int> s;
    set<int>::iterator itr;
    if (k==1){
        cout<<x;
    }else{
        for(i=1;i<k;i++){
            s.insert(x-i);
            s.insert(x+i);
        }
        s.insert(x);
        for (itr=s.begin(); itr != s.end(); ++itr) 
        { 
            cout << *itr<<" "; 
        }    
    }
}

Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
constexpr int MOD = 1e9 + 7;
inline void upd(int &x, const int &y) { (x += y) >= MOD ? (x -= MOD) : 0; }
int dp[605][605], nxt[605][605], arr[605], app[605];
int main()
{
	// freopen("AGC030-F.in", "r", stdin);
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n << 1; i++)
	{
		scanf("%d", arr + i);
		if (~arr[i])
			app[--arr[i]] = 1;
	}
	for (int i = 0; i < n; i++)
	{
		if (~arr[i << 1] && ~arr[i << 1 | 1])
			app[arr[i << 1]] = app[arr[i << 1 | 1]] = -1;
	}
	dp[0][0] = 1;
	for (int t = 0; t < n << 1; t++)
	{
		if (app[t] == -1)
			continue;
		memset(nxt, 0, sizeof(nxt));
		if (!app[t])
		{
			for (int i = 0; i <= n << 1; i++)
			{
				for (int j = 0; j <= n << 1; j++)
				{
					if (!dp[i][j])
						continue;
					upd(nxt[i + 1][j], dp[i][j]);
					upd(nxt[i][j + 1], dp[i][j]);
					if (j)
						upd(nxt[i][j - 1], dp[i][j]);
				}
			}
		}
		else
		{
			for (int i = 0; i <= n << 1; i++)
			{
				for (int j = 0; j <= n << 1; j++)
				{
					if (!dp[i][j])
						continue;
					if (i)
						upd(nxt[i - 1][j], (long long)dp[i][j] * i % MOD);
					upd(nxt[i][j + 1], dp[i][j]);
				}
			}
		}
		memcpy(dp, nxt, sizeof(nxt));
	}
	int ans = dp[0][0], cnt = 0;
	for (int i = 0; i < n; i++)
	{
		if (-1 == arr[i << 1] && -1 == arr[i << 1 | 1])
			ans = (long long)ans * ++cnt % MOD;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 3072
#include<iostream>
#include<algorithm>
using namespace std;
const int M=100000+5;
int n,a,b[M]={0},c[M]={0};
int main()
{
	cin>>n;
	for(int i=0;i<n;i++){
		scanf("%d",&a);
		c[a]++;
	}
	for(int i=1;i<M;i++)
		b[i]=c[i-1]+c[i]+c[i+1];
	int max=0;
	for(int i=0;i<M;i++)
		if(b[i]>max) max=b[i];
	cout<<max<<endl;
	return 0; 
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<iterator>
#include<string>
#include<queue>

using namespace std;

int main(){
    int N,M;
    cin>>N>>M;
    int g=0;
    for(int i=1;i<1e5;i++){
        if(M%i==0){
            int j=M/i;
            if(j>=N){
                g=max(g,i);
            }
            if(i>=N){
                g=max(g,j);
            }
        }
    }
    cout<<g<<endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static public void main(String args[]){
        final int INF = (int)1e10;

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();

        long[] h = new long[n];
        long[] dp = new long[n];
        for(int i = 0; i < n ; i++){
            h[i] = sc.nextLong();
            dp[i] = INF;
        }
        dp[0] = 0;

        for(int i = 0 ; i < n-1 ; i++){
            for(int j = 1 ; j <= k ; j++) {
                if (i + j < n) {
                    dp[i + j] = Math.min(dp[i + j], dp[i] + Math.abs(h[i + j] - h[i]));
                }
            }
        }

        System.out.println(dp[n-1]);
    }
}


Measured memory_bytes: 61812
import java.io.*;
import java.util.*;

public class Main {

    final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    public static void main(String[] args) {
        new Main().run();
        // Sworn to fight and die
    }

    void init() throws FileNotFoundException {
        if (1 > 0) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            init();
            solve();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time = " + (t2 - t1));
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    public void solve() throws IOException {
        int n = readInt();
        int a = readInt();
        int b = readInt();

        int diff = Math.abs(a - b);

        if (diff % 2 == 0) {
            out.println("Alice");
        } else {
            out.println("Borys");
        }
    }
}

Measured memory_bytes: 22996
import copy


if __name__ == '__main__':
    N = int(input())
    X_list = list(map(int, input().split()))
    tmp_X_list = copy.deepcopy(X_list)
    tmp_X_list = sorted(tmp_X_list)
    med_minus1 = tmp_X_list[N//2-1]
    med_plus1 = tmp_X_list[N//2]

    answer = -1
    for i in range(0, N):
        if X_list[i] <= med_minus1:
            answer = med_plus1
        elif X_list[i] >= med_plus1:
            answer = med_minus1

        print(answer)


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

#include <algorithm>
#include <array>
#include <chrono>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

#define ll long long
#define ld long double
#define P pair<ll, ll>
#define FOR(i, n, m) for (ll i = n; i < (ll)m; i++)
#define FORr(i, m, n) for (ll i = n; i >= (ll)m; i--)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define sortAl(v) sort(v.begin(), v.end())
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())
#define cout(n) cout << fixed << setprecision(n)

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

  ll r;
  cin >> r;

  if (r < 1200) {
    cout << "ABC" << endl;
  } else if (r < 2800) {
    cout << "ARC" << endl;
  } else {
    cout << "AGC" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import math
def main():
    A, B, N = map(int, input().split())
    ans = 0
    if N < B:
        ans = math.floor((A*N)/B) - A*math.floor(N/B)
    else:
        ans = math.floor((A*(B-1)/B)) - A*math.floor((B-1)/B)
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9148
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;
int main()
 {
	int x,a,b[26];
	for(a=0;a<26;a++)
	   b[a]=0;
	string s;
	cin>>s;
	for(a=0;a<s.length();a++)
	   {
	       b[s[a]-97]++;
	   }
	for(a=0;a<26;a++)
	   {
	       if(b[a]==0)
	         {
	             cout<<char(97+a)<<endl;
	             return 0;
	         }
	   }
	cout<<"None"<<endl;   
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

#define H 251

int main(void){
    int n, i, A[H];
    
    scanf("%d", &n);
    
    for (i = 1; i <= n; i++) {
        scanf("%d", &A[i]);
    }
    
    for (i = 1; i <= n; i++) {
        printf("node %d: key = %d, ", i, A[i]);
        if (i != 1) {
            printf("parent key = %d, ", A[i / 2]);
        }
        if (2 * i <= n) {
            printf("left key = %d, ", A[2 * i]);
        }
        if (2 * i + 1 <= n) {
            printf("right key = %d, ", A[2 * i + 1]);
        }
        printf("\n");
    }
    
    return 0;
}




Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define lg length()
#define pb push_back
ifstream in("file.in");
ofstream out("file.out");
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

int n,m;

char a[10][10],t[10][10];

int main() {
    cin >> n >> m;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin >> a[i][j];
            t[i][j]='.';
        }
    }
    int x=1,y=1; t[x][y]='#';
    while(x!=n || y!=m){
        if(x<n && a[x+1][y]=='#') x++;
        else if(y<m && a[x][y+1]=='#') y++;
        else{
            cout << "Impossible";
            return 0;
        }
        //cout << x << ' ' << y << '\n';
        t[x][y]='#';
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(a[i][j]!=t[i][j]){
                cout << "Impossible";
                return 0;
            }
        }
    }
    cout << "Possible";
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

Int dp[3300][2];
Int h, w, n, x, y;
vector<P> wall;

Int fact[1100000], invfact[1100000], inv[1100000];

void init(){
    fact[0] = 1;
    for(int i = 1;i < 1100000;i++)fact[i] = fact[i-1] * i % MOD;
    inv[1] = 1;
    for(int i = 2;i < 1100000;i++){
        //MOD / i * i + MOD % i = 0
        //MOD / i * i = - (MOD % i);
        //inv[MOD/i] * inv[i] = - inv[MOD%i];
        inv[i] = -inv[MOD%i] * (MOD / i) % MOD;
        if(inv[i] < 0)inv[i] += MOD;
    }
    invfact[0] = 1;
    for(int i = 1;i < 1100000;i++){
        invfact[i] = invfact[i-1] * inv[i] % MOD;
    }
}

Int nCk(Int n, Int k){
//    n!/k!/(n-k)!
    return fact[n] * invfact[k] % MOD * invfact[n-k] % MOD;      
}

Int route(P a, P b){
    int x = b.first - a.first;
    int y = b.second - a.second;
    if(x < 0 || y < 0)return 0;
    return nCk(x + y, x);
                                  
}

int main(){
    init();
    cin >> h >> w >> n;
    for(int i = 0;i < n;i++){
        cin >> x >> y;
        wall.push_back(P(x,y));
    }
    wall.push_back(P(1,1));
    sort(wall.begin(), wall.end());
    dp[0][0] = 1;
    for(int i = 1;i <= n;i++){
        for(int j = 0;j < i;j++){
            dp[i][0] += dp[j][1] * route(wall[j], wall[i]) % MOD;
            dp[i][0] %= MOD;
            dp[i][1] += dp[j][0] * route(wall[j], wall[i]) % MOD;
            dp[i][1] %= MOD;
        }
    }

    P goal = P(h, w);
    Int ban = 0;
    for(int i = 1;i <= n;i++){
        ban -= dp[i][0] * route(wall[i], goal) % MOD;
        ban += dp[i][1] * route(wall[i], goal) % MOD;
        ban %= MOD;
    }
    Int ans = (nCk(h+w-2, h-1) - ban) % MOD;
    if(ans < 0)ans += MOD;
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 26240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
    vector<int> a(3);
    for(int i=0; i<3; i++) cin >> a[i];

    sort(a.begin(), a.end());
    if(a[0]+a[1] == a[2]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<deque>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

using namespace std;

#define DBG cerr << '!' << endl;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int sum[100010];
bool ok[100010];
bool isp[100010];

void func()
{
	isp[0] = isp[1] = true;
	for(int i = 2;i < 10000;i++)
	{
		if(!isp[i])
		{
			for(int j = 2*i;j < 100010;j += i)isp[j] = true;
		}
	}
	
	for(int i = 1;i < 100010;i++)
	{
		if(!isp[i] && !isp[(i+1)/2])ok[i] = true;
	}
	
	for(int i = 1;i < 100010;i++)
	{
		sum[i] = sum[i-1];
		if(ok[i])sum[i]++;
	}
	
}

int main()
{
	func();
	
	int q;cin >> q;
	
	REP(i,q)
	{
		int a,b;scanf("%d %d",&a,&b);
		printf("%d\n",sum[b] - sum[a-1]);
	}
	
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>


// #define INT_MAX 2147483647
// #define LL_MAX 9223372036854775807

using namespace std;
#define i64  long long

void solve(void)
{

  vector<int> vec;
  int count = 0;

  while(true)
  {

    int n;
    cin>>n;
    if(n == 0) break;    
    count++;
    vec.push_back(n);

  }

  for (int i = 0; i < count; i++)
  {
    cout<<"Case "<<i+1<<": "<<vec[i]<<endl;
  }
  
  
  
  
  return;
}
int main(int argc, const char *argv[])
{

  solve();

  return 0;
}



Measured memory_bytes: 3252
import java.io.*;
import java.util.*;
class Main{
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int l = saori.saori_hayami();
		String[] s = new String[n];

		for(int i = 0; i < n;i++){
			s[i] = saori.nextHayami();
		}
		Arrays.sort(s);
		String str = String.join("", s);
		System.out.println(str);
		
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
#define PII pair<int,int>
#define ls x<<1
#define rs x<<1|1
#define fi first
#define se second
#define pb push_back
#define cwk freopen("D:\\c++\\in.txt","r",stdin),freopen("D:\\c++\\out.txt","w",stdout)
using namespace std;
const int N=1e6+10;
const int mod=1e9+7;
ll n,k;
ll sum[N];
ll ksm(ll a,ll b) {
	ll res=1,t=a;
	while(b) {
		if(b&1) res=(res*t)%mod;
		t=(t*t)%mod;
		b>>=1;
	}
	return res;
}
int main()
{
	//cwk;
	scanf("%lld%lld",&n,&k);
	for(ll i=k;i>=1;i--) {
		ll gs=k/i;
		ll temp=ksm(gs,n);
		for(ll j=2*i;j<=k;j+=i) {
			temp=(temp-sum[j]+mod)%mod;
		}
		sum[i]=temp;
	}
	ll ans=0;
	for(int i=1;i<=k;i++) {
		ans=(ans+(1ll*i*sum[i])%mod)%mod;
	}
	printf("%lld\n",ans);

	return 0;
}

Measured memory_bytes: 4540
import java.util.Scanner;

public class Main {

	private void solve() {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int[] A = new int[N];
		int[] B = new int[N];
		int[] C = new int[N-1];
		for (int i = 0; i < A.length; i++) {
			A[i] = in.nextInt()-1;
		}
		for (int i = 0; i < B.length; i++) {
			B[i] = in.nextInt();
		}
		for (int i = 0; i < C.length; i++) {
			C[i] = in.nextInt();
		}
		
		int total = 0;
		int prev = -100;
		for (int i = 0; i < A.length; i++) {
			total += B[A[i]];
			if(A[i] == prev+1) {
				total += C[prev];
			}
			prev = A[i];
		}
		System.out.println(total);
 	}
	
	public static void main(String[] args) {
		new Main().solve();
	}
}



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

using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define fi first
#define si second
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n) for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
const int nax = 5e3;
const int mod = 1e9+7;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int a[5];
	F(a, 5);
	for(int i=0; i<5; i++){
		if(a[i] == 0){
			cout<<i+1;
			return 0;
		}
	}
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int a, b, t;
	cin >> a >> b >> t;
	cout << (t/a)*b << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>

using namespace std;

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

int main(){
    int x, a, b;

    cin >> x >> a >> b;

    int da = abs(x-a);
    int db = abs(x-b);

    if(da<db){
        cout << "A" << endl;
    } else {
        cout << "B" << endl;
    }
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


string S;
int N;
ll mo=998244353;
ll dp[202020][2][3][3];

void solve() {
	int i,j,k,l,r,x,y,z; string s;
	
	cin>>S;
	N=S.size();
	
	if(N<=7) {
		set<string> T,R;
		T.insert(S);
		while(T.size()) {
			set<string> U;
			FORR(t,T) {
				R.insert(t);
				FOR(i,N-1) {
					if(t[i]!=t[i+1]) {
						string a=t;
						a[i]=a[i+1]='a'+'b'+'c'-a[i]-a[i+1];
						if(R.count(a)==0) {
							U.insert(a);
							R.insert(a);
						}
					}
				}
				
			}
			T=U;
		}
		cout<<R.size()<<endl;
		return;
	}
	
	int cnt[3]={};
	int tot=0;
	FORR(c,S) {
		c-='a';
		cnt[c]++;
		tot+=c;
	}
	
	if(cnt[0]==N || cnt[1]==N || cnt[2]==N) return _P("1\n");
	
	dp[1][0][0][0]=1;
	dp[1][0][1][1]=1;
	dp[1][0][2][2]=1;
	for(i=1;i<N;i++) {
		
		FOR(j,2) FOR(x,3) FOR(y,3) FOR(z,3) {
			(dp[i+1][j|(x==z)][z][(y+z)%3]+=dp[i][j][x][y])%=mo;
		}
	}
	
	ll ret=1;
	FOR(i,3) ret+=dp[N][1][i][tot%3];
	FOR(i,N-1) if(S[i]==S[i+1]) {
		ret--;
		break;
	}
	cout<<ret%mo<<endl;
	
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 28692
#include <bits/stdc++.h>
#include <set>
using namespace std;
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define fill(x, y)     memset(x, y, sizeof(y))
#define all(x)         (x).begin(), (x).end()
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;

const int INF = 1e9 + 5;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vi a(N); vi b(N); vi c(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }
  
  vi dp(3, INF);
  dp[0] = a[0];
  dp[1] = b[0];
  dp[2] = c[0];
  for (int i = 1; i < N; i++) {
    int aa = max(dp[1] + a[i], dp[2] + a[i]);
    int bb = max(dp[0] + b[i], dp[2] + b[i]);
    int cc = max(dp[0] + c[i], dp[1] + c[i]);
    dp[0] = aa; dp[1] = bb; dp[2] = cc;
  }
  cout << max(dp[0], max(dp[1], dp[2])) << "\n";


  return 0;
}

Measured memory_bytes: 4468
#include <stdio.h>
#include <math.h>

#pragma warning(disable:4996)


typedef struct {int X; int Y;} Point;

int main() {
	Point point;

	int N, D;
	(void)scanf("%d%d", &N, &D);


	int sum = 0;

	for (int i = 0; i < N; i++) {
		(void)scanf("%d%d", &point.X, &point.Y);
		double Buffer = (double)point.X * (double)point.X + (double)point.Y * (double)point.Y;
		if (sqrt(Buffer) <= D) sum++;
	}
	printf("%d", sum);
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define Number 1000000007
using namespace std;
unsigned long long int calcmod(long int N,long int M);
int main(void){
    // Here your code !
    long int N,M;
    cin >> N >> M;
    if(abs(N-M)==0){
    cout << (calcmod(N,Number)*calcmod(M,Number)*2)%(Number) << "\n";
        return 0;
        
    }else if(abs(N-M)==1){
        cout << (calcmod(N,Number)*calcmod(M,Number))%(Number) << "\n";
        return 0;
        
    }else{
        cout << 0 << "\n";
        
    }
    
    return 0;
}


unsigned long long int calcmod(long int N,long int M){
    
    
    if(N==0){
        return 1;
        
    }else{
        
        return (N*(calcmod(N-1,M)))%M;
    }
    
    
}

Measured memory_bytes: 3328
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<int Modulo = MOD>
struct Mint {

	lint val;
	constexpr Mint(lint v = 0) noexcept : val(v % Modulo) { if (val < 0) val += Modulo; }

	constexpr Mint& operator += (const Mint &r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint &r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint &r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint &r) noexcept {
		lint a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			lint t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}

	constexpr Mint operator + (const Mint &r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint &r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint &r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint &r) const noexcept { return Mint(*this) /= r; }

	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }

	constexpr bool operator == (const Mint &r) const noexcept { return val == r.val; }
	constexpr bool operator != (const Mint &r) const noexcept { return val != r.val; }

	friend ostream &operator << (ostream &os, const Mint<Modulo> &x) noexcept { return os << x.val; }
	friend istream &operator >> (istream &is, Mint<Modulo> &x) noexcept {
		lint tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	constexpr Mint<Modulo> modpow(lint n) noexcept {
		Mint res(1), tmp = val;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

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

	int N;
	cin >> N;

	vector<int> c(N);
	for (int i = 0; i < N; i++) cin >> c[i];
	sort(c.begin(), c.end());

	mint ans = 0;
	for (int i = 0; i < N; i++) {
		ans += mint(4).modpow(N - 1) * (N - i + 1) * c[i];
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(void)
{
  int a, b, c, d, e, k;
  
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  cin >> e;
  cin >> k;
  
  if(e-a > k){
    cout << ":(" << endl;
  }
  
  else{
    cout << "Yay!" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int X = scan.nextInt();
		int N = scan.nextInt();
		int p = 0;
		int min;
		int max;
		int[] result = new int[N];

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

		for(int i = 0;i < N;i++) {
			p = scan.nextInt();
			result[i] = p;
		}

		for(int i = 0;;i++) {
			min = X - i;
			for(int j = 0;j < N;j++) {
				if(result[j] == min) {
					break;
				}else if(j == N - 1) {
					System.out.println(min);
					System.exit(0);
				}
			}
			max = X + i;
			for(int j = 0;j < N;j++) {
				if(result[j] == max) {
					break;
				}else if(j == N - 1) {
					System.out.println(max);
					System.exit(0);
				}
			}
		}

	}
}

Measured memory_bytes: 27376
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
const int INF = 100000000;
const int MAX_N = 100;
typedef pair<int , int> P;
typedef long long ll;
 
int main () {
  string S, T;
  cin >> S >> T;
  int length = T.length();
  string tmp;
  tmp = T.substr(0, length-1);
  // cout << tmp << endl;
  if (S == tmp) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 3596
k = int(input())
nums = [i for i in range(1,10)]
if k < 10:
    print(k)
    exit(0)
    
for x in nums:
    d = x%10
    if d != 0:nums.append(x*10+d-1)
    if len(nums) == k:
        print(nums[-1])
        break
    nums.append(x*10+d)
    if len(nums) == k:
        print(nums[-1])
        break
    if d !=9:nums.append(x*10+d+1)
    if len(nums) == k:
        print(nums[-1])
        break

    
    

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

int main() {
	int R;
	cin >> R;
	if (R < 1200) {
		cout << "ABC";
	}
	else if (R < 2800) {
		cout << "ARC";
	}
	else {
		cout << "AGC";
	}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
s = [(i+1, N-i-1) for i in range((N-1) // 2 + 1)]
ss = [sum(list(map(int,list(str(v[0])[::1])))) + sum(list(map(int,list(str(v[1])[::1])))) for v in s]
print(min(ss))

Measured memory_bytes: 46044
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
const ll N=2e5+5;
vector<ll>ans;
int main()
{
    ll k,x;
    cin>>k>>x;
    k--;
    for(ll i=x-k;i<=x;i++)
        cout<<i<<" ";
    for(ll i=x+1;i<=x+k;i++)
        cout<<i<<" ";
   return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
signed main() {
	string s;
	while (cin >> s, s[0] != '#') {
		int p = s.size() - 1, d = 0;
		int a = 0, b = 1;
		while (p >= 0) {
			if (d == 0) {
				a = (s[p] == 't' ? 90 : 0);
			}
			else {
				b *= 2; a *= 2;
				if (s[p] == 't') {
					a += 90;
				}
				else {
					a -= 90;
				}
			}
			d++;
			p -= (s[p] == 't' ? 4 : 5);
		}
		while (a % 2 == 0 && b % 2 == 0) { a /= 2; b /= 2; }
		if (b == 1)cout << a << endl;
		else cout << a << '/' << b << endl;
	}
}


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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long a,b;
	string s;
	 a=0;
	 int n;
	 cin >> n;
	 map<string, int> mp;
	 for(int i = 0; i < n; i++) {
	  cin >> s;
	  sort(s.begin( ), s.end( ));
	  mp[s]++;
	 }
	 map<string, int>::iterator itr;
	 for(itr = mp.begin(); itr != mp.end(); itr++) {
	  if(itr->second>1) {
	   b=itr->second;
	   b=(b*(b-1))/2;
	   a=a+b;
	  }
     }
	 cout<<a;
	
	return 0;
}

Measured memory_bytes: 11264
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read() for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


T = read_col(5, 1)[0]

# 10に丸め込んで、一番最後に小さい値を求めれば良い

ans = 0

for t in T:
    if t % 10 == 0:
        ans += t
    else:
        ans += (t // 10 + 1) * 10

# print(ans)

tmp = [x % 10 for x in T if x % 10 != 0]

if tmp == []:
    ans += 10
else:
    ans += min(tmp)

print(ans-10)


Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <string>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
using namespace std;

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int x, y;
  cin >> y >> x;
  cout << x*y << endl;
  
  return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

int main(){
    int h, w, n;
    cin >> h >> w >> n;
    if(h>=w && n%h==0) cout<<n/h;
    else if(h>=w && n%h!=0) cout << n/h+1;
    else if(h<w && n%w==0) cout << n/w;
    else if(h<w && n%w!=0) cout << n/w+1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
    mint per(int n, int k) {
        return fact[n]*ifact[n-k];
    }
};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vl a(n);
    rep(i, n) cin >> a[i];
    vl sum(n+1);
    rep(i, n) {
        sum[i+1] = sum[i] + a[i];
    }
    mint ans = 0;
    rep(i, n) {
        mint res = sum[n] - sum[i+1];
        res *= a[i];
        ans += res;
    }
    
    pr(ans);
    return 0;
}


Measured memory_bytes: 6348
n = gets.chomp.to_i
as = gets.chomp.split(" ").map(&:to_i)
begin
  if as.include?(0)
    puts 0
    exit
  end
product = as.inject{ |a, b|
  c = a * b
  raise if c > 10**18
  c
}
rescue
    puts -1
else
  puts product
end

Measured memory_bytes: 23492
#include <iostream>

using namespace std;

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

    int odd_count = 0, even_count = 0, dividable_4_count = 0;

    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a % 2 == 0) {
            if (a % 4 == 0) {
                dividable_4_count++;
            } else {
                even_count++;
            }
        } else {
            odd_count++;
        }
    }

    if (odd_count == 0) {
        cout << "Yes" << endl;
        return 0;
    }    
    
    if (odd_count == dividable_4_count + 1) {
        if (even_count > 0) {
            cout << "No" << endl;
        } else {
            cout << "Yes" << endl;
        }
        return 0;
    } 

    if (odd_count > dividable_4_count + 1) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int h, n;
    int index[100000];
    int ans = 0;

    cin >> h >> n;
    for (int i = 0; i < n ;i++) {
        cin >> index[i]; 
        ans += index[i];
    }
    if (ans >= h) {
       cout << "Yes" << "\n";
    }
    else {
       cout << "No" << "\n";
    }

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A[3][3];
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> A[i][j];
		}
	}
	bool ok = true;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			for (int i2 = 0; i2 < 3; i2++) {
				for (int j2 = 0; j2 < 3; j2++) {
					if (A[i][j] - A[i2][j] != A[i][j2] - A[i2][j2]) {
						ok = false;
					}
				}
			}
		}
	}
	if (ok) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256