akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}

const int MOD = 1e9+7;
const int MX = 1050;
V(bool) isp(MX, true);
vi pns;

void pjudge() {
    isp[0]=isp[1]=false;
    for(int i=2; i*i<MX; i++) {
        if(!isp[i]) continue;
        for(int j=i*2; j<MX; j+=i) {
            isp[j] = false;
        }
    }
    rep(i, MX) if(isp[i]) pns.pb(i);
}

void countp(int n, map<int, int> &mp) {
    int m = pns.size();
    rep(i, m) {
        while(n%pns[i]==0) {
            mp[pns[i]]++;
            n /= pns[i];
        }
    }
}

signed main() {
    int N;
    cin >> N;

    pjudge();
    map<int, int> mp;
    FOR(i, 1, N+1) countp(i, mp);

    int res = 1;
    for(auto &p : mp) {
        res *= p.se+1;
        res %= MOD;
    }

    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var s = "";

            for (int i = 0; i < 3; i++) {
                // 文字列の入力
                string str = Console.ReadLine();
                s += str[i];
            }

            Console.WriteLine(s);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>

int main(void)
{
    int number[5];
    int i,j;
    int temp;

    for (i = 0; i < 5; i++){
        scanf("%d", &number[i]);    //入力
    }
    for (i = 0; i < 4; i++){        //5回まわす
        for (j = 4; j > i; j--){    //配列の後ろから並べ替える
            if (number[j] > number[j-1]){     //配列が大きい方がひとつ前より値が大きければ入れ替える
                temp = number[j];
                number[j] = number[j - 1];
                number[j - 1] = temp;
            }
        }
    }
    printf("%d", number[0]);
    for (i = 1; i < 5; i++){
        printf(" %d", number[i]);
    }
    printf("\n");
    
    return (0);
}


Measured memory_bytes: 2084
#include<bits/stdc++.h>
using namespace std;
int n, k;
int main(){
  cin >> n >> k;
  int count = 1;
  for(int i = 0; i < n; i++){
    if(count*2 < count+k) count *= 2;
    else count += k;
  }
  cout << count << endl;
}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    vector<int64_t> ans(n);
    for (auto i : irange(0L, n - 1)) {
        int64_t a;
        cin >> a;
        ++ans[a - 1];
    }

    for (auto i : irange(0L, n)) {
        cout << ans[i] << "\n";
    }
}

Measured memory_bytes: 4844
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define Endl endl
#define mod  998244353
#define mkp make_pair
#define pb push_back
#define cin(n) scanf("%d",&n)
#define cout(n) printf("%d ",n)
#define sf(n) scanf("%d",&n)
#define pf(n) printf("%d ",n)
#define bitget(n) __builtin_popcountll(n)
ll dx[] = {1,1,0,-1,-1,-1,0,1};
ll dy[] = {0,-1,-1,-1,0,1,1,1};
ll dxx[] = {1,-1,0,0};
ll dyy[] = {0,0,-1,1};
ll modexpo(ll x,ll y){if(y==0)return 1;if(y%2){ll viky=modexpo(x,y/2);
return (((x*viky)%mod)*viky)%mod;}else{ll viky=modexpo(x,y/2);return (viky*viky)%mod;
}}
bool isvalid(ll x,ll y,ll n, ll m) { return (x>=0&&x<n&&y>=0&&y<m); }

ll ap[100011];

int main() {
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n,k,q;
    cin>>n>>k>>q;
    for(ll i=1;i<=n;i++){
        ap[i] = 0;
    }
    for(ll i=0;i<q;i++){
        ll x;
        cin>>x;
        ap[0] -= 1;
        ap[x] += 1;
        ap[x+1] -= 1;
    }

    for(ll i=1;i<=n;i++){
        ap[i] += ap[i-1];
        // cout<<ap[i]<<" ";
        if(abs(ap[i])<k){
            cout<<"Yes\n";
        }else{
            cout<<"No\n";
        }
    }

    return 0;
}

Measured memory_bytes: 1408
H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())

S = ['#'*(W+4)]*(H+4)
for h in range(2, H+2):
    S[h] = '##' + input() + '##'

T = [[-1]*(W+4) for _ in range(H+4)]

f = 0
for h in range(2,H+2):
    for w in range(2,W+2):
        if S[h][w]=='#' or T[h][w]!=-1: continue
        
        queue = [(h,w)]
        iq = 0
        while iq<len(queue):
            ph, pw = queue[iq]
            iq += 1

            if S[ph][pw]=='#' or T[ph][pw]!=-1: continue
            
            T[ph][pw] = f
            queue.append((ph+1,pw  ))
            queue.append((ph-1,pw  ))
            queue.append((ph  ,pw+1))
            queue.append((ph  ,pw-1))

        f += 1

P = [set() for _ in range(f)]
    
for h in range(2,H+2):
    for w in range(2,W+2):
        f = T[h][w]
        if f==-1: continue
        for h2 in range(h-2, h+3):
            for w2 in range(w-2, w+3):
                f2 = T[h2][w2]
                if f2==-1: continue
                if f!=f2: P[f].add(f2)

N = [-1]*len(P)
queue = [(T[Ch+1][Cw+1], 0)]
iq = 0
while iq<len(queue):
    f, n = queue[iq]
    iq += 1

    if N[f]!=-1: continue

    N[f] = n
    for f2 in P[f]: queue.append((f2, n+1))

print(N[T[Dh+1][Dw+1]])


Measured memory_bytes: 144692
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	string s;
	cin>>s;
	cout<<s.substr(0,4)<<" "<<s.substr(4)<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int Maxn=200000;
const int Maxm=1000000000;
const ll Inf=0x3f3f3f3f3f3f3f3fll;
int id_tot;
int lson[Maxn*40+5],rson[Maxn*40+5];
ll maxn[2][Maxn*40+5];
int n;
int Root;
void update(int x,int y,int& root=Root,int left=1,int right=Maxm){
	if(root==0){
		root=++id_tot;
	}
	if(left==right){
		maxn[0][root]=max(maxn[0][root],-1ll*x-y);
		maxn[1][root]=max(maxn[1][root],1ll*y-x);
		return;
	}
	int mid=(left+right)>>1;
	if(y<=mid){
		update(x,y,lson[root],left,mid);
	}
	else{
		update(x,y,rson[root],mid+1,right);
	}
	maxn[0][root]=max(maxn[0][lson[root]],maxn[0][rson[root]]);
	maxn[1][root]=max(maxn[1][lson[root]],maxn[1][rson[root]]);
}
ll query(int l,int r,int x,int root=Root,int left=1,int right=Maxm){
	if(l>right||r<left||root==0){
		return -Inf;
	}
	if(l<=left&&r>=right){
		return maxn[x][root];
	}
	int mid=(left+right)>>1;
	return max(query(l,r,x,lson[root],left,mid),query(l,r,x,rson[root],mid+1,right));
}
struct Node{
	int x,y;
	friend bool operator <(Node a,Node b){
		return a.x<b.x;
	}
}a[Maxn+5];
int main(){
	memset(maxn,-0x3f,sizeof maxn);
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i].x,&a[i].y);
	}
	sort(a+1,a+1+n);
	ll ans=0;
	for(int i=1;i<=n;i++){
		ans=max(ans,1ll*a[i].x+a[i].y+query(1,a[i].y,0));
		ans=max(ans,1ll*a[i].x-a[i].y+query(a[i].y,Maxm,1));
		update(a[i].x,a[i].y);
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 149284
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define all(x) (x).begin (),(x).end()
#define pb push_back
#define mp make_pair
#define vi vector<ll>
#define pii pair<ll,ll>
#define vii vector<pii>
#define mi map<ll,ll>
#define endl "\n"
#define si set<ll>
#define rep(i,a,b) for(unsigned ll i=a;i<b;i++)
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define M 1000000007LL
vi r,g,b;
void solve()
{
    ll n; cin>>n;
    ll ans=0;
    rep(i,1,n+1)
    {
        if(i%3==0 || i%5==0) continue;
        else ans+=i;
    }
    cout<<ans;

}

int main()
{
    SPEED;
    ll t = 1;

   //cin>>t;

    while(t--) solve();

   return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int a,b,c,x1,x2,x3;
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	x1=abs(a-b)+abs(b-c);
	x2=abs(a-c)+abs(b-a);
	x3=abs(b-c)+abs(c-a);
    printf("%d",min(x1,min(x3,x2)));
 	return 0;
}

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

typedef long long ll;

using namespace std;

int main() {
    ll n, m;
    cin >> n >> m;

    ll* A = new ll[n];

    ll all_vote = 0;
    for (ll i = 0; i < n; i++) {
        cin >> A[i];
        all_vote += A[i];
    }


    ll count = 0;
    for (ll i = 0; i < n; i++) {
        if (A[i] >= all_vote * 1.0 / (double)(4 * m)) {
            count++;
        }
    }

    if (count >= m) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;

int main(){
  ll n; cin >> n;
  vector<ll> a(n);
  bool num[1000005];
  bool exist[1000005];
  for(ll i = 0; i <= 1000005; i++){
    exist[i] = false;
    num[i] = false;
  }

  for(ll i = 0; i < n; i++){
    cin >> a[i];
    if(exist[a[i]] == true){
      num[a[i]] = false;
    }
    else{
      num[a[i]] = true;
      exist[a[i]] = true;
      for(ll j = a[i] * 2; j < 1000005; j += a[i]){
        num[j] = false;
        exist[j] = true;
      }
    }
  }
  ll ans = 0;
  for(ll i = 0; i < n; i++){
    if(num[a[i]] == true){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

sys.setrecursionlimit(100000)

N, M = (int(i) for i in input().split())
L = []
for i in range(M):
    a, b = (int(j) for j in input().split())
    L.append((a-1, b-1))
L.reverse()

uf = [-1]*N
def parent(v):
    if uf[v] < 0:
        return v
    else:
        uf[v] = parent(uf[v])
        return uf[v]

def union(u, v):
    pu = parent(u)
    pv = parent(v)
    if pu != pv:
        res = uf[pv] * uf[pu]
        uf[pv] += uf[pu]
        uf[pu] = pv
    else:
        res = 0
    return res

res = [0]*M
ans = (N*(N-1))//2
res[0] = ans

for i in range(1, M):
    a, b = L[i-1]
    ans -= union(a, b)
    res[i] = ans

res.reverse()
for i in range(M):
    print(res[i])

Measured memory_bytes: 34368
N, K = map(int, input().split())

x = 10 ** 9 + 7

#A = [0] * (N-K+1)
answer = 0
#new = map(lambda x : x + 1, list(range(N+1)))
#print(new)

for k in range(N+1, K-1, -1):
    #print("Itereation :" + str(k))
    min_a = k * (k-1) // 2
    max_a = k * (2*N - k + 1) // 2
    #print("min: " + str(min_a))
    #print("max: " + str(max_a))
    num = max_a - min_a + 1
    #print("Num " + str(num))
    answer = (answer + (num % x))%x 
print(answer)

Measured memory_bytes: 79940
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();

        final int[] array = new int[100_001];
        for (int i = 0; i < n; i++) {
            final int a = scanner.nextInt();
            if (a != 0) {
                array[a - 1]++;
            }
            array[a]++;
            array[a + 1]++;
        }

        int max = -1;
        for (final int value : array) {
            if (value > max) {
                max = value;
            }
        }

        System.out.println(max);
    }
}


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

#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>

int N;
vector<pii> V[20];

signed main()
{
    cin >> N;
    rep(i, N)
    {
        int a;
        cin >> a;
        rep(j, a)
        {
            int x, y;
            cin >> x >> y;
            x--;
            V[i].push_back({x, y});
        }
    }

    int ans = 0;
    rep(i, 1 << N)
    {
        bool flag = false;
        rep(j, N)if(i & (1 << j))
        {
            for(auto e : V[j])
            {
                if(e.second != ((i >> e.first) & 1))flag = true;
            }
        }
        if(!flag)
        {
            int tmp = 0;
            rep(j, N)if(i & (1 << j))tmp++;
            ans = max(ans, tmp);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mod 1000000007
int main() {

	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

	ll a,b,c,k;
	cin>>a>>b>>c>>k;

	ll sum=0;

	if(k<=a){
		cout<<k<<endl;
		return 0;
	}
	if(k>a){
		sum+=a;
		k=k-a;
	}
	//cout<<sum<<" "<<k<<endl;
	if(k)
	{
		k-=b;
	}
	//cout<<k<<endl;
	if(k)
	{
		sum-=k;
	}

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

Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back

int dfa[51]={};
int fa(int n){
    if(dfa[n]!=0)return dfa[n];
    if(n==0)return 1;
    else return dfa[n] = fa(n-1)*2+3;
}

int dfp[51]={};
int fp(int n){
    if(dfp[n]!=0)return dfp[n];
    if(n==0)return 1;
    else return dfp[n] = fp(n-1)*2+1;
}

signed main(){
    int n,x;
    cin>>n>>x;

    int ans = 0;
    while(x>0){
        for(int i=n;i>=0;i--){
            if(x>=fa(i)){
                x-=fa(i);
                ans+=fp(i);

                if(x>0){
                    x--;
                    ans++;
                }

                n = i;
                break;
            }else{
                x--;
            }
        }
    }

    cout<<ans<<endl;
}


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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define iter(v, i) for (__typeof__((v).begin()) i = (v).begin(); i != (v).end(); i++)
#define all(v) (v).begin(), (v).end()

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

const double eps = 1e-9;
const double pi = 3.141592653589793238462;

const int MAXN = 1e5 + 10;

int cnt[MAXN];
bool red[MAXN];

int main() {
    //freopen("", "rt", stdin);
    //freopen("", "wt", stdout);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        cnt[i] = 1;
    red[1] = true;
    while (m--) {
        int x, y;
        scanf("%d %d", &x, &y);
        cnt[x]--;
        cnt[y]++;
        if (red[x]) red[y] = true;
        if (cnt[x] == 0) red[x] = false;
    }
    int ans = 0;
    for (int i = 1; i <= n; i++)
        if (red[i]) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 768
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int z = in.nextInt();
            int w = in.nextInt();
            int[] a = in.nextIntArray(n);

            int[] d = new int[n];
            for (int i = 0; i < n; i++) {
                d[i] = Math.abs(a[i] - a[n - 1]);
            }

            int[] dp1 = new int[n];
            int[] dp2 = new int[n];
            for (int i = n - 2; i >= 0; i--) {
                dp1[i] = d[i];
                dp2[i] = d[i];
                for (int j = i + 1; j < n - 1; j++) {
                    dp1[i] = Math.max(dp1[i], dp2[j]);
                    dp2[i] = Math.min(dp2[i], dp1[j]);
                }
            }

            int ans = Math.abs(w - a[n - 1]);
            for (int i = 0; i < n; i++) {
                ans = Math.max(ans, dp2[i]);
            }
            out.println(ans);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 22100
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int32_t, int32_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

int32_t neighbours[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};

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

  int32_t N, T;
  cin >> N >> T;
  int32_t finish = 0;
  int32_t sum_oyu = 0;
  for (int32_t i = 0; i < N; ++i) {
    int32_t a;
    cin >> a;
    if (finish < a) {
      sum_oyu += T;
    } else {
      sum_oyu += max((a + T) - finish, 0);
    }

    finish = a + T;
  }
  cout << sum_oyu << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
const int N = 100;
#define LL long long
int F[N][N][N], G[N][N], mx, ai[N], bi[N];
LL ans;
int main()
{
    cin >> n;
    for (int i = 1; i <= n; ++ i) cin >> ai[i], mx = max(mx, ai[i]);
    for (int i = 1; i <= n; ++ i) cin >> bi[i];
    for (int i = 0; i <= mx; ++ i) F[0][i][i] = 1;
    for (int i = 1; i <= mx; ++ i)
        for (int j = 0; j <= mx; ++ j)
            for (int k = 0; k <= j; ++ k)
                F[i][j][k] = F[i - 1][j][k] || F[i - 1][j % i][k];
    for (int i = 1; i <= n; ++ i) if (!F[mx][ai[i]][bi[i]]) {cout << -1 << endl; return 0;}
    for (int i = 1; i <= n; ++ i) G[i][ai[i]] = 1;
    for (int i = mx; i >= 1; -- i)
    {
        int p = 1;
        for (int j = 1; j <= n; ++ j)
        {
            int q = 0;
            for (int k = 0; k <= ai[j]; ++ k)
                if (G[j][k] && F[i - 1][k][bi[j]])
                    q = 1;
            p &= q;
        }
        if (!p)
        {
            ans |= 1ll << i;
            for (int j = 1; j <= n; ++ j)
                for (int k = 0; k <= ai[j]; ++ k)
                    if (G[j][k]) G[j][k % i] = 1;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
//main
signed main(){
  int a;string s;cin>>a>>s;
  if(a<3200)cout<<"red"<<endl;
  else cout<<s<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

#define MAX 100000

int partition(int *,int, int);

int main(){
  int i,a[MAX],b,n;

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

  b=partition(a,0,n-1);
  
  for(i=0;i<n;i++){
   
    if(i==b){
      printf("[");
    }
    printf("%d",a[i]);
    if(i==b){
      printf("]");
    }
    if(i<n-1){
      printf(" ");
    }
  }
    printf("\n");
  
    return 0;
  }

  int partition(int a[],int p,int r){

    int x,i,j,c;

    x=a[r];
    i=p-1;
    for(j=p;j<=r-1;j++){
      if(a[j]<=x){
	i=i+1;
	c=a[i];
	a[i]=a[j];
	a[j]=c;
      }
    }
    c=a[i+1];
    a[i+1]=a[r];
    a[r]=c;

    return i+1;
  }



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

int main() {
    vector<int> a;
    int q;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        int t;
        cin >> t;
        if (t == 2) a.pop_back();
        else {
            int x;
            cin >> x;
            if (t == 0) a.push_back(x);
            else cout << a[x] << endl;
        }
    }
}



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

int main()

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

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define repo(i,o,n) for(int i=o;i<(int)(n);i++)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);

int n,k,d;
vector<int> v;

main() {
    cin >> n >> k;
    rep(i,k) cin >> d,v.pb(d);
    for(int i=n;;i++) {
        int f=1,tmp = i*10;
        while (tmp /= 10,tmp) {
            auto itr = lower_bound(all(v),tmp%10);
            if (*itr == tmp%10) goto hoge;
        }
        cout << i << endl;
        return 0;
        hoge:;
    }
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<algorithm>
#include<map>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i =0;i < n;i++)
int main() {
    string s;
    cin >> s;int a = 0, b = 0;
    rep(i, s.size()) {
        if (s[i] == 'A') {
            a = i;
            break;
        }
    }
    for (int j = s.size() - 1;j >= 0;j--) {
        if (s[j] == 'Z') {
            b = j;
            break;
        }
    }
    cout << b - a  + 1<< endl;
}

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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
//gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1 << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique(x).begin(),(x).end()),(x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define F first
#define S second
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T> //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T> //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <class T>
bool chmax(T &a, const T &b) //最大値更新 返り値はbool
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) //最小値更新 返り値はbool
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n, cnt = 0;
    cin >> n;
    vector<int> x(n + 2), a(n);
    rep(i, 0, n) cin >> x[i + 1];
    x[0] = x[n + 1] = 0;

    rep(i, 1, n + 2) cnt += abs(x[i] - x[i - 1]);

    rep(i, 1, n + 1)
    {
        int arc = abs(x[i - 1] - x[i + 1]), oqe = abs(x[i - 1] - x[i]), c = abs(x[i + 1] - x[i]);
        a[i - 1] = cnt + arc - oqe - c;
    }

    rep(i, 0, n) cout << a[i] << '\n';
    return 0;
}

Measured memory_bytes: 2816
//
// Created on 2020/08/02.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;



int main() {
    int x;
    cin>>x;
    if(x >= 30){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3620
#include<stdio.h>
int main(){
  int i,n,A[250];

  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[i*2]);
      }
      if(2*i+1 <= n){
	printf("right key = %d, ",A[i*2+1]);
      }
    printf("\n");
  }
 
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (ll i=0; i<n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  vector<pair<double, ll>> diff(n); // a[n-1]との差と添え字
  for (ll i=0; i<n; i++) {
    diff[i].first = abs(a[i]-(double)a[n-1]/2);
    diff[i].second = i;
  }
  sort(diff.begin(), diff.end());
  cout << a[n-1] << " " << a[diff[0].second] << endl;
  return 0;
}

Measured memory_bytes: 2560
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

template <class T = int>
class CuSum {
private:
	vector<T> cusum;

public:
	CuSum(vector<T> const &vec) : cusum(vec.size() + 1) { for (int i = 0; i < (int)(vec.size()); i++) cusum[i + 1] = cusum[i] + vec[i]; }

	CuSum(int N) : cusum(N + 1) {}
	void add(int i, T x) { cusum[i + 1] += cusum[i] + x; }

	T query(int l, int r) { return cusum[r] - cusum[l]; }  // partial sum of [l, r)
};

int main() {

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

	int N, Q;
	string S;
	cin >> N >> Q >> S;

	CuSum<int> ACsum(N);
	for (int i = 1; i < N; i++) ACsum.add(i, S[i - 1] == 'A' && S[i] == 'C');

	vector<pair<int, int>> range(Q);
	for (int i = 0; i < Q; i++) cin >> range[i].first >> range[i].second;

	for (int i = 0; i < Q; i++) cout << ACsum.query(range[i].first, range[i].second) << "\n";

	return 0;
}

Measured memory_bytes: 2256
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 9999971;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H& b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H& b) const { return x == b.x && y == b.y; }
	bool operator!=(const H& b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T& a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T& a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
string s;
signed main() {
	cin >> s;
	bool l = 1;
	//直前が2個だったかどうか
	int ans = 0;
	for (int i = 0; i < s.size(); i++) {
		if (l) {
			ans++;
			l = 0;
		}
		else {
			if (i > 0 && s[i - 1] == s[i]) {
				l = 1;
				ans++;
				i++;
			}
			else {
				ans++;
			}
		}
			if (s.size() > 1 && i == s.size() && s[i - 2] == s[i-1]) {
				ans--;
			}
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
	string s; cin >> s;
	LLONG sum = 0;
	for (const char ch : s)
	{
		sum += static_cast<int>(ch - '0');
	}
	cout << (sum % 9 == 0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3756
#include <stdio.h>
int main(){
	int H[100]={1},W[100]={1},s,t,a;
	//??\???
	for(a=0;H[a]!=0 && W[a]!=0 && a<100-1;a++){
		do{
			printf("");
			scanf("%d %d",&H[a+1],&W[a+1]);
		}while(!(H[a+1]>=0 && H[a+1]<=300 && W[a+1]>=0 && W[a+1]<=300));
	}
	
	//??????
	for(a=1;W[a]!=0 && H[a]!=0;a++){
		for(s=1;s<=H[a];s++){
			for(t=1;t<=W[a];t++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;

int main(){
    int n,k; cin >> n >> k;
    double ans = 0.0;
    double ip = 1 / (double) n;
    for(int i=1;i<=n;i++){
        double p = 1;
        int t = i;
        while(t < k){t = t*2; p = 0.5 * p;}    
        ans = ans + ip * p;
    }
    printf("%.12lf\n", ans);
    return 0;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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(){
    cin.tie(0);
   	ios::sync_with_stdio(false);

    ll N, M;
    cin >> N >> M;

    map<int, vector<int>> mp;

    ll tmp_a, tmp_b;
    for(ll i = 0; i < M; i++){
        cin >> tmp_a >> tmp_b;
        mp[tmp_b].push_back(tmp_a);
    }

    for(auto itr = mp.begin(); itr != mp.end(); ++itr){
        sort(itr->second.begin(), itr->second.end());
    }

    ll ans = 0;
    ll tmp_pos = mp.begin()->first;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr){
        for(ll i = 0; i < itr->second.size(); i++){
            if(tmp_pos <= itr->second[i]){
                tmp_pos = itr->first;
                ans++;
            }
        }
    }
    ans++;

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



Measured memory_bytes: 7680
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;

int main(void) {
	int K,A,B;

	cin >> K ;
	cin >> A >> B;

	for (int i = A; i <= B;i++) {
		if (i%K==0) {
			cout << "OK";
			return 0;
		}
	}

	cout << "NG";
	return 0;
}

Measured memory_bytes: 3600
import scala.collection.mutable._
import io.StdIn.readLine

object Main extends App {
  val map = new HashMap[String,Int]
  val s = readLine.split(" ")
  s.foreach(e => {
    if(!map.contains(e)) map.put(e,1)
    else map.put(e,map(e)+1)
  })
  val maxF = map.maxBy(_._2)._1
  val l = s.map(_.length).max
  val maxL = s.find(_.length == l).get

  println(maxF + " " + maxL)
}


Measured memory_bytes: 43684
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

int main(){
    int N;cin >> N;
    vector<int> V(N),C(N);
    rep(i,N)cin >>V[i];
    rep(i,N)cin >>C[i];

    int res = 0;
    for(int bit=0;bit<(1<<N);bit++){
        int x=0,y=0;
        for(int i=0;i<N;i++){
            if(bit&(1<<i)){
                x+=V[i];
                y+=C[i];
            }
        }
        res=max(res,x-y);
    }
    cout << res << endl;
    return 0;
}

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

const int MAXN = 64;
int mem[MAXN];

vector<int> split(int y) {
  vector<int> res;
  for(int k = 0; (k|y); y >>= 1) {
    if(y & 1) {
      ++k;
    } else {
      if(k) {
        res.push_back(k);
        k = 0;
      }
    }
  }
  return res;
}

int grundy(int x) {
  int &res = mem[x];
  if(res != -1) return res;
  set<int> s;
  for(int i = 1; i <= x; ++i) {
    vector<int> v = split(x - i);
    int ni = 0;
    for(int j = 0; j < v.size(); ++j) {
      ni ^= grundy(v[j]);
    }
    s.insert(ni);
  }
  res = 0;
  while(s.count(res)) ++res;
  return res;
}

int toDec(int p, string s) {
  reverse(s.begin(), s.end());
  int res = 0;
  for(int i = 0, b = 1; i < s.size(); ++i, b *= p) {
    int a = 
      isdigit(s[i]) ? s[i]-'0' : isupper(s[i]) ? s[i]-'A'+10 : s[i]-'a'+36;
    res += a * b;
  }
  return res;
}

int main() {
  fill(mem, mem+MAXN, -1);
  int n; cin >> n;
    int x = 0;
    for(int i = 0; i < n; ++i) {
      int p;
      string s;
      cin >> p >> s;
      vector<int> v = split(toDec(p, s));
      for(int j = 0; j < v.size(); ++j) {
        x ^= v[j];
        //x ^= grundy(v[j]);
      }
    }
    if(x) cout << "win" << endl;
    else cout << "lose" << endl;

  return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 998244353;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

ll fastPow(ll x, ll n)
{
    if (n == 0)
        return 1;
    if (n % 2 == 0)
        return fastPow(x * x % MOD, n / 2);
    else
        return x * fastPow(x, n - 1) % MOD;
}

ll fac[112346];
void combInit(int mx)
{
    fac[0] = 0;
    fac[1] = 1;
    for (int i = 2; i <= mx; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
    }
}

ll modDiv(ll a, ll b)
{
    return a * fastPow(b, MOD - 2) % MOD;
}

ll comb(ll a, ll b)
{
    if (b == 0)
        return 1;
    if (a < b)
        return 0;
    if (a <= 0 || b < 0)
        return 0;
    if (a == b)
        return 1;

    ll p, c;

    c = modDiv(fac[a], fac[a - b]);
    p = fac[b];

    ll res = modDiv(c, p);

    return res;
}

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

    combInit(210);

    int n, x[210], y[210];

    ll li[210];
    fill(li, li + n + 1, 0);

    cin >> n;
    REP(i, n)
    cin >> x[i] >> y[i];

    ll res = 0;

    bool used[210][210];

    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            used[i][j] = i == j;

    V l;

    for (int i = 0; i < n; i++)
        for (int j = i + 1; j < n; j++)
        {
            if (used[i][j])
                continue;

            V v;

            v.push_back(i);
            v.push_back(j);

            int cnt = 2;
            for (int k = j + 1; k < n; k++)
            {
                int a = (x[j] - x[i]) * (y[k] - y[j]);
                int b = (y[j] - y[i]) * (x[k] - x[j]);

                if (a == b)
                {
                    cnt++;

                    v.push_back(k);
                }
            }

            if (cnt > 2)
            {
                for (int k = 0; k < v.size(); k++)
                    for (int m = 0; m < v.size(); m++)
                        used[v[k]][v[m]] = true;

                l.push_back(cnt);
            }
        }

    res = fastPow(2, n);

    res -= 1;
    res -= n;
    res -= n * (n - 1) / 2;

    for (int i = 3; i <= n; i++)
    {
        ll tmp = 0;

        for (int j : l)
        {
            if (i > j)
                continue;
            tmp += comb(j, i);
            tmp %= MOD;
        }

        res += MOD - tmp;
        res %= MOD;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <climits>
#include <sstream>
 
using namespace std;
 
int main(){
    string s;

    cin >> s;

    for(int i = 0; i < s.size(); i++){
        if(s[i] == ',') s[i] = ' ';
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define ll long long
#define rsz resize
#define mod 1000000007
vector<vector<int> >v(1010);
int main()
{
   int a,b;
   cin>>a>>b;
   if(b>=a)
   cout<<"unsafe"<<endl;
   else
   cout<<"safe"<<endl;
}


Measured memory_bytes: 3644
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)
#define test cout << "test" << endl;
#define NNN_MAX 100010
int main (){
	int NNN;
	cin >> NNN ;
	int temp=0;
	vector <int> a;
	rep(i,NNN){
		cin >>temp;
		a.push_back(temp);
	}
	sort(a.begin(),a.end());
	
	int count=0;
	int ans=0;
	int p=0;
	temp=0;
	while(p<a.size()){
		if(a[p]==temp){
			count ++;
		}
		else{
			if(temp > count){
				ans += count ;
				count =0;
			}
			else if(temp==count){
				count =0;
			} 
			else if(temp <count){
				count = count - temp;
				ans += count;
			}
			temp = a[p];
			count = 1;
		}
		p++;
		if(p==a.size()){
			if(temp > count){
				ans += count ;
				count =0;
			}
			else if(temp==count){
				count =0;
			} 
			else if(temp <count){
				count = count - temp;
				ans += count;
			}
		}
	}
	cout << ans << endl;

	return 0;
}

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const int INF = 1e9;

int main(void){

	
	int N, R; cin >> N >> R;
	if(N >= 10) cout << R << endl;
	else cout << R + (100 * (10 - N)) << endl;


	return 0;

}


Measured memory_bytes: 256
using System;

namespace atcoder_ABC075B
{
    class MainClass
    {
        public static void Main(string[] args)
        {
			string[] array = Console.ReadLine().Split(' ');
			int height = int.Parse(array[0]);
			int width = int.Parse(array[1]);

            //多次元配列バージョン
			//char[,] grid = new char[height, width];
   //         for (int i = 0; i < height; i++)
			//{
			//	string line = Console.ReadLine();
   //             for (int j = 0; j < width; j++)
			//	{
			//		grid[i, j] = line[j];
			//	}
			//}

			//for (int i = 0; i < height; i++)
			//{
			//	for (int j = 0; j < width; j++)
			//	{
			//		int mineCount = 0;
			//		if (grid[i, j] == '.')
			//		{
			//			if (i - 1 >= 0 && grid[i - 1, j] == '#') mineCount++;
			//			if (i + 1 <= height - 1 && grid[i + 1, j] == '#') mineCount++;

			//			if (j - 1 >= 0 && grid[i, j - 1] == '#') mineCount++;
			//			if (j + 1 <= width - 1 && grid[i, j + 1] == '#') mineCount++;

			//			if (i - 1 >= 0 && j - 1 >= 0 && grid[i - 1, j - 1] == '#') mineCount++;
   //                     if (i + 1 <= height - 1 && j + 1 <= width - 1 && grid[i + 1, j + 1] == '#') mineCount++;

			//			if (i - 1 >= 0 && j + 1 <= width - 1 && grid[i - 1, j + 1] == '#') mineCount++;
   //                     if (i + 1 <= height - 1 && j - 1 >= 0 && grid[i + 1, j - 1] == '#') mineCount++;
                        
			//			grid[i, j] = char.Parse(mineCount.ToString());

			//			Console.Write(grid[i, j]);
			//		}
			//		else
			//		{
			//			Console.Write(grid[i, j]);
			//		}
			//	}

			//	Console.Write("\n");
			//}

            //ジャグ配列バージョン
			char[][] grid = new char[height][];
            for (int i = 0; i < height; i++)
            {
				grid[i] = new char[width];
                string line = Console.ReadLine();
                for (int j = 0; j < width; j++)
                {
                    grid[i][j] = line[j];
                }
            }

			for (int i = 0; i < height; i++)
            {
                for (int j = 0; j < width; j++)
                {
                    int mineCount = 0;
                    if (grid[i][j] == '.')
                    {
                        if (i - 1 >= 0 && grid[i - 1][j] == '#') mineCount++;
                        if (i + 1 <= height - 1 && grid[i + 1][j] == '#') mineCount++;

                        if (j - 1 >= 0 && grid[i][j - 1] == '#') mineCount++;
                        if (j + 1 <= width - 1 && grid[i][j + 1] == '#') mineCount++;

                        if (i - 1 >= 0 && j - 1 >= 0 && grid[i - 1][j - 1] == '#') mineCount++;
                        if (i + 1 <= height - 1 && j + 1 <= width - 1 && grid[i + 1][j + 1] == '#') mineCount++;

                        if (i - 1 >= 0 && j + 1 <= width - 1 && grid[i - 1][j + 1] == '#') mineCount++;
                        if (i + 1 <= height - 1 && j - 1 >= 0 && grid[i + 1][j - 1] == '#') mineCount++;

                        grid[i][j] = char.Parse(mineCount.ToString());
                    }
                }

                Console.WriteLine(grid[i]);
            }
        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

int main() {
    ll n, ins;
    cin >> n;
    ins = n;
    ll sum = 0;
    while (ins) {
        sum += (ins % 10);
        ins /= 10;
    }
    if (n % sum == 0)
        cout << "Yes\n";
    else
        cout << "No\n";
    return 0;
}

Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	String S=sc.next();



    	System.out.println(S.replaceAll("2017", "2018"));
    }

}







Measured memory_bytes: 21844
import copy

h, w, k= map(int, input().split(' '))

def count_b(ar):
	count=0
	for i in ar:
		for j in i:
			if j== '#':
				count+=1
	return count

ar= []
for i in range(h):
	ar.append(list(input()))


tot_b= count_b(ar)

ans=0
for i in range(2**(h+w)):
	test_ar= copy.deepcopy(ar)
	case= str(bin(i)[2:])
	while len(case)<h+w:
		case= '0'+case
	for j in range(len(case)):
		if case[j]=='1':
			if j<h:
				for i in range(len(test_ar[j])):
					test_ar[j][i]=None
			else:
				col_num= j-h
				for row_num in range(h):
					test_ar[row_num][col_num]=None
	if count_b(test_ar)==k:
		ans+=1
print(ans)

Measured memory_bytes: 9172