akhauriyash/Code-Regression huggingface dataset:
# 焼きなまし（2500から線形に落とす）

from time import time
from math import exp
key = 1
rnd_mod = 12345678901234567891
rnd_x = 9876543210987654321 + 1234567890123456789 * key % rnd_mod
def rnd():
    global rnd_x
    rnd_x = rnd_x**2 % rnd_mod
    return (rnd_x>>10) % (1<<40)
def randrange(a, b=-1):
    if b > 0: return randrange(b-a) + a
    return rnd() % a

def calc():
    s = 0
    last = [-1] * 26
    for i, t in enumerate(A):
        s += S[i][t]
        last[t] = i
        for j, c in enumerate(C):
            s -= c * (i - last[j])
    return s

sTime = time()
D = int(input())
C = [int(a) for a in input().split()]
S = [[int(a) for a in input().split()] for _ in range(D)]
A = [randrange(26) for _ in range(D)]
# A = [0] * D
# A = [0, 16, 12, 13, 12]
# A = [0, 16, 12, 13, 19]
ans = calc()
# print("ans =", ans)

def day_all(d):
    global ans
    i = A[d]
    for k in range(d)[::-1]:
        if A[k] == i:
            prev = k
            break
    else:
        prev = -1
    for k in range(d + 1, D):
        if A[k] == i:
            prev_ne = k
            break
    else:
        prev_ne = D
    for j in range(26):
        t = S[d][j] - S[d][i]
        for k in range(d)[::-1]:
            if A[k] == j:
                new = k
                break
        else:
            new = -1
        for k in range(d + 1, D):
            if A[k] == j:
                new_ne = k
                break
        else:
            new_ne = D
        t += C[j] * (d - new) * (new_ne - d) - C[i] * (d - prev) * (prev_ne - d)
        if (T < 1 and t > 0) or (T >= 1 and randrange(1 << 10) < exp(max(min(t / T, 0), -10)) * (1 << 10)):
            A[d] = j
            ans += t
            prev, prev_ne = new, new_ne
            i = j
            if 0:
                print("A =", A)
                print("ans =", ans)
                print("calc =", calc())

ans = 0
while time() - sTime < 1.8:
    T = 2500 * max(1 - (time() - sTime) / 1.6, 0)
    d = randrange(D)
    day_all(d)
            

print(*[a + 1 for a in A], sep = "\n")
if 0:
    print(ans)
    print("A =", A)


Measured memory_bytes: 76820
N,M = map(int, input().split())
'''
table = [0 for i in range(N)]

for loop in range(gyou):
    a = list(map(int, input().split()))
    for loop2 in range(retu):
        table[loop][loop2] = a[loop2]
sum = [0,0,0]
for one in range(retu):
    b = int(input())
    for two in range(gyou):
        sum[two] = sum[two] + table[two][one] * b

for three in range(gyou):
    print(sum[three])

'''

A = [[] for i in range(N)]

for i in range(N):
    A[i] = list(map(int,input().split()))

B = [[0]*1 for i in range(M)]

for i in range(M):
    B[i] = int(input())


for row in range(N):
    tmp = 0
    for col in range(M):
        tmp += A[row][col]*B[col]
    print("%d"%(tmp))


Measured memory_bytes: 6020
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int main(){
	int a,b; cin >> a >> b;
	if(b <= 500*a) puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
ll a,b;
//ld ;
//string s, t;
 
int main() {
  cin >> a >> b;
  ll s = min(a,b);
  ll n = max(a,b);
  for(ll i=0;i<n;i++){
    cout << s;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
n , m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
ans = []
for i in range(n):
    cnt = 0
    for j in range(m):
        if ab[j][0] == i+1 or ab[j][1] == i+1:
            cnt += 1
    ans.append(cnt)
for k in range(n):
    print(ans[k])

Measured memory_bytes: 9020
using System;
using System.Collections.Generic;
class Program
    {
    	static void Main(string[] args)
    	{
            int n = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');
            int[] a = new int[n];
            for (int i=0; i<n; i++) a[i] = int.Parse(s[i]);

            double ans = 0;
            for (int i=0; i<n; i++) ans += 1.0 / a[i];
            Console.WriteLine(1.0 / ans);

            
            
            
        }
    }
    //mcs Main.cs
    //mono Main.exe

Measured memory_bytes: 11092
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Joy
 */

#include <bits/stdc++.h>

#define REP(i, N) for (ll i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF ll(1e9)
#define INFL ll(1e18)
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int ctoi(char c) {return c - '0';}

class ERedAndGreenApples {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ll X, Y, A, B, C;
	    in >> X >> Y >> A >> B >> C;
	    priority_queue<ll> P, Q, R;
	    REP(i, A) {
	        ll a; in >> a;
	        P.push(a);
	    }
	    REP(i, B) {
            ll a; in >> a;
            Q.push(a);
        }
        REP(i, C) {
	        ll a; in >> a;
	        R.push(a);
	    }
	    ll x = 0, y = 0, z = 0;
	    ll ans = 0;
	    while (x + y + z < X + Y) {
	        ll p = P.top(), q = Q.top(), r = -1;
	        if (!R.empty()) r = R.top();
	        if (x == X) p = -1;
	        if (y == Y) q = -1;
	        if (p > q) {
	            if (p >= r) {
	                ans += p;
	                P.pop();
	                x++;
	            } else {
	                ans += r;
	                R.pop();
	                z++;
	            }
	        } else if (p < q) {
	            if (q >= r) {
	                ans += q;
	                Q.pop();
	                y++;
	            } else {
	                ans += r;
	                R.pop();
	                z++;
	            }
	        } else {
	            if (p < r) {
	                ans += r;
	                z++;
	                R.pop();
	            } else {
	                if (x < X) {
	                    ans += p;
	                    x++;
	                    P.pop();
	                } else {
	                    ans += q;
	                    y++;
	                    Q.pop();
	                }
	            }
	        }
	    }

	    out << ans << '\n';
	}
};


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

	ERedAndGreenApples solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3444
#include<iostream>
#include<cmath>

using namespace std;

int main(){

  int n;
  cin >> n;

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

  int min;
  min=a[0];
  for(int i=1;i<n;i++){
    if(min>a[i]){
      min=a[i];
    }
  }

  int co=1;

 
  for(int i=min;i>2;i-=2){
    bool flag=true;
    for(int k=0;k<n;k++){
      if(a[k]%i!=0){
	flag=false;
	break;
      }
    }
    if(flag){
      co=i;
      break;
    }
  }
  if(co==1){
    bool flag=true;
    for(int k=0;k<n;k++){
      if(a[k]%2!=0){
	flag=false;
	break;
      }
    }
    if(flag){
      co=2;
    }
  }
  cout << co << endl;

  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#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>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
const long long int mod1=1000000007;
const long long int mod2 = -1;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pp pop_back                                       
#define ff first
#define ss second
#define ll long long int
#define ull unsigned long long int
#define ordered_set tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define ordered1 tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define inf mod1
#define all(x) x.begin(),x.end()
ll gcd(ll a, ll b){
    ll c;
     while(b){
        c = b;
        b = a % b;
        a = c;
     }
     return a;
}
ll power1(ll a, ll b){
     if(b == 0) return 1;
     else if(b % 2) return a * power1(a, b - 1);
     else {
        ll temp = power1(a, b / 2);
        return temp * temp;
     }
}
ll power2(ll a, ll b, ll m){
     a %= m;
     if(b == 0) return 1;
     else if(b % 2) return (a * power2(a, b - 1, m)) % m;
     else{
        ll temp = power2(a, b / 2, m);
        return (temp * temp) % m;
     }
}
ll mod(ll x, ll p){
return (x % p + p) % p;
}
ll lcm(ll x, ll y){
return (x * y)/gcd(x, y);
}
ll f(ll n){
	if(n == 1){
		return 1;
	}
	else{
		return 1 + 2 * f(n / 2);
	}
}
int main(){
	fast;
	ll h = 1;
	//cin >> h;
    while(h--){
 	ll h, n;
 	cin >> h >> n;
 	ll a[n], b[n];
 	for(int i = 0; i < n; i++){
 		cin >> a[i] >> b[i];
 	}
 	ll cnt[h + 1];
 	cnt[h] = 0;
 	for(int i = 0; i < h; i++){
 		cnt[i] = mod1;
 	}
 	for(int i = h; i >= 0; i--){
 		for(int j = 0; j < n; j++){
 			cnt[max(0ll, i - a[j])] = min(cnt[max(0ll, i - a[j])], cnt[i] + b[j]);
 		}
 	}
 	cout << cnt[0] << endl;
}
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <set>
#include <algorithm>
using namespace std;

int main() {

    int n;
    int p[200000];
    int m[200000];

    cin >> n;
    for (int i = 0; i < n; ++i ) {
        cin >> p[i];

        if ( i == 0 ) {
            m[i] = p[i];
        }
        else {
            m[i] = min(m[i-1],p[i]);
        }
    }

    int ans = 0;
    for (int i = 0; i < n; ++i ) {
        if ( p[i] <= m[i]) {
            ++ans;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    ll N, sum = 0;
    cin >> N;
    vector<ll> a(3 * N);
    rep(i, 3 * N) cin >> a[i];
    sort(all(a));

    for (int i = 3 * N - 2, cnt = 0; cnt < N; cnt++, i -= 2) {
        sum += a[i];
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define pb push_back
#define sz(a) int(a.size())
#define re return
#define all(a) a.begin(),a.end()
using namespace std;
int nn[3]={10,10,10};
int main()
{
	int n,m;
	cin>>n>>m;
	int kg=0;
	for (int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		if (nn[a-1]!=10 && nn[a-1]!=b)  kg=1;
		nn[a-1]=b;
	}
	if (n==1 && nn[0]==0)  {cout<<0;re 0;}
	if (n==1 && nn[0]==10)  {cout<<0;re 0;}
	if (nn[0]==0)  kg=1;
	if (kg==1)  {cout<<-1;re 0;}
	if (nn[0]==10)  nn[0]=1;
	for (int i=1;i<n;i++)  if (nn[i]==10)  nn[i]=0;
	for (int i=0;i<n;i++)  cout<<nn[i];
	re 0;
}


Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, cos, radians, pi, sin
from operator import mul
from functools import reduce
from operator import mul


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


t = I()
for _ in range(t):
    n, a, b, c, d = LI()
    D = defaultdict(int)
    def f(x):
        if D[x]:
            return D[x]
        if x == 0:
            return 0
        if x == 1:
            return d
        ret = INF
        ret = min(ret, f(x // 2) + x % 2 * d + a)
        ret = min(ret, f(x // 3) + x % 3 * d + b)
        ret = min(ret, f(x // 5) + x % 5 * d + c)
        if x % 2:
            ret = min(ret, f(x // 2 + 1) + (2 - x % 2) * d + a)
        if x % 3:
            ret = min(ret, f(x // 3 + 1) + (3 - x % 3) * d + b)
        if x % 5:
            ret = min(ret, f(x // 5 + 1) + (5 - x % 5) * d + c)
        ret = min(ret, x * d)
        D[x] = ret
        return ret

    print(f(n))

Measured memory_bytes: 100804
#include<bits/stdc++.h>
using namespace std;
long long int ball(long long int n,long long int a,long long int b)
{
  long long int x,y,z;
  x=n/(a+b);
  y=n%(a+b);
  z=x*a;
  if(y>a)
    z+=a;
  else
    z+=y;
  return z;
}
int main()
{
  long long int n,a,b,res;
  cin>>n>>a>>b;
  res=ball(n,a,b);
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
import bisect
from operator import itemgetter
import math
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def gcd(a,b):
    while b % a:
        a,b = b, a % b
    return a

A,B,C,D = IL()

c = B//C - (A-1)//C
d = B//D - (A-1)//D
cd =B//(C*D//gcd(C,D)) - (A-1)//(C*D//gcd(C,D))

print((B-A+1)-(c+d)+cd)

Measured memory_bytes: 20584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#endif

const int MAXN = 1000006;
const ll MOD = 1000000007;

int n, v[MAXN];
/*********************GoodLuck***********************/
int main () {
    IOS();

    cin >> n;
    REP (i, n) {
        cin >> v[i];
    }
    sort(v, v+n);
    int ptr = 0;

    int ans = 0;
    REP (i, n) {
        while (ptr<n && v[ptr]-v[i]<3) {
            ptr++;
        }
        ans = max(ans, ptr-i);
    }

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


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

const long long MOD = 998244353;

int main() {
    long long n, a, b, k, result = 0;
    cin >> n >> a >> b >> k;
    long long factorial[n + 1], inv[n + 1], ifactorial[n + 1];
    factorial[0] = 1;
    ifactorial[0] = 1;
    factorial[1] = 1;
    ifactorial[1] = 1;
    inv[1] = 1;
    for (long long i = 2; i <= n; i++) {
        factorial[i] = factorial[i - 1] * i % MOD;
        inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
        ifactorial[i] = inv[i] * ifactorial[i - 1] % MOD;
    }
    function<long long(long long, long long)> C = [&](long long n, long long k) {
        return factorial[n] * ifactorial[k] % MOD * ifactorial[n - k] % MOD;
    };
    for (long long i = 0; i <= n && i * a <= k; i++) {
        if ((k - i * a) % b == 0) {
            long long j = (k - i * a) / b;
            if (j <= n) {
                result = (result + C(n, i) * C(n, j)) % MOD;
            }
        }
    }
    cout << result;
    return 0;
}

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

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << endl;}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}


signed main() {
    //my-code
    int n; cin >> n;
    vector<string> s(n); REP(i, n) cin >> s[i];
    map<string, int> mp;
    REP(i, n) {
        mp[s[i]]++;
    }
    cout << mp.size() << endl;

    return 0;
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 25116
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input().split())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input().split()) for _ in range(n) ]

# ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())

a,b,c = MI()
l = [a,b,c]
print(len(set(l)))

Measured memory_bytes: 77172
#include <cstdio>
#include <algorithm>    
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cstring>
#include <cmath>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int uii;
typedef pair<int,int> pii;
typedef unsigned long long uLL; 
typedef vector<int> vii; 
//__int128
const int maxn = 1e5 + 5;
const int M = 1e9 + 7;
LL d[205][maxn], f[205], finv[205];
bool vis[205][maxn];
int a[205];

LL qpow(LL a, LL p, LL n){
	LL res = 1;
	for(; p; a = a * a % n, p >>= 1) {
		if(p & 1) {
			res = res * a % n;
		}
	}
	return res;
}

inline LL inv(LL a, LL n){
	return qpow(a, n - 2, n);
}

LL dp(int n, int x){
	if(vis[n][x]) return d[n][x];
	if(n == 1) return x % a[1];
	vis[n][x] = 1;
	d[n][x] = (dp(n - 1, x % a[n]) * finv[n] % M + dp(n - 1, x) * (n - 1) % M * finv[n] % M) % M;
	return d[n][x];
}

int main(int argc, char const *argv[])
{
	int n, x;
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> x;
	f[0] = 1;
	for(int i = 1; i <= 200; ++i){
		f[i] = f[i - 1] * i % M;
		finv[i] = inv(i, M);
	}
	for(int i = 1; i <= n; ++i){
		cin >> a[i];
	}
	sort(a + 1, a + n + 1);
	cout << f[n] * dp(n, x) % M << endl;
	return 0;
}

Measured memory_bytes: 177408
import std.stdio;

int[111] a;

void main(){
	int n, ans, l, r, m, x;
	while (readf("%d\n", &n), n) {
		foreach (i; 0..n) readf("%d\n", &a[i]);
		readf("%d\n", &x);
		ans = l = 0;
		r = n-1;
		// binary search
		while (l <= r) {
			m = (l + r) / 2;
			ans++;
			if (a[m] == x) break;
			if (a[m] < x) l = m+1;
			else r = m-1;
		}
		writeln(ans);
	}
}

Measured memory_bytes: 984
#include <bits/stdc++.h>
 
using namespace std;
 
#define MD 1000000007
typedef long long int ll;

int main(){
    int x;
    cin>>x;
    if(x<1200){
        cout<<"ABC"<<endl;
    }else{
        cout<<"ARC"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define endl "\n"
#define speed() ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(x) (int)(x).size()
#define _USE_MATH_DEFINES
using namespace std;
typedef long long int lli;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
    speed();
    int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
    int x = x2 - x1, y = y2 - y1;
    cout << (x2-y) << " " << (y2+x) << " " << (x1-y) << " " << (y1+x) << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
def dfs(tiles, W, H, x, y):
    tiles[y][x] = '0'
    for dx,dy in ((-1,-1), (-1,0), (-1,1), (0,-1), (0,1), (1,-1), (1,0), (1,1)):
        if 0<=x+dx<W and 0<=y+dy<H and tiles[y+dy][x+dx]=='1':
            dfs(tiles, W, H, x+dx, y+dy)
    return

def main():
    while True:
        W,H = [int(x) for x in input().split()]
        if W==0 and H==0:
            exit()
        tiles = [[c for c in input().split()] for h in range(H)]
        cnt = 0
        for h in range(H):
            for w in range(W):
                if tiles[h][w] == '1':
                    cnt += 1
                    dfs(tiles, W, H, w, h)
        print(cnt)

if __name__ == '__main__':
    sys.setrecursionlimit(100000)
    main()

Measured memory_bytes: 9636
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	if(n%2==1){
		printf("%0.10lf\n",(double)((n+1)/2)/n);
	}
	else{
		printf("0.5000000000\n");
	}
	return 0;	
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <cstdlib>
#include <set>
#include <stack>
#include <queue>
using namespace std;

#define X first
#define Y second
#define N 5010
#define M 210
typedef long long ll;
typedef pair<int,int> pii;
const int Mod=1000000007;

const double INF=1e18;
typedef long long ll;

int n,m;
int a[N][M],d[N];
struct node
{
	int v,id;
	node (int _v=0,int _id=0){v=_v,id=_id;}
};
stack<node> Q[M];

ll mx[N<<2],tag[N<<2];

void Push_down(int x)
{
	int lc=x<<1,rc=lc|1;
	tag[lc]+=tag[x];
	tag[rc]+=tag[x];
	mx[lc]+=tag[x];
	mx[rc]+=tag[x];
	tag[x]=0;	
}

void Modify(int x,int L,int R,int l,int r,int del)
{
	//cout<<x<<" "<<L<<" "<<R<<" "<<l<<" "<<r<<endl;
	if (L==l && R==r)
	{
		mx[x]+=del;
		tag[x]+=del;
		return;
	}
	Push_down(x);
	
	int Mid=(L+R)>>1,lc=x<<1,rc=lc|1;
	if (l<=Mid) Modify(lc,L,Mid,l,min(Mid,r),del);
	if (r> Mid) Modify(rc,Mid+1,R,max(l,Mid+1),r,del);
	mx[x]=max(mx[lc],mx[rc]);
}

ll Query(int x,int L,int R,int l,int r)
{
	if (L==l && R==r) return mx[x];
	
	int Mid=(L+R)>>1;
	if (r<=Mid) return Query(x<<1,L,Mid,l,r);
	if (l> Mid) return Query(x<<1|1,Mid+1,R,l,r);
	return max(Query(x<<1,L,Mid,l,Mid),Query(x<<1|1,Mid+1,R,Mid+1,r));
}

int main()
{
	//freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
	
	ll ans=-1ll<<60;
	scanf("%d%d",&n,&m);
	for (int i=2;i<=n;i++) scanf("%d",&d[i]);
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++)
			scanf("%d",&a[i][j]);
	for (int i=1;i<=m;i++) Q[i].push(node(1<<30,0));
	for (int i=1;i<=n;i++)
	{
		for (int j=1;j<=m;j++)
		{
			while (a[i][j]>=Q[j].top().v)
			{
				node tmp=Q[j].top();
				Q[j].pop();
				Modify(1,1,n,Q[j].top().id+1,tmp.id,-tmp.v);
			}
			Modify(1,1,n,Q[j].top().id+1,i,a[i][j]);
			Q[j].push(node(a[i][j],i));
			
		}
		if (i>1) Modify(1,1,n,1,i-1,-d[i]);
		ans=max(ans,Query(1,1,n,1,i));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4736
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		String s = sc.next();
		int cnt = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'x') {
				cnt++;
			}
		}
		if (cnt >= 8) {
			sb.append("NO");
		} else {
			sb.append("YES");
		}
		System.out.println(sb);
	}
}


Measured memory_bytes: 21844
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var n,m int
    fmt.Scan(&n)
    a := make([]string, n)
    for i:=0; i<n; i++{
        fmt.Scan(&a[i])
    }
    fmt.Scan(&m)
    b := make([]string, m)
    for i:=0; i<m; i++{
        fmt.Scan(&b[i])
    }
    mp := make(map[string]int)
    for i:=0; i<m; i++{
        mp[b[i]]--
    }
    ans := 0
    for i:=0; i<n; i++{
        mp[a[i]]++
    }
    for _,i := range mp{
        ans = max32(ans,i)
    }
    fmt.Println(ans)
}





// Pairsort
type Pair struct {
    first,second int64
}

type By func(p1, p2 *Pair) bool

func (by By) Sort(pairs []Pair) {
    ps := &pairSorter{
            pairs : pairs,
            by: by,
    }
    sort.Sort(ps)
}

type pairSorter struct {
    pairs []Pair
    by func(p1, p2 *Pair) bool
}

func (s *pairSorter) Len() int {
    return len(s.pairs)
}

func (s *pairSorter) Swap(i, j int) {
    s.pairs[i], s.pairs[j] = s.pairs[j], s.pairs[i]
}

func (s *pairSorter) Less(i, j int) bool {
    return s.by(&s.pairs[i], &s.pairs[j])
}

func first (p1, p2 *Pair) bool {
        return p1.first < p2.first
}

func second (p1, p2 *Pair) bool {
        return p1.second < p2.second
}
// end



func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define int long long
using namespace std;
vector<int> ans1,ans2;
void a(int n,int k){
  if(n==1)return;
  if(n%2){
    a(n-1,k+1);
    ans1.push_back(k);
  }else{
    a(n/2,k+1);
    ans2.push_back(k);
  }
}
signed main(){
  int N;
  cin>>N;
  a(N+1,1);
  reverse(ans1.begin(),ans1.end());
  for(int i:ans2)ans1.push_back(i);
  int M=ans1.size();
  cout<<M*2<<endl;
  for(int i=0;i<M;i++)cout<<ans1[i]<<' ';
  for(int i=M;i>=1;i--)cout<<i<<(i==1?'\n':' ');
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using dijkstra = priority_queue<T, vector<T>, greater<T>>;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define fbo find_by_order  // k th index
#define ook order_of_key   // strictly smaller than k
#define PI acos(-1.0)
#define inf 0x3f3f3f3f
#define max_ull 18446744073709551615
#define max_ll 9223372036854775807
#define lead_zero(x) __builtin_clzll(x)
#define trail_zero(x) __builtin_ctzll(x)
#define total_1s(x) __builtin_popcountll(x)
#define first_1(x) __builtin_ffsll(x)
#define log2_(x) __builtin_clz(1) - __builtin_clz(x)
#define isLeap(x) ((x % 400 == 0) || (x % 100 ? x % 4 == 0 : false))
#define QUERY           \
    int test;           \
    scanf("%d", &test); \
    for (int _T = 1; _T <= test; _T++)
#define FAST ios_base::sync_with_stdio(0), cin.tie(0)
#define all(v) v.begin(), v.end()
#define reunique(v) v.resize(std::unique(all(v)) - v.begin())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define ff first
#define ss second
#define MERGE(v1, v2, v) merge(all(v1), all(v2), back_inserter(v))
#define MP make_pair
#define EB emplace_back
#define read freopen("input.txt", "r", stdin)
#define write freopen("output.txt", "w", stdout)
#define in_range(v, r, l) upper_bound(all(v), r) - lower_bound(all(v), l)
#define LCM(a, b) (a / __gcd(a, b)) * b;

ll rdn(int y, int m, int d) {
    /* Rata Die day one is 0001-01-01 */
    if (m < 3)
        y--, m += 12;
    return 365 * y + y / 4 - y / 100 + y / 400 + (153 * m - 457) / 5 + d - 306;
}
/* Direction arrays */
/*int dx[] = {1,-1,0,0}, dy[] = {0,0,1,-1};                             */  // 4Direction
/*int dx[] = {1,-1,0,0,1,1,-1,-1}, dy[] = {0,0,1,-1,1,-1,1,-1};         */  // 8Direction
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1};     */  // KnightDirection
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1};                */  // HexagonalDirection
/* int day[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; */

int main() {
    int n;
    scanf("%d", &n);
    vector<int> v(n + 2);
    vector<int> cnt(n + 2, 0);
    ll ans = 0;
    vector<int> distinct;
    for (int i = 0; i < n; i++) {
        scanf("%d", &v[i]);
        cnt[v[i]]++;
        if (cnt[v[i]] == 1) {
            distinct.EB(v[i]);
        }
    }
    for (int i : distinct) {
        ans = (ans + (1LL * cnt[i] * (cnt[i] - 1)) / 2LL);
    }
    for (int i = 0; i < n; i++) {
        ans = (ans - max(0LL, (1LL * cnt[v[i]] * (cnt[v[i]] - 1)) / 2LL));
        ans = (ans + max(0LL, (1LL * (cnt[v[i]] - 1) * (cnt[v[i]] - 2)) / 2LL));
        printf("%lld\n", ans);
        ans = (ans - max(0LL, (1LL * (cnt[v[i]] - 1) * (cnt[v[i]] - 2)) / 2LL));
        ans = (ans + max(0LL, (1LL * cnt[v[i]] * (cnt[v[i]] - 1)) / 2LL));
    }
}


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

class Key {
  public:
    int cost;
    int mask;
    Key() {
      cost = 0;
      mask = 0;
    }
    Key(int _cost, int _mask) {
      cost = _cost;
      mask = _mask;
    }
};

int main()
{
  int nbox, nkey;
  cin >> nbox >> nkey;
  vector<Key> key(nkey);
  for (int i = 0; i < nkey; i++) {
    int cost, nbit;
    cin >> cost >> nbit;
    key.at(i).cost = cost;
    for (int j = 0; j < nbit; j++) {
      int x;
      cin >> x;
      key.at(i).mask |= (1 << (x-1));
    }
  }
  vector<int> cost(1 << nbox, 1e9);
  cost.at(0) = 0;
  for (const auto& k : key) {
    for (int i = 0; i < (int)cost.size(); i++) {
      cost[i | k.mask] = min(cost[i | k.mask], cost[i] + k.cost);
    }
  }
  if (cost.back() == 1e9) {
    cost.back() = -1;
  }
  cout << cost.back() << '\n';
  return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
module Main where

import qualified Data.IntSet as IS
import Data.List (foldl')
import Control.Monad
import Data.List (sortBy)
import Data.Ord (comparing)

greedy
  :: Foldable f
  => s -- ^ empty set
  -> (a -> s -> Maybe s) -- insert an element
  -> f a
  -> s
greedy e ins = foldl' (\s a -> case ins a s of
  Just s' -> s'
  _ -> s) e

assign :: Int -> (Int, Int) -> (Int, IS.IntSet) -> Maybe (Int, IS.IntSet)
assign duration (d, v) (total, s) = do
  day <- IS.lookupLE (duration - d) s
  return (total + v, IS.delete day s)

readL :: Read a => IO [a]
readL = map read . words <$> getLine

main = do
  [n, duration] <- readL
  jobs <- map (\[a, b] -> (a :: Int, b :: Int)) <$> replicateM n readL
  let (total, _) = greedy (0, IS.fromList [0..duration]) (assign duration)
        $ sortBy (comparing (negate . snd)) jobs
  print total


Measured memory_bytes: 88444
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


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;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n;
  cin>>n;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  ll ans=1;
  rep(i,n){
    if(v[i]%2==0) ans*=2;
  }
  ll tmp=1;
  rep(i,n){
    tmp*=3;
  }
  cout<<tmp-ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define async ios_base::sync_with_stdio(false); cin.tie(NULL);
#define int long long int
#define let auto
#define of :
#define all(y) y.begin(), y.end()
#define present( x, y ) (x.find( y ) != x.end())
#define _matrix(T) vector<vector<T>>
template<class T>
auto matrix( int r, int c, T v ){
	return vector<vector<T>>( r, vector<T>( c, v ) ) ;
}
const int mod = (int)1e9 + 7 ;
const int inf = (int)1e18 ;
void mxz( int &a, int b ){
	a = max( a, b ) ;
}

signed main(){
	double N, D ; cin >> N >> D ;
	int cnt = 0 ;
	double x, y ;
	set<pair<double,double>> st ;
	for( int i = 0 ; i < N ; i++ ){
		cin >> x >> y ;
		if( !present(st, make_pair(x,y)) ) if( sqrt( x*x + y*y ) <= (D) ) cnt++ ;
	}
	cout << cnt ;
	return 0 ;
}


Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
   int a[3][3];
   rep(i, 3) rep(j, 3) cin>>a[i][j];
   int n;
   cin>>n;  
   rep(_, n){
      int b;
      cin>>b;
      rep(i, 3) rep(j, 3) if(a[i][j]==b) a[i][j]= -1;
   }

   bool ok=false;
   rep(i, 3){
      bool f=true;
      rep(j, 3) if(a[i][j]!= -1) f=false;
      if(f) ok=true;
   }
   rep(j, 3){
      bool f=true;
      rep(i, 3) if(a[i][j]!= -1) f=false;
      if(f) ok=true;
   }
   {  
      bool f=true;
      rep(i, 3) if(a[i][i]!= -1) f=false;
      if(f) ok=true;
   }
   {  
      bool f=true;
      rep(i, 3) if(a[i][2-i]!= -1) f=false;
      if(f) ok=true;
   }
   
   if(ok) cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
   return 0;
}


Measured memory_bytes: 3640
/*modintを書く
欲しい機能：
・自動的にmodを取ってくれる:done
・任意modに対応する:done
・負数のmodもいい感じにしてくれる:done
・プリミティブな整数型とも計算ができる:done
・そのまま出力ができる:done
*/

#include<iostream>
#include<vector>
class modint{
    private:
        typedef long long ll;
        ll val;
        ll _mod;
    public:
        modint(ll n=0,ll mod=1e9+7):val(n),_mod(mod){
            while(val<0){
                val+=_mod*_mod;
            }
            val%=mod;
        }
        modint operator+(ll x){return modint(val+x,_mod);}
        modint operator-(ll x){return modint(val-x,_mod);}
        modint operator*(ll x){return *this*modint(x,_mod);}
        modint operator+(modint m){return modint(val+m.val,_mod);}
        modint operator-(modint m){return modint(val-m.val,_mod);}
        modint operator*(modint m){return modint(val*m.val,_mod);}
        modint& operator+=(ll x){return *this=*this+x;}
        modint& operator-=(ll x){return *this=*this-x;}
        modint& operator*=(ll x){return *this=*this*x;}
        modint& operator+=(modint m){return *this=*this+m;}
        modint& operator-=(modint m){return *this=*this-m;}
        modint& operator*=(modint m){return *this=*this*m;}
        friend std::ostream& operator<<(std::ostream &os,modint m){os<<m.val;return os;}
};

int main(){
    using namespace std;
    int N,K;
    int a[100];
    cin>>N>>K;
    for(int i=0;i<N;++i) cin>>a[i];
    vector<vector<modint>> dp(N+1,vector<modint>(2*K+2));
    dp[N][K]=1;
    for(int i=N-1;i>=0;--i) for(int j=K;j>=0;--j){
        dp[i][j]=dp[i+1][j]+dp[i][j+1]-dp[i+1][j+a[i]+1];
    }
    cout<<dp[0][0]<<endl;
}

Measured memory_bytes: 319360
#include <bits/stdc++.h>
#define LL long long int
using namespace std;

int main()
{
    LL a,b,c,k;
    cin>>a>>b>>c>>k;
    
    LL ans;
    
    if(k%2==0)
    ans=a-b;
    
    else
    ans=b-a;
    
    cout<<ans<<"\n";
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define endl "\n"
#define fcout cout<<fixed<<setprecision(15)
typedef pair<int, int> P;
struct edge { int to, cost; };

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

bool prime(int n) {
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0)return false;
    }
    return n != 1;
}
int gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
int lcm(int x, int y) {
return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
    if (p == 0) return 1;
    if (p % 2 == 0) {
        int t = mod_pow(n, p / 2, m);
        return (t * t) % m;
    }
    return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
int modinv(int a, int m) {
    int b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int modinv2(int a, int mod) {
    return mod_pow(a, mod - 2, mod);
}
int digit(int x) {
    int cnt = 0;
    while (x > 0) {
        cnt += x % 10;
        x /= 10;
    }
    return cnt;
}
int read() {
    int tmp;
    cin >> tmp;
    return tmp;
}
int xor128() {
    static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    int t = (x xor (x << 11));
    x = y; y = z; z = w;
    return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
    map<int, int>ans;
    int now = 2;
    while (now * now <= x) {
        if (x % now == 0) {
            x /= now;
            ans[now]++;
        }
        else now++;
    }
    if (x != 1) ans[x]++;
    return ans;
}
int comb(int n, int k, int mod) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    k = min(k, n - k);
    int x = 1, y = 1;
    rep(i, k) {
        y *= i + 1;
        y %= mod;
    }
    for (int i = n - k + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }
    return x * modinv(y, mod) % mod;
}

signed main() {
    //srand((unsigned)time(NULL));

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

    int a, b;
    cin >> a >> b;
    if (a <= b) cout << "unsafe" << endl;
    else cout << "safe" << endl;

    return 0;
}


Measured memory_bytes: 3676
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	as := make([]int, n)
	counts := make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		a, err := strconv.Atoi(sc.Text())
		if err != nil {
			panic(err)
		}
		a--
		as[i] = a
		counts[a]++
	}
	combis := make([]int, n)
	sums := 0
	for i := 0; i < n; i++ {
		if counts[i] >= 2 {
			combis[i] = counts[i] * (counts[i] - 1) / 2
			sums += combis[i]
		}
	}
	for i := 0; i < n; i++ {
		diff := 0
		a := as[i]
		if combis[a] == 1 {
			diff = 1
		} else if combis[a] > 1 {
			diff = counts[a] - 1
		}
		fmt.Printf("%d\n", sums-diff)
	}
}


Measured memory_bytes: 8576
let s' = read_line ()
let t = read_line ()
let n, m = String.(length s', length t)
let _ = String.(for i = n - m downto 0 do let b = ref true in iteri (fun j c -> if s'.[i + j] <> '?' && s'.[i + j] <> c then b := false) t;
  if !b then (print_endline @@ map (function '?' -> 'a' | c -> c) @@ sub s' 0 i ^ t ^ sub s' (i + m) (n - i - m); exit 0) done); print_endline "UNRESTORABLE"

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>
#include <fstream>
#include <ctime>

using namespace std;
using ll = long long;

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ret.push_back(i);
            if (i != 1 && i*i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

template<typename T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

struct ToUpper {
    char operator()(char c) { return toupper(c); }
};

struct ToLower {
    char operator()(char c) { return tolower(c); }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int H, W, A, B;
    cin >> H >> W >> A >> B;

    REP(h, H) {
        REP(w, W) {
            if ((w < A) xor (h < B)) {
                cout << 0;
            }
            else {
                cout << 1;
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1280