akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll a,b,c;

ll sz(ll a, ll b){
	
	ll s1 = 0,s2=0;
	while(a){
		s1++;
		a/=10;
	}
	
	while(b){
		s2++;
		b/=10;
	}
	return max(s1,s2);
	


}

int main(){
	ll n;
	cin >> n;
	ll maxi = 0x3f3f3f3f;
	for(ll i = 1;i*i<=n;i++){
		if(n%i == 0){
			maxi = min(maxi,sz(i,n/i));

		}
	
	}
	cout<<maxi<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++)
#define numa(x,a) for(auto x: a)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define pf push_front
#define sec second
#define sz(x) ((int)(x).size())
#define ALL( c ) (c).begin(), (c).end()
#define gcd(a,b) __gcd(a,b)
#define mem(x,n) memset(x,n,sizeof(x))
#define endl "\n"
using namespace std;
template <int POS, class TUPLE> void deploy(std::ostream &os, const TUPLE &tuple){}
template <int POS, class TUPLE, class H, class ...Ts> void deploy(std::ostream &os, const TUPLE &t){ os << (POS == 0 ? "" : ", ") << get<POS>(t); deploy<POS + 1, TUPLE, Ts...>(os, t); }
template <class T,class U> std::ostream& operator<<(std::ostream &os, std::pair<T,U> &p){ os << "(" << p.first <<", " << p.second <<")";return os; }
template <class T> std::ostream& operator<<(std::ostream &os, std::vector<T> &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; }
template <class T> std::ostream& operator<<(std::ostream &os, std::set<T> &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; }
template <class T, class K> std::ostream& operator<<(std::ostream &os, std::map<T, K> &mp){ int remain = mp.size(); os << "{"; for(auto e: mp) os << "(" << e.first << " -> " << e.second << ")" << (--remain == 0 ? "}" : ", "); return os; }
#define DEBUG1(var0) { std::cerr << (#var0) << "=" << (var0) << endl; }
#define DEBUG2(var0, var1) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG1(var1); }
#define DEBUG3(var0, var1, var2) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG2(var1,var2); }
#define DEBUG4(var0, var1, var2, var3) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG3(var1,var2,var3); }
using ll = long long;


int main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  string S;
  cin >> S;
  int N = sz(S);
  if (N == 2) {
    if (S[0] == S[1]) {
      cout << 1 << ' ' << 2 << endl;
    }else{
        cout << -1 << ' ' << -1 << endl;
    }
    return 0;
  }
  S += "12345";
  rep(i,N){
    set <char> cnt;
    rep2(j,i,i+3){
      cnt.insert(S[j]);
    }
    if (sz(cnt) <= 2) {
      cout << i+1 << ' ' << i+3 << endl;
      return 0;
    }
  }
  cout << -1 << ' ' << -1 << endl;
  return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    string s;
    cin >> s;
    int n = s.length();

    string ans = "Yes";
    int c = n / 2;
    for (int i = 0; i < n; i++) {
        if (s[i] != s[n - i - 1]) ans = "No";
    }
    for (int i = 0; i < c; i++) {
        if (s[i] != s[c - i - 1]) ans = "No";
    }
    for (int i = c + 1; i < n; i++) {
        if (s[i] != s[n - i + c]) ans = "No";
    }

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

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;


int main(){
  int n;
  cin >> n;
  vector<int> x(n),y(n);
  rep(i,n) cin >> x[i] >> y[i];
  map<pair<ll,ll>,int> mp;
  rep(i,n)rep(j,n)if(i!=j){
    mp[{x[i]-x[j],y[i]-y[j]}]++;
  }
  int tmp=0;
  for(auto it:mp){
    tmp = max(tmp, it.S);
  }
  ll ans = n- tmp;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
N,K=map(int,input().split())
x=998244353
dp=[0 for i in range(N)]
sdp=[0 for i in range(N)]
L=[]
R=[]
dp[0]=1
sdp[0]=1
for i in range(K):
    l,r=map(int,input().split())
    L.append(l)
    R.append(r) 
for i in range(1,N):
    for j in range(K):
        dp[i]+=(sdp[max(i-L[j],-1)]-sdp[max(i-R[j]-1,-1)])
        dp[i]%=x
    sdp[i]=(sdp[i-1]+dp[i])%x
print(dp[-1]%x)

Measured memory_bytes: 24592
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LL long long
#define M 100020
using namespace std;
LL read(){
	LL nm=0,fh=1; LL cw=getchar();
	for(;!isdigit(cw);cw=getchar()) if(cw=='-') fh=-fh;
	for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
	return nm*fh;
}
LL n,p[M],G[M],F[M],ans;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read();
	for(LL i=1;i<=n;i++){
		p[i]=read();
		if(i>1&&p[i]>0&&p[i-1]>0) p[i-1]+=p[i],i--,n--;
	}
	for(LL i=1;i<=n;i++) G[i]=G[i-1]+p[i],F[i]=F[i-1]+abs(p[i]); ans=G[n];
//	for(LL i=1;i<=n;i++) printf("I = %lld    p = %lld   G = %lld   F = %lld \n",i,p[i],G[i],F[i]);
	for(LL i=2;i<=n;i++) if(p[i-1]<0) ans=max(ans,G[i-1]-p[i]+F[n]-F[i]);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2560
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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

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

    int A, B; cin >> A >> B;
    if(A > 9 || B > 9) {
        COUT(-1);
    } else {
        COUT(A * B);
    }
}



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

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define sort(vvv) sort(vvv.begin(),vvv.end())
#define rvs(vvv) reverse(vvv.begin(),vvv.end())

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> data(n);
	ff(i, 0, n) {
		cin >> data.at(i);
	}
	int ans = 0;
	int pre = 0;
	ff(i, 0, n-1) {
		if (data.at(i) >= data.at(i + 1)) {
			pre++;
		}
		else {
			pre = 0;
		}
		if (ans < pre)ans = pre;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------

int n;
double v[110];
vector<double> t;
double sp,psp,r;

double limit(double tim){
    auto d = (lower_bound(all(t), tim) - t.begin());
    double limit = v[d-1];
    FOR(di,d,n+1){
        limit = min(limit,v[di] + abs(tim - t[di]));
    }
    return limit;
}

signed main(){
    I(n);
    t.resize(n+1);
    REP(i,n){
        cin >> t[i+1];
        t[i+1] += t[i];
    }
    REP(i,n){
        cin >> v[i];
    }

    for(double tim = 0.0; tim <= t[n]; tim += 0.5){
        psp = sp;
        sp = min(psp+0.5, limit(tim));
        // cerr << tim << " :" << sp << endl; 
        r += (psp+sp) * 0.5 * 0.5;
    }
    printf("%.13f\n", r);
}

Measured memory_bytes: 256
from collections import deque


H,W=map(int,input().split())
A=[list(input()) for _ in range(H)]   # (i,j) = A[i][j]
seen = [[False] * W for _ in range(H)] 
queue = deque([])

for i in range(H):
    for j in range(W):
        if A[i][j]=='#':
            queue.append((i,j,0))
            seen[i][j]=True

while queue:
    i,j,k=queue.popleft()
    if i!=0   and seen[i-1][j] == False: 
        queue.append((i-1,j,k+1))
        seen[i-1][j]=True
    if i!=H-1 and seen[i+1][j] == False:
        queue.append((i+1,j,k+1))
        seen[i+1][j]=True
    if j!=0   and seen[i][j-1] == False:
        queue.append((i,j-1,k+1))
        seen[i][j-1]=True
    if j!=W-1 and seen[i][j+1] == False:
        queue.append((i,j+1,k+1))
        seen[i][j+1]=True

print(k)


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

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


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

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

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

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

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


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8



int main(){
	LL a, b, c, d, e, f;
	LL x, y, z;
	double p, q, r;
	string s = "a", t, u;
	
	a = b = c = d = e = f = 0;
	x = y = z = 0;
	p = q = r = 0.0;
	
	cin >> a >> b >> c >> d >> e >> f;
	cin.clear();
	cin >> s >> t >> u;
	cin.clear();
	
	;cout << (a*b%2==1?"Yes":"No") << endl;
}


Measured memory_bytes: 764
N = int(input())
N_str = list(str(N))
length = len(str(N))

#1<=k<=Nで 先頭がiで末尾がjの総和
c = [[0]*9 for i in range(9)]
'''
#C(i,j)を求めるのは無理

def count(i, j):
    pass

for i in range(9):
    for j in range(9):
        c[i][j] = count(i, j)
'''

for i in range(1, N+1):
    s = str(i)
    if s[0] == "0" or s[-1] == "0":continue
    c[int(s[0])-1][int(s[-1])-1] += 1

ans = 0
for i in range(9):
    for j in range(9):
        ans += c[i][j] * c[j][i]

print(ans)


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int dp[5005][5005];

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

    string S;
    cin >> S;

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

    for(int i=N-1; i>=0; i--){
        for(int j=N-1; j>=0; j--){
            if(S[i] == S[j]) dp[i][j] = dp[i+1][j+1] + 1;
            else dp[i][j] = 0;
        }
    }

    int ans = 0;
    for(int i=0; i<N; i++){
        for(int j=0; j<N; j++){
            if(i >= j) continue;
            if(dp[i][j] > j-i) continue;
            ans = max(ans, dp[i][j]);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 98048
N,M = gets.chomp.split(" ").map(&:to_i)
strs = M.times.map{gets.split.map(&:to_i)}

strs.sort_by! { |a, b| b }

expect_bridge = 0
ans = 0
strs.each do |a, b|
  next if a <= expect_bridge
  ans += 1
  expect_bridge = b - 1
end
puts ans

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


int main(void){

	int a,b,c;
	int d;

	scanf("%d %d %d",&a,&b,&c);

	d = a + b + c;


	if(d > 21){
		printf("bust\n");
	}else{
		printf("win\n");
	}



	return 0;
}



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

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

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

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

ll lcmk(ll a, ll b) {
  return a / gcdk(a, b) * b;
}


signed main() {
	ll n, t, result = 1;
  cin >> n;
  rep(i, n) {
    cin >> t;
    result = lcmk(result, t);
  }
  cout << result << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    A=list(map(int,input().split()))

    now=0
    for a in A:
        if(a==now+1):
            now+=1

    if(now==0):
        print(-1)
    else:
        print(n-now)
resolve()

Measured memory_bytes: 72220
#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
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define vul vector<ull>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi2d vector<vi >
#define vl2d vector<vl >
#define vpll vector<pll >

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rz resize
#define fr(i,n) for(i=0;i<(n);i++)
#define frr(i,n) for(i=(n-1);i>=0;i--)
#define fre(i,n) for(i=0;i<=(n);i++)
#define frre(i,n) for (i=(n);i>=0;i--)
#define frab(i,a,b) for(i=(a);i<(b);i++)
#define freab(i,a,b) for(i=(a);i<=(b);i++)
#define frrab(i,a,b) for(i=(b-1);i>=a;i--)
#define frreab(i,a,b) for(i=(b);i>=a;i--)

#define sz(a) int((a).size())
#define mset(a,b) (memset(a,b,sizeof(a)))
#define max3(a,b,c) (max((a),max((b),(c))))
#define min3(a,b,c) (min((c),min((a),(b))))
#define sumv(v) accumulate(all(v),ll(0))
#define productv(v) accumulate(all(v), ll(1), multiplies< ll >())
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
vector <ll> sprime;
vector<char> prime (1000000, true);
void sieve(ll n)
{
  //O(nloglogn) time
  sprime.pb(0);
  prime[0] = prime[1] = false;
  ll cnt = 0;
  for (ll i = 2; i <= n; ++i)
  {
    if (prime[i])
    {
      cnt++;
      sprime.pb(i);
      for (ll j = 2 * i; j <= n; j += i)
        prime[j] = false;
    }
  }
}
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll fastpowMOD(ll a, ll p, ll MOD) { if (p == 0) return 1; ll z = fastpowMOD(a, p / 2, MOD); z = (z * z) % MOD; if (p % 2) z = (z * a) % MOD; return z; }
ll fastpow(ll a, ll p) { if (p == 0) return 1; ll z = fastpow(a, p / 2); z = (z * z); if (p % 2) z = (z * a); return z; }

#define mod 1000000007
#define inf LLONG_MAX
#define minf LLONG_MIN
#define pi 3.14
#define ex 2.71

//*********************************************///
const int N = 1e5 + 5;
int i,j;
int a[N];
int dp[N];
void solve()
{
  int n;
  cin>>n;
  freab(i,1,n)
    cin>>a[i];
    a[0]=a[1];
  freab(i,2,n)
    dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
  cout<<dp[n]<<endl;
}

int main()
{
  fast;
  int z;
  //cin>>z;
  z=1;
  while(z--)
  {
    solve();
  }
  return 0;
}


Measured memory_bytes: 2048
A = []
A11,A12,A13 = map(int, input().split())
A21,A22,A23 = map(int, input().split())
A31,A32,A33 = map(int, input().split())
N = int(input())
B = []
for i in range(N):
  B.append(int(input()))
  
A = [[A11,A12,A13],
     [A21,A22,A23],
     [A31,A32,A33]]

sets = []

for i in range(3):
  s = []
  for j in range(3):
  	s.append(A[i][j])
  sets.append(s)
  
for j in range(3):
  s = []
  for i in range(3):
  	s.append(A[i][j])
  sets.append(s)
  
sets.append([A11,A22,A33])
sets.append([A13,A22,A31])

for s in sets:
  count = 0
  for b in B:
    if b in s : 
      count+=1
  if count == 3:
    print("Yes")
    break
else:
  print("No")
  
  
  

Measured memory_bytes: 3192
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>

#define ll long long
#define vl vector<ll>
#define vvl vector< vector<ll> >
#define vb vector<bool>
#define vbb vector< vector<bool> >
#define vs vector<string>
#define vc vector<char>
#define vvc vector< vector<char> >

#define all(a) (a).begin(),(a).end()
using namespace std;

int main(){
	ll n; cin >> n;
	ll d, x; cin >> d >> x;
	ll ans = x;
	for (ll i = 0; i < n; ++i){
		ll t; cin >> t;
		ll now = 0;
		while (now*t + 1 <= d) now++;
		ans += now ;
	}cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#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 watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
const ll INF = ll(1e18);
const int MOD = 998244353;

const int MAXN = 100005;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	forn(i,0,5){
		int x; cin>>x;
		if(x==0){ cout<<i+1<<'\n'; break;}
	}
	
	return 0;
}


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

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    ll a,b,v,w,t;
    cin  >> a >> v >> b >> w >> t;
    ll sa=abs(a-b);
    ll sa2=(v-w);
    if(t*sa2<sa) cout << "NO" << endl;
    else cout << "YES" << endl;
    

    return 0;
}











Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 2 - 170;

int main() {
    int n, t;
    cin >> n >> t;
    vector<int> v1(n), v2(n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &v1[i]);
    }
    int v = 0;
    v2[0] = -INF<int>;
    for (int i = n-1; i >= 1; --i) {
        v = max(v, v1[i]);
        v2[i-1] = v-v1[i-1];
    }
    sort(v2.begin(), v2.end(), greater<>());
    cout << (upper_bound(v2.begin(), v2.end(), v2[0], greater<>())-v2.begin())<< "\n";
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
int a, b, c;

cin >> a >> b >> c;

int ans;

ans = a - (b + c);
if (ans > 0){
 cout << "0" << endl;
}else{
 ans = ans * -1;
 cout << ans << endl;
}
}


Measured memory_bytes: 256
use std::io;
use std::str::FromStr;

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();

    let mut it = buf.split_whitespace().map(|n| String::from_str(n).unwrap());
    let mut s = it.next().unwrap();

    while s.len() > 0 {
        s = s[0..s.len() - 2].to_string();
        if s.len() % 2 == 1 {
            continue;
        }
        if s[0..s.len() / 2 - 1] == s[s.len() / 2..s.len() - 1] {
            println!("{}", s.len());
            return;
        }
    }
    return;
}


Measured memory_bytes: 4352
n,a,b=map(int,input().split())
sum=0
for i in range(n+1):
     wa = int((i / 10000) % 10)+int((i / 1000) % 10) + int((i / 100) % 10) + int((i / 10) % 10)  + int(i % 10)
     if a <= wa and wa<=b:
         sum += i
print(sum)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

signed main() {
	ll n, m; cin >> n >> m;
	ll a = n, b = m - 2 * n;
	if (b < 0) {
		cout << m / 2 << endl; return 0;
	}
	cout << a + b / 4 << endl;
}

Measured memory_bytes: 256
# 入力
A, B = map(int, input().split())

# 同じなら引き分け、1が出たら勝ち、大きい方が勝ち
if A == B:
    print('Draw')
elif A == 1:
    print('Alice')
elif B == 1:
    print('Bob')
elif A > B:
    print('Alice')
elif A < B:
    print('Bob')

Measured memory_bytes: 9000
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            tmp = i*500 + j*100 + k*50
            if tmp == X:
                cnt += 1
print(cnt)


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

int main() {
  int N, K;
  cin >> N >> K;
  
  int sum = 0;
  
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    if (x > K - x) {
      sum += (K - x) * 2;
    } else {
      sum += x * 2;
    }
  }
  
  cout << sum;
  
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			h = scanner.nextInt();
			w = scanner.nextInt();
			if ((h | w) == 0)
				break;
			char[][] map = new char[h][w];
			for (int i = 0; i < h; i++) {
				map[i] = scanner.next().toCharArray();
				for (int j = 0; j < w; j++) {
					if (map[i][j] == 'A') {
						ay = i;
						ax = j;
					} else if (map[i][j] == 'B') {
						by = i;
						bx = j;
					}
				}
			}
			int[][] dp = new int[h][w];
			for (int[] dp1 : dp)
				Arrays.fill(dp1, 1 << 30);
			Deque<Point> deque = new ArrayDeque<Main.Point>();
			deque.push(new Point(ay, ax, 0));
			dp[ay][ax] = 0;
			while (!deque.isEmpty()) {
				Point p = deque.poll();
				int y = p.y;
				int x = p.x;
				int step = p.step + 1;

				for (int[] m : move) {
					int ny = y + m[0];
					int nx = x + m[1];
					if (!isOK(ny, nx))
						continue;
					if (map[ny][nx] == '#')
						continue;
					if (dp[ny][nx] <= step)
						continue;
					dp[ny][nx] = step;
					deque.offer(new Point(ny, nx, step));
				}

			}
			char[] p = scanner.next().toCharArray();
			String ans = "impossible";
			for (int i = 0; i < 200; i++) {
				if (dp[by][bx] <= i) {
					ans = i + " " + by + " " + bx;
					break;
				}
				char o = p[i % p.length];
				int ny = by + (o == '2' ? 1 : 0) - (o == '8' ? 1 : 0);
				int nx = bx + (o == '6' ? 1 : 0) - (o == '4' ? 1 : 0);
				if (!isOK(ny, nx))
					continue;
				by = ny;
				bx = nx;
			}
			System.out.println(ans);
		}
	}

	private boolean isOK(int ny, int nx) {
		return 0 <= ny && ny < h && 0 <= nx && nx < w;
	}

	int ay, ax, by, bx, h, w;
	int[][] move = { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };

	class Point {
		int y, x, step;

		public Point(int y, int x, int step) {
			super();
			this.y = y;
			this.x = x;
			this.step = step;
		}

		@Override
		public String toString() {
			return "Point [y=" + y + ", x=" + x + ", step=" + step + "]";
		}

	}
}

Measured memory_bytes: 24396
#include<iostream>
#include<algorithm>
using namespace std;
const int MAX=100005;
int a[MAX];
int num[MAX];
int n;
int main()
{
	cin>>n;
	int minus=0;
	for(int i=1;i<=n;++i){
		cin>>a[i];
		num[a[i]]++;
	}
	for(int i=1;i<MAX;++i){
		if(num[i]>=1) minus+=(num[i]-1); 
	}
	if(minus%2==1) minus++;
	cout<<n-minus<<endl;
	return 0;
}

Measured memory_bytes: 1024
//
//  main.cpp
//  A
//
//  Created by 黄道煜 on 2018/7/14.
//  Copyright © 2018年 黄道煜. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <cstring>
#define MAXN  105
using namespace std;

int n, a[MAXN], ans, tag[MAXN];

int main()
{
    scanf("%d", &n);
    for(int i=1; i<=n; i++)
    {
        scanf("%d", &a[i]);
        if(a[i]==a[i-1] && !tag[i-1]) tag[i]=1, ans++;
    }
    printf("%d\n", ans);
}


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

int main(){
  int H, M;

  while(1){
    cin>>H>>M;
    if(H == 0 && M ==0) break;
    for(int i=0;i<H;i++){
      for(int j=0;j<M;j++){
        cout<<'#';
      }
      cout<<endl;
    }
    cout<<endl;
  }

  return 0;
}
    


Measured memory_bytes: 3064
#include <stdio.h>

int main() {
    int a, b , t, ans;
    int time;
    scanf("%d %d %d", &a, &b, &t);
    time = t/a + 0.5;
    if(t >= a){
        ans = b*time;
        printf("%d", ans);
    }else if(a > t){
        puts("0");
    }
    return 0;
}

Measured memory_bytes: 128
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

int dx[] = { -1, 0, 1, 0, -1, -1, 1, 1};
int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
/*
\x*8/100/  =A
\x*10/100/ =B

*/

int main() {

	long long  a, b; cin >> a >> b;

	long long  lo = 1, hi = 1e4, ans = -1;
	while (lo <= hi) {
		long long  x = lo + (hi - lo) / 2;

		if (((x * 8) / 100) == a and (x / 10) == b) ans = x, hi = x - 1;
		else if (((x * 8) / 100) < a or (x / 10) < b) lo = x + 1;
		else if (((x * 8) / 100) > a or (x / 10) > b) hi = x - 1;
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 3124
let readString() = stdin.ReadLine()
let readStringArray() = stdin.ReadLine().Split(' ');
let readInt() = readString() |> int
let readIntArray() = readStringArray() |> Array.map (fun x -> int x)
let char2String(value) = List.ofSeq value |> List.toArray |> System.String


let s = readStringArray();
if s.[0] > s.[1] then 
    ">" 
else if s.[0] = s.[1] then 
    "="
else 
    "<"
|> printfn "%s"

Measured memory_bytes: 12764
// -*- coding:utf-8-unix -*-

use num_traits::{pow, One};
use proconio::{fastout, input};
use std::ops::{Add, Div, Mul, Sub};

const MODULUS: usize = 1000000007;

// ABC086C - Traveling
// https://atcoder.jp/contests/abs/fasks/arc089_a

#[fastout]
fn main() {
    input! {
        n: usize,
        k: usize,
        ab :[(usize, usize); n-1]
    }

    let mut neighbors: Vec<Vec<usize>> = vec![Vec::new(); n];
    for &(a, b) in &ab {
        neighbors[a - 1].push(b);
        neighbors[b - 1].push(a);
    }

    let mut forbidden_colors = vec![0; n];
    let mut stack: Vec<(Option<usize>, usize)> = Vec::new();
    let mut patterns = ModP(1);
    stack.push((None, 1));
    while let Some((parent, me)) = stack.pop() {
        if forbidden_colors[me - 1] > 0 {
            continue;
        }
        match parent {
            None => {
                patterns = ModP(k);
                forbidden_colors[me - 1] = 1;
            }
            Some(par) => {
                if k <= forbidden_colors[par - 1] {
                    println!("0");
                    return;
                }
                patterns = patterns * (ModP(k - forbidden_colors[par - 1]));
                forbidden_colors[me - 1] = 2;
                forbidden_colors[par - 1] += 1;
            }
        }
        for &child in &neighbors[me - 1] {
            stack.push((Some(me), child));
        }
    }
    println!("{}", patterns.0);
}

#[derive(Clone, Copy, PartialEq, Debug)]
struct ModP(usize);

impl One for ModP {
    fn one() -> Self {
        return ModP(1);
    }
}
impl Add for ModP {
    type Output = Self;
    fn add(self, rhs: Self) -> Self {
        return ModP((self.0 + rhs.0) % MODULUS);
    }
}
impl Sub for ModP {
    type Output = Self;
    fn sub(self, rhs: Self) -> Self {
        return ModP((self.0 + MODULUS - rhs.0) % MODULUS);
    }
}
impl Mul for ModP {
    type Output = Self;
    fn mul(self, rhs: Self) -> Self {
        return ModP((self.0 * rhs.0) % MODULUS);
    }
}
impl Div for ModP {
    type Output = Self;
    fn div(self, rhs: Self) -> Self {
        if rhs.0 == 0 {
            panic!("Tried to divide by ModP(0)!");
        }
        let rhs_inv = pow(rhs, MODULUS - 2);
        return self * rhs_inv;
    }
}


Measured memory_bytes: 14180
s=input()

max_len=0
tmp=""

for i in range(1,min(len(s)+1,3)):
  last=s[:i]
  cnt=1
  for s_ in s[i:]:
    tmp+=s_
    if tmp != last:
      last=tmp
      tmp=''
      cnt+=1
  max_len=max(max_len,cnt)

print(max_len)

Measured memory_bytes: 3500
class Dice:
    def __init__(self,my_label):
        self.top,self.front,self.right,self.left,self.back,self.bottom = [int(x) for x in my_label]

    def Roll(self,i):
        if i == 0:
            self.top, self.front, self.right, self.left, self.back, self.bottom = \
            self.right, self.front, self.bottom, self.top, self.back, self.left
        
        if i == 1:
            self.top, self.front, self.right, self.left, self.back, self.bottom = \
            self.left, self.front, self.top, self.bottom, self.back, self.right
        
        if i == 2:
            self.top, self.front, self.right, self.left, self.back, self.bottom = \
            self.back, self.top, self.right, self.left, self.bottom, self.front
            
        if i == 3:
            self.top, self.front, self.right, self.left, self.back, self.bottom = \
            self.front, self.bottom, self.right, self.left, self.top, self.back

    def Open(self):
        print(self.top)


def CheckData(data,top,front):
    for i in range(len(data)):
        if(data[i][0] == top and data[i][1] == front):
            print(data[i][2])
            break

def MakeData(dice):
    num_data = 4 * len(my_label)-1
    
    dataset = list()
    data = [dice.top, dice.front, dice.right]

    dataset.append(data)
    
    isOnly = True
    
    while 0 < num_data:
        data = [dice.top, dice.front, dice.right]

        isOnly = True
        for i in range (len(dataset)):
            if(data == dataset[i]):
                isOnly = False
                break
        if isOnly == True:
            dataset.append(data)
            dataset.sort()
            num_data -= 1
        
        dice.Roll(int(random.random() * 4))
        
    
        
    return dataset


import random
my_label = [int(x) for x in input().split(" ")]
dice = Dice(my_label)
data = MakeData(dice)


q = int(input())
while q > 0:
    n_top,n_front = [int(x) for x in input().split(" ")]
    
    CheckData(data,n_top,n_front)
    
    q -= 1



Measured memory_bytes: 8208
//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define s(x) scanf("%d",&x)
#define rep(i,x) for(int i=0;i<x;i++)
int main()
{
	int n,m;
while(1)
{
	scanf("%d %d",&n,&m); if(!n) return 0;
	string s;
	cin >> s;
	int ret=0;
	for(int i=0;i<m;i++)
	{
		if(s[i]=='O') continue;
		else
		{
			int res=0;
			while(i+2<m && s[i+1]=='O' && s[i+2]=='I') {i+=2;res++;}
			ret+=max(res-n+1,0);
		}
	}
	printf("%d\n",ret);
}
}

Measured memory_bytes: 2132
#include <iostream>
using namespace std;
int main(){
  string S;
  cin>>S;
  string datas[4]={"Sunny", "Cloudy", "Rainy", "Sunny"};
  
  for(int i=0;i<4;i++){
    if(S==datas[i]){
      cout<<datas[i+1]<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define Int long long
#define rep(i,n) for(int i=0; i<n; ++i)
using namespace std;
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() {
  int N; cin >> N;
  int ans = 0;
  rep(i,N) {
    int l, r; cin >> l >> r;
    ans += r-l+1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    COMinit();
    ll H,W,A,B;
    cin >>H>>W>>A>>B;

    ll ans=0;
    rep(i,min(H,W)-1){
        ans= (ans+(COM(H-A+B-1,B+i)*COM(W-B+A-1,A+i))%mod)%mod;
    }
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 15528
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define dump(x) cout << #x << " = " << (x) << endl;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

#define int long long

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  sort(all(S));
  bool ng = true;
  FOR(i, 1, 4) {
    if(S[0] != S[i]) ng = false;
  }
  if(ng) {
    cout << "No" << endl;
    return 0;
  }
  if(S[0] == S[1] && S[2] == S[3])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
[n,m]=i2()
p=i2()

import sys
sys.setrecursionlimit(10000)

par=[i for i in range(n)]
rank=[0 for i in range(n)]

def rt(x):
 if par[x]==x:
    return x
 else:
    par[x]=rt(par[x])
    return par[x]

def un(x,y):
    x=rt(x)
    y=rt(y)
    if x==y:
       return
    else:
       if rank[x]<rank[y]:
          par[x]=y
       else:
          par[y]=x
          if rank[x]==rank[y]:
             rank[x]+=1

       
for i in range(m):
 [x,y]=i2()
 un(x-1,y-1)

s=0
for i in range(n):
 if rt(i)==rt(p[i]-1):
   s+=1
print(s)
   


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

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    ll k;
    cin >> k;
    ll now=7,count=0;
    bool flag=false;
    for(ll i=0;i<=1000000;i++){
        count++;
        now=now%k;
        if(now==0){
            flag=true;
            break;
        }
        now=now*10+7;
    }
    
    if(flag) cout << count << endl;
    else cout << -1 << endl;

    return 0;
}











Measured memory_bytes: 3632
#include <cstdio>
#include <cstring>

inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while(ch>'9' || ch<'0'){
		if(ch=='-')
		f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-48;
		ch=getchar();
	}
	return x*f;
}
int n,k,cnt;
bool vis[105];

int main(){
	memset(vis,true,sizeof(vis));
	n=read();k=read();
	for(int i=1;i<=k;++i){
		int d=read();
		for(int i=1;i<=d;++i)
		vis[read()]=false;
	}
	for(int i=1;i<=n;++i)
	if(vis[i])++cnt;
	printf("%d\n",cnt);
}

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

int main(){

	int n;
	cin >> n;

	for(int i=1;n>=i;i++){

		if(i%3 == 0)cout << " " << i;
		else if(i%10 == 3)cout << " " << i;
		else {
			int x=i;
		    while(1){
		     	x /= 10;
		     	if(x == 0)break;
		     	if(x%10 == 3){
		     		cout << " " << i;
		     		break;
		       	}
		    }

		}

	}	     

	cout << endl;
	
	return 0;
}

Measured memory_bytes: 3092
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))}
const main=()=>{
  let n=tn(),s=ts(),x=0,mx=0
  for(let i=0;i<n;i++){
    if(s[i]=='I')x++
    else if(s[i]=='D')x--
    if(x>mx)mx=x
  }
  to(mx)
}
main()

Measured memory_bytes: 7372
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<cctype>
#define qmin(x,y) (x=min(x,y))
#define qmax(x,y) (x=max(x,y))
using namespace std;

inline char gc() {
//  static char buf[100000],*p1,*p2;
//  return (p1==p2)&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
    return getchar();
}

template<class T>
int read(T &ans) {
    ans=0;char ch=gc();T f=1;
    while(!isdigit(ch)) {
        if(ch==EOF) return -1;
        if(ch=='-') f=-1;
        ch=gc();
    }
    while(isdigit(ch))
        ans=ans*10+ch-'0',ch=gc();
    ans*=f;return 1;
}

template<class T1,class T2>
int read(T1 &a,T2 &b) {
    return read(a)!=EOF&&read(b)!=EOF?2:EOF;
}

template<class T1,class T2,class T3>
int read(T1 &a,T2 &b,T3 &c) {
    return read(a,b)!=EOF&&read(c)!=EOF?3:EOF;
}

typedef long long ll;
const int Maxn=31000;
const int inf=0x3f3f3f3f;
const ll mod=1000000007;

int f[Maxn],pre[Maxn],suf[Maxn],n;

char readch() {
    char ch=gc();
    while(ch!='>'&&ch!='<') ch=gc();
    return ch;
}

signed main() {
//  freopen("test.in","r",stdin);
    read(n);f[1]=pre[1]=suf[1]=1;
    for(int i=2;i<=n;i++) {
        if(readch()=='<') for(int j=1;j<=i;j++) f[j]=pre[j-1];
        else for(int j=1;j<=i;j++) f[j]=suf[j];
        for(int j=1;j<=i;j++) pre[j]=(pre[j-1]+f[j])%mod;
        for(int j=i;j>=1;j--) suf[j]=(suf[j+1]+f[j])%mod;
    }
    printf("%d",pre[n]);
    return 0;
}

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

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

double f(double i) {
  double res = (i/2.0)*(i+1.0);
  return res/i;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<double> p(n);
  rep(i,n) cin >> p[i];

  double sum = 0;
  rep(i,k) {
    sum += f(p[i]);
  }
  double ans = sum;
  for (int i=k; i<n; i++) {
    sum -= f(p[i-k]);
    sum += f(p[i]);
    ans = max(ans, sum);
  }
  printf("%.10f\n", ans);
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> vi;
#define endl '\n'
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define rf(i,a,b) for(int i=a;i>=b;i--) 
#define fast_io ios_base::sync_with_stdio(0);
#define show(x) cout<<x<<endl;
#define pret(x) cout<<x<<endl; return 0;
#define disp(x) cout<<x<<" ";
#define let(x,y) cout<<x<<" "<<y<<endl;
ll MOD=1e9+7;
const int maxn=2e5+5;

int f(){
	int n,d;
	cin>>n;
	cin>>d;
	d *= d;
	int ans = 0;
	for (int i = 0; i < n; ++i)
	{
		int x,y;
		cin>>x>>y;
		int curr = x*x + y*y;
		if(curr <= d) ans++;
	}
	return ans;
}

int32_t main(){
    fast_io;
    int t=1;
    // cin>>t;
    while(t--){
    	show(f());

    	// f();

    	// if(f()){
    	// 	cout<<"Yes"<<endl;
    	// }
    	// else cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;
int n;
ll sum;
void wf(vector<vector<ll>> &b) {
	rep(k,n) rep(i,n) rep(j,n) b[i][j]=min(b[i][j],b[i][k]+b[k][j]);
	return;
}

bool diff(vector<vector<ll>> &a, vector<vector<ll>> &b) {
	rep(i,n) rep(j,n) if (a[i][j]!=b[i][j]) return true;
	return false;
}

void calc(vector<vector<ll>> &b, vector<vector<bool>> &fl) {
	rep(k,n) {
		rep(i,n) {
			rep(j,n) {
				if (i==j||k==i||j==k) continue;
				if (b[i][j]==b[i][k]+b[k][j]) fl[i][j]=false;
			}
		}
	}
}

int main(int argc, char const *argv[]) {
	cin>>n;
	vector<vector<ll>> a(n, vector<ll>(n));
	sum=0ll;
	rep(i,n) rep(j,n) cin>>a[i][j];
	vector<vector<ll>> b(a);
	vector<vector<bool>> fl(n, vector<bool>(n, true));
	wf(b);
	if (diff(a,b)) {
		cout << -1 << endl;
		return 0;
	}
	calc(b,fl);

	rep(i,n) rep(j,n) if (fl[i][j]) sum+=b[i][j];
	cout << sum/2 << endl;
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X)
#define debug(x0123456789) cerr<<#x0123456789<<':'<<x0123456789<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto x0123456789:v)cerr<<x0123456789<<' ';cerr<<endl;
#define INF 1000000007
#define LINF 1000000000000000007
#define EPS 1e-9
typedef long long ll;
typedef long double ld;

signed main(){
    int N;
    cin >> N;
    int a[N];
    FOR(i,0,N)cin >> a[i];
    int sum = 0;
    FOR(i,0,N)sum += a[i];
    int MIN = INF;
    FOR(i,0,N)MIN = min(MIN,abs(N*a[i]-sum));
    FOR(i,0,N){
        if(MIN == abs(N*a[i]-sum)){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int[] h=new int[101];
		while (sc.hasNext()) {
			h[sc.nextInt()]++;
		}
		long max=0;
		for(int i=0;i<101;i++){
			max=Math.max(max,h[i]);
		}
		for(int i=0;i<101;i++){
			if(max==h[i]){
				System.out.println(i);
			}
		}
    }
}

Measured memory_bytes: 18160