akhauriyash/Code-Regression huggingface dataset:
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val s = in.next()
  val _x, y = in.next().toInt
  val N = s.length
  var x = _x

  var dir = 0
  var sayuu: List[Int] = Nil
  var updown: List[Int] = Nil

  def calc(com: Char, num: Int): Unit = {
    com match {
      case 'F' =>
        if(dir == 0)
          sayuu = num :: sayuu
        else
          updown = num :: updown
      case 'T' =>
        if(num % 2 == 1)
          dir += 90
        dir %= 180

    }
  }

  var ind = 0
  ////
  breakable {
    while(ind < N) {
      if(s(ind) == 'F') {
        ind += 1
      }
      else
        break
    }
  }

  x -= ind

  while(ind < N) {
    val now = s(ind)
    var r = ind + 1

    breakable {
      while(true) {
        if(r == N || now != s(r)) {
          calc(now, r-ind)
          ind = r
          break
        }
        else {
          r += 1
        }
      }
    }
  }

  var setlr: Set[Int] = Set(0)
  for(e <- sayuu) {
    var now: Set[Int] = Set()

    for(e2 <- setlr) {
      now = now + (e2 + e) + (e2 - e)
    }

    setlr = now
  }

  var setud: Set[Int] = Set(0)
  for(e <- updown) {
    var now: Set[Int] = Set()

    for(e2 <- setud) {
      now = now + (e2 + e) + (e2 - e)
    }

    setud = now
  }


  if(setlr.contains(x) && setud.contains(y))
    println("Yes")
  else
    println("No")
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}


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

int main()
{
    int N;
    int count = 0;
    cin >> N;
    for (int i = 0; i < N; i++){
        int l, r;
        cin >> l >> r;
        count += r - l + 1;
    }
    cout << count << endl;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int h, w, a, b;
  cin >> h >> w >> a >> b;

  rep(i, h) {
    rep(j, w) {
      int s = 0;
      if (i < b && a <= j) s = 1;
      if (b <= i && j < a) s = 1;
      cout << s;
    }
    cout << endl;
  }
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;


int64_t gcd(int64_t a, int64_t b) {
	if (a < b) swap(a, b);
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

int64_t lcm(int64_t a, int64_t b) {
	return a * b / gcd(a, b);
}

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

	int64_t n, m; cin >> n >> m;
	vector<int64_t> as(n);
	for (auto& a : as) {
		cin >> a;
	}

	int64_t lcm_v = 1;
	FOR_LT(i, 0, n) {
		lcm_v = lcm(lcm_v, as[i]);
		if (m < lcm_v / 2) {
			cout << 0 << endl;
			return 0;
		}
	}

	FOR_LT(i, 0, n) {
		if (((lcm_v / as[i]) & 1) == 0) {
			cout << 0 << endl;
			return 0;
		}
	}

	int64_t fv = lcm_v / 2;
	if (m < fv) {
		cout << 0 << endl;
	}
	else {
		cout << 1 + (m - fv) / (2 * fv) << endl;
	}

	return 0;
}

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

int main() {
    int n; cin >> n;
    vector<int> f(n, 0);
    bool same = true;

    for(int i = 0; i < n; ++i) {
        cin >> f[i];
        if(f[i] != n - 1) {
            same = false;
        }
    }

    if(same) {
        cout << "Yes\n";
        return 0;
    }

    sort(f.begin(), f.end());

    if(f.back() - f[0] > 1) {
        cout << "No\n";
        return 0;
    }
    
    int all = f.back();
    int rem = 0;

    if(f.back() - f[0] == 1) {
        int it = 0, u = 0;
        while(f[it] == f[0]) {
            u += 1;
            it += 1;
        }
        
        all -= u;
        rem = n - it;

        if(all <= 0) {
            cout << "No\n";
            return 0;
        }
    } else {
        rem = n;
    }

    if(2 * all > rem) {
        cout << "No\n";
    } else {
        cout << "Yes\n";
    }
}

Measured memory_bytes: 640
N = int(input())
A = list(map(int, input().split()))
cau = 0
flag = True
while flag:
    for i in range(N):
        if A[i] % 2 == 1:
            flag = False
            break        
    if flag:
        for i in range(N):
            A[i] = A[i]/2
        cau += 1
print(cau)

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

typedef pair<int, int> P;

vector<P> d;
int dp[200];

int cmp(P &a, P &b)
{
	if (a.first < b.first && a.second < b.second) return 1;
	return 0;
}

void solve()
{
	int n = d.size();
	fill(dp, dp + n, 1);
	for (int i = 1; i < n; i++){
		for (int j = 0; j < i; j++){
			if (cmp(d[j], d[i])){
				dp[i] = max(dp[i], dp[j] + 1);
			}
		}
	}
	int res = 0;
	for (int i = 0; i < n; i++){
		res = max(res, dp[i]);
	}
	printf("%d\n", res);
}

int main()
{
	while (true){
		d.clear();
		for (int c = 0; c < 2; c++){
			int n;
			scanf("%d", &n);
			if (!n) return 0;
			for (int i = 0; i < n; i++){
				int a, b;
				scanf("%d %d", &a, &b);
				d.push_back(P(a, b));
			}
		}
		sort(d.begin(), d.end());
		solve();
	}
}

Measured memory_bytes: 1196
/*
    Ujjawal Pabreja [cuber_coder]
*/
#include <bits/stdc++.h> 
#include <functional> 
using namespace std;
#define speed_cubing    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll              long long
#define ld              long double
#define rep(i,a)        for(ll i = 0 ; i < a ; i++)
#define repe(i,a,b)     for(ll i = a ; i < b ; i++)
#define bac(i,a)        for(ll i = a ; i >= 0 ; i--)
#define bace(i,a,b)     for(ll i = a ; i >= b ; i--)
#define pb              push_back
#define in              insert
#define ff              first
#define ss              second
#define setbit(x)       __builtin_popcountll(x)
#define init(c,a)       memset(c,a,sizeof(c))
#define all(c)          c.begin(),c.end()
#define sz(c)           (ll)c.size()
#define lb              lower_bound
#define ub              upper_bound
#define maxe            *max_element
#define mine            *min_element
#define rev             reverse
#define Y				"YES"
#define N 				"NO"
#define endl            "\n"
#define debug(x)        cout << #x << " : " << x << endl;
const ll inf = 1e18;  
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 2e5 + 1;

inline ll add(ll a,ll b) {return ((a % mod) + (b % mod)) % mod;}
inline ll sub(ll a,ll b) {return ((a % mod) - (b % mod) + mod) % mod;}
inline ll mul(ll a,ll b) {return ((a % mod) * (b % mod)) % mod;}
ll pwr(ll x,ll n){
    if(n == 0){
        return 1;
    }
    if(n&1){
        return mul(x, pwr(mul(x, x), (n - 1) / 2));
    } else {
        return pwr(mul(x, x), n / 2);
    }
}
ll modInv(ll n){ 
    return pwr(n, mod - 2); 
}
ll gcd(ll a,ll b) {
    if(b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
// ====== Useful functions end ======
 
// ====== Global Variables begin ======
ll n, m;
vector <ll> g[MAX];
map <pair<ll,ll>, ll> edge;
bool vis[MAX];
ll cnt = 0;
// ====== Global Variables end ======
void dfs(ll u){
    vis[u] = true;
    cnt++;
    for(auto v : g[u]){
        if(!vis[v]){
            dfs(v);
        }
    }
}
void speed_solve(){
    cin >> n >> m;
    ll u, v;
    rep(i,m){
        cin >> u >> v;
        u--,v--;
        if(u > v){
            swap(u, v);
        }
        if(edge.count({u, v})){
            continue;
        }
        g[u].pb(v);
        g[v].pb(u);
        edge[{u, v}]++;
    }
    ll ans = 0;
    rep(i,n){
        if(!vis[i]){
            cnt = 0;
            dfs(i);
            ans = max(ans, cnt);
        }
    }
    cout << ans;
}

int main(){
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    speed_cubing;
    ll test_cases = 1;
    // cin >> test_cases;
    rep(i,test_cases){
        // cout << "Case #" << i + 1 << ": ";
        speed_solve();
    }
    return 0;
}

Measured memory_bytes: 33488
import numpy as np
N,M,X=map(int,input().split())
C=np.zeros(N,dtype=int)
A=np.zeros([N,M],dtype=int)
for i in range(N):
    T=list(map(int,input().split()))
    C[i]=T[0]
    for j in range(M):
        A[i,j]=T[j+1]
a=np.zeros(N,dtype=int)
ans=-1
while a.all()!=1:
  if ((a@A)>=X).all():
    if ans==-1:
        ans=a@(C.T)
    elif a@(C.T)<ans:
        ans=a@(C.T)
  for i in range(N):
    if a[N-i-1]==0:
      a[N-i-1]=1
      break
    else:
      a[N-i-1]=0

if ((a@A)>=X).all():
  if ans==-1:
      ans=a@(C.T)
  elif a@(C.T)<ans:
      ans=a@(C.T)

print(ans)

Measured memory_bytes: 27324
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;
using ll = long long;

ll getVal(vector<ll>& vec, ll M) {
  ll val = 0;
  sort(vec.begin(), vec.end(), greater<ll>());
  for (ll i = 0; i < M; ++i) {
    val += vec[i];
  }
  return val;
}

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

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

  vector<ll> ppp(N), npp(N), pnp(N), ppn(N), nnp(N), npn(N), pnn(N), nnn(N);
  ll x, y, z;
  for (ll i = 0; i < N; ++i) {
    cin >> x >> y >> z;
    ppp[i] = +x +y +z;
    npp[i] = -x +y +z;
    pnp[i] = +x -y +z;
    ppn[i] = +x +y -z;
    nnp[i] = -x -y +z;
    npn[i] = -x +y -z;
    pnn[i] = +x -y -z;
    nnn[i] = -x -y -z;
  }

  ll maxval = 0, val;
  
  val = getVal(ppp, M);
  if (maxval < val) maxval = val;
  val = getVal(npp, M);
  if (maxval < val) maxval = val;
  val = getVal(pnp, M);
  if (maxval < val) maxval = val;
  val = getVal(ppn, M);
  if (maxval < val) maxval = val;
  val = getVal(nnp, M);
  if (maxval < val) maxval = val;
  val = getVal(npn, M);
  if (maxval < val) maxval = val;
  val = getVal(pnn, M);
  if (maxval < val) maxval = val;
  val = getVal(nnn, M);
  if (maxval < val) maxval = val;

  cout << maxval << endl;

  return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main()
{
  int n,k;
  int s=0;
  scanf("%d %d",&n,&k);

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

  for(int j=0;j<n;j++){
    if(h[j]>=k){s=s+1;
               }
  }
  printf("%d",s);

  return 0;
  
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    string str;
    cin >> str;
    for(int i=0;i<str.size()/2;i++){
        if(str[i]!=str[str.size()-i-1]){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
}

Measured memory_bytes: 256
n,m,x = map(int,input().split())
lst = [int(i) for i in input().split()]
r_cost = 0
l_cost = 0
for i in range(x):
    if i in lst:
        r_cost += 1
for i in range(x+1,n):
    if i in lst:
        l_cost += 1
print(min(r_cost,l_cost))

Measured memory_bytes: 3064
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            Deque<String> stack = new ArrayDeque<>();
            String line = sc.nextLine();
            if (line.equals(".")) {
                break;
            }
            boolean t = true;
            for (int i = 0; i < line.length(); i++) {
                char c = line.charAt(i);
                if (c == '(' || c == '[') {
                    stack.push(c + "");
                } else if (c == ')') {
                    if (stack.size() == 0 || !stack.poll().equals("(")) {
                        t = false;
                        break;
                    }
                } else if (c == ']') {
                    if (stack.size() == 0 || !stack.poll().equals("[")) {
                        t = false;
                        break;
                    }
                }
            }
            if (t && stack.size() == 0) {
                System.out.println("yes");
            } else {
                System.out.println("no");
            }
        }
    }
}

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

int main()
{
    long long int n; vector<long long int>v;
    cin>>n;
    if(n==0)
    {
        cout<<0<<endl;
        return 0;
    }
    for(;n!=0;)
    {
        v.push_back(abs(n%-2));
        n=(n-abs(n%-2))/-2;
    }
    for(auto it=v.rbegin();it!=v.rend();it++)
        cout<<*it;
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = list(input())
Q = int(input())
K = list(map(int,input().split()))
DP = [[0,0,0]]
C = []
for i in range(N):
    q = DP[i][:]
    if S[i] == "D":
        q[0] += 1
    elif S[i] == "M":
        q[1] += 1
        q[2] += q[0]
    elif S[i] == "C":
        C.append(i+1)
    DP.append(q)

for k in K:
    ans = 0
    for c in C:
        if c < k:
            ans += DP[c][2]
        else:
            ans += DP[c][2] - DP[c-k][2] - DP[c-k][0]*(DP[c][1] - DP[c-k][1])
    print(ans)

Measured memory_bytes: 207932
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

import numpy as np

# 適当な素数と原始根でrolling hash
MOD = 10 ** 9 + 993
base = 123450

S = np.array([ord(x) for x in input().rstrip()],dtype=np.int64)
T = np.array([ord(x) for x in input().rstrip()],dtype=np.int64)

# Sの方が長くする
LS = len(S)
LT = len(T)
n = (LT + (-LT) % LS) // LS
S = np.concatenate([S]*(n+1))
S = S[:LS+LT]

def cumprod(arr):
    L = len(arr); Lsq = int(L**.5+1)
    arr = np.resize(arr,Lsq**2); arr = arr.reshape(Lsq,Lsq)
    for n in range(1,Lsq):
        arr[:,n] *= arr[:,n-1]; arr[:,n] %= MOD
    for n in range(1,Lsq):
        arr[n] *= arr[n-1,-1]; arr[n] %= MOD
    return arr.ravel()[:L]

base_inv = pow(base,MOD-2,MOD)
x = np.full(LS+LT,base,dtype=np.int64)
x[0] = 1
power = cumprod(x)
x = np.full(LS+LT,base_inv,dtype=np.int64)
x[0] = 1
power_inv = cumprod(x)

def to_rolling_hash(S):
    return (S * power[:len(S)] % MOD).cumsum() % MOD

S_hash = to_rolling_hash(S)
T_hash = to_rolling_hash(T)[-1] # 文字列全体

S_hash_LT = S_hash[LT-1:]
S_hash_LT[1:] -= S_hash.copy()[:LS]
S_hash_LT %= MOD
S_hash_LT *= power_inv[:LS+1]
S_hash_LT %= MOD

INF = 10 ** 18
visited = [False] * LS
dist = [INF] * LS # 操作終了位置からの距離

q = np.where(S_hash_LT[:LS] != T_hash)[0].tolist()

d = 0
while q:
    qq = []
    for x in q:
        if dist[x] == INF:
            dist[x] = d
            qq.append((x-LT)%LS)
    d += 1
    q = qq

answer = max(dist)
if answer >= INF:
    answer = -1

print(answer)

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

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

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)

int n;
int ways[1 << 20];

int main() {
	scanf("%d", &n);
	for (int i = 1; i < n; ++ i) {
		for (int j = i; j < n; j += i) {
			ways[j] ++;
		}
	}
	int ans = 0;
	for (int i = 1; i < n; ++ i) ans += ways[i];
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 7700
#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int OO = (int) 2e9;
const double eps = 1e-9;

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	ll h;
	cin >> h;
	cout << (1LL << ((int)log2(h) + 1)) - 1 << endl;
	return 0;
}


Measured memory_bytes: 512
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]
for i in S:
    i.insert(0, '.')
    i.append('.')
S.insert(0, ['.' for _ in range(W+2)])
S.append(['.' for _ in range(W+2)])

for i in range(1, H+1):
    for j in range(1, W+1):
        x = []
        if S[i][j] == '.':
            #周囲を全探索
            for di in range(-1, 2):
                for dj in range(-1, 2):
                    x.append(S[i+di][j+dj])
            print(x.count('#'), end="")
        else:
            print('#', end="")
    print("")


Measured memory_bytes: 3444
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n, m, q;

struct X {
    int a,b,c,d;
};

Vi u;
V<X> v;

int dfs(int depth) {
    if (depth == 0) {
        int maxi = 0;
        REP2(i, 1, m+1) {
            u = {i};
            maxi = max(maxi, dfs(1));
        }
        return maxi;
    } else if (depth == n) {
        int sum = 0;
        REP(i, q) {
            if (u[v[i].b] - u[v[i].a] == v[i].c) {
                sum += v[i].d;
            }
        }
        return sum;
    } else {
        int maxi = 0;
        REP2(i, u.back(), m+1) {
            u.push_back(i);
            maxi = max(maxi, dfs(depth+1));
            u.pop_back();
        }
        return maxi;
    }
}

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

    v = V<X>(q);
    REP(i, q) {
        int a,b,c,d; cin >> a >> b >> c >> d; a--; b--;
        v[i] = {a,b,c,d};
    }

    cout << dfs(0) << '\n';

    return 0;
}


Measured memory_bytes: 3564
import bisect,sys
import math
from collections import deque

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


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


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac =fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % mod) % mod
        
    return CONV()



sys.setrecursionlimit(200005)


def main():
    N,K,C = isRaw()
    S = sRaw()
    ans = []
    lefts = []
    ava = 0
    idx = 0
    while idx < N:
        if S[idx]=="x":
            idx+=1
            continue
        ava+=1
        lefts.append(idx)
        if ava==K:
            break
        idx+=C+1
    rights = []
    ava = 0
    idx = N-1
    while idx >= 0:
        if S[idx]=="x":
            idx-=1
            continue
        ava +=1
        rights.append(idx)
        if ava == K:
            break
        idx-=C+1
    ans = [str(lefts[idx]+1) for idx in range(ava) if lefts[idx] == rights[ava-1-idx]]
    return "\n".join(ans)

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


Measured memory_bytes: 67064
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	string s;
	cin>>s;
	int ans=0;
	fori(s.length()-1){
		if(s[i]!=s[i+1]){
			++ans;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 512
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

D = INT()
C = LIST()
S = [[]] * (D+1)
for i in range(1, D+1):
    S[i]  = LIST()
T = [0] + [t-1 for t in LIST(D)]
M = 26

last = list2d(M, D+2, 0)
def check(T):
    score = 0
    for i, t in enumerate(T[1:], 1):
        score += S[i][t]
        for j in range(M):
            last[j][i] = last[j][i-1] + 1
        last[t][i] = 0
        for j in range(M):
            score -= C[j] * last[j][i]
    return score

def change(day, a, b):
    nxtday = last[a].index(0, day+1)
    w = nxtday - day
    h = last[a][day-1] + 1
    a_change = C[a] * h * w
    for d in range(day, nxtday):
        last[a][d] = last[a][d-1] + 1

    nxtday = last[b].index(0, day+1)
    w = nxtday - day
    h = last[b][day-1] + 1
    b_change = C[b] * h * w
    last[b][day] = 0
    for d in range(day+1, nxtday):
        last[b][d] = last[b][d-1] + 1

    res = -a_change + b_change - S[day][a] + S[day][b]
    return res

score = check(T)
Q = INT()
for i in range(Q):
    d, q = MAP()
    q -= 1

    prev = T[d]
    nxt = q
    score += change(d, prev, nxt)
    print(score)
    T[d] = q


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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(n) FOR(z, 1, (n))
#define pb push_back
#define INF 1000000000000000000
#define f first
#define s second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int MAXN = 100100;

int main()
{
    FAST_IO;

    int x, a; cin >> x >> a;
    if (x < a) cout << 0 << endl;
    else cout << 10 << endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

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

signed main(){
	string s;
	string t[4] = {"Sunny","Cloudy","Rainy","Sunny"};
	cin >> s;
	rep(i,0,3) if(s == t[i]) cout << t[i+1];
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using i64 = int64_t;
#define rep(i, s, n) for (i64 i = (s); i < (n); ++i)

i64 modexp(i64 b, i64 e, i64 m){
  i64 ret = 1;
  while(0 < e){
    if(e % 2 == 1){
      ret = (ret*b)%m;
    }
    e /= 2;
    b = (b*b)%m;
  }
  return ret;
}

void run() {
  const i64 mod{1000000007};
  i64 n;
  cin >>n ;
  if(n<2){cout<<0<<endl;return;}
  i64 ret = modexp(10, n, mod) - 2*modexp(9, n, mod) +modexp(8, n, mod);
  while(ret < 0){
    ret += mod;
  }
  cout<<(ret%mod)<<endl;
}

int main() {
  cin.tie(nullptr);
  run();
  return 0;
}


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

int	main()
{
	int		n;	
	int64_t	a;
	int64_t	b;

	cin >> n;
	a = 2;
	b = 1;
	for (int i = 2; i <= n; i++)
	{
		b = a + b;
		a = b - a;
	}
	cout << b << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<cstring>
using namespace std;
typedef long long ll;
int main()
{
    int a[5][5];
    int n;
    for(int i=1; i<=3; i++)
    {
        for(int j=1; j<=3; j++)
        {
            cin>>a[i][j];
        }
    }
    cin>>n;
    int k;
    int temp=0;
    for(int s=0; s<n; s++)
    {
        cin>>k;
        for(int i=1; i<=3; i++)
        {
            for(int j=1; j<=3; j++)
            {
                if(a[i][j]==k)
                    a[i][j]=0;
            }
        }
    }
    for(int i=1; i<=3; i++)
    {
        if(a[i][1]==0&&a[i][2]==0&&a[i][3]==0)
        {
            temp=1;
            break;
        }
        if(a[1][i]==0&&a[2][i]==0&&a[3][i]==0)
        {
            temp=1;
            break;
        }
    }
    if(a[1][1]==0&&a[2][2]==0&&a[3][3]==0)
        temp=1;
    if(a[1][3]==0&&a[2][2]==0&&a[3][1]==0)
        temp=1;
    if(temp==1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



int main(){
  ll a, b, c;
  cin >> a >> b >> c;
  int cnt = 0;
  while(cnt < 1e7) {
    if(a % 2 || b % 2 || c % 2) {
      cout << cnt << endl;
      return 0;
    }
    int ai = a/2;
    int bi = b/2;
    int ci = c/2;
    a = bi + ci;
    b = ci + ai;
    c = ai + bi;
    cnt++;
  }
  cout << -1 << endl;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

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

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

	int N;
	cin >> N;

	vector<pll> v(N);
	rep(i, N) cin >> v[i].second >> v[i].first;

	sort(v.begin(), v.end());

	ll t = 0;
	rep(i, N){
		t += v[i].second;
		if(t > v[i].first){
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
}


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

import static java.lang.System.in;

public class Main {
    public static void main(String[] args)throws IOException{
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String a = sc.next(), b = sc.next(), c= sc.next();
        int ans = 0;
        for(int i=0;i<n;i++){
            char a1 = a.charAt(i), b1 = b.charAt(i), c1 = c.charAt(i);
            if(a1==b1&&a1==c1) continue;
            if(a1==b1||a1==c1||b1==c1) ans += 1;
            else ans += 2;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 25300
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Dynamic;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int A = int.Parse(Console.ReadLine());
            int B = int.Parse(Console.ReadLine());
            int C = int.Parse(Console.ReadLine());
            int X = int.Parse(Console.ReadLine());
            int count = 0;
            for(int i = 0; i <= A; i++)
            {
                for(int j = 0; j <= B; j++)
                {
                    for(int l = 0; l <= C; l++)
                    {
                        if((500 * i) + (100 * j) + (50 * l) == X)
                        {
                            count++;
                        }
                    }
                }
            }
            Console.WriteLine(count);
        }
    }
}


//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 27544
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <utility>
#include <numeric>
#include <iomanip>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<bool> vec(n); 

    int l, r;
    int min = 0;
    int max = 100000;

    for (int i = 0; i < m; i++)
    {
        cin >> l >> r;

        if (l > min)
        {
            min = l;
        }
        if (r < max)
        {
            max = r;
        }
    }

    if (max - min + 1 < 0)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << max - min + 1 << endl;
    }
}

/*
int main() {
    int n, m;
    cin >> n >> m;
    vector<bool> vec(n); 

    int l, r;
    for (int i = 0; i < m; i++)
    {
        cin >> l >> r;

        for (int i = 0; i < l-1; i++)
        {
            vec[i] = true;
        }

        for (int i = n-1; i > r-1; i--)
        {
            vec[i] = true;
        }

    }

    int ans = 0;

    for (int i = 0; i < n; i++)
    {
        if (vec[i] == false)
        {
            ans++;
        }
    }
    
    cout << ans << endl;
}
*/


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>

#define LP(i,n) for(int i=0;i<n;i++)
#define Mset(x,v) memset(x,v,sizeof(x))
#define INF INT_MAX

using namespace std;
using LL=long long;

int main(){
    int x;
    cin>>x;
    cout<<"ai1333";
    LP(i,x/100) cout<<"3";
    cout<<endl;
    return 0;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define pb push_back
#define pll pair<ll, ll> 
#define vl vector<ll> 
#define vvl vector< vector<ll> > 
#define vlp vector< pair<ll, ll> >
#define vllp vector<pair<pll, ll> > 
#define mll map<ll, ll> 
#define rep(i,a)  for(ll i=0; i< a; i++)
#define rep1(i,a)   for(ll i = 1; i< a; i++)
#define foi(i, a, b)    for(ll i = a; i<b ; i++)
#define fod(i, a, b)    for(ll i = a; i>=b ; i--)
#define mp make_pair
#define all(v)  (v).begin(), (v).end()
#define fst first
#define sec second
#define ff first.first
#define fs first.second
#define max3(a, b, c)   max(max(a, b), c)
#define min3(a, b, c)   min(min(a, b), c)
#define MAX 1000005
#define MOD 1000000007
// #define MOD 998244353
#define endl "\n"
#define INF (ll)1e18
#define s(v) (ll)v.size()
#define e(v) v.empty()
#define bscount(x) __builtin_popcountll(x)
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
// using namespace __gnu_pbds;

ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
ll fexp(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%MOD; b/=2;a=a*a%MOD;}return ans;}
ll inverse(ll a, ll p){return fexp(a, p-2);} 
void ingraph(vvl& graph, ll m){ll x, y;rep(i, m){cin>>x>>y;x--, y--;graph[x].pb(y);graph[y].pb(x);}}
ll modify(ll n){ll res = n;res%=MOD;res+=MOD;res%=MOD;return res;}

int main(){
    // #ifndef ONLINE_JUDGE
    //     freopen("../input.txt", "r", stdin);
    //     freopen("../output.txt", "w", stdout);
    // #endif
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll t;
    // cin>>t;
    t = 1;
    while(t--){
        ll n;
        cin>>n;
        vl vec(n);
        vl cnt(MAX, 0);
        vl dp(MAX, 0);
        rep(i, n){
            cin>>vec[i];
            cnt[vec[i]]++;
            dp[vec[i]]++;
        }
        rep1(i, MAX){
            if(cnt[i] == 0) continue;
            for(ll j = 2*i; j <= MAX; j+= i)    dp[j] += cnt[i];
        }
        ll ans = 0;
        rep1(i, MAX){
            if(cnt[i] != 0 && dp[i] == cnt[i] && cnt[i] == 1)  ans += cnt[i];
        }
        cout<<ans;
    }
}

Measured memory_bytes: 20356
def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    ans = 0
    for a in range(A+1):
        a = a * 500
        for b in range(B+1):
            b = 100 * b
            for c in range(C+1):
                c = 50 * c
                if a + b + c == X:
                    ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
//Author: master19
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ff first 
#define ss second 
#define pb push_back
#define endl "\n"
#define PI acos(-1.0)
#define mod 1000000007LL // fixed...
#define modd 1000000007LL // Can be changed for global use
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define Yes cout << "Yes\n"
#define No cout << "No\n"
#define all(arr) arr.begin(),arr.end()
#define x(arr) arr.begin(),arr.end()
#define ulli unsigned long long int
#define assign(x,val) memset(x,val,sizeof(x))
#define prec(val, dig) fixed << setprecision(dig) << val
#define Sort(arr) sort(arr.begin(), arr.end())
#define lower(str) transform(str.begin(), str.end(), str.begin(), ::tolower);
#define upper(str) transform(str.begin(), str.end(), str.begin(), ::toupper);
#define crap ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define get(arr, num) vector < ll > arr(num); for(int i=0; i<num; i++)cin >> arr[i];
#define get_set(arr, num, st, type) set < type > st; for(int i=0; i<num; i++) st.insert(arr[i]);
#define put(arr, num) for(int i=0; i<num; i++)cout << arr[i] << " "; cout << endl;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > new_ds; 
ll lets_do_it();
// pi xy[] = {{-1, 0}, {1, 0} , {0, -1}, {0, 1}};
// pi dig[] = {{-1, -1}, {-1, 1}, {1, 1}, {1, -1}};
// bool isValid(ll x, ll y, ll row, ll col){
//     return ((x>=0) && (y >=0)  && (x < row) && (y < col));
// }
int main(int argc, const char** argv) {
    crap;
    ll test = 1;
    // cin >> test;
    for(int loop=0; loop<test; loop++){
        // cout << "Case #" << (loop+1) << ": "; 
        lets_do_it();
    }
    return 0;
}
ll lets_do_it(){
    // Your code goes by here !!
    ll num;
    cin >> num;
    get(arr, num);
    ll count = 0;
    for(int i=0; i<num; i+=2){
        if(arr[i]%2 == 1)
            count++;
    }
    cout << count << endl;





























    return 0;
}


Measured memory_bytes: 3636
n = int(input())
vote_ls = {}
#vote_num = [0]*n
for i in range(n):
    aaa = input()
    if aaa in vote_ls.keys():
        vote_ls[aaa]+=1
    else:
        vote_ls[aaa] = 1
#print(vote_ls)
sub_ls = []
'''
max_vote = max(vote_)
for i in range(n):
    if vote_num[i] == max_vote:
        sub_ls.append(vote_ls[i])
sub_ls.sort()
for i in range(len(sub_ls)):
    print(sub_ls[i])
'''
sorted = sorted(vote_ls.items(), key=lambda x:x[1])
sub_ls.append(sorted[-1])
for i in range(len(sorted)-2,-1,-1):
    if sorted[i][1] == sorted[-1][1]:
        sub_ls.append(sorted[i])
    else:
        break
#print(sub_ls)
sub_ls.sort()
for i in range(len(sub_ls)):
    print(sub_ls[i][0])


Measured memory_bytes: 45784
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <unordered_set>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const int NIL = -1;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
 
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 pow(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= a; }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; }
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; }
 
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

int main(){
    int cnt[100100];
    REP(i, 100100){
        cnt[i] = 0; 
    }
    int a, n;
    cin >> n;
    REP(i, n){
        cin >> a;
        if(a == 0){
            cnt[0]++;
            cnt[1]++;
        }else{
            FOR(j, a - 1, a + 2){
                cnt[j]++;
            }
        }
    }
    int ans = 0;
    REP(i, 100000){
        ans = max(cnt[i], ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main(){
  int dp[17][17];
  bool flag[17][17];
  int W, H;
  
  while(cin >> W >> H){
    if(W == 0 && H == 0) break;
    memset(flag, 1, sizeof(flag));
    memset(dp, 0, sizeof(dp));
    int n; cin >> n;

    int x, y;
    for(int i = 0 ; i < n ; i++){
      cin >> x >> y;
      flag[y][x] = 0;
    }

    for(int i = 1 ; i <= H ; i++){
      for(int j = 1 ; j <= W ; j++){
	if(i == 1 && j == 1) dp[i][j] = 1;
	else dp[i][j] = dp[i-1][j] + dp[i][j-1];
	if(!flag[i][j]) dp[i][j] = 0;
      }
    }
    
    /* for(int i = 1 ; i <= H ; i++){
      for(int j = 1 ; j <= W ; j++){
	cout << dp[i][j]<< ' ';
      }
      cout << endl;
      }*/

    cout << dp[H][W] << endl;
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.Scanner
import scala.collection.Searching._

import scala.annotation.tailrec

class IUnionFind(val size: Int) {

  private case class Node(var parent: Option[Int], var treeSize: Int)

  private val nodes = Array.fill[Node](size)(new Node(None, 1))

  def union(t1: Int, t2: Int): IUnionFind = {
    if (t1 == t2) return this

    val root1 = root(t1)
    val root2 = root(t2)
    if (root1 == root2) return this

    val node1 = nodes(root1)
    val node2 = nodes(root2)

    if (node1.treeSize < node2.treeSize) {
      node1.parent = Some(t2)
      node2.treeSize += node1.treeSize
    } else {
      node2.parent = Some(t1)
      node1.treeSize += node2.treeSize
    }
    this
  }

  def connected(t1: Int, t2: Int): Boolean = t1 == t2 || root(t1) == root(t2)

  @tailrec
  private def root(t: Int): Int = nodes(t).parent match {
    case None => t
    case Some(p) => root(p)
  }
}


object Main {
  def solve(sc: => Scanner): Unit = {
    val N = sc.nextInt
    val A = Array.fill(360)(0)
    for (_ <- 0 until N) {
      val M, D, V, S = sc.nextInt
      val start = (M - 1) * 30 + D - 1;
      for (i <- start until start + V) {
        A(i % 360) = math.max(A(i % 360), S)
      }
      for (i <- 0 until S) {
        A((start - i + 720) % 360) = math.max(A((start - i + 720) % 360), S - i)
        A((start + V + i - 1 + 720) % 360) = math.max(A((start + V + i - 1 + 720) % 360), S - i)
      }
    }
    println(A.min)
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)

    solve(sc)
  }
}

Measured memory_bytes: 45804
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if ((a - b) % 2 == 0) cout << (a + b) / 2 << endl;
    else cout <<"IMPOSSIBLE"<< endl;

}

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

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define debug(x) cout << #x << ": " << x << endl
using ll = long long;
//#define int ll

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

signed main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, a, b;
    cin >> n >> a >> b;

    if((b-a)%2 == 0) printf("Alice\n");
    else printf("Borys\n");
    
    return 0;
    
}


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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

#define rep(i, n) FOR(i, 0, n)
#define FOR(i, x, n) for (int i = (x); i < (n); ++i)
#define all(v) (v).begin(), (v).end()

using ll = long long;

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

int n, m, q, ans;
int a[50], b[50], c[50], d[50];
int v[11];

void eval() {
    int sum = 0;
    for (int i = 0; i < q; ++i) {
        if (v[b[i]] - v[a[i]] == c[i]) {
            sum += d[i];
        }
    }
    chmax(ans, sum);
}

void dfs(int i) {
    if (i > n) {
        eval();
        return;
    }
    for (int j = v[i - 1]; j <= m; ++j) {
        v[i] = j;
        dfs(i + 1);
    }
}

int main() {
    cin >> n >> m >> q;
    for (int i = 0; i < q; ++i) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }

    v[0] = 1;
    dfs(1);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int res=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-f;ch=getchar();}
	while(ch>='0'&&ch<='9'){res=(res<<3)+(res<<1)+ch-'0';ch=getchar();}
	return res*f;
}
void write(int x){
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10|'0');
}
const int N=200005;
int n,nn,a[N],b[N],l,r;
inline bool check(int k){
	for(int i=1;i<=nn;i++)
		if(a[i]<k) b[i]=0;
		else b[i]=1;
	int pos1=1e8,pos0=1e8;	
	for(int i=1;i<nn;i++)
		if(b[i]==b[i+1]){
			if(b[i]) pos1=min(pos1,min(abs(n-i),abs(n-(i+1))));
			else pos0=min(pos0,min(abs(n-i),abs(n-(i+1))));
		}
	if(pos1==1e8&&pos0==1e8)return (n&1)==b[n];
	return pos1<pos0;
}
int main(){
	n=read();nn=2*n-1;
	for(int i=1;i<=nn;i++){
		a[i]=read();
	}
	l=-1e8;r=1e8;
	while(r-l>1){
		int mid=(l+r)>>1;	
		if(check(mid)) l=mid;
		else r=mid;
	}	
	write(l);
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
using namespace std;
int a[202];
bool check[202];

int main(){
	int n,l,min=303,ans=0;
	cin>>n>>l;
	for (int i=1;i<=n;i++){
		check[i]=false;
	}
	for (int i=1;i<=n;i++){
		a[i]=l+i-1;
		ans+=a[i];
		if (a[i]<0){
			a[i]=-1*a[i];
			check[i]=true;
		}
	}
	int i;
	for (i=1;i<=n;i++){
		if (a[i]<min) min=a[i];
	}
	if (check[i-1]==true) cout<<ans+min<<endl;
	else cout<<ans-min<<endl;
	return 0;
} 

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

int main(){
    
    int a,b;
    
    cin >> a >> b;  
     if(a > b){
         cout << "a > b" << endl;
         return 0;
     }
     if(a < b){
         cout << "a < b" << endl;
         return 0;
     }
    cout << "a == b" << endl;
    
    return 0;
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();
            var N = int.Parse(str);

            var sum = 0.0;
            for (int i = 0; i < N; i++)
            {
                str = Console.ReadLine();
                var strs = str.Split(' ');
                
                if (strs[1] == "JPY")
                {
                    sum += double.Parse(strs[0]);
                }
                else
                {
                    sum += double.Parse(strs[0]) * 380000.0;
                }
            }

            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 11220