akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

typedef long long ll;

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 () {
  ll n, k;
  cin >> n >> k;
  COMinit();
  for (int i = 1; i <= k; i++) {
    ll ans = COM(k - 1, i - 1)*COM(n - k + 1, i);
    ans %= MOD;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 12160
#include<bits/stdc++.h>
using namespace std;
int n,l,r;
long long ans=0;
int main()
{
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		cin>>l>>r;
		ans+=r-l+1;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

s64 numCorrect[100000];
int N;
s64 K;
s64 Q;
int A;

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

    cin >> N >> K >> Q;

    rep (i, Q)
    {
        cin >> A;
        ++numCorrect[A - 1];
    }

    rep (i, N)
    {
        if (numCorrect[i] > Q - K)
        {
            cout << "Yes\n";
        }
        else
        {
            cout << "No\n";
        }
    }

    return 0;
}



Measured memory_bytes: 1408
#include<bits/stdc++.h>
 
#define REP(i,s,n) for(int (i)=s; (i)<(int)(n);(i)++)
#define RIT(it,c) for(__typeof(c.begin()) it = c.begin();it!=c.end();it++)
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)(x).size()
#define MSET(m,v) memset(m,v,sizeof(m))
 
 
using namespace std;
 
 
typedef long long LL;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<LL> vL;
typedef vector<bool> vb;
typedef pair<int,vi> iv;
typedef pair<LL,LL> pLL; 
typedef long double LD;
typedef unordered_set<int> ui;

int H,W;
int dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};



int main(){
	std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>H>>W;
	vector<string> B(H);
	for(int i=0;i<H;++i) cin>>B[i];
	for(int i=0;i<H;++i) for(int j=0;j<W;++j) if(B[i][j] == '.'){
		int cnt = 0;
		for(int k=0;k<8;++k){
			int x = i+dx[k], y = j+dy[k];
			if(x>=0&&x<H&&y>=0&&y<W&&B[x][y]=='#') ++cnt;
		}
		B[i][j] = char(cnt + (int)'0');
	}
	for(auto s:B) cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first

#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
 
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<vvvll> vvvvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef vector<pair<long long,long long> > vpll;
typedef vector<vector<pair<ll,ll> > > vvpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
int main()
{
    IOS;
    ll x,y;
    cin>>x>>y;
    if(x==y)
    cout<<-1;
    else
    {
        if(x%y==0)
        cout<<-1;
        else
        cout<<x;
    }
}

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

// int/long:		-2147483648 - 2147483648 (-2^31 <= int < 2^31)
// long/long long:	-9223372036854775808 - 9223372036854775807 (-2^63 <= long < 2^63)
#define	INF (1<<29)
//536870912

#define	MOD 1000000007

#define	ON	1
#define	OFF	0

int	main() {
	int N, C;
	cin >>N >>C;
	vector<vector<int>> S(N, vector<int> (3, 0));
	for (int i=0; i<N; i++)
		for (int j=0; j<3; j++)
			cin >>S.at(i).at(j);
	// data input done
	vector<vector<int>> log;
	for (int i=0; i<N; i++) {
		int s=S.at(i).at(0);
		int t=S.at(i).at(1);
		int c=S.at(i).at(2);
		log.push_back({s*2-1, c});
		log.push_back({t*2, c});
	}
	sort(log.begin(), log.end());
	int SS=0;
	int i=0;
	vector<int> CRec(C+1, 0);
	while(i<log.size()) {
		int ti=log.at(i).at(0);
		while(ti==log.at(i).at(0)) {
			if (1==ti%2)
				CRec.at(log.at(i).at(1))++;
			else
				CRec.at(log.at(i).at(1))--;
			i++;
			if (i==log.size())
				break;
		}
		int SSS=0;
		for (int i=1; i<=C; i++)
			if (0!=CRec.at(i))
				SSS++;
		SS=max(SS, SSS);
	}
	cout <<SS <<endl;
	return 0;
}



Measured memory_bytes: 17968
n=int(input())
tmp=0
for i in range(1,10000000):
    tmp+=i
    if tmp>n:
        a=i-1
        tmp-=i
        break
    elif tmp==n:
        for j in range(i):
            print(j+1)
        exit()
x=n-tmp#ずらす個数
y=a-x#ずらさない個数
#print(a,tmp,x,y)
ans=[]
for i in range(1,a+1):
    if i<=y:
        ans.append(i)
    else:
        ans.append(i+1)
#print(ans)
[print(i) for i in ans]

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

#define ll long long 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ar array
#define vi vector<int>
#define vll vector<ll>
#define vpl vector<pair<ll, ll>> 
#define MOD 1000000007
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()

void init() {
	
}

void solve() {
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	ll op = 0;
	while (b <= a) {
		b *= 2;
		op++;
	}
	while (c <= b) {
		c *= 2;
		op++;
	}
	if (op <= k) cout << "Yes";
	else cout << "No";
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	init();
	int t = 1; 
	// cin >> t;
	while(t--) {
		solve();
	}
	return 0;
}

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

int main() {
    int A, B;
    cin >> A >> B;
    A = A - 1;
    B = B - 1;
    cout << (A + B -1) / A << endl;
    return 0;
}

Measured memory_bytes: 256
program prob3
    implicit none
    integer :: n, m
    integer, allocatable :: a(:)
    integer :: pena
    integer :: ac
    integer :: i, p
    character(1) :: s
    character(25) :: x, y

    read(*,*) n, m
    allocate(a(n))

    a = 0

    pena = 0
    ac = 0
    do i = 1, m
        read(*,*) p, s
        if(s == 'A') then
            if(a(p) /= -1)then
                pena = pena + a(p)
                ac = ac + 1
                a(p) = -1
            end if
        else
            if(a(p) /= -1)then
                a(p) = a(p) + 1
            end if
        end if
    end do
    write(x,*) ac
    write(y,*) pena
    write(*,'(a,1X,a)') trim(adjustl(x)), trim(adjustl(y)) 
    deallocate(a)

    stop
contains
end program prob3

Measured memory_bytes: 2872
from itertools import combinations_with_replacement

n, m, q = map(int, input().split())
req = [list(map(int, input().split())) for _ in range(q)]

ans = 0
for A in combinations_with_replacement(range(1, m+1), n):
    s = sum(d for a, b, c, d in req if A[b-1] - A[a-1] == c)
    ans = max(ans, s)
print(ans)


Measured memory_bytes: 9076
//#pragma GCC optimize "trapv"
//-D_GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define pm(m) for(auto itr=(m).begin();itr!=(m).end();itr++){itr->first<<" "<<itr->second<<"\n";}
#define int long long int
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define ii pair<int,int>
#define Max 100000+5
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f first
#define s second
#define pb push_back
#define bug(x) cout<<(x)<<" ";exit(0);
int mod = 1000000007;
int mod1 = 998244353;
vector<int> g[Max];
bool vis[Max];
int d, x, y;
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
void ex(int A, int B) {
    if(B == 0) {
        d = A;
        x = 1;
        y = 0;
    }
    else {
        ex(B, A%B);
        int temp = x;
        x = y;
        y = temp - (A/B)*y;
    }
}


void dfs(int u){

	vis[u]=1;
	for(int i=0;i<g[u].size();i++){
		int v=g[u][i];
		if(vis[v]!=1)
			dfs(v);
	}
}



int power(int a,int b){
    if(b==1)return a;
    if(a>mod)a%=mod;
    int r=1;
    while(b){
        if(b&1)r=r%mod*a%mod;
        a=a%mod*a%mod;
        b/=2;
    }
    return r;
}
class uf{
    vector<int> v;
    vector<int> sz;
    
    
    public :
    uf(int n){
        v.resize(n+1);
        iota(v.begin()+1,v.end(),1);
        sz.resize(n+1,1);
        //1 to sz
    }
    int root(int b){
        while(v[b]!=b){
            b = v[b];
        }   
        return b;
    }
    void u(int a, int b){
        //combine a and b
        
        int ra=root(a);
        int rb=root(b);
        if(ra==rb)return ;
        if(sz[ra]<sz[rb]){
            v[ra] = v[rb];
            sz[rb]+=sz[ra];
        }else{
            v[rb]=v[ra];
            sz[ra]+=sz[rb];
        }
    }
    bool f(int a,int b){
        //same set
        return (root(a)==root(b));
    }
   
    
};
vector<int> matmul(vector<int> a,vector<int> b){
    vector<int> c(4,0);
    c[0] = (a[0]%mod*b[0]%mod + a[1]%mod*b[2]%mod)%mod;
    c[1] = (a[0]%mod*b[1]%mod + a[1]%mod*b[3]%mod)%mod;
    c[2] = (a[2]%mod*b[0]%mod + a[3]%mod*b[2]%mod)%mod;
    c[3] = (a[2]%mod*b[1]%mod + a[3]%mod*b[3]%mod)%mod;
    return c;
}
vector<int> id={1,0,0,1};

int32_t main(){
	IO
	//freopen("input.txt","r",stdin);
    	//freopen("output.txt","w",stdout);
	int n;
	cin>>n;
	vector<int> v(n);
	for(int i=0;i<n;i++)cin>>v[i];
	vector<int> dp(n);
	dp[0]=0;
	dp[1]=dp[0]+abs(v[0]-v[1]);
	for(int i=2;i<n;i++){
	    dp[i] = min(dp[i-1]+abs(v[i-1]-v[i]),dp[i-2]+abs(v[i-2]-v[i]));
	}
	cout<<dp[n-1]<<"\n";
}

Measured memory_bytes: 7100
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<ll,ll> P;
const ll MOD=1234567;
const ll INF=1000000010;
const ll LINF=1000000000000000010LL;
const int MAX=500010;
const double EPS=1e-3;
int dx[4]={0,1,0,1};
int dy[4]={0,0,1,1};
ll a[300010],sum1[300010],sum2[300010];
int main(){
    int n;cin>>n;
    int a[101];
    int f[10]={};
    for(int i=0;i<n;i++){
        cin>>a[i];
        int c=0;
        for(int j=0;j<=2800;j+=400){
            if(a[i]>=j&&a[i]<j+400){
                f[c]++;
            }
            c++;
        }
        if(a[i]>=3200){
            f[8]++;
        }
    }
    int mi=0;int ma=0;
    for(int i=0;i<8;i++){
        if(f[i]){
            mi++;
            ma++;
        }
    }
    ma+=f[8];
    cout<<max(mi,1)<<" "<<ma<<endl;
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  int g = 0, p = 0, win = 0, lose = 0;
  for (int i = 0; i < s.size(); i ++) {
    if (p < g) {
      p ++;
      if (s[i] == 'g') win ++;
    } else {
      g ++;
      if (s[i] == 'p') lose ++;
    }
  }

  cout << win - lose << endl;
}


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


int main() {
    int N;
    cin >> N;
    vector<int> v(N);
    for (int i = 0; i < N; ++i) {
        cin >> v[i];
    }

    vector<int> v2(N);
    copy(v.begin(), v.end(), v2.begin());
    sort(v2.begin(), v2.end());

    for (int i = 0; i < v.size(); ++i) {
        if (v2[v.size()-1] != v[i]) {
            cout << v2[v.size()-1] << endl;
        } else {
            cout << v2[v.size()-2] << endl;
        }
    }
}

Measured memory_bytes: 3200
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }
    long[] A;
    private void run() {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int K = scanner.nextInt();
        A = new long[N+1];
        for(int i = 1; i <= N; i++) {
            A[i] = scanner.nextLong();
        }
        for(int i = K + 1; i <= N; i++) {
            if(A[i - K] < A[i]) System.out.println("Yes");
            else System.out.println("No");
        }
    }
}

Measured memory_bytes: 61108
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define int long long
#define double long double
#define all(a) a.begin(), a.end()
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; }
using namespace std;

signed main(void){
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);

    int n; cin>>n;
    rep(i,30)if((1<<i)==n){
        cout<<"No"<<endl;
        return 0;
    }

    cout<<"Yes"<<endl;
    rep(i,2){
        cout<<i+1<<' '<<i+2<<endl;
        cout<<i+1+n<<' '<<i+2+n<<endl;
    }
    cout<<3<<' '<<n+1<<endl;
    int now=4;
    for(;now<n;now+=2){
        cout<<now<<' '<<now+1<<endl;
        cout<<now+1<<' '<<n+1<<endl;
        cout<<now+n<<' '<<now+1+n<<endl;
        cout<<n+1<<' '<<now+n<<endl;
    }
    if(now==n){
        int lsb=n&(-n);
        int tmp=n^lsb^1;
        cout<<n<<' '<<lsb+n<<endl;
        cout<<tmp<<' '<<2*n<<endl;
    }

}

Measured memory_bytes: 2816
fun main(args: Array<String>) {
    val x = readLine()!!.split("").drop(1).dropLast(1)
    val (y,z) = x.partition { it ==x[0] }

    if (y.size ==2 && z.distinct().size ==1)
    {
        print("Yes")
    }
    else {
        print("No")
    }
}

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

int main(){
    string s;
    cin>>s;
    if(s[0]==s[1]&&s[1]==s[2])cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}

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

int parent[100005];
int length[100005];
void init(){
  for (int i=0; i<100005; i++){
    parent[i] = -1;
    length[i] = 1;
  }
  return;
}
int getroot(int a){
  int temp = a;
  while(parent[temp]!=-1){
    temp = parent[temp];
  }
  return temp;
}

bool samegroup(int a, int b){
  int aroot = getroot(a);
  int broot = getroot(b);
  if (parent[a]!=aroot && parent[a]!=-1){
    parent[a] = aroot;
  }
  if (parent[b]!=broot && parent[b]!=-1){
    parent[b] = broot;
  }
  if (aroot==broot){
    return true;
  } else {
    return false;
  }
}

void combine(int a, int b){
  if (samegroup(a, b)){
    //printf("samwgourp!\n");
    return;
  }
  //printf("combine claled\n");
  int aroot = getroot(a);
  int broot = getroot(b);
  if (parent[a]!=aroot && parent[a]!=-1){
    parent[a] = aroot;
  }
  if (parent[b]!=broot && parent[b]!=-1){
    parent[b] = broot;
  }
  //  printf("root of %d = %d\n",a,aroot);
  //printf("root of %d = %d\n",b,broot);
  if (length[aroot]>length[broot]){
    parent[broot] = aroot;
    length[aroot]+=length[broot];
  } else {
    parent[aroot] = broot;
    length[broot] += length[aroot];
    //    if (length[aroot]==length[broot]){
    //      length[broot]++;
    //    }
  }
  return;
}

int count(int a){
  int aroot = getroot(a);
  if (parent[a]!=aroot && parent[a]!=-1){
    parent[a] = aroot;
  }
  //printf("root of %d = %d\n",a,aroot);
  return length[aroot];
}


int main(){
  init();
  int N, M, K;
  scanf("%d", &N);
  scanf("%d", &M);
  scanf("%d", &K);
  //printf("nmk end\n");
  std::vector<int > A(M), B(M);
  std::vector<int > C(K), D(K);
  std::vector<int > like[100005];
  for (int i=0; i<M; i++){
    scanf("%d", &A[i]);
    scanf("%d", &B[i]);
    A[i]--;
    B[i]--;
    like[A[i]].push_back(B[i]);
    like[B[i]].push_back(A[i]);
    combine(A[i], B[i]);
  }
  //printf("m end\n");
  std::vector<int > dislike[100005];
  //printf("step1\n");
  for (int i=0; i<K; i++){
    scanf("%d", &C[i]);
    scanf("%d", &D[i]);
    //printf("i=%d\n",i);
    C[i]--;
    D[i]--;
    dislike[C[i]].push_back(D[i]);
    dislike[D[i]].push_back(C[i]);
  }
  //printf("step2\n");
  for (int i=0; i<N; i++){
    //printf("====== i=%d ====== \n",i);
    int groupnum = count(i);
    //printf("groupnum=%d\n",groupnum);
    int dislikecount = 0;
    for (int j=0; j<dislike[i].size(); j++){
      if (samegroup(i, dislike[i][j])){
        dislikecount++;
      }
    }
    //printf("dislikecount=%d\n",dislikecount);
    int likecount = 0;
    for (int j=0; j<like[i].size(); j++){
      if (samegroup(i, like[i][j])){
        likecount++;
      }
    }
    //printf("likecount=%d\n",likecount);
    printf("%d\n",groupnum-1-dislikecount-likecount);
  }
  return 0;
}


Measured memory_bytes: 14200
//K-OS WITH THE OCDE

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <iostream>
#include <numeric>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <deque>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <climits>

using namespace std;

typedef long long int ll;
typedef long double db;


#define TEST ll t; cin>>t; while(t--)
#define vell vector<ll>
#define pl pair<ll,ll>
#define all(v) v.begin(),v.end()
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define dbg(x)  cerr << #x << ": "<< x <<endl
#define dbg2(x,y) cerr<< #x <<": "<< x <<" || "<< #y << ": " << y << endl

#define endl "\n"
#define MAX 1e18
#define MIN INT_MIN
#define mod 1000000007



void solve()
{
    ll n , k;
    cin >> n >> k;
    ll a[n];
    for (ll i = 0 ; i < n ; ++i)
        cin >> a[i];

    vector <ll> dp(n + 1 , 1);

    for (ll i = 1 ; i < n ; ++i) {
        for (ll j = i - 1 , c = 0; j >= 0 && c < 102 ; --j , c++) {
            if (abs(a[i] - a[j]) <= k)
                dp[i] = max(dp[i] , dp[j] + 1);
        }
    }


    ll mx = 0;
    for(ll i = 0 ; i<n ; ++i)
        mx = max(mx , dp[i]);

    cout << mx;


}

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



Measured memory_bytes: 7940
#pragma once
#include <stdio.h>
#include <sstream>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const ll MAX = 1000010;
const ll 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;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int> > calcNext(const string& S) {
	int n = (int)S.size();
	vector<vector<int> > res(n + 1, vector<int>(26, n));
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j];
		res[i][S[i] - 'a'] = i;
	}
	return res;
}
// mod 1000000007 の世界で a += b する関数
void add(long long& a, long long b) {
	a += b;
	if (a >= MOD) a -= MOD;
}
const ll ainf = 998244353;

struct cell {
	int x, y;
	int deep;
	cell(int x, int y, int deep) : x(x), y(y), deep(deep) {}
};

int dx[] = { -1,1,0,0 };
int dy[] = { 0,0,-1,1 };

int W, H, N;
int X1[500], X2[500], Y1[500], Y2[500];

bool fld[500 * 6][500 * 6];
int compress(int* x1, int* x2, int w) {
	vector<int> xs;
	for (int i = 0; i < N; i++)
	{
		for (int d = -1; d <= 1; d++)
		{
			int tx1 = x1[i] + d, tx2 = x2[i] + d;
			if (1 <= tx1 && tx1 <= W) xs.push_back(tx1);
			if (1 <= tx2 && tx2 <= W) xs.push_back(tx2);
		}
	}

	sort(xs.begin(), xs.end());
	xs.erase(unique(xs.begin(), xs.end()), xs.end());

	for (size_t i = 0; i < N; i++)
	{
		x1[i] = find(xs.begin(), xs.end(), x1[i]) - xs.begin();
		x2[i] = find(xs.begin(), xs.end(), x2[i]) - xs.begin();
	}
	return xs.size();
}
const int MAX_N = 1 << 17;

void solv() {

	int n;
	cin >> n;
	int res = 0;
	for (int i = 1; i <= n; i++)
	{
		if (i < 10) res++;
		else if (i < 100) {}
		else if (i < 1000) res++;
		else if (i < 10000) {}
		else if (i < 100000) res++;
	}
	cout << res << endl;
}

int main() {
	//COMinit();
	solv();

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007

void solve()
{
	ll h,w;
	cin>>h>>w;
	vector<string> s(h);
	for(ll i=0;i<h;i++)
	{
		cin>>s[i];
		cout<<s[i]<<endl<<s[i]<<endl;
	}
		
	return;
}

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



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,S=0,i;cin>>N;
  vector<pair<int,int>>X(N);
  for(i=0;i<N;i++)cin>>X.at(i).second>>X.at(i).first;
  sort(X.begin(),X.end());
  for(i=0;i<N;i++){
    S+=X.at(i).second;
    if(S>X.at(i).first)break;
  }
  if(i==N)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 1792
import re
while 1:
    R=[]
    C=[]
    S=[]
    p,q=map(int,input().split())
    if p==q==0:break
    #P=[input()for _ in range(p)]
    G=[]
    R_c=[0]
    C_c=[0]
    S_c=[0]
    for _ in range(p):
        s=input()
        cnt=s.count
        G.append(re.match('[.]*',s).span()[1])
        R_c.append(R_c[-1]+cnt('(')-cnt(')'))
        C_c.append(C_c[-1]+cnt('{')-cnt('}'))
        S_c.append(S_c[-1]+cnt('[')-cnt(']'))
    for x in range(1,21):
        for y in range(1,21):
            for z in range(1,21):
                for g,i,j,k, in zip(G,R_c,C_c,S_c):
                    if i*x+j*y+k*z!=g:
                        break
                else:
                    R.append(x)
                    C.append(y)
                    S.append(z)
    #print(R,C,S)
    R_c=[0]
    C_c=[0]
    S_c=[0]
    for _ in range(q):
        s=input()
        cnt=s.count
        R_c.append(R_c[-1]+cnt('(')-cnt(')'))
        C_c.append(C_c[-1]+cnt('{')-cnt('}'))
        S_c.append(S_c[-1]+cnt('[')-cnt(']'))
    R_c=R_c[:-1]
    C_c=C_c[:-1]
    S_c=S_c[:-1]

    a=[set()for _ in range(q)]
    for x,y,z in zip(R,C,S):
        for idx,(i,j,k)in enumerate(zip(R_c,C_c,S_c)):
            a[idx].add(i*x+j*y+k*z)
    print(*[list(t)[0]if len(t)==1else-1for t in a])


Measured memory_bytes: 6892
import sys
def Ii():return int(sys.stdin.buffer.readline())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))
 
n,k = Mi()
b = [1]*(n+1)
for i in range(k):
  d = Ii()
  a = Li()
  for j in a:
    b[j] = 0
    
print(sum(b)-1)

Measured memory_bytes: 9184
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int x, y;
    cin >> x;
    cin >> y;

    if (y%2 != 0)
    {
        cout << "No";
        return 0;
    }
    else
    {
        if ( (4*x - y) >= 0 && ((y/2) - x) >= 0)
        {
            cout << "Yes";
            return 0;
        }
        cout <<"No"; return 0;
    }
    


}


Measured memory_bytes: 3640
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"
	"strconv"
)

func bingo(a []int) bool {
	for i := range a {
		if a[i] != -1 {
			return false
		}
	}
	return true
}

func main() {
	a := make([]int, 9)
	for i := range a {
		a[i] = readInt()
	}

	n := readInt()
	b := make(map[int]bool)
	for i := 0; i < n; i++ {
		b[readInt()] = true
	}

	for i := range a {
		if b[a[i]] {
			a[i] = -1
		}
	}

	if bingo(a[0:3]) || bingo(a[3:6]) || bingo(a[6:9]) ||
		bingo([]int{a[0], a[3], a[6]}) || bingo([]int{a[1], a[4], a[7]}) || bingo([]int{a[2], a[5], a[8]}) ||
		bingo([]int{a[0], a[4], a[8]}) || bingo([]int{a[2], a[4], a[6]}) {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readInt() int {
	return int(readInt64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


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

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
  
const int N = 16777217;
  
int n;
char data[16777217];
  
int conv(char c){
  switch(c){
  case 'A':
    return 1;
    break;
  case 'C':
    return 2;
    break;
  case 'G':
    return 3;
    break;
  case 'T':
    return 4;
    break;
  }
}
  
int hash(char str[10]){
  int res = 0, size = strlen(str), r = 1, i;
  for(i=size-1;i>=0;i--){
    res += r * conv(str[i]);
    r *= 4;
  }
  return res;
}
  
void insertElm(int d){
  data[d] = 1;
}
  
char findElm(int d){
  return data[d];
}
  
main(){
  char ope[13], str[13];
  int i;
  memset(data, 0, 16777217);
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%s", ope);
    scanf("%s", str);
    if(!strcmp(ope, "insert")) insertElm(hash(str));
    else printf("%s\n", (findElm(hash(str)) ? "yes" : "no"));
  }
  return 0;
}

Measured memory_bytes: 16980
N = int(input())
a = list(map(int, input().split()))

num_count = 1
remain_count = 0
for i in range(N):
    if num_count == a[i]:
        num_count+=1
        remain_count+=1
if remain_count == 0:
    print(-1)
else:
    print(N - remain_count)

Measured memory_bytes: 77516
#include<iostream>
#include<stdio.h>//printf("%.15f\n",*********);
#include<vector>//文字列.erase(n),vector
#include<algorithm>//next_permutation
#include<set>
#include<string>//char(小文字-32=大文字)
                //to_string,string,substr
#include<sstream>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>//min,max
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)//start==1
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)//end==1
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define Yay(ans) if(ans)cout<<"Yay!"<<rt;else cout<<":("<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())//反転
#define str string
#define please return
#define AC 0
#define rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define pi 3.1415926535897932384626//pi
#define nine 1000000000//10^9

using namespace std;
typedef vector<int> vint;
typedef long double ldouble;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef vector<double> vdouble;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int KETA(int n) { //Sum of Each Digit
	int sum = 0;
	while (n > 0) {
		sum += n % 10; n /= 10;
	}
	return sum;
}

unsigned ND(unsigned num) {//Number of Digits
	return std::to_string(num).length();//outmax=10
}//stringのほうが効率よくないか？

bool KIBN(string s) {
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - 1 - i])return false;
	}
	return true;
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */


int main(void) {
	rapid_pleaseAC_fast;
	
	int x, t;
	cin >> x >> t;

	if (x <= t) {
		cout << 0 << rt;
		return 0;
	}
	cout << x - t << rt;

	please AC;
}
//参考：---

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

using namespace __gnu_pbds;

#define int long long
#pragma GCC optimize ("O3")
#define ll long long
#define vec vector <int>
#define rep(i,a,b) for (ll i=a;i<b;i++)
#define repD(i,a,b) for (ll i=a;i>b;i--)
#define pb push_back
#define pii pair <int,int>
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define maa 1000000007
#define Eps 1e-9
#define PI 3.14159265359

typedef tree<pii,null_type,less <pii >,rb_tree_tag,tree_order_statistics_node_update>ind_set;
typedef gp_hash_table<int, int, hash<int> > ht1;   /// if clear is required
typedef cc_hash_table<int, int, hash<int> > ht2;

///*X.find_by_order("index")
///X.order_of_key("key")

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

int n;
int arr[100005];
int DP[100005];
void solve()
{
    cin>>n;
    rep(i,0,n)cin>>arr[i];

    DP[1]=abs(arr[1]-arr[0]);DP[0]=0;
    rep(i,2,n)
    {
        DP[i]=min(abs(arr[i]-arr[i-1])+DP[i-1],
                  abs(arr[i]-arr[i-2])+DP[i-2]);

    }
    cout<<DP[n-1]<<"\n";

}
signed main()
{

    srand(time(NULL));

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

///freopen("input.txt","r",stdin);
///freopen("output.txt","w",stdout);

    int t=1;
///cin>>t;
    rep(a,0,t)
    {
        ///cout<<"Case "<<a+1<<": ";
        solve();
    }
}


Measured memory_bytes: 1792
import copy

calc = ""


def dfs(nums, ret, data):
    if len(nums) == 0 and ret == 7:
        global calc
        calc = data
        return True
    if len(nums) == 0:
        return False
    cp = copy.copy(nums)
    v = cp.pop(0)
    if dfs(cp, ret+v, data+"+"):
        return True
    if dfs(cp, ret-v, data+"-"):
        return True


N = list(map(int, list(input())))
n_cp = copy.copy(N)
v = N.pop(0)
dfs(N, v, "")

ans = ""
for i in range(len(n_cp)):
    ans += str(n_cp[i])
    if i != 3:
        ans += str(calc[i])
ans += "=7"
print(ans)


Measured memory_bytes: 3444
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <cmath>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#include <vector>
#include <stdlib.h>
#include <algorithm>
using namespace std;

int arr[4],n;
double dp[305][305][305];
double dfs(int a,int b,int c)
{
    if(a==0&&b==0&&c==0) return 0;
    if(dp[a][b][c]>0) return dp[a][b][c];
    double ans = 1.0*n/(a+b+c);
    if(a) ans+=(1.0*a/(a+b+c))*dfs(a-1,b,c);
    if(b) ans+=(1.0*b/(a+b+c))*dfs(a+1,b-1,c);
    if(c) ans+=(1.0*c/(a+b+c))*dfs(a,b+1,c-1);
    return dp[a][b][c] = ans;
}
int main()
{
    int d;
    cin>>n;
    for(int i = 1;i<=n;++i)
    {
        cin>>d;
        arr[d]++;
    }
    printf("%.10f\n",dfs(arr[1],arr[2],arr[3]));
    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}



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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    int n; cin >> n;
    vector<pair<int, int>> ans;

    int jogai = n;
    if (n % 2 == 1) jogai--;

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            if (j <= i) continue;
            if (j == jogai) continue;

            ans.push_back(make_pair(i, j));
        }

        jogai--;
    }

    cout << ans.size() << endl;

    for (auto p : ans) {
        cout << p.first << ' ' << p.second << endl;
    }
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define eb emplace_back
 
typedef long long ll;

const int INF = 1e9;
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	int N, D; cin >> N >> D;
	
	vector<vector<int> > pts(N, vector<int>(D));
	
	for (auto &e : pts) {
		for (auto &f : e) {
			cin >> f;
		}
	}
	int res = 0;
	for (int i=0; i<N; i++) {
		for (int j=0; j<i; j++) {
			int sum = 0;
			for (int k=0; k<D; k++) {
				sum += (pts[i][k] - pts[j][k]) * (pts[i][k] - pts[j][k]);
			}
			for (int k=0; k<200; k++) {
				if (k*k == sum) {
					res++;
					break;
				}
			}
		}
	}
	
	cout << res << endl;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
*A, = map(int, input().split())

INF = 1<<30
dp = [[INF]*(N) for _ in [0]*(M+1)]
dp[0][0] = 0
dp[1][0] = A[0]

for i, a in enumerate(A):
    if i == 0:
        continue
    for k in range(M+1):
        dp[k][i] = min(dp[k][i-1], dp[k-1][i-1]+a)

print(min(dp[M]))


Measured memory_bytes: 21944
#include <bits/stdc++.h>
/*
#include<algorithm>
#include<array>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<typeinfo>
#include<utility>
#include<vector>
*/
#define int long long int
#define double long double
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define rep(i, n) for (int(i) = 0, i##_len = (n); (i) < i##_len; (i)++)
#define reps(i, x) for (int(i) = 1; (i) <= (int)(x); (i)++)
#define rrep(i, x) for (int(i) = ((int)(x)-1); (i) >= 0; (i)--)
#define rreps(i, x) for (int(i) = ((int)(x)); (i) > 0; (i)--)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define pb push_back
#define mp make_pair
#define bit(n) ((int)(1) << (n))
#define all(x) (x).begin(), (x).end()
#define debug(x) std::cout << #x << ": " << (x) << std::endl
#define nint int
using namespace std;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
typedef pair<int, int> pii;
typedef pair<double, double> dop;
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;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
struct aaa {
    aaa()
    {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
    };
} aaaaaaa;


signed main()
{
    int q, h, s, d;
    cin >> q >> h >> s >> d;
    int n;
    cin >> n;
    int one = min(q * 4, min(h * 2, s));
    int two = d;
    if (one * 2 <= two) {
        cout << one * n << endl;
    } else {
        cout << two * (n / 2) + one * (n % 2) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<string>
#include<cmath>
#include<stack>
#include <vector>
#include<queue>
#include <random>
using namespace std;


int main() {
	int c[3][3];
	bool flg = true;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> c[i][j];
		}
	}
	for (int i = 0; i < 3; i++) {
		if (c[0][i % 3] + c[1][(i + 1) % 3]+c[2][(i+2)%3] != c[1][i % 3] + c[2][(i + 1) % 3] + c[0][(i + 2) % 3]) {
			flg = false;
		}
	}
	if (flg) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
def main():
    # S = int(input())
    # S = input()
    N, K = list(map(int, input().split(' ')))
    
    dn = []
    An = []
    for _ in range(K):
        dn.append(int(input()))
        An.extend(list(map(int, input().split(' '))))
        
    an = set(An)
    
    print(N - len(an))
    
        
    
        
    
    
    
    



main()

Measured memory_bytes: 67604
#include <bits/stdc++.h>
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define pb push_back
#define ALL(s) s.begin(),s.end()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SZ(s) int(s.size())
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

vector<int> sum[1000100],d[1000100];
string s[1000100];

int query(int a, int b, int c, int d){
	int ans=sum[c][d];
	if(a) ans-=sum[a-1][d];
	if(b) ans-=sum[c][b-1];
	if(a&&b) ans+=sum[a-1][b-1];
	return ans;
}

set<int> row[1000100],col[1000100];

int main(){FIN;
	int n,m,k; cin>>n>>m>>k;
	int xs,ys,xe,ye; cin>>xs>>ys>>xe>>ye;
	xs--; ys--; xe--; ye--;
	int INF=1e9;
	fore(i,0,n) sum[i].assign(m,0),d[i].assign(m,INF);
	fore(i,0,n){
		cin>>s[i];
		fore(j,0,m) sum[i][j]=s[i][j]=='@';
	}
	fore(i,0,n) fore(j,0,m){
		if(i) sum[i][j]+=sum[i-1][j];
		if(j) sum[i][j]+=sum[i][j-1];
		if(i&&j) sum[i][j]-=sum[i-1][j-1];
		if(s[i][j]!='@') row[i].insert(j),col[j].insert(i);
	}
	
	
	queue<ii> q;
	d[xs][ys]=0; q.push({xs,ys});
	row[xs].erase(ys); col[ys].erase(xs);
	
	while(SZ(q)){
		int x=q.front().fst,y=q.front().snd; q.pop();
		//cout<<x+1<<" "<<y+1<<" with "<<d[x][y]<<"\n";
		if(x==xe&&y==ye)break;
		//en fila
		{
			//derecha
			auto it=row[x].lower_bound(y);
			vector<int> tor;
			while(it!=row[x].end()&&*it<=y+k){
				if(query(x,y,x,*it))break;
				tor.pb(*it);
				d[x][*it]=d[x][y]+1;
				q.push({x,*it});
				it++;
			}
			
			it=row[x].lower_bound(y);
			while(it!=row[x].begin()){
				--it;
				if(*it<y-k||query(x,*it,x,y))break;
				tor.pb(*it);
				d[x][*it]=d[x][y]+1;
				q.push({x,*it});
			}
			
			for(auto ss:tor) row[x].erase(ss),col[ss].erase(x);
		}
		
		//en columna
		{
			auto it=col[y].lower_bound(x);
			vector<int> tor;
			while(it!=col[y].end()&&*it<=x+k){
				if(query(x,y,*it,y))break;
				tor.pb(*it);
				d[*it][y]=d[x][y]+1;
				q.push({*it,y});
				it++;
			}
			
			it=col[y].lower_bound(x);
			while(it!=col[y].begin()){
				--it;
				if(*it<x-k||query(*it,y,x,y))break;
				tor.pb(*it);
				d[*it][y]=d[x][y]+1;
				q.push({*it,y});
			}
			
			for(auto ss:tor) col[y].erase(ss),row[ss].erase(y);
		}
	}
	if(d[xe][ye]==INF)cout<<"-1\n";
	else cout<<d[xe][ye]<<"\n";
}

Measured memory_bytes: 277092
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <complex>
#include <queue>
#include <cmath>
#define FILL(a, n, x) memset((a), (x), sizeof ((a)[0]) * (n))
#define COPY(a, n, b) memcpy((b), (a), sizeof ((a)[0]) * (n))
using namespace std;

typedef long long li;
const li infl = ~0LLU >> 2;
template <class T>
inline void Min(T &x, T y) {
  if (y < x) x = y;
}

// const int mod = 1e9 + 7;
// inline int Add(int x) { return x >= mod ? x - mod : x; }
// inline void Add(int &x, int y) { x += y; if (x >= mod) x -= mod; }
// inline int Sub(int x) { return x < 0 ? x + mod : x; }
// inline void Sub(int &x, int y) { x -= y; if (x < 0) x += mod; }
// inline int Mul(int x, int y) { return (int)((li)x * y % mod); }
// inline int Mul(int x, int y, int z) { return Mul(x, Mul(y, z)); }
// int Pow(int x, int y) {
//   int z = 1;
//   for (; y; y >>= 1) {
//     if (y & 1) z = Mul(z, x);
//     x = Mul(x, x);
//   }
//   return z;
// }
// int Inv(int x) {
//   return Pow(x, mod - 2);
// }

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

const int maxn = 1e5;

int n, m;
int A[maxn], B[maxn], ord[maxn], C[maxn];
int par[maxn];
li best[maxn];
li sum[maxn];
vector<int> g[maxn];
bool light[maxn];

int Find(int x) {
  while (x != par[x]) {
    par[x] = par[par[x]];
    x = par[x];
  }
  return x;
}

int main(void) {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", A + i, B + i);
    ord[i] = i;
    C[i] = max(0, A[i] - B[i]);
  }
  sort(ord, ord + n, [](int i, int j) {
      return C[i] < C[j];
    });
  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x; --y;
    g[x].push_back(y);
    g[y].push_back(x);
  }

  for (int i = 0; i < n; ++i) {
    light[i] = false;
    par[i] = i;
  }
  for (int i = 0; i < n; ++i) {
    int u = ord[i];
    vector<int> list;
    for (int v : g[u]) {
      if (light[v]) {
        list.push_back(Find(v));
      }
    }
    sort(list.begin(), list.end());
    list.erase(unique(list.begin(), list.end()), list.end());

    sum[u] = 0;
    for (int v : list) {
      sum[u] += sum[v];
    }
    best[u] = sum[u] + max(A[u], B[u]);
    li min_extra = infl;
    for (int v : list) {
      li extra = max<li>(A[u], B[u] + best[v]) - sum[v];
      Min(min_extra, extra);
    }
    Min(best[u], min_extra + sum[u]);

    sum[u] += B[u];

    for (int v : list) {
      par[v] = u;
    }

    light[u] = true;
  }

  printf("%lld\n", best[Find(0)]);
  return 0;
}


Measured memory_bytes: 9852
process.stdin.resume();
var body = '';
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function (chunk) {
    body += chunk;
});

process.stdin.on('end', function () {
    var data = body.split('\n');
    var output = [];
    for(var i = 0; i < data.length; i++) {
        if(0 != data[i]) {
            output.push('Case ' + (i + 1) + ': ' + data[i]);
        }
    }
    console.log(output.join('\n'));
});

Measured memory_bytes: 19484
#include<iostream>
#include<stdio.h>

using namespace std;

int main(){

  int a=0, b=0;
  char in;
  int i = 0;

  while(scanf("%c",&in)){
    if(in == '0') break;
    if(i == 0){
      scanf("%c",&in);
      i++;
    }
    if(in == 'A') a++;
    if(in == 'B') b++;
    if(in == '\n'){
      i = 0;
      if(a > b) a++;
      else b++;
      cout << a << " " << b << endl;
      a = 0;
      b = 0;
    }

  }
  return 0;

}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    string s;
    cin>>a>>b>>s;
    for(int i=0;i<=a+b;i++){
        if(i==a){
            if(s[i]!='-'){
                cout<<"No"<<endl;
                return 0;
            }
        }else{
            if(!(s[i]-'0'>=0&&s[i]-'9'<=0)){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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;
}

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int A, B;
  cin >> A >> B;

  repp(i, 1, 10000) {
    if ((int)(i * 0.08) == A && (int)(i * 0.1) == B) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << '\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <stdio.h>
using namespace std;

//typedefリスト
typedef vector<int> vint;
typedef vector<string> vstr;

int main(void) {
	int N, M,ans,K;
	ans = 0;
	cin >> N >> M;
	vint n(M + 1);
	for (int i = 0; i < M + 1; i++) {
		n[i] = 0;
	}

	for (int i = 0;i<N; i++) {
		cin >> K;
		vint num(K);
		for (int j = 0; j < K; j++) {
			cin >> num[j];
			for (int k = 1; k <= M; k++) {
				if (k == num[j])n[k]++;
			}
		}
		for (int i = 0; i <= M; i++) {
			if (n[i] == N)ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
S = input()
T = input()

max_count = 0
for i in range(max(1, len(S) - len(T))):
    count = 0
    for j in range(len(T)):
        if S[i+j] == T[j]:
            count += 1
    max_count = max(max_count, count)
    
print(len(T) - max_count)


Measured memory_bytes: 9064
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
long long dp[105][4][4][4],ans;
bool check(int a,int b,int c)
{
	if(a==1&&b==2&&c==3)
		return true;
	else
		return false;
}
int main(){
	int n,i,a,b,c,d;
	cin>>n;
	memset(dp,0,sizeof(dp));
	dp[0][0][0][0]=1;
	for(i=0;i<n;i++)
		for(a=0;a<4;a++)
			for(b=0;b<4;b++)
				for(c=0;c<4;c++)
					for(d=0;d<4;d++)
					{
						if(check(a,b,c)||check(a,c,d)||check(a,b,d)||check(b,c,d))
							continue;
						if(check(c,b,d)||check(b,d,c))
							continue;
						dp[i+1][b][c][d]+=dp[i][a][b][c];
						dp[i+1][b][c][d]%=MOD;
					}
	ans=0;
	for(a=0;a<4;a++)
		for(b=0;b<4;b++)
			for(c=0;c<4;c++)
				ans=(ans+dp[n][a][b][c])%MOD;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256