akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
#define wl() cout << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

///////////////////////////////////////////////////////////////////////////////////////

unordered_set<ll> us;

bool solv(ll x) {
	while (x) {
		if (us.find(x % 10) != us.end()) return false;
		x /= 10;
	}
	return true;
}

int main() {
	ll n, k;
	cin >> n >> k;
	repi(i,0,k){
		ll d;
		rd(d);
		us.insert(d);
	}
	while (1) {
		if (solv(n)) {
			wrln(n);
			break;
		}
		n++;
	}
	return 0;
}


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

int main() {
  int N;
  std::cin >> N;
  double p = (double)(((N - (N % 2)) / 2) + N % 2) / (double)N;
  std::cout << std::setprecision(8) << p;
  return 0;
}

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

//Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

//Type Definitions:
typedef long long ll;
typedef unsigned long long ull;

//Constants:
const int INF = 2e9;
const int MOD = 1e9 + 7;

//Global Variables:
int n;

//Prototype Declarations:
int gcd(int, int);
int bins(int, int);

//================ Main Loop ================
int main() {
    cin >> n;
    ll ans = 0;
    for(int x = 1; x < 10; x++) {
        for(int y = 1; y < 10; y++) {
            int bf1 = 0, bf2 = 0;
            for(int b = (x != y); b <= 5; b++) {
                bf1 += bins(x * pow(10, b) + y, b - 1);
                bf2 += bins(y * pow(10, b) + x, b - 1);
                //dbg
                //cout << b << " " << bf1 << " " << bf2 << endl;
            }
            ans += (ll)bf1 * bf2;
            //dbg
            //cout << "----" << x << " " << y << " " << bf1 * bf2 << endl;
        }
    }
    cout << ans << endl;
    return 0;
}
//===========================================

//Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

int bins(int base, int vnum) {
    if(vnum == -1) return (base / 2) <= n;
    if(vnum == 0) return base <= n;
    int r = pow(10, vnum) - 1;
    int l = 0;
    int now;
    if(base + r * 10 <= n) return r + 1;
    if(base > n) return 0;
    while(1) {
        now = l + (r - l) / 2;
        if(l == r) {
            break;
        }
        if(base + now * 10 <= n) {
            l = now + 1;
        } else if(base + now * 10 > n) {
            r = now;
        }
    }
    //dbg
    //cout << base << " " << now << endl;
    return now;
}

Measured memory_bytes: 256
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]
ans = 0

for i in range(N):
  calc = 0
  for j in range(M):
    calc += A[i][j] * B[j]
  if calc + C > 0:
    ans += 1
    
print(ans)

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

int n;
vector<bool> s;

bool check(vector<bool> &ans) {
	for (int i = 1; i < n-2; i++) {
		if ((s[i] && !ans[i]) || (!s[i] && ans[i])) {
			ans[i+1] = ans[i-1];
		} else {
			ans[i+1] = !ans[i-1];
		}
	}
	bool ret = true;
	if ((s[n-1] && !ans[n-1]) || (!s[n-1] && ans[n-1])) {
		ret &= ans[n-2] == ans[0];
	} else {
		ret &= ans[n-2] != ans[0];
	}
	if ((s[n-2] && !ans[n-2]) || (!s[n-2] && ans[n-2])) {
		ret &= ans[n-3] == ans[n-1];
	} else {
		ret &= ans[n-3] != ans[n-1];
	}
	return ret;
}

void printvec(vector<bool> &ans) {
	for (int i = 0; i < n; i++) {
		cout << "SW"[ans[i]];
	}
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	string ch; cin >> n >> ch;
	for (int i = 0; i < n; i++) {
		if (ch[i] == 'o') s.push_back(true);
		else s.push_back(false);
	}
	for (int i = 0; i < 2; i++) {
		vector<bool> ans(n, false);
		ans[0] = bool(i);
		for (int j = 0; j < 2; j++) {
			if ((s[0] && !ans[0]) ||(!s[0] && ans[0])) {
				ans[1] = ans[n-1] = bool(j);
			} else {
				ans[1] = bool(j);
				ans[n-1] = !ans[1];
			}
			if (check(ans)) {
				printvec(ans);
				return 0;
			}
		}
	}
	cout << "-1" << endl;
	return 0;
}

Measured memory_bytes: 592
// Created by ...Lusifer
#include<bits/stdc++.h>
using namespace std;
 
#define pb 		push_back
#define mp 		make_pair
#define prior   priority_queue
#define MOD 	1000000007
#define INF64 	(long long)1e18
#define INF 	(int)1e9
#define PI 		3.1415926535897932384626433832795 
#define ll      long long
#define ld		long double
#define ret     return
#define NUM 	1000001
const int SIZE = 2e5+4;
void fastio(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

void solveTest(){
	int a,b,c,x;
	cin>>a>>b>>c>>x;
	int ans=0;
	for(int i=0;i<=a;i++){
		for(int j=0;j<=b;j++){
			for(int k=0;k<=c;k++){
				int t = 500*i+100*j+50*k;
				if(t==x){
					ans++;
				}
			}
		}
	}
	cout<<ans<<endl;
	
	return ;
}
 
int main(){
	fastio();

	int t=1;
	//cin>>t;
	while(t--){
		solveTest();
 
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const int SIZE = 1e6+5;
const LL INF = 1LL<<60;
const double eps = 1e-7;

char v[100009];

int main(){
	RS(v);
	int l=LEN(v);
	bool n=0,e=0,s=0,w=0;
	REP(i,l){
		if(v[i]=='N')n=1;
		if(v[i]=='E')e=1;
		if(v[i]=='S')s=1;
		if(v[i]=='W')w=1;
	}
	if(n^s||e^w)printf("No");
	else printf("Yes");
}


Measured memory_bytes: 256
n = int(input())
s = input()
ans = 0
for i in range(1, n+1):
    cnt = 0
    x = s[0:i]
    y = s[i:n+1]
    for j in range(97, 123):
        if chr(j) in x and chr(j) in y:
            cnt += 1
    ans = max(cnt, ans)
print(ans)

Measured memory_bytes: 9052
import math
def sieve(n, done):
    for i in range(n, 10**6+1, n):
        done[i] = 1

n = int(input())
a = sorted(map(int, input().split()))

ans = 0
done = [0] * (10 ** 6 + 1)

for i in range(n):
    num = a[i]
    if i < n-1 and a[i] == a[i+1]:
        if i > 0 and a[i] == a[i-1]:
            continue
        sieve(num, done)
        continue
    
    if not done[num]:
        sieve(num, done)
        ans += 1

print(ans)


Measured memory_bytes: 96876
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

dp = []
for i in range(N):
    if i < K:
        if T[i] == "s":
            dp.append([R, 0, 0])
        elif T[i] == "p":
            dp.append([0, S, 0])
        else:
            dp.append([0, 0, P])
    else:
        dpi = dp[-K]
        maxdpi = max(dpi)
        if T[i] == "s":
            dp.append([max(dpi[1], dpi[2]) + R, maxdpi, maxdpi])
        elif T[i] == "p":
            dp.append([maxdpi, max(dpi[0], dpi[2]) + S, maxdpi])
        else:
            dp.append([maxdpi, maxdpi, max(dpi[0], dpi[1]) + P])

ans = sum(max(dp[i]) for i in range(N - K, N))
print(ans)


Measured memory_bytes: 16500
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        
        if(n<=i*1.08&&i*1.08<n+1){
            cout<<i;
            break;
        }
        if(i==n){
            cout<<":(";
            break;
        }
    }
}

Measured memory_bytes: 256
n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0

for i in range(n-1):
    t=a[i]+a[i+1]
    if t>x:
        if t-x<=a[i+1]:
            a[i+1]-=t-x
            ans+=t-x
        else:
            a[i]+=x-a[i+1]
            a[i+1]=0
            ans+=t-x

print(ans)



Measured memory_bytes: 14056
#pragma GCC optimize("O3") 
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx") 
#define __USE_MINGW_ANSI_STDIO 0
#include<bits/stdc++.h>                               
using namespace std;

#define PI acos(-1)
#define pb push_back
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(c) (c).begin(), (c).end()
#define TIMESTAMP fprintf(stderr, "Execution time: %.3lf s.\n", (double)clock()/CLOCKS_PER_SEC)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair <int, int> pii;
typedef vector <vi> vvi;
typedef vector <pii> vpii;
typedef vector<string> vs;

const int MAXN = 1e5 + 9;
const int MOD = (int)(1e9 + 7);
const int INF = 100500;

void input() {
	ll n, a, b;
	cin >> n >> a >> b;
	vll hh(n);
	for(int i = 0; i < n; i++) cin >> hh[i];
	ll l = 0, r = 2e10;
	while(l < r - 1) {
		ll m = (l + r) / 2;
		ll cnt = 0;
		for(int i = 0; i < n; i++) {
			ll cur = hh[i] - (b * m);
			if(cur <= 0) continue;
			cnt += ((cur + (a - b - 1)) / (a - b));
		}
		if(cnt <= m) r = m;
		else l = m;
	}
	cout << r << endl;
}

void solve() {

}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#ifdef LOCAL
	freopen("xxx.in", "r", stdin);
	freopen("xxx.out", "w", stdout);
#else
	//freopen("xxx.in", "r", stdin);
	//freopen("xxx.out", "w", stdout);
#endif	
	input();
	solve();
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<time.h>
#include<ctype.h>
    char ch[201];
int main(){
    int n, i, j, cnt=0, a;
    scanf("%d", &n);
    scanf("%s", &ch);
    if(n%2==0){
    for(i=0, j=(n/2);i<(n/2),j<n;i++,j++){

            if(ch[i]==ch[j]){
                cnt++;

            }

    }
    if(cnt==ceil(n/2))
        printf("Yes");
    else
        printf("No");
    }
    else
        printf("No");

return 0;
}


Measured memory_bytes: 256
n,x,y = map(int, input().split())

dis = [0]*n

for i in range(n):
    for j in range(i+1, n):
        kyori = min(j-i, abs(x - (i+1)) + 1 + abs(y - (j+1)))
        dis[kyori] += 1

for k in range(1, n):
    print(dis[k])


Measured memory_bytes: 46300
#include <stdio.h>

int main() {	
	int a,b,ans;
	char op;
	
	scanf("%d %c %d",&a,&op,&b);
	
	if(op == '+'){
		ans = a + b;
		printf("%d",ans);
	}

	if(op == '-'){
		ans = a - b;
		printf("%d",ans);
	}
	return 0; 
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n,m;
    cin >> n >> m;
    ll ans=0;
    if(n*2>=m){
        ans=m/2;
        cout << ans << endl;
        return 0;
    }
    ans+=n;
    m-=n*2;
    ans+=m/4;
    cout << ans << endl;
}

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

using namespace std;

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

	if (N == 1){
		cout << "Hello World" << endl;
	}
	else{
		int A;
		int B;
		cin >> A;
		cin >> B;

		cout << A + B << endl;
	}
}

Measured memory_bytes: 256
import itertools
from collections import defaultdict
import collections
import sys
sys.setrecursionlimit(200000)
mod = 1000000007

a, b, c, k = map(int, input().split())

ans = 0
if a >= k:
    print(k)
elif a + b >= k:
    print(a)
else:
    print(a - (k - a-b))

Measured memory_bytes: 9464
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
using namespace std;
int main(){
  long long n;
  cin>>n;
  vector <int> a(n);
  for (long long i=0;i<n;i++)
    cin>>a[i];
  long long m=0,j=0,ans=0;
  for (long long i=0;i<n;i++){
    while (j<n && (m & a[j])==0)
      m ^= a[j++];
    ans+=j-i;
    m ^= a[i];
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>

using namespace std;

const int N = 100009;
int n, a[N], ans;

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  reverse(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++)
    if (i + 1 > a[i + 1]) {
      for (int j = i + 1; a[j] == i; j++) ans ^= 1;
      ans |= (a[i] - i) & 1;
      puts(ans ? "First" : "Second");
      return 0;
    }
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
typedef long long ll;
#define endl '\n'
using namespace std;
const ll MOD = 1000000007, MAX = 2000000007, MAXN = 100005;
ll ans[MAXN];

ll fast_exp(ll base, ll exp)
{
    if(exp==1)
        return base;
    else
    {
        if(exp%2 == 0)
        {
            ll x = fast_exp(base,exp/2);
            ll base1 = (x*x)%MOD;
            if(base1 >= MOD)
                return base1%MOD;
            else
                return base1;
        }
        else
        {
            ll x = fast_exp(base,(exp-1)/2);
            ll ans = (base*x)%MOD;
            ans = (ans*x)%MOD;
            if(ans >= MOD)
                return ans%MOD;
            else
                return ans;
        }
    }
}

ll solve(ll n, ll k)
{
    for(ll i=k; i>=1; i--)
    {
        ll muls = k/i;
        ans[i] = fast_exp(muls,n);
        ans[i]%=MOD;
        ll to_subtract = 0;
        for(ll j=i+i; j<=k; j+=i)
        {
            to_subtract+=ans[j];
            to_subtract%=MOD;
        }
        ans[i] = (ans[i] - to_subtract + MOD)%MOD;
    }
    ll finalans = 0;
    for(ll i=1; i<=k; i++)
    {
        ll temp = (ans[i]*i)%MOD;
        finalans+=temp;
        finalans%=MOD;
    }
    return finalans;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    ll n,k;
    cin>>n>>k;       
    cout<<solve(n,k)<<endl;
	return 0;
}

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()
auto &errStream = cerr;
#ifdef LOCAL
#define cerr (cerr << "-- line " << __LINE__ << " -- ")
#else
class CerrDummy {
} cerrDummy;
template <class T> CerrDummy &operator<<(CerrDummy &cd, const T &) {
  return cd;
}
using charTDummy = char;
using traitsDummy = char_traits<charTDummy>;
CerrDummy &operator<<(CerrDummy &cd,
                      basic_ostream<charTDummy, traitsDummy> &(
                          basic_ostream<charTDummy, traitsDummy> &)) {
  return cd;
}
#define cerr cerrDummy
#endif
#define REACH cerr << "reached" << endl
#define DMP(x) cerr << #x << ":" << x << endl
#define ZERO(x) memset(x, 0, sizeof(x))
#define ONE(x) memset(x, -1, sizeof(x))

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

#define CAPITAL
void Yes(bool ex = true) {
#ifdef CAPITAL
  cout << "YES" << endl;
#else
  cout << "Yes" << endl;
#endif
  if (ex)
    exit(0);
}
void No(bool ex = true) {
#ifdef CAPITAL
  cout << "NO" << endl;
#else
  cout << "No" << endl;
#endif
  if (ex)
    exit(0);
}

const ll infLL = LLONG_MAX / 3;

#ifdef int
const int inf = infLL;
#else
const int inf = INT_MAX / 2 - 100;
#endif

signed main() {
  int A = read(), B = read(), C = read();

  if (A == B) {
    print(C);
  } else if (A == C) {
    print(B);
  } else {
    print(A);
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
	if (a<b) { return gcd(b, a); }
	else if (a%b) { return gcd(b, a%b); }
	else { return b; }
}
int main() {
	ll R;
	cin >> R;
	if (R < 1200)
		cout << "ABC" << endl;
	else if (R >= 1200 && R < 2800)
		cout << "ARC" << endl;
	else
		cout << "AGC" << endl;

}








Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORD(i,a,b) for (int i = (a); i >= (b); i--)
#define REP(i,a) FOR(i,0,(int)(a)-1)
#define reset(a,b) memset(a,b,sizeof(a))
#define BUG(x) cout << #x << " = " << x << endl
#define PR(x,a,b) {cout << #x << " = "; FOR (_,a,b) cout << x[_] << ' '; cout << endl;}
#define CON(x) {cout << #x << " = "; for(auto i:x) cout << i << ' '; cout << endl;}
#define mod 1000000007
#define pi acos(-1)
#define eps 0.00000001
#define pb push_back
#define sqr(x) (x) * (x)
#define _1 first
#define _2 second

long long n, m, x[55], y[55], xx[55], yy[55];

int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  REP (i, n) cin >> x[i] >> y[i];
  FOR (i, 1, m) cin >> xx[i] >> yy[i];
  REP (i, n) {
  	long long ans = 1, cur = abs(x[i] - xx[1]) + abs(y[i] - yy[1]);
  	FOR (j, 2, m) {
  		long long tmp = abs(x[i] - xx[j]) + abs(y[i] - yy[j]);
  		if (cur > tmp) ans = j, cur = tmp;
  	}
  	cout << ans << endl;
  }
}

Measured memory_bytes: 256
h, w = list(map(int, input().split()))
m = 1000000007

grid = [input() for _ in range(h)]

dp = [[0 for _ in range(w)] for _ in range(h)]
dp[0][0] = 1

for y in range(h):
    for x in range(w):
        if grid[y][x] == ".":
            if y > 0:
                dp[y][x] += dp[y-1][x]
            if x > 0:
                dp[y][x] += dp[y][x-1]

            dp[y][x] %= m

print(dp[h-1][w-1])

Measured memory_bytes: 50476
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
int main()
{
	int N, M, a, b;
	vector<int> A;
	cin >> N >> M;
	A.resize(N, 0);

	rep(i, M) {
		cin >> a >> b;
		a--; b--;
		A.at(a)++;
		A.at(b)++;
	}
	rep(i, N) cout << A.at(i) << endl;

	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        for line in sys.stdin:
            lines.append(line.strip())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    n = int(lines[0])
    aa = [int(e) for e in lines[1].split(' ')]

    return (n, aa)


def solve(n, aa):

    cnt = 0
    for i in range(1, n+1):
        if i % 2 == 1 and aa[i-1] % 2 == 1:
            cnt = cnt + 1
            
    
    return cnt


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()
	

Measured memory_bytes: 62036
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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

    string s;
    cin >> s;

    int bucket[26] = {0};

    rep(i, s.length()){
        ++bucket[s[i] - 'a'];
    }
    rep(i, 26){
        if(bucket[i] > 1){
            puts("no");
            return 0;
        }
    }
    puts("yes");
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    if(s.at(0)!=s.at(1)&&s.at(1)!=s.at(2)&&s.at(2)!=s.at(3)){
        cout << "Good" << endl;
    }else{
        cout << "Bad" << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };


signed main() {
	int n, minn = 9999999;

	cin >> n;

	for (int i = 1; i < n; i++) {
		int num = n - i;
		string s1 = to_string(i);
		string s2 = to_string(num);
		int sum1 = 0, sum2 = 0;

		for (int j = 0; j < s1.length(); j++) {
			sum1 += s1[j] - '0';
		}

		for (int j = 0; j < s2.length(); j++) {
			sum2 += s2[j] - '0';
		}

		minn = min(minn, sum1 + sum2);
	}

	cout << minn << endl;
	  
	return 0;
}

Measured memory_bytes: 256
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import math
from functools import reduce
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
def lcm_base(a, b):
    return (a * b) // gcd(a, b)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def main():
  a, b, x = map(int, readline().split())
  V = a*a*b/2
  if V < x:
    ans = math.degrees(math.atan((2*(a*a*b-x))/a**3))
  else:
    ans = math.degrees(math.atan((a*b*b)/(2*x)))
  print(ans)
  
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 14564
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define FILE "file"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 4 * 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

typedef long long ll;
#define pb push_back
#define mp make_pair

vector<vector<int>> g;
vector<int> val;

void dfs(int v, int p = -1)
{
    for(int i = 0; i < (int) g[v].size(); i++)
    {
        int next = g[v][i];
        
        if(next == p)
        {
            continue;
        }
        
        val[next] += val[v];
        dfs(next, v);
    }
}

void solve()
{
    int n, q;
    cin >> n >> q;
    
    g.resize(n);
    val.assign(n, 0);
    
    for(int i = 0; i < n - 1; i++)
    {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        
        g[u].pb(v);
        g[v].pb(u);
    }
    
    for(int i = 0; i < q; i++)
    {
        int q, x;
        cin >> q >> x;
        q--;
        val[q] += x;
    }
    
    dfs(0);
    
    for(int i = 0; i < n; i++)
    {
        cout << val[i] << " ";
    }
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen("/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.in", "r", stdin);freopen("/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.out", "w", stdout);
    
    int t = 1;
    //cin >> t;
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 23552
#include<stdio.h>
int main() {
	int x, i = 0;
	while (1) {
		i++;
		if (i == 10001) break;
		scanf("%d", &x);
		if (x == 0 ) {
			break;
		}
		printf("Case %d: %d\n", i, x);
	}
	return 0;
}

Measured memory_bytes: 2680
n,k=map(int,input().split())
p=list(map(int,input().split()))
from heapq import heappop,heappush,heapify


import heapq
class pqheap:
  def __init__(self,key=None):
    self.p = list()
    self.q = list()

  def insert(self,x):
    heapq.heappush(self.p, x)
    return

  def erase(self,x):
    heapq.heappush(self.q, x)
    return

  def minimum(self):
    while self.q and self.p[0] == self.q[0]:
      heapq.heappop(self.p)
      heapq.heappop(self.q)
    return self.p[0] if len(self.p)>0 else None
minheap=pqheap()
maxheap=pqheap()
for i in range(k):
  minheap.insert(p[i])
  maxheap.insert(-p[i])
ans=1
premin=minheap.minimum()
premax=-maxheap.minimum()

for i in range(k,n):
  ins=p[i]
  era=p[i-k]
  minheap.erase(era)
  maxheap.erase(-era)
  minheap.insert(ins)
  maxheap.insert(-ins)
  if premin==era and ins==-maxheap.minimum():
    pass
  else:
    ans+=1
  premax=-maxheap.minimum()
  premin=minheap.minimum()
ans0=0
now=1
pre=p[0]
for x in p[1:]:
  if x>pre:
    now+=1
  else:
    now=1
  if now==k:
    ans0+=1
  pre=x


print(ans-max(0,ans0-1))


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

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

using namespace std;

int main(){
	int deg[4]={};
	rep(i,3){
		int u,v; scanf("%d%d",&u,&v); u--; v--;
		deg[u]++;
		deg[v]++;
	}
	puts(count(deg,deg+4,3)==0?"YES":"NO");

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;	
int n,m,a,b;
int main()
{
	scanf("%d%d%d%d",&n,&m,&a,&b);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
			if((i<=b&&j<=a)||((i>b&&j>a)))
				printf("1");
			else
				printf("0");
		printf("\n");
	}
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define int long long 
using namespace std;
const int maxn=1e5+5;
int a[maxn];
int vis[maxn];
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    int sum=0;
    for(int i=1;i<=n;i++){cin>>a[i];vis[a[i]]++;sum+=a[i];}
    int m;
    cin>>m;
    int b,c;
    for(int i=1;i<=m;i++){
       cin>>b>>c;
       sum+=(vis[b]*c-vis[b]*b);
       vis[c]+=vis[b];
       vis[b]=0;
       cout<<sum<<endl;


    }
    return 0;
}

Measured memory_bytes: 5156
#include <bits/stdc++.h>
#define INF 1234567891
#define MAXS 100007

#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define INP freopen("input.txt", "r", stdin)
#define OUT freopen("out.txt", "w", stdout)

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int n, m, a, b;
int lista[MAXS];
vector <pii > vetor;
vector <int> o;

void tes(){
  vi aux = o;
  vi aux2;
  while(!aux.empty()){
    for(int i = 0 ; i < aux.size(); ++i){
      if(lista[i] < o[i]) lista[i] = o[i];
      else{
        aux2.pb(o[i]);
      }
    }
    aux = aux2;
  }
}

int main(){
  cin >> n >> m;
  for(int i = 0; i < n; ++i){
    cin >> lista[i];
  }
  sort(lista, lista+n);
  for(int i = 0; i < m; ++i){
    cin >> a  >> b;
    vetor.pb(mp(b, a));
  }
  sort(vetor.begin(),vetor.end());
  reverse(vetor.begin(), vetor.end());
  for(int i = 0; i < vetor.size(); ++i){
    if(o.size() >= n) break;
    for(int j = 0; j < vetor[i].second; ++j){
      o.pb(vetor[i].first);
      if(o.size() >= n) break;
    }
  }
  // reverse(o.begin(), o.end());
  ll ans = 0;
  int i;
  for(i = 0; i < o.size(); ++i){
    ans += max(o[i], lista[i]);
  }
  for(i; i < n; ++i){
    ans+=lista[i];
  }
  cout << ans;
}

Measured memory_bytes: 2292
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

int main(){
    int a,b,c,x,y; cin >> a >> b >> c >> x >> y;
    int ans = a * x + b * y;
    for(int i= 1; i <= 2 * max(x,y); i++){
        if(x >= i && y >= i){
            ans = min(ans,a * (x - i) + b * (y - i) + c * 2 * i);
        }else if(x < i && y >= i){
            ans = min(ans,  b * (y - i) + c * 2 * i);
        }else if(x >= i && y < i){
            ans = min(ans, a * (x - i) + c * 2 * i);
        }else{
            ans = min(ans , c * 2 * i);
        }
    }
    cout << ans << endl;
}

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

int main(){
	int i, j, tmp, a[3]={1, 0, 0};
	char s1, s2, kanma;
	
	
	while(1){
		cin>>s1>>kanma>>s2;
		if(cin.eof())break;

		if(s1=='A'||s2=='A'){
			i=0;
			if(s1=='B'||s2=='B')
				j=1;
			else 
				j=2;
		}
		else if(s1=='B'||s2=='B'){
			i=1;
			if(s1=='C'||s2=='C')
				j=2;
			else
				j=0;
		}
		else if(s1=='C'||s2=='C'){
			i=2;
			if(s1=='A'||s2=='A')
				j=0;
			else
				j=1;
		}

		tmp=a[i];
		a[i]=a[j];
		a[j]=tmp;
	}
if(a[0]==1)
		cout<<"A\n";
	else if(a[1]==1)
		cout<<"B\n";
	else if(a[2]==1)
		cout<<"C\n";

	return 0;

}


Measured memory_bytes: 3048
import std.stdio, std.algorithm;

int[1000][1000] memo;
int[200] h, r;
int n, m;

void main(){
	while (readf("%d\n", &n), n) {
		foreach (i; 0..n) readf("%d %d\n", &h[i], &r[i]);
		readf("%d\n", &m);
		foreach (i; 0..m) readf("%d %d\n", &h[n+i], &r[n+i]);
		n = n + m;
		foreach (i; 0..1000) memo[i][] = -1;
		writeln(solve(999, 999));
	}
}

int solve(int xh, int xr){
	int res = 0;
	if (memo[xh][xr] != -1) return memo[xh][xr];
	foreach (i; 0..n)
		if (h[i] < xh && r[i] < xr)
			res = max(res, solve(h[i], r[i])+1);

	return memo[xh][xr] = res;
}

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

using namespace std;

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

const int N = 1e5 + 100;

int cnt[N];

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

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

	int x = 0;
	for (int i = 0; i < n; i++)
		x += cnt[i] % 2;

	if (x) cout << "NO\n";
	else cout << "YES\n";
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cctype>
#include <vector>
#include <queue>
#include <string>

#define ll long long

using namespace std;

inline int read() {
	int x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)) {if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*f;
}

char s[10000];

bool isp(int l,int r) {
	for (int i=l;i<=r;i++) {
		int j=r-(i-l);
		if (s[i]!=s[j]) return false;
	}
	return true;
}

int main() {
	scanf("%s",s+1);
	int n=strlen(s+1);
	if (isp(1,n)&&isp(1,(n-1)/2)&&isp((n+3)/2,n)) {
		cout<<"Yes"<<endl;
	} else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
// Harry Singh**************************************************************************************************************

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 using namespace std;
#define endl '\n'
#define ll long long 
#define maxn 100010
const int MOD = 1000000007;
bool prime[20000000+3]; 

void harry_singh(){

   
   int k;cin>>k;string s;cin>>s;
   if(s.length()<=k)
   cout<<s<<endl;
   else
   {
   	for(int i=0;i<=k-1;i++)
   	cout<<s[i];
   	
   	cout<<"...\n";
   }
   
}
 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
 
    int t=1;
    while (t--)
   harry_singh();
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<vector<int>> table(3,vector<int>(3));
  for(int k = 0;k < 9;k++){
    int i,j;
    i = k / 3;
    j = k % 3;
    cin >> table.at(i).at(j);
  }
  vector<int> yoko(3);
  vector<int> tate(3);
  for(int i = 0;i < 3;i++){
  yoko.at(i) = table.at(i).at(0) + table.at(i).at(1) + table.at(i).at(2);
  tate.at(i) = table.at(0).at(i) + table.at(1).at(i) + table.at(2).at(i);
  }
  bool yokosum = true;
  bool tatesum = true;
  for(int i = 0;i < 2;i++){
    if((yoko.at(i+1) - yoko.at(i)) % 3 != 0) yokosum = false;
    if((tate.at(i+1) - tate.at(i)) % 3 != 0) tatesum = false;
  }
  if(yokosum == true && tatesum == true) cout << "Yes" << endl;
  else cout << "No" << endl;
}
  

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

#define MAX(p,q) (p>q)?p:q
#define MIN(p,q) (p<q)?p:q

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

int main(void)
{
  int i,j;
  int n,m,c;
  scanf("%d%d%d",&n,&m,&c);
  int b[m];
  int a[n][m];
  REP(i,m) scanf("%d",&b[i]);
  REP(i,n)
  {
    REP(j,m) scanf("%d",&a[i][j]);
  }
  int flag=0;
  int ans=0;
  REP(i,n)
  {
    ans = c;
    REP(j,m)
    {
      ans += a[i][j]*b[j];
    }
    if(ans > 0) flag++;
  }
  printf("%d",flag);
  return 0;
}


Measured memory_bytes: 128
a,b, c=map(int, input().split())
mini=a
middle=b
maxi=c
if a< b :
    if c < a:
       mini= c
       middle=a
       maxi=b
    elif c< b:
        mini=a
        middle=c
        maxi=b
    else:
        mini=a
        middle=b
        maxi=c
else:
     if c < b:
       mini  =c
       middle=b
       maxi=a
     elif c< a:
        mini=b
        middle=c
        maxi=a
     else:
        mini=b
        middle=a
        maxi=c

print(mini, middle, maxi)


Measured memory_bytes: 5596
function Vector(x, y) {
  this.x = x;
  this.y = y;
}
Vector.prototype.sub = function(v) {
  return new Vector(this.x - v.x, this.y - v.y);
};
Vector.prototype.product = function(v) {
  return this.x * v.y - this.y * v.x;
};

(function(input) {
  var line = input.replace(/\n$/, '').split('\n');
  while (line.length > 0) {
    var p = line.shift().split(' ').map(Number);

    var v1 = new Vector(p.shift(), p.shift());
    var v2 = new Vector(p.shift(), p.shift());
    var v3 = new Vector(p.shift(), p.shift());
    var p = new Vector(p.shift(), p.shift());

    var v12 = v2.sub(v1);
    var v2p = p.sub(v2);
    var v23 = v3.sub(v2);
    var v3p = p.sub(v3);
    var v31 = v1.sub(v3);
    var v1p = p.sub(v1);

    var c1 = v12.product(v2p);
    var c2 = v23.product(v3p);
    var c3 = v31.product(v1p);
    
    if ((c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0)) {
      console.log('YES');
      continue;
    }
    console.log('NO');
  }
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 8700
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m, x, y;
    cin >> n >> m;
    vector<pair<int, int>> v;
    for(int i=0; i<m; i++){
    	cin >> x >> y;
    	v.push_back({x, y});
    }
    sort(v.begin(), v.end());
    int res=0, r=0;
    for(int i=0; i<m; i++){
    	if(v[i].first>=r){
    		res++;
    		r=v[i].second;
    	}else{
    		r=min(r, v[i].second);
    	}
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <cmath>
#include <ios>
#include <ctype.h>
#include <stack>
#include <istream>
#include <stdio.h>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <functional>
#include <bitset>
#include <list>
#include <deque>
#include <time.h>
#include <random>
#include <iomanip>
#include <fstream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define pint pair<int,int>
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int,int>>>;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
int main(){
  int n,l;
  cin >> n >> l;
  vector<string>v(n);
  rep(i,n)cin >> v[i];
  sort(all(v));
  rep(i,n)cout << v[i];
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <ostream>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstring>

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

template <typename T, typename U>
std::ostream& operator << (std::ostream& out, std::pair<T, U> p) {
  out << "(" << p.first << ", " << p.second << ")";
  return out;
}

template <typename T>
std::ostream& operator << (std::ostream& out, std::vector<T> v) {
  out << "[";
  for (int i = 0; i < v.size(); ++i) {
    out << v[i] << (i == (v.size() - 1) ? "" : ", ");
  }
  out << "]";
  return out;
}

std::vector<int> prime{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
std::vector<int> prime_num(25, 0);

int f(int idx, int count) {
  if (idx >= 25 or count > 75) {
    return 0;
  }
  if (count == 75) {
    return 1;
  }

  int ret = 0;

  for (int i = 0; i <= prime_num[idx]; ++i) {
    ret += f(idx + 1, count * (i + 1));
  }

  return ret;
}

int main() {
  int N;

  cin >> N;

  if (N <= 9) {
    cout << 0 << endl;
    return 0;
  }

  for (int i = 2; i <= N; ++i) {
    int k = i, idx = 0;

    while (k != 1) {
      if (k % prime[idx] != 0) {
        idx++;
        continue;
      }

      k /= prime[idx];
      prime_num[idx]++;
    }
  }

  //cout << prime_num << endl;

  cout << f(0, 1) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int n, p, d1, d2, best_p;
  while (true) {
    int longest = -1;
    cin >> n;
    if (n == 0) {
      return 0;
    }
    for (int i = 0; i < n; ++i) {
      cin >> p >> d1 >> d2;
      if (d1 + d2 > longest) {
        longest = d1 + d2;
        best_p = p;
      }
    }
    cout << best_p << " " << longest << endl;
  }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
typedef pair<int,int> PII;
const int mod = 1e9+7,INF = 1e9;
const int mx = 1e6+5;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin>>n;
    string s;
    while(n>0)
    {
        int d = n%26;
        if(d==0)
            d =26;
        s+= (char)(d+'a'-1);
        n=n-d;
        n/=26;
    }
    reverse(s.begin(),s.end());
    cout<<s<<endl;
    return 0;
}



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

int main(){
    int n;cin>>n;
    vector<int> l(n),r(n);
    int ans=0;

    for(int i=0;i<n;i++){
        cin>>l[i]>>r[i];
        ans += r[i]-l[i]+1;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int bitcnt(int);
int dp[31][65536];
int main(void)
{
	int n,c,aa[16],bb[16],a[30],b[30];

	int i,j,x,cnt,k,x1,x2,max;
	
	while(1)	{
		scanf("%d %d",&n,&c);
		if(n==0 && c==0)	break;
		for(i=0;i<n;i++)	{
			a[i]=0;
			for(j=0;j<16;j++)	{
				a[i]=a[i]*2;
				scanf("%d",&x);
				a[i]=a[i]+x;
			}
		}
		for(i=0;i<c;i++)	{
			b[i]=0;
			for(j=0;j<16;j++)	{
				b[i]=b[i]*2;
				scanf("%d",&x);
				b[i]=b[i]+x;
			}
		}		
		for(i=0;i<=n;i++)	{
			for(j=0;j<65536;j++)	{
				dp[i][j]=-1;
			}
		}
		dp[0][0]=0;
		for(i=0;i<n;i++)	{
			for(j=0;j<65536;j++)	{
				if(dp[i][j]!=-1)	{
					x=j|a[i];
					for(k=0;k<c;k++)	{
						x1=x&b[k];
						x2=x&(b[k]^0x0000ffff);
//						printf("x2=%d\n",x2);
						cnt=bitcnt(x1);
						if(dp[i+1][x2]<dp[i][j]+cnt)	{
							dp[i+1][x2]=dp[i][j]+cnt;
						}
					}
				}
			}
		}
		max=-1;
		for(j=0;j<65536;j++)	{
			if(max<dp[n][j])	max=dp[n][j];
		}
		printf("%d\n",max);
	}
	return 0;
}
int bitcnt(int x)
{
	int cnt,i;
	cnt=0;
	for(i=0;i<16;i++)	{
		cnt=cnt+x%2;
		x=x>>1;
	}
	return cnt;
}


Measured memory_bytes: 8536
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define infy  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;
int main()
{
 
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  string s1,s2;
  cin >> s1 >> s2;
  for (int i = 0; i < n; ++i)
  {
    cout << s1[i] << s2[i];
  }
  return 0;
} 


Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
#define F first
#define S second
const ll E=1LL<<60;
const ll MOD=1000000007;

ll gcd(ll a,ll b){
    while(a%b){a%=b; swap(a,b);}
    return b;
}


int main(){
    ll n,m;
    cin>>n>>m;
    vector<ll> A(n);
    vector<ll> P(n);
    for(auto &I:A){cin>>I;}
    for(auto &I:P){cin>>I;}
    vector<double> p(1LL<<n,1);
    vector<double> p2(1LL<<n,1);
    vector<ll> LCM(1LL<<n,1);
    vector<ll> bitcount(1LL<<n,0);
    const ll ALL=(1LL<<n)-1;
    for(ll i=1;i<(1LL<<n);i++){
        for(int t=0;t<n;t++){
            if(i>>t&1){
                p[i]=p[i^(1LL<<t)]*P[t]/100.0;
                p2[i]=p2[i^(1LL<<t)]*(100-P[t])/100.0;
                LCM[i]=LCM[i^(1LL<<t)];
                bitcount[i]=bitcount[i^(1LL<<t)]+1;
                if(LCM[i]==E){break;}
                ll g=gcd(LCM[i],A[t]);
                if(LCM[i]/g<m/A[t] || (LCM[i]/g==m/A[t] && LCM[i]/g*A[t]<=m)){LCM[i]=LCM[i]/g*A[t];}
                else{LCM[i]=E;}
                break;
            }
        }
    }
    for(ll i=1;i<(1LL<<n);i++){
        LCM[i]=m/LCM[i];
        if(bitcount[i]&1){LCM[i]*=-1;}
    }
    LCM[0]=0;
    for(int i=0; i<n; i++){
        for(int s=0; s<1<<n; s++){
            if ((s>>i&1)==1){
                LCM[s]+=LCM[s^(1<<i)];
            }
        }
    }
    
    double ans=0;
    for(ll i=1;i<(1LL<<n);i++){
        LCM[i]=abs(LCM[i]);
        ans+=LCM[i]*p[i]*p2[ALL^i];
        //cout<<i<<" "<<LCM[i]<<endl;
    }
    cout<<fixed<<setprecision(12)<<ans<<endl;
    
    
    
    return 0;
}



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

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

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

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

int main() {

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

	string s, t;
	cin >> s >> t;

	for (int i = s.size() - t.size(); i >= 0; i--) {
		DMP(i);
		if (equal(s.begin() + i, s.begin() + i + t.size(), t.begin(), 
			[](auto s, auto t) { return s == '?' || s == t; })) {

			for (int j = 0; j < i; j++) {
				if (s[j] == '?') cout << 'a';
				else cout << s[j];
			}
			cout << t;
			for (int j = i + t.size(); j < s.size(); j++) {
				if (s[j] == '?') cout << 'a';
				else cout << s[j];
			}

			return 0;
		}
	}

	cout << "UNRESTORABLE" << "\n";
	return 0;
}

Measured memory_bytes: 256
'use strict'

const main = arg => {
    var input = arg.trim().split("\n");
    const endIndex = input.indexOf("0");
    input = input.slice(0, endIndex);
    const result = [];

    input.forEach(str => {
        const sum = str.split("").map(num => parseInt(num ,10)).reduce((a,b) => a + b);
        result.push(sum);
    });
    
    console.log(result.join("\n"));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 16468
N, M = map(int,input().split())

lang = [[] for _ in range(M)]

for i in range(N):
    L = list(map(int,input().split()))[1:]
    for l in L:
        l -= 1
        lang[l].append(i)

class Unionfind:

    __slots__ = ['nodes','size']

    def __init__(self, n):
        self.nodes = list(range(n))
        self.size = [1]*n

    def root(self, x):
        if self.nodes[x] == x:
            return x
        else:
            root_x = self.root(self.nodes[x])
            self.nodes[x] = root_x
            return root_x

    def unite(self, x, y):
        x = self.root(x); y = self.root(y)
        if x == y:
            return
        if self.size[x] < self.size[y]:
            x, y = y, x
        self.size[x] += self.size[y]
        self.nodes[y] = x

    def same(self, x, y):
        return self.root(x) == self.root(y)

    def kind(self):
        for v in range(N):
            self.root(v)
        return len(list(set(self.nodes)))

uf = Unionfind(N)

for group in lang:
    for i in range(len(group)-1):
        v = group[i]
        nv = group[i+1]
        uf.unite(v, nv)

if uf.kind() == 1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 19000