akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    // TODO 自動生成されたメソッド・スタブ
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();

    int p[][] = new int[m][3];

    for (int i = 0; i < m; i++) {
      p[i][0] = sc.nextInt();
      p[i][1] = sc.nextInt();
      p[i][2] = i;
    }

    Arrays.sort(p, (a, b) -> Integer.compare(a[1], b[1]));
    Arrays.sort(p, (a, b) -> Integer.compare(a[0], b[0]));

    p[0][1] = 1;
    for (int i = 1; i < m; i++) {
      p[i][1] = p[i][0] == p[i - 1][0] ? p[i - 1][1] + 1 : 1;
    }

    Arrays.sort(p, (a, b) -> Integer.compare(a[2], b[2]));

    for (int i = 0; i < m; i++) {
      System.out.print(String.valueOf(p[i][0] + 1_000_000).substring(1, 7));
      System.out.println(String.valueOf(p[i][1] + 1_000_000).substring(1, 7));
    }
  }
}

Measured memory_bytes: 100472
import java.util.Scanner;

public class Main {
  
  public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long W = sc.nextLong();
		int vmax = 100000;

		long[][] dp = new long[N+1][vmax+1];
		long INF = 1000000001;

		for(int i=0;i<=N;i++){
			for(int j=0;j<=vmax;j++){
				dp[i][j] = INF;
			}
		}

		dp[0][0] = 0;

		for(int i=1;i<=N;i++){

			long wi = sc.nextLong();
			int vi = sc.nextInt();

			for(int j=0;j<=vmax;j++){


				if(j + vi <= vmax){
					dp[i][j+vi] = chmin(dp[i-1][j]+wi, dp[i][j+vi]);
				}

				dp[i][j] = chmin(dp[i-1][j]+0, dp[i][j]);
			}
		}

		long ans = 0;

		/*
		for(int i=0;i<=N;i++){
			for(int j=0;j<=vmax;j++){
				System.out.print(dp[i][j]);;
			}
			System.out.println();
		}
		*/

		for(int vi=vmax;vi>=0;vi--){
//			System.out.println(dp[N][vi]);
			if(dp[N][vi] <= W){
				ans = vi;
				break;
			}
		}

		System.out.println(ans);
	}



	public static long chmin(long a, long b){

		if(a <= b){
			return a;
		}else{
			return b;
		}
	}

}

Measured memory_bytes: 127060
n = int(input())
listx = []
listu = []
for i in range(n):
    x, u = input().split()
    listx.append(float(x))
    listu.append(u)

s = 0
for i in range(n):
    if listu[i] == "JPY":
        s += listx[i]
    else:
        s += listx[i] * 380000

print(s)


Measured memory_bytes: 3060
import sys
#from collections import defaultdict, deque, Counter
#from bisect import bisect_left
#import heapq
#import math
#from itertools import groupby as gb
#from itertools import permutations as perm
#from itertools import combinations as comb
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
#x,y,z = map(int, stdin.readline().rstrip().split())
#AB = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]

print(n//2 + n%2)


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

#define pb push_back
#define fr first
#define sc second

int main(){
	static int N,M,Q;
	static string S[2002];
	static int x1[200010],y1[200010],x2[200010],y2[200010];
	scanf("%d%d%d",&N,&M,&Q);
	for(int i = 1 ; i <= N ; i ++){
		cin >> S[i];
	}
	for(int i = 1 ; i <= Q ; i ++){
		scanf("%d%d%d%d",&x1[i],&y1[i],&x2[i],&y2[i]);
	}
	
	static int a[2002][2002] = {}, b[2002][2002] = {}, c[2002][2002] = {};
	for(int i = 1 ; i <= N ; i ++){
		for(int j = 1 ; j <= M ; j ++){
			a[i][j] = S[i][j-1] - '0';
		}
	}
	for(int i = 1 ; i <= N ; i ++){
		for(int j = 1 ; j <= M-1 ; j ++){
			if(S[i][j-1] == '1' && S[i][j] == '1'){
				b[i][j] = 1;
			}
		}
	}
	for(int i = 1 ; i <= N-1 ; i ++){
		for(int j = 1 ; j <= M ; j ++){
			if(S[i][j-1] == '1' && S[i+1][j-1] == '1'){
				c[i][j] = 1;
			}
		}
	}
	for(int i = 0 ; i < 2002 ; i ++){
		for(int j = 1 ; j < 2002 ; j ++){
			a[i][j] += a[i][j-1];
			b[i][j] += b[i][j-1];
			c[i][j] += c[i][j-1];
		}
	}
	for(int i = 1 ; i < 2002 ; i ++){
		for(int j = 0 ; j < 2002 ; j ++){
			a[i][j] += a[i-1][j];
			b[i][j] += b[i-1][j];
			c[i][j] += c[i-1][j];
		}
	}
	
	for(int i = 1 ; i <= Q ; i ++){
		x1[i] --;
		y1[i] --;
		int A = a[x1[i]][y1[i]] - a[x1[i]][y2[i]] - a[x2[i]][y1[i]] + a[x2[i]][y2[i]];
		int B = b[x1[i]][y1[i]] - b[x1[i]][y2[i]-1] - b[x2[i]][y1[i]] + b[x2[i]][y2[i]-1];
		int C = c[x1[i]][y1[i]] - c[x1[i]][y2[i]] - c[x2[i]-1][y1[i]] + c[x2[i]-1][y2[i]];
		//cout << A << " " << B << " " << C << endl;
		printf("%d\n",A-B-C);
	}
}



Measured memory_bytes: 56064
#include <stdio.h>
#include <stdlib.h>

typedef struct Node {
  struct Node* children[4000];
  int size;
  int citizen;
} Node;

char str[20000];
char* ptr;

Node* create() {
  Node* node = calloc(1, sizeof(Node));
  while (++ptr, *ptr != '\0') {
    if (*ptr == '[') {
      node->children[node->size++] = create();
    } else if (*ptr == ']') {
      return node;
    } else if (*ptr >= '0' && *ptr <= '9') {
      node->citizen = node->citizen * 10 + (*ptr - '0');
    }
  }

  return node;
}

int asc(const void* a, const void* b) { return *(int*)a - *(int*)b; }

int dfs(Node* n) {
  if (n->citizen != 0) {
    return n->citizen / 2 + 1;
  }

  int* arr = malloc(sizeof(int) * n->size);

  int i;
  for (i = 0; i < n->size; ++i) {
    arr[i] = dfs(n->children[i]);
  }

  qsort(arr, n->size, sizeof(int), asc);

  int sum = 0;
  for (i = 0; i < n->size / 2 + 1; ++i) {
    sum += arr[i];
  }

  return sum;
}

void deallocate(Node* n) {
  int i;
  for (i = 0; i < n->size; ++i) {
    deallocate(n->children[i]);
  }

  free(n);
}

void print_space(int space) {
  while (space--) {
    printf(" ");
  }
}

void print(int tabstop, int depth, Node* node) {
  if (node->citizen != 0) {
    print_space(depth);
    printf("%d,\n", node->citizen);
    return;
  }
  print_space(depth);
  puts("{");
  int i;
  for (i = 0; i < node->size; ++i) {
    print(tabstop, depth + tabstop, node->children[i]);
  }
  print_space(depth);
  puts("},");
}

int main(void) {
  int n;
  scanf("%d", &n);
  while (n--) {
    scanf("%s", str);

    ptr = str;

    Node* root = create();
    printf("%d\n", dfs(root));
    // print(2, 0, root);
    deallocate(root);
  }
}


Measured memory_bytes: 92592
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  std::cout << (n*(n+1))/2 << '\n';
}


Measured memory_bytes: 256
import numpy as np
x=int(input())
#ａ⁵－ｂ⁵＝(ａ－ｂ)(ａ⁴＋ａ³ｂ＋ａ²ｂ²＋ａｂ³＋ｂ⁴)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
d=make_divisors(x)
for i in range(len(d)):
  d.append(-d[i])
flag=False

for i in d:
  if flag==True:
    break
  tui=x//i
  ans=np.roots([5,10*i,10*i**2,5*i**3,i**4-tui])
  for j in ans:
    if flag==True:
      break
    if j.imag==0:
      a=i+round(j.real)
    if a**5-(round(j.real))**5==x:
      print(int(a),int(round(j.real)))
      flag=True
      break

Measured memory_bytes: 28112
# coding: utf-8
# Your code here!

a = raw_input().lower()
a = " "+a+" "
s = a.split()
ss = ""
tmp = ""
n = 0
for i in s:
    if len(ss) < len(i):
        ss = i
for i in s:
    i = " " + i + " " 
    if a.count(i) > n:
        n = a.count(i)
        tmp = i.strip()
print tmp, ss


Measured memory_bytes: 4640
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int MAXN=4010, LOG=20;

ll ans=INF, x; // :))
int n, m, k, u, v, t, a, b;
int A[MAXN], mn[MAXN][MAXN];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n>>x;
	for (int i=1; i<=n; i++) cin>>A[i], A[n+i]=mn[i][i]=mn[n+i][n+i]=A[i];
	for (int r=1; r<=2*n; r++) for (int l=r-1; l; l--)
		mn[l][r]=min(mn[l+1][r], A[l]);
	for (int i=0; i<n; i++){
		ll sum=i*x;
		for (int j=1; j<=n; j++) sum+=mn[n+j-i][n+j];
		ans=min(ans, sum);
	}
	cout<<ans<<"\n";
	
	return 0;
}


Measured memory_bytes: 48920
/**
 *    author:  tourist
 *    created: 16.03.2019 15:29:11       
**/
#include <bits/stdc++.h>

using namespace std;

int remove_bit(int x, int j) {
  int low = x & ((1 << j) - 1);
  return ((x >> (j + 1)) << j) + low;
}

int insert_bit(int x, int j, int v) {
  int low = x & ((1 << j) - 1);
  return ((x >> j) << (j + 1)) + (v << j) + low;
}

vector<int> solve(int n, int a, int b) {
  if (n == 1) {
    return {a, b};
  }
  for (int j = 0; j < n; j++) {
    if ((a ^ b) & (1 << j)) {
      int aa = remove_bit(a, j);
      int bb = remove_bit(b, j);
      for (int u = 0; u < (1 << n); u++) {
        int uu = remove_bit(u, j);
        if (uu != aa && uu != bb) {
          if (__builtin_popcount(aa ^ uu) % 2 == 0) {
            continue;
          }
          if (__builtin_popcount(bb ^ uu) % 2 == 0) {
            continue;
          }
          vector<int> p1 = solve(n - 1, aa, uu);
          vector<int> p2 = solve(n - 1, uu, bb);
          for (int& x : p1) {
            x = insert_bit(x, j, (a >> j) & 1);
          }
          for (int& x : p2) {
            x = insert_bit(x, j, (b >> j) & 1);
          }
          p1.insert(p1.end(), p2.begin(), p2.end());
          return p1;
        }
      }
    }
  }
  assert(false);
  return {};
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  if (__builtin_popcount(a ^ b) % 2 == 0) {
    cout << "NO" << '\n';
    return 0;
  }
  cout << "YES" << '\n';
  vector<int> p = solve(n, a, b);
  set<int> val(p.begin(), p.end());
  assert((int) val.size() == (1 << n));
  for (int i = 0; i < (1 << n); i++) {
    assert(0 <= p[i] && p[i] < (1 << n));
  }
  for (int i = 0; i < (1 << n) - 1; i++) {
    assert(__builtin_popcount(p[i] ^ p[i + 1]) == 1);
  }
  for (int i = 0; i < (1 << n); i++) {
    if (i > 0) {
      cout << " ";
    }
    cout << p[i];
  }
  cout << '\n';
  return 0;
}


Measured memory_bytes: 7664
#include<bits/stdc++.h>
using namespace std;
struct each{
    long long x,y;
}a[90];
typedef pair<long,long>P;
map<P,long long>ma;
bool com(each x,each y){
    if(x.x==y.x)    return x.y<y.y;
    return x.x<y.x;
}
int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%lld%lld",&a[i].x,&a[i].y);
    sort(a+1,a+n+1,com);
    long long ans=0;
    for(int i=1;i<=n;i++)
        for(int j=i+1;j<=n;j++){
            P tmp=P(a[i].x-a[j].x,a[i].y-a[j].y);
            ma[tmp]++;
            ans=max(ans,ma[tmp]);
        }
    printf("%lld\n",n-ans);
    return 0;
}

Measured memory_bytes: 384
K = int(input())
queue = []
for i in range(1, 10):
  queue.append(i)

while K != 0:
  if K <= len(queue):
    print(queue[K-1])
    exit(0)

  K -= 1
  num = queue.pop(0)

  if K == 0:
    print(num)
    exit(0)

  o = int(str(num)[-1])
  for n in [o-1, o, o+1]:
    if n == -1 or n == 10: continue
    queue.append( int(str(num)+str(n)) )

Measured memory_bytes: 5736
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <random>
#include <chrono>
#include <string>
#include <cstring>
#include <bitset>
#include <cassert>
#include <queue>
#include <deque>
#include <memory>

//#pragma comment(linker, "/STACK:16777216")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,abm,mmx,avx,avx2,popcnt,tune=native")

using namespace std;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

#define ll long long
#define ull unsigned long long
//#define double long double
#define int ll
//#define int ull
//#define int short
//#define int unsigned short
//#define int unsigned int
#define mp make_pair
#define F first
#define S second
#define pii pair<int, int>
#define hash hash228
const int SZ = 2e5 + 100;
const double EPS = 1e-7;
const int mod = 163577857;
const int hashpow = 2;
const int inf = 2e18;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int n;
int a[SZ];
vector<int> g[SZ];

void read() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 1; i < n; ++i) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
}

vector<int> x[SZ];
int len = 0;
int ans[SZ];

void dfs(int u, int p = -1) {
    int lo = -1, hi = len;
    while (hi - lo > 1) {
        int m = lo + ((hi - lo) >> 1);

        if (x[m].back() >= a[u]) {
            hi = m;
        } else {
            lo = m;
        }
    }

    if (x[hi].back() == inf) {
        ++len;
    }
    bool z = false;
    if (x[hi].back() != a[u]) {
        x[hi].push_back(a[u]);
        z = true;
    }

    ans[u] = len;

    for (int v : g[u]) {
        if (v == p) continue;
        dfs(v, u);
    }

    if (z) x[hi].pop_back();
    if (x[hi].back() == inf) --len;
}

void solve() {
    for (int i = 0; i < SZ; ++i) {
        x[i].push_back(inf);
    }
    dfs(0);
    for (int i = 0; i < n; ++i) {
        cout << ans[i] << "\n";
    }
}

signed main() {

#ifdef __LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

//    int t;
//    cin >> t;
//    for (int i = 0; i < t; ++i) {
        read();
        solve();
//    }

    return 0;
}

Measured memory_bytes: 40964
char*p,*q,*c;d;S(h){for(h=0;h+=*c<41;h-=*c++&1)d&4&&putchar(*c);}R(i){for(i=*p&7|*q&7?S(c=p),p=c,S(c=q),q=c,0:3;i--;i&&R())putchar(*p++),q++;}main(){for(;~scanf("%s%as%as",&d,&p,&q);puts(""))R();}

Measured memory_bytes: 0
#include <stdio.h>

int main()
{
    int A, B, C;

    scanf("%d %d %d", &A, &B, &C);

    if(((A == B) && C != A) || ((A == C) && B != A) || ((B == C) && A != B))
        printf("\nYes");
    else
        printf("\nNo");
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
void solve(int H,int W){
    int graph[H*W][H*W];
    rep(i,0,H*W)rep(j,0,H*W)graph[i][j] = INF;
    rep(i,0,H*W)graph[i][i] = 0;
    rep(i,0,H * 2 - 1){
        if(i % 2 == 0){
            int arr[W-1];
            rep(j,0,W-1)cin >> arr[j];
            rep(j,0,W-1){
                int y = i / 2;
                int x = j;
                int pos = y * W + x;
                graph[pos][pos + 1] = graph[pos + 1][pos] = arr[j] ? INF : 1;
            }
        }else{
            int arr[W];
            rep(j,0,W)cin >> arr[j];
            rep(j,0,W){
                int y = i / 2;
                int x = j;
                int pos = y * W + x;
                graph[pos][pos + W] = graph[pos + W][pos] = arr[j] ? INF : 1;
            }
        }
    }
    vector<int> dist(H*W,INF);
    queue<int> que;
    que.push(0);
    dist[0] = 1;
    while(!que.empty()){
        int now = que.front();
        int x = now % W;
        int y = now / W;
        que.pop();
        int dx[] = {1, 0, -1, 0};
        int dy[] = {0, 1, 0, -1};
        rep(i,0,4){
            int ny = y + dy[i];
            int nx = x + dx[i];
            if(nx < 0 || nx >= W || ny < 0 || ny >= H)continue;
            int next = ny * W + nx;            
            if (dist[now] + graph[now][next] < dist[next]){
                dist[next] = dist[now] + graph[now][next];
                que.push(next);
            }
        }
    }
    int ans = dist[(H - 1) * W + W - 1];
    if(ans == INF)cout << 0 << endl;
    else cout << ans << endl;
}
main(){
    int H,W;
    cin >> W >> H;
    while(H){
        solve(H,W);
        cin >> W >> H;
    }
}


Measured memory_bytes: 6236
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans=0
for i,bi in enumerate(b):
    x = min(a[i],bi)
    bi-=x
    a[i]-=x
    ans+=x
    if bi>0:
        x=min(a[i+1],bi)
        a[i+1]-=x
        ans+=x
print(ans)

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

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define inf 100000000000010
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pi;

bool isprime(ll n)
{
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0||n%3==0)return false;
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)return false;
    }
    return true;
}

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
        if(b&1)r=(r*a)%m;
        b = b>>1;
        a=(a*a)%m;
    }
    return r%m;
}

struct CustomCompare
{
    bool operator()(const int& lhs, const int& rhs)
    {
        return lhs < rhs;
    }
};

bool comp(pair<ll, ll>a,pair<ll,ll>b)
{
    return a.fi>=b.fi;
}

ll builtin_popcount(ll x)
{
    ll cnt = 0;
    for(ll i=60;i>=0;i--)
    {
        if((1LL<<i)&x)cnt++;
    }
    return cnt;
}

ll addmod(ll a,ll b)
{
    a%=mod;
    b%=mod;
    return (a+b)%mod;
}
ll mulmod(ll a,ll b)
{
    a%=mod;
    b%=mod;
    return (a*b)%mod;
}
/*
const int mxn = 5*(1e6) +10;
vi spf(mxn);
void sieve()
{
    for(ll i =0;i<mxn;i++)spf[i]  = i;
    for(ll i=2;i<mxn;i+=2)spf[i] = 2;
    for(ll i = 3;i*i<mxn;i++)
    {
        if(spf[i]==i)
        {
            for(ll j = i*i;j<mxn;j+=i)
            {
                if(spf[j]==j)spf[j] = i;
            }
        }
    }
}
*/

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
ll n,m,sum; cin>>n>>m>>sum;
ll ans = 0;
vector<string>arr(n);
rep(i,0,n)cin>>arr[i];
for(ll i=0;i<(1<<n);i++)
{
    for(ll j =0;j<(1<<m);j++)
    {
        vector<string>temp = arr;
        for(ll k=0;k<n;k++)
        {
            if((1<<k)&i)
            {
                for(ll col=0;col<m;col++)temp[k][col] = '1';
            }
        }
        for(ll k=0;k<m;k++)
        {
            if((1<<k)&j)
            {
                for(ll row=0;row<n;row++)temp[row][k] = '1';
            }
        }
        ll cnt = 0;
        rep(row,0,n)
        {
            rep(col,0,m)if(temp[row][col]=='#')cnt++;
        }
        if(cnt==sum)ans++;
    }
}
cout<<ans<<endl;
return 0;

}
/*
1
8
1 7 3 4 7 6 2 9
*/


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
//find_by_order(k) - k is the kth element of the set
//order_of_key(k) - Number of elements striclty samller than k
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b;
    cin>>a>>b;
    if(a>=13)
        cout<<b;
    else if(a>=6 && a<=12)
        cout<<b/2;
    else
        cout<<"0";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int h, w; cin >> h >> w;
  int a, b; cin >> a >> b;
  vector<vector<int>> ans(h, vector<int>(w, 1));
  for(int i=0;i<b;++i) {
    for(int j=0;j<a;++j) {
      ans[i][j] = 0;
    }
  }
  for(int i=b;i<h;++i) {
    for(int j=a;j<w;++j) {
      ans[i][j] = 0;
    }
  }
  for(int i=0;i<h;++i) {
    for(int j=0;j<w;++j) {
      cout << ans[i][j];
    }
    cout << endl;
  }
}


Measured memory_bytes: 5120
#include<stdio.h>

void init_alpha(char*);

int main(){
  int N,cut=1,ans=0;
  scanf("%d",&N);
  getchar();
  char S[N];
  char alpha[26];
  init_alpha(alpha);
  for (int i = 0; i < N; i++)
  {
    scanf("%c",&S[i]);
  }
  
  while (cut<N)
  {
    for (int x = 0; x < cut; x++){
      for (int y = cut; y < N; y++){
        if (S[x]==S[y])
        {
          alpha[S[x]-97]=1;
        }
      }
    }
    int count=0;
    for (int i = 0; i < 26; i++)
    {
      if (alpha[i]==1){ count++;}
    }
    if (ans<count){ans=count;}
    init_alpha(alpha);
    cut++;
  }
  
  
  printf("%d",ans);

  return 0;
}

void init_alpha(char *al){
  for (int i = 0; i < 26; i++){
    al[i]=0;
  }
}

Measured memory_bytes: 1732
// tmp.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

struct range
{
	char c;
	ll length;
};


ll calc_count(range r)
{
	ll length = (ll)r.length;

	if (length % 2 == 0)
	{
		return length / 2;
	}
	else
	{
		return (length - 1) / 2;
	}
}

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

	ll k;
	cin >> k;

	vector<range> rs;
	for (int i = 0; i < s.length(); i++)
	{
		int j = i;
		while (s[i] == s[j]) j++;

		range r;
		r.c = s[i];
		r.length = j - i;
		rs.emplace_back(r);
		i = j - 1;
	}


	ll count = 0;

	if (rs.size() > 1)
	{
		//まず、最初の最後の連続以外で必要な置換個数を算出
		for (int i = 1; i < rs.size() - 1; i++)
		{
			//k個の繰り返しなので、k倍。
			count += k * calc_count(rs[i]);
		}

		//最初の連続と最後の連続の置換個数を計算
		//同じ文字の場合はsを繰り返すときにくっつくため、特別に考慮が必要。
		int last = rs.size() - 1;
		if (rs[0].c == rs[last].c)
		{
			//文字が同じ場合
			//最初と最後がくっついた区間はk - 1個ある
			range r;
			r.c = rs[0].c;
			r.length = rs[0].length + rs[last].length;

			count += (k - 1) * calc_count(r);

			//先頭の最初と末尾の最後の分を計算。
			count += calc_count(rs[0]) + calc_count(rs[last]);
		}
		else
		{
			//文字が異なる場合
			//個別に個数を計算
			count += k * (calc_count(rs[0]) + calc_count(rs[last]));
		}
	}
	else
	{
		//全部の文字が同じ場合
		//k倍して計算
		range r;
		r.c = rs[0].c;
		r.length =  k * rs[0].length;

		count += calc_count(r);
	}

	cout << count << endl;
	
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, readline().split())
A = list(map(int, readlines()))
assert len(A) == M

MOD = 10 ** 9 + 7


def solve():
    broken = [False] * (N + 1)
    for a in A:
        broken[a] = True
    p1, p2 = 1, 0
    for i in range(1, N + 1):
        if broken[i]:
            p1, p2 = 0, p1
        elif i == 1:
            p1, p2 = p1, p1
        else:
            p1, p2 = (p1 + p2) % MOD, p1
    return p1


if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 11812
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n, W;
    cin >> n >> W;
    int w[n];
    rep(i,n) cin >> w[i];
    sort(w, w+n);

    int MOD = 1e9+7;

    int dp[W+1] = {};
    dp[0] = 1;
    int sum = 0;
    int ans = 0;
    rep(i,n){
        rep(j, W+1)dp[j] = 0;
        if(sum > W)break;
        dp[sum] = 1;
        if(sum + w[i] > W)ans++;
        for(int j = n-1; j > i; j--){
            int tmp[W+1] = {};
            srep(k, sum, W+1){
                if(k + w[j] > W){
                    tmp[k] += dp[k];
                    continue;
                }
                if(k + w[j] > W - w[i]){
                    ans += dp[k];
                    ans %= MOD;
                }
                tmp[k] += dp[k];
                tmp[k + w[j]] += dp[k];
            }
            rep(k, W+1){
                dp[k] = tmp[k];
                dp[k] %= MOD;
            }
        }
        sum += w[i];
        /*
        cout << i << ' ' << ans << endl;
        rep(j, W+1)cout << dp[j] << ' ';
        cout << endl;
        */
    }
    if(sum <= W) ans++;
    cout << ans << endl;
    return 0;
}
 
 



Measured memory_bytes: 3204
//set many funcs
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1145141919
#define llinf 1145141919810364364
#define mod 1000000007

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int n,i,a[131072],s=0,d=0;
    scanf("%d",&n);
    for(i = 1;i <= n;i++){
        scanf("%d",&a[i]);
        if(a[i]%4==0){d++;}
        else if(a[i]%2==0){s++;}
    }
    if(d*2+s>=n||d*2+1>=n){printf("Yes\n");}else{printf("No\n");}
    return 0;
}

Measured memory_bytes: 512
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let n = get!(usize);
    let aa = get!(usize; n).into_iter().map(|i| i-1).collect::<Vec<_>>();
    let mut bb = vec![false; n];
    bb[0] = true;
    let mut i = 0;
    let mut c = 0;
    while bb[1] == false {
        i = aa[i];
        if bb[i] {
            println!("-1");
            return;
        }
        bb[i] = true;
        c += 1;
    }
    println!("{}", c);
}

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

#define mp make_pair
#define X first
#define Y second
#define FOE(x, a) for(auto x : a)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FOD(i, a, b) for(int i = a; i >= b; i--)

using namespace std;

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

const int N = 2010;
const int MOD = 998244353;

void add(int &x, int y){
    x += y;
    x -= (x >= MOD) * MOD;
}

void sub(int &x, int y){
    x -= y;
    x += (x < 0) * MOD;
}

int n, k, d[2 * N], C[2 * N][2 * N], pow2[N];

int nCk(int n, int k){
    if (n < 0 || n < k || k > n || k < 0)
        return 0;
    return C[n][k];
}

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

    cin >> k >> n;

    C[0][0] = 1;
    FOR(i, 1, 2 * max(n, k)){
        C[i][0] = 1;
        FOR(j, 1, i){
            add(C[i][j], C[i - 1][j]);
            add(C[i][j], C[i - 1][j - 1]);
        }
    }

    pow2[0] = 1;
    FOR(i, 1, max(n, k))
        pow2[i] = (ll) pow2[i - 1] * 2 % MOD;

    FOR(i, 1, k)
        FOR(j, i + 1, k)
            d[i + j]++;

    FOR(x, 2, 2 * k)
        if (x % 2 == 1){
            int ans = 0;
            FOR(i, 0, d[x])
                add(ans, (ll) pow2[i] * nCk(k - 2 * d[x] + n - 1, n - i) % MOD * nCk(d[x], i) % MOD);
            cout << ans << endl;
        } else {
            int ans = 0;
            FOR(i, 0, d[x]){
                add(ans, (ll) pow2[i] * nCk(k - 2 * d[x] + n - 2, n - i) % MOD * nCk(d[x], i) % MOD);
                add(ans, (ll) pow2[i] * nCk(k - 2 * d[x] + n - 3, n - i - 1) % MOD * nCk(d[x], i) % MOD);
            }
            cout << ans << endl;
        }

    int ans = 0;


    return 0;
}

Measured memory_bytes: 48868
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <random>
#include <chrono>
#include <iomanip>
#include <queue>
#define lint long long int
#define FOR(x, to) for(x=0; x<(to); x++) // for簡略表記
#define DUMP(ar) for(int i=0; i<ar.size(); i++) cout << "[" << i << "]:" << ar[i] << endl // 配列一覧表示
#define COUT(x) cout << x << endl // 単要素出力
#define ALL(ar) ar.begin(), ar.end() // コンテナの全要素
using namespace std;
// cout << fixed << setprecision(4) で小数点以下4桁の桁そろえ
// goto ANSWER; で最後へ飛ぶ

struct task{
    string t_name;
    int t_time;
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    // auto time_start = chrono::system_clock::now();
    
    int n, q;
    queue<task> process;
    cin >> n >> q;
    for(int i=0; i<n; i++){
        task tmp;
        cin >> tmp.t_name >> tmp.t_time;
        process.push(tmp);
    }

    int t=0;
    while(process.size() > 0){
        auto p = process.front();
        if(p.t_time > q){
            t += q;
            process.push({p.t_name, p.t_time - q});
            process.pop();
        }else{
            t += p.t_time;
            cout << p.t_name << ' ' << t << '\n';
            process.pop();
        }
    }
    cout << flush;

    // auto time_end = chrono::system_clock::now();
    // auto time_dur = time_end - time_start;
    // auto msec = chrono::duration_cast<chrono::milliseconds>(time_dur).count();
    // cout << "実行時間:" << msec << "ミリ秒" << endl;
ANSWER:
    return 0;
}


Measured memory_bytes: 6340
from decimal import Decimal as dec
import math

def main():
    a, b, h, m = map(int, input().split())
    mr = 6*m
    hr = 30*h+dec(mr/12)
    x = dec((a**2 + b**2 - 2*a*b*math.cos(math.radians(abs(dec(hr-mr)))))**0.5)
    print(x)
    
    

if __name__ == "__main__":
    main()

Measured memory_bytes: 10284
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds; 
using namespace std;
#define int long long
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define mii map<int,int>
// #define mp make_pair
#define pb push_back
#define rep(i,b) for(ll (i)=0;i<(b);i++)
#define all(c) (c).begin(), (c).end()
#define F first
#define S second
#define CLR(p) memset(p, 0, sizeof(p))
#define SET(p) memset(p, -1, sizeof(p))
#define DEBUG true
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
//typedef long long int ll;
typedef tree<int, null_type, less<int>, rb_tree_tag, 
tree_order_statistics_node_update> new_data_set; 
const int MAX=1e6+5;
#define MOD 1000000007
/*std::cout << std::fixed;
std::cout << std::setprecision(6);*/
//(a%mod-b%mod+mod)%mod



/************************************


 
*************************************/

vector<vector<ll>>v;
ll T=0;
ll cnt1=0,cnt0=0;
vector<ll>dep;
bool visited[MAX];
vector<ll>par;
vector<ll>tin,tout;
vector<ll>col;

int countDivisibles(int A, int B, int M) 
{ 
    
    if (A % M == 0) 
        return (B / M) - (A / M) + 1; 
  
    // A is not divisible by M 
    return (B / M) - (A / M); 
} 


signed main(){
    int t=1;
    // cin>>t;
    while(t--){
        string s;
        int k;
        cin>>k;
        cin>>s;
        int n=s.size();
        if(n<=k)
        cout<<s<<endl;
        else{
            for(int i=0;i<k;i++){
                cout<<s[i];
            }
            cout<<"...\n";
        }
        
        

    }
    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()


using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;


// UnionFind木(サイズ持ち)
class UnionFind {
    public : 

        vector<int> par;

        UnionFind(int N){
            par = vector<int>(N, -1);
        }

        int parent(int x){
            return par[x];
        }

        int root(int x){
            if(par[x] < 0)return x;
            return par[x] = root(par[x]);
        }

        int size(int x){
            return -par[root(x)];
        }

        void connect(int x, int y){
            int rx = root(x);
            int ry = root(y);
            if(rx == ry)return;

            if(size(rx) < size(ry))swap(rx, ry);

            par[rx] += par[ry];
            par[ry] = rx;

            return;
        }

        bool same(int x, int y){
            return root(x) == root(y);
        }
};



int main(){
    ll n;
    cin >> n;
    ll sum = 0;
    ll m = n;
    while(m){
        sum += m % 10;
        m /= 10;
    }
    cout << (n % sum == 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
int main(void)
{
    int a,b;cin>>a>>b;
    int ans = a+b;
    if(ans>=24){
      cout<<ans-24<<endl;
    }else{
      cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{ long long a[10015];
int i=1;
cin>> a[0];
while(a[i-1]!=0){
   cin>>a[i];
   i++; }
   for ( int j=0 ;j<i;j++){
   if(a[j]==0)break;
   else cout<<"Case "<<j+1<<": "<<a[j]<<endl;}
return 0;
}



Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
#define N 3005
int n,m,ans,f[N],c[N][N],s[N][N];
long long pw(long long x,int y,int mod){long long r=1;for(;y;y>>=1,x=x*x%mod)if(y&1)r=r*x%mod;return r;}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=0;i<=n;i++)c[i][0]=1;
	for(int i=1;i<=n;i++)for(int j=1;j<=i;j++)c[i][j]=(c[i-1][j-1]+c[i-1][j])%m;
	s[1][1]=1;
	for(int i=2;i<N;i++)for(int j=1;j<=i;j++)s[i][j]=(s[i-1][j-1]+1ll*j*s[i-1][j]%m)%m;
	for(int i=0;i<=n;i++)
	{
		long long a=pw(2,pw(2,n-i,m-1),m),b=pw(2,n-i,m),c=1;
		for(int j=0;j<=i;j++,c=1ll*c*b%m)(f[i]+=1ll*s[i+1][j+1]*a%m*c%m)%=m;
	}
	for(int i=0;i<=n;i++)if(i&1)(ans-=1ll*c[n][i]*f[i]%m)%=m;else (ans+=1ll*c[n][i]*f[i]%m)%=m;
	printf("%d\n",(ans+m)%m);
	return 0;
}

Measured memory_bytes: 69504
#include <bits/stdc++.h>
using std::cerr;using std::cin;using std::cout;using std::abs;using std::min;using std::max;using std::swap;using std::map;using std::unordered_map;using std::unordered_set;using std::bitset;using std::pair;using std::set;using std::string;using std::vector;using std::sort;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}


const int N=1e5+5;
pii a[N];
int dp[N];
int32_t main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;++i){
        cin>>a[i].f>>a[i].s;
    }
    a[0]={0,0};
    sort(a+1,a+n+1,[](const pii&p1,const pii&p2){
        return p1.f+p1.s<p2.f+p2.s;
    });
    for(int i=1;i<=n;++i){
        int xl=a[i].f-a[i].s;
        int l=0,r=i;
        while(r-l>1){
            int m=(l+r)/2;
            if(a[m].f+a[m].s<=xl)l=m;
            else r=m;
        }
        dp[i]=max(dp[i-1],dp[l]+1);
    }
    cout<<dp[n]<<'\n';


    return 0;
}


Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var hs=new Dictionary<string,int>();
		int p=1;
		for(int i = 0;i<n;i++) {
			var e=sc.S;
			if(hs.ContainsKey(e)){
				hs[e]++;
				p=Max(p,hs[e]);
			}
			else{hs.Add(e,1);}
		}
		var li=new List<string>();
		foreach(var e in hs){
			if(e.Value==p){
				li.Add(e.Key);
			}
		}
		li.Sort(StringComparer.OrdinalIgnoreCase);
		Console.WriteLine(String.Join("\n",li));
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

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

using namespace std;

int main()
{
    int N;
    cin >> N;
    int a[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    sort(a,a+N);

    cout << a[N-1]-a[0] << endl;
    return 0;
}

Measured memory_bytes: 256
// coded by zeffy
#pragma GCC optimize("O3","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zeroupper") //Enable AVX
#pragma GCC target("avx","popcnt")  //Enable AVX
#include <x86intrin.h> //SSE Extensions
#include <bits/stdc++.h> 
using namespace std;
#define eb emplace_back
#define mp make_pair
#define hello cout<<"hello"<<"\n"
#define forr(i,a,b) for(int i=a;i<b;i++)
#define it(s)	for(auto itr:s)
#define dvg(s) 	for(auto itr:s)	cout<<itr<<" ";cout<<endl;
#define dbg(s)	cout<<#s<<"= "<<s<<endl;
typedef long long int lli;
typedef unsigned long long int ulli;
const lli INF=(lli)1e17+5;
const ulli MOD=1e8+7;

int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    std::cout<< std::fixed;
    std::cout.precision(10);
    
   lli n,W;
   cin>>n>>W;

   vector<lli> dp(W+1,0);
   
   forr(i,0,n)
   {
      lli vi,wi;
      cin>>wi>>vi;
      for(lli i=W-wi;i>=0;i--)
      {
         dp[i+wi]=max(dp[i+wi],dp[i]+vi);
      }
   }

   cout<<dp[W]<<"\n";
   return 0;
}


Measured memory_bytes: 3936
n = int(input())
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
mx = 0
for N in range(1,n):
    a1[N] += a1[N - 1]
    a2[n - N - 1] += a2[n - N]
for N in range(n):
    mx = max(mx,a1[N] + a2[N])
print(mx)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
  int h, w, z;
  string s, t;

  while(1) {
    s = "";
    t = "#";
    cin >> h >> w;
    if (h == 0 && w == 0) break;
    for (int i = 0; i < w; i++) {
      s = s + "#";
    }
    cout << s << endl;
    for (int j = 0; j < (w - 2); j++) {
      t = t + ".";
    }
    t = t + "#";
    for (int k = 0; k < (h - 2); k++) {
      cout << t << endl;
    }
    cout << s << endl << endl;
  }
}


Measured memory_bytes: 3104
import scala.io.StdIn.{readInt,readLine}

object Main {
  def main(args:Array[String]) = {
    var n = 0
    while({n=readInt;n}!=0) {
      val a = readLine.split(" ").map(_.toInt)
      var rem = 32
      var i = 0
      while(rem!=0) {
        rem = rem - (rem-1)%5
        println(rem)
        rem = rem - (if(a(i%n)<=rem) a(i%n) else rem)
        println(rem)
        i += 1
      }
    }
  }
}

Measured memory_bytes: 43780
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    l=list(map(int,input().split()))
    ans=0
    l.sort()
    ans+=l[2]-l[1]
    l[0]+=l[2]-l[1]
    l[1] = l[2]
    x=l[1]-l[0]
    if x%2==0:
        ans+=x//2
    else:
        ans+=(x+1)//2+1

    print(ans)

resolve()

Measured memory_bytes: 38384
import numpy as np
N, K = map(int,input().split())


A = []
for i in range(K):
  d = int(input())
  kk = map(int,input().split())
  
  for a in kk:
    A.append(a)

count = 0


for i in range(1,N+1):

  if not i in A:
    count += 1

print(count)



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

const int N = 5e3 + 5;
const int mod = 1e9 + 7;

int n;
vector <int> g[N];
int dp[N][N][2];
int fac[N];
int tmp[N][2];
int siz[N];

void dfs(int u, int p) {
	dp[u][1][0] = 1;
	siz[u] = 1;
	for (int i = 0; i < g[u].size(); ++ i) {
		int v = g[u][i];
		if (v == p) continue;
		dfs(v, u);
		memset(tmp, 0, sizeof(tmp));
		for (int s0 = 0; s0 <= siz[u]; ++ s0) {
			for (int f0 = 0; f0 < 2; ++ f0) {
				for (int s1 = 0; s1 <= siz[v]; ++ s1) {
					for (int f1 = 0; f1 < 2; ++ f1) {
						(tmp[s0 + s1][(f0 + f1) % 2] += 1LL * dp[u][s0][f0] * dp[v][s1][f1] % mod) %= mod;
						if (s1 % 2 == 0) {
							(tmp[s0][(f0 + f1 + 1) % 2] += 1LL * fac[s1] * dp[u][s0][f0] % mod * dp[v][s1][f1] % mod) %= mod;
						}
					}
				}
			}
		}
		memcpy(dp[u], tmp, sizeof(dp[u]));
		siz[u] += siz[v];
	}
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i < n; ++ i) {
		int u, v;
		scanf("%d %d", &u, &v); -- u, -- v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	fac[0] = 1;
	for (int i = 2; i <= n; i += 2) {
		fac[i] = 1LL * fac[i - 2] * (i - 1) % mod;
	}
	dfs(0, -1);
	int ans = 0;
	for (int i = 0; i <= n; i += 2) {
		ans = (ans + 1LL * fac[i] * dp[0][i][0] % mod) % mod;
		ans = (ans + mod - 1LL * fac[i] * dp[0][i][1] % mod) % mod;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 196864
package main

import (
	"fmt"
)

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

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	cal := a * b / gcd(a, b)

	fmt.Println(cal)
}


Measured memory_bytes: 512
using System;
class soj
{
    static void Main()
    {
        int a=0, b=10000, c=10000;
        for(int i = 0; i < 4; i++)
        {
            int d = int.Parse(Console.ReadLine());
            a += d;
            if (d < b) b = d;
        }
        for(int j = 0; j < 2; j++)
        {
            int d = int.Parse(Console.ReadLine());
            a += d;
            if (d<c) c = d;
        }
        a -= b;
        a-= c;
        Console.WriteLine(a);
    }
}

Measured memory_bytes: 9184