akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }

const int MAX = 2100000;
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;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int K;
    string S;
    cin >> K;
    cin >> S;

    COMinit();
    ll ans = 0;
    REP(i, S.size() - 1, S.size() + K) {
        ll t = COM(i, S.size() - 1);
        t *= modpow(25, i - (S.size() - 1), MOD);
        t %= MOD;
        t *= modpow(26, S.size() + K - i - 1, MOD);
        ans += t;
        ans %= MOD;
    }

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

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

int main(void){
  int n;
  cin >> n;
	
  int b[100];
  for (int i = 0; i < n-1; i++) {
    cin >> b[i];
  }
  
  long long ans = b[0];
  for (int i = 1; i < n-1; i++) {
    if (b[i] > b[i-1])
      ans += (long long) b[i-1];
    else
      ans += (long long) b[i];
  }
  ans += (long long) b[n-2];
  
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
    long long int t;
    t=1;
    //cin>>t;
    
    while(t--)
    {
        int n;
        cin>>n;
        int a,b,c;
        a=n%10;
        n=n/10;
        b=n%10;
        n=n/10;
        c=n%10;
        if(a==7||b==7||c==7) cout<<"Yes";
        else cout<<"No";
        
    }
}

Measured memory_bytes: 3608
#include <iostream>
    using namespace std;
     
    long long mod = 1000000007;
    long long N, H, D;
    long long dp[1 << 20], fact[1 << 20];
     
    int main() {
    	cin >> N >> H >> D;
    	fact[0] = 1; for (int i = 1; i <= N; i++) fact[i] = (1LL * i*fact[i - 1]) % mod;
    	long long s = 0; for (int i = 1; i <= N; i++) { s += fact[i]; s %= mod; }
     
    	dp[0] = 1; long long ret = dp[0];
    	for (int i = 1; i <= H; i++) {
    		if (i == H) dp[i] = (ret*fact[N]) % mod;
    		else dp[i] = (ret * s) % mod;
    		ret += dp[i]; ret %= mod;
    		if (i >= D) { ret -= dp[i - D]; ret += mod; ret %= mod; }
    	}
    	cout << dp[H] << endl;
    	return 0;
    }

Measured memory_bytes: 16640
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<string, int> P;

const double PI = 3.14159265358979323846;


int main(int argc, char *args[]) {
	int a, b, c;
	set<int> se;
	cin >> a >> b >> c;
	se.insert(a);
	se.insert(b);
	se.insert(c);
	if (se.size() == 1 || se.size()==3) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
}

Measured memory_bytes: 256
A=list(input())
B=list(input())
C=list(input())
al=len(A)
bl=len(B)
cl=len(C)
i=0
j=0
k=0
s=A[0]
while True:
    if s=='a':
        if i==al:
            print('A')
            exit()
        else:
            s=A[i]
            i+=1
    elif s=='b':
        if j==bl:
            print('B')
            exit()
        else:
            s=B[j]
            j+=1
    else:
        if k==cl:
            print('C')
            exit()
        else:
            s=C[k]
            k+=1

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>

using namespace std;

int main() {
  string s,t;
  cin >> s >> t;
  
  for(int i = 0; i < (s.size()+t.size()); i++) {
    if(i % 2 == 0) cout << s[i/2];
    else cout << t[(i-1)/2];
  }
  cout << endl;
}

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

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

int main(){
  ll N,X;
  cin>>N>>X;
  vector<ll> dis(N);
  ll tmp;
  for(ll i=0;i<N;i++){
    cin>>tmp;
    dis[i]=abs(tmp-X);
  }
  ll ans=dis[0];
  for(ll i=1;i<N;i++){
    ans=bcd(ans,dis[i]);
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 1024
#include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define N 55
#define M 2500
#define P 100
#define inf 0x3f3f3f3f
using namespace std;
struct Ahri
{
	int v,n;
}e[M];
int head[N],cnt;
inline void add(int u,int v)
{
	e[++cnt].v=v;
	e[cnt].n=head[u];
	head[u]=cnt;
}
bool f[P+5][N][N];
int dis[N],n,m,A,B,C;
int da[N],db[N],dc[N];
void getf() {
    for(int i = 1; i <= n; i++) f[0][i][i] = 1;

    for(int len = 0; len <= 101; len++) {
        for(int u = 1; u <= n; u++) {
            for(int v = 1; v <= n; v++) {
                if(f[len][u][v]) {
                    for(int p = head[v]; p; p = e[p].n) {
                        int w = e[p].v;
                        f[len + 1][u][w] = 1;
                    }
                }
            }
        }
    }

}
queue<int>q;
void bfs()
{
	while(!q.empty())q.pop();
	memset(dis,-1,sizeof dis);
	memset(da,0,sizeof da);
	memset(db,0,sizeof db);
	memset(dc,0,sizeof dc);
	
	int i,u;
	q.push(n),dis[n]=0;
	
	while(!q.empty())
	{
		u=q.front(),q.pop();

		for(i=1;i<=n;i++)if(dis[i]==-1)
		{
			if(!da[i]&&f[A][i][u])da[i]=dis[u]+1;
			if(!db[i]&&f[B][i][u])db[i]=dis[u]+1;
			if(!dc[i]&&f[C][i][u])dc[i]=dis[u]+1;
			if(da[i]&&db[i]&&dc[i])
				dis[i]=max(da[i],max(db[i],dc[i])),q.push(i);
		}
	}
}

int main()
{
//	freopen("test.in","r",stdin);
	int i,j,k;
	scanf("%d%d%d%d%d",&n,&m,&A,&B,&C);
	while(m--)
	{
		scanf("%d%d",&i,&j);
		add(i,j);
	}
	getf();
	bfs();
	if(dis[1]==-1)puts("IMPOSSIBLE");
	else printf("%d\n",dis[1]);
	
	return 0;
}

Measured memory_bytes: 1520
/*

Author: @karngyan
Team: BlundersPride

*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define pb push_back
#define INF 99999999999999999
vector<ll> a;

ll n;
ll cache[100010];
ll go(ll i)
{

	if(i == n-1)
	{
		return 0;
	}

    ll &ans = cache[i];
    if(ans != -1)
        return ans;
    
	if(i == n-2)
	{
		ans = abs(a[n-1] - a[n-2]);
		return ans;
	}
	ans = min(abs(a[i+1] - a[i]) + go(i+1) , abs(a[i+2] - a[i]) + go(i+2)  );
	return ans;
}

signed main()
{

	fast;
////////////////////////////////////////////////////////////////////////////////////////////
	memset(cache , -1, sizeof cache);
    
	cin >> n;
	a.resize(n);
	for(ll i = 0 ; i<n ; ++i)
	{
		cin >> a[i];
	}

	// cout<<0<<endl;
	cout<<go(0)<<endl;





	
	return 0;
}


Measured memory_bytes: 4224
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>

typedef std::tuple<long, long, char, long long, std::string> item;

int main() {
  int n;
  std::cin >> n;
  item items[n];
  for (int i = 0; i < n; ++i)
    std::cin >> std::get<0>(items[i]) >> std::get<1>(items[i]) >>
        std::get<2>(items[i]) >> std::get<3>(items[i]) >> std::get<4>(items[i]);

  std::sort(items, items + n);

  for (int i = 0; i < n; ++i) {
    std::cout << std::get<0>(items[i]) << " " << std::get<1>(items[i]) << " "
              << std::get<2>(items[i]) << " " << std::get<3>(items[i]) << " "
              << std::get<4>(items[i]) << std::endl;
  }
}



Measured memory_bytes: 13208
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define next Next
#define y1 _y1
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=1005;
int n,m;
int a,b;
int main(){
	n=read(),m=read();
	a=read(),b=read();
	swap(a,b);
	if (a*2>n||b*2>m)
		return puts("-1"),0;
	For(i,1,n){
		For(j,1,m)
			putchar('0'+((i<=a&&j<=b)||(i>a&&j>b)));
		puts("");
	}
	return 0;
}

Measured memory_bytes: 1280
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        Console.WriteLine(Solve());
        //Solve();
        return;
    }

    public static string Solve()
    {
        int[] input = ReadInts();
        int N = input[0], L = input[1];
        int ans = 0;
        if (L >= 0)
        {
            ans = N * L + N * (N - 1) / 2 - L;
        }
        else if (L + N - 1 >= 0)
        {
            ans = N * L + N * (N - 1)/2;
        }
        else
        {
            ans = N * L + N * (N - 1)/2 - (L + N - 1);
        }

        return ans.ToString();
    }

    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}


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

using namespace std;
typedef long long ll;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll a,v,b,w,t;
    cin >> a >> v >> b >> w >> t;
    if(v*t-w*t>=abs(a-b)) cout << "YES\n";
    else cout << "NO\n";
    return 0;
}


Measured memory_bytes: 3664
s = input()
f = int(s[:2])
b = int(s[2:4])
jdg = str(int(0 < f and f <= 12)) + str(int(0 < b and b <= 12))
if jdg == '11':
    print('AMBIGUOUS')
elif jdg == '10':
    print('MMYY')
elif jdg == '01':
    print('YYMM')
else:
    print('NA')

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

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

CanYay = True
ant = [a,b,c,d,e]
for i in range(len(ant)):
    for j in range(i+1, len(ant)):
        if ant[i] == ant[j]:
            continue
        else:
            if abs(ant[i] - ant[j]) > k:
                CanYay = False
            else:
                continue
if CanYay:
    print("Yay!")
else:
    print(":(")


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

int main() {
    std::cout<<std::fixed<<std::setprecision(10);
    
    int N; cin >> N;
    vector<int> d(N);
    rep(i, N) cin >> d[i];

    int ans = 0;
    rep(i, N) {
        for (int j=i+1; j<N; ++j) {
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()





int main(){
  string S;

  cin >> S;

  rep(i, 0, 2){
    if(S[i] != S[i+1]){
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";

}

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

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

#define F first
#define S second

int H,W;
char A[505][505];

int main(){

    cin >> H >> W;
    for(int i=0;i<H;i++) cin >> A[i];

    for(int i=0;i<H;i++)
    {
        A[i][0]='R';
        A[i][W-1]='A';
    }
    for(int i=0;i<H;i++)
    {
        for(int j=1;j<W-1;j++)
        {
            if(A[i][j]!='#')
            {
                if(i%2) A[i][j]='A';
                else A[i][j]='R';
            }
        }
    }

    ///Imprimir
    for(int i=0;i<H;i++) {
        for(int j=0;j<W;j++) {
            if(A[i][j]=='R'||A[i][j]=='#') cout << "#";
            else cout << ".";
        }
        cout << endl;
    }
    cout << endl;
    for(int i=0;i<H;i++) {
        for(int j=0;j<W;j++) {
            if(A[i][j]=='A'||A[i][j]=='#') cout << "#";
            else cout << ".";
        }
        cout << endl;
    }
    /*
    for(int i=0;i<H;i++)
    {
        for(int j=0;j<W;j++)
        {
            cout << A[i][j];
        }
        cout << endl;
    }*/

    return 0;
}


Measured memory_bytes: 1024
using System;
using System.Linq;

namespace B___Hina_Arare
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var Si = Console.ReadLine().Split().ToArray();

            Console.WriteLine(Si.Any(x => x == "Y") ? "Four" : "Three");
        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using vl = vector<long long>;
using P = pair<long long,long long>;

int main(){
	string s; cin >> s;
	string ans = s[0] == s[1] || s[1] == s[2] || s[2] == s[3] ? "Bad" : "Good";
	cout << ans << endl;
} 


Measured memory_bytes: 256
n, m, l = map(int, input().split())

matrixA = []
matrixB = []
matrixC = [[0 for i in range(l)] for j in range(n)]

for a in range(n):
    matrixA.append(list(map(int, input().split())))

for b in range(m):
    matrixB.append(list(map(int, input().split())))

for index_a in range(len(matrixA)):
    for index_b in range(len(matrixB[0])):
        for index_c in range(len(matrixB)):
            matrixC[index_a][index_b] += matrixA[index_a][index_c] * matrixB[index_c][index_b]

for i in matrixC:
    print(*i, sep=" ")


Measured memory_bytes: 7068
import heapq
n, m = map(int,input().split())
a = list(map(int,input().split()))
assert len(a) == n

hp = []
for x in a:
    item = (-x, x, 0)
    heapq.heappush(hp, item)

for i in range(m):
    (neg_cost, full_price, n) = heapq.heappop(hp)
    new_cost = full_price // (2 ** (n+1))
    item = (-new_cost, full_price, n+1)
    heapq.heappush(hp, item)

print(sum([-c for (c, _, _) in hp]))

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

int main(){
	int i,j,k,n,m,l,f,x,y,z; string s;
	cin >> s;
	n = s.size();
	f = 0;
	rep(i, n){
		for(j=0; j<i;j++){
			if(s[i] == s[j]){
				f = 1;
				break;
			}
		}
	}
	if(f==1) cout << "no" << endl;
	else cout << "yes" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;

int main(){
  while(1){
    int h,w;
    cin>>w>>h;
    if(h==0&&w==0) break;
    char a[h][w];
    queue<pair<int,int>> q;
    bool used[h][w];
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        cin>>a[i][j];
        used[i][j]=0;
        if(a[i][j]=='@') q.push(make_pair(i,j));
      }
    }
    int ans=0;
    while(!q.empty()){
      pair<int,int> p=q.front();
      q.pop();
      int x=p.first, y=p.second;
      if(used[x][y]) continue;
      used[x][y]=1;
      ans++;
      if(x>0){
        if(!used[x-1][y]&&a[x-1][y]=='.'){
          q.push(make_pair(x-1,y));
        }
      }
      if(x<h-1){
        if(!used[x+1][y]&&a[x+1][y]=='.'){
          q.push(make_pair(x+1,y));
        }
      }
      if(y>0){
        if(!used[x][y-1]&&a[x][y-1]=='.'){
          q.push(make_pair(x,y-1));
        }
      }
      if(y<w-1){
        if(!used[x][y+1]&&a[x][y+1]=='.'){
          q.push(make_pair(x,y+1));
        }
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 3180
n = int(input())
wl = []

for i in range(n):
    w = input()
    wl.append(w)

ans = 0

for i in range(n):
    if wl.count(wl[i]) > 1:
        ans += 1
    else:
        ans+=0

for i in range(n-1):
    a = list(wl[i])
    b = list(wl[i+1])
    if a[-1] == b[0]:
        ans += 0
    else:
        ans += 1

if ans == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,x,t;
    cin>>n>>x>>t;
    cout<<(n+x-1)/x*t<<endl;
    return 0;
}


Measured memory_bytes: 3632
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
#define mp make_pair
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;

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

	vector<int> b(N+1);

	for (int i = N; i >= 1; i--) {
		int sum = 0;
		for (int j = i+i; j <= N; j += i) {
			sum ^= b[j];
		}
		b[i] = sum^a[i];
	}

	vector<int> ans;
	for (int i = 1; i <= N; i++) if (b[i]) ans.push_back(i);

	cout << ans.size() << endl;
	for (int i = 0; i < (int)ans.size(); i++) {
		cout << ans[i];
		if (i+1 == (int)ans.size()) cout << endl;
		else cout << " ";
	}
    return 0;
}


Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

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

int main()
{
	string s, t;
	cin >> s >> t;
	for (int j = 0; j < s.length(); j++) {
		s = s.back() + s.substr(0, s.length() - 1);
		if (s == t) {
			break;
		}
	}
	if (s == t) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int l=a+b;
	int r=c+d;
	if(l>r)
	cout<<"Left";
	else if(l<r)
	cout<<"Right";
	else
	cout<<"Balanced";
	return 0;
} 

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

using namespace std;

int main() {
  int L;
  cin>>L;
  double a = (double)L*L*L/27;

  cout<<setprecision(16)<<a<<endl;
}


Measured memory_bytes: 256
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let nums: Vec<i32> = s.trim()
        .split_whitespace()
        .map(|e| e.parse().unwrap()).collect();
    let (a, b): (i32, i32) = (nums[0], nums[1]);

    if a > b {
        println!("a > b");
    } else if a < b {
        println!("a < b");
    } else {
        println!("a == b");
    }
}



Measured memory_bytes: 5024
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
// #include <bits/stdc++.h>

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

struct ant {
  char d;
  int p;
};

int main() {
  int n, l;
  while(cin >> n >> l, n | l) {
    vector<ant> ants(n);
    REP(i, n){
      cin >> ants[i].d >> ants[i].p;
      ants[i].d = ants[i].d == 'L' ? -1 : 1;
    }

    int field[l + 1];
    for(int t = 1;; t++) {
      fill_n((int *)field, l + 1, -1);
      int last = -1;
      bool update = false;

      REP(i, n){
        if(ants[i].p <=0 || ants[i].p >= l) continue;
        ants[i].p += ants[i].d;
        if(ants[i].p <=0 || ants[i].p >= l) {
          // LOG("out : %d at %d --- %d\n", i + 1, t, ants[i].p);
          if(last == -1 || ants[last].p != 0) {
            last = i;
          }
          continue;
        }
        update = true;
        int p = ants[i].p;
        if (field[p] == -1) {
          field[p] = i;
        }else{
          ants[field[p]].d *= -1;
          ants[i].d *= -1;
        }
      }
      if(!update) {
        printf("%d %d\n", t, last + 1);
        break;
      }
    }
  }
}

Measured memory_bytes: 3012
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Security.Cryptography;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);
        var k = int.Parse(spl[1]);

        int y = 1;
        for(int i=0; i<n; i++) {
            if(i == 0) y*=k;
            else y*=k-1;
        }

        return y;
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}

Measured memory_bytes: 11092
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define io ios_base::sync_with_stdio(false); cin.tie(0);

#define fs first
#define sc second
#define mp make_pair
#define mt make_tuple
#define pb push_back

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : (x))
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef pair<int, int> pii;
typedef vector<int> vi;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef long double ld;

const ll LINF = 1e18;
const int INF = 1e9;
const ld EPS = 1e-9;
const int MOD = 1e9+7;

/// Scanf para ler char array separados por espacos -> scanf(" %[^\n]", texto);
 
////////////////////////// Solution starts below. //////////////////////////////

int main(){

    int a, five = 0, seven = 0;
	rep(i, 0, 3){
		scanf("%d", &a);
		if(a == 5) five++;
		else if(a == 7) seven++;
	}

	if(seven == 1 and five == 2) puts("YES");
	else puts("NO");
	
	return 0;
}

Measured memory_bytes: 256
A, B = map(int, input().split())
S = input()
for i in range(A+B+1):
    if S[A] == '-':
        if S[:A].isdecimal() == True and S[A+1:].isdecimal() == True:
            print('Yes')
            break
        else:
            print('No')
            break
else:
    print('No')

Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);i++)
#define urep(i,a,n) for(ll i = (a);i>=(n);i--)
#define all(x) (x).begin(),(x).end()
#define INF 1e9
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N, M, Q, H, W, D, L, R,K;
ll A;
ll B[200001];
ll ans=INF;
string S;
char s[52][52];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
ll x[100000];
vector<ll> posi;
vector<ll> tmp;
vector<ll> nega;
int main() {
	cin >> N >> K;
	posi.push_back(0);
	nega.push_back(0);
	rep(i, 0, N) {
		cin >> x[i];
		if (x[i] >= 0)
			posi.push_back(x[i]);
		else
			tmp.push_back(x[i]);
	}
	if (!tmp.empty()){
		urep(i, tmp.size() - 1, 0) {
			nega.push_back(-1 * tmp[i]);
		}
	}
	if (K < nega.size())
		ans = nega[K];
	if (K < posi.size())
		ans = min(ans,posi[K]);
	rep(i, 0, K) {
		if (i < posi.size() && K - i < nega.size())
			ans = min(ans, posi[i] * 2 + nega[K - i]);
		if (K - i < posi.size() && i < nega.size())
			ans = min(ans, nega[i] * 2 + posi[K - i]);
	}
	cout << ans << endl;
	cin >> N;
	return 0;
}

Measured memory_bytes: 3316
x,y = map(int,input().split())
res = 0
if x == 1:
  res += 300000
elif x == 2:
  res += 200000
elif x == 3:
  res += 100000
if y == 1:
  res += 300000
elif y == 2:
  res += 200000
elif y == 3:
  res += 100000
if x==1 and y==1:
  res += 400000
print(res)

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

string str;

int solve()
{
	int R = 0; 
	int B = 0;
	for(int i = 0; i < str.length(); i++)
	{
		if(str[i] == '0') R++; else B++;
	}
	return 2 * min(R, B);
}

int main()
{
	cin >> str;
	printf("%d\n", solve());
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
long long n,a[105];
int main()
{
	cin>>n;
	a[0]=2;
	a[1]=1;
	for(int i=2;i<=n;i++)
	{
		a[i]=a[i-1]+a[i-2];
	}
	cout<<a[n];

	return 0;
}

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


signed main(){
  while(1){
    int p,q;
    cin>>p>>q;
    if(p==0&&q==0) break;
    vector<vector<int> > lis;
    int rc=0,cc=0,sc=0;
    lp(i,p){
      string s;
      cin>>s;
      int countdot=0;
      if(i!=0){
	lp(i,s.size()){
	  if(s[i]=='.') countdot++;
	  else break;
	}
	vector<int> hoge={rc,cc,sc,countdot};
	lis.push_back(hoge);
      }
      lp(i,s.size()){
	if(s[i]=='(') rc++;
	if(s[i]==')') rc--;
	if(s[i]=='{') cc++;
	if(s[i]=='}') cc--;
	if(s[i]=='[') sc++;
	if(s[i]==']') sc--;
      }
    }
    vector<vector<int> > can;
    lp(i,21){
      if(i==0) continue;
      lp(j,21){
	if(j==0) continue;
	lp(k,21){
	  if(k==0) continue;
	  int stat=0;
	  lp(l,lis.size()){
	    if(i*lis[l][0]+j*lis[l][1]+k*lis[l][2]==lis[l][3]) 1;
	    else {
	      stat=1;
	      break;
	    }
	  }
	  if(stat==0){
	    vector<int> hoge={i,j,k};
	    can.push_back(hoge);
	  }
	}
      }
    }
    int r=-1,c=-1,ss=-1;
    lp(i,can.size()){
      if(i==0){
	r=can[i][0];
	c=can[i][1];
	ss=can[i][2];
      }
      else{
	if(r!=can[i][0]) r=-1;
	if(c!=can[i][1]) c=-1;
	if(ss!=can[i][2]) ss=-1;
      }
    }
    rc=0;cc=0;sc=0;

    
    lp(i,q){
      string s;
      cin>>s;
      int ans=0;
      if(rc==0&&cc==0&&sc==0) cout<<0;
      else {
	int stat=0;
	lp(j,lis.size()){
	  if(rc==lis[j][0]&&cc==lis[j][1]&&sc==lis[j][2]){
	    cout<<lis[j][3];
	    stat=1;
	    break;
	  }
	}
	if(stat==0){
	  if(rc!=0&&r==-1) ans=-1;
	  else if(cc!=0&&c==-1) ans=-1;
	  else if(sc!=0&&ss==-1) ans=-1;
	  else ans=rc*r+cc*c+sc*ss;
	  cout<<ans;
	}
      }
      if(i!=q-1) cout<<" ";
      lp(i,s.size()){
	if(s[i]=='(') rc++;
	if(s[i]==')') rc--;
	if(s[i]=='{') cc++;
	if(s[i]=='}') cc--;
	if(s[i]=='[') sc++;
	if(s[i]==']') sc--;
      }
    }
    cout<<endl;
  }

  return 0;
}




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

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

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;

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

    int n;
    cin >> n;

    int ans = 100100100;
    rep(i, n){
        int a;
        cin >> a;

        int cnt = 0;
        while(a % 2 == 0){
            a /= 2;
            cnt++;
        }

        ans = min(ans, cnt);
    }

    cout << ans << endl;


    return 0;
}



Measured memory_bytes: 256
// Last Change: 06/14/2019 00:06:06.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

void Solve(int n) {
  vector<string> data(n);
  vector<int> dotCnt(n, 0);
  string ipt;
  size_t depth = 0;
  for (int i = 0; i < n; ++i) {
    cin >> ipt;
    for (size_t j = 0; j < ipt.size(); ++j) {
      if (ipt[j] != '.') {
        dotCnt[i] = j;
        data[i] = ipt.substr(j);
        depth = max(depth, j);
        break;
      }
    }
  }

  vector<string> ans(n);
  vector<int> bar(depth + 1, 0);
  for (int i = n - 1; i >= 0; --i) {
    string ansStr;
    bar[dotCnt[i]] = 0;
    for (int j = 0; j < dotCnt[i] - 1; ++j) {
      if (bar[j] == 1) {
        ansStr += '|';
      } else {
        ansStr += ' ';
      }
    }
    if (dotCnt[i] > 0) {
      ansStr += '+';
    }
    ansStr += data[i];
    ans[i] = ansStr;
    if (dotCnt[i] > 0) {
      bar[dotCnt[i] - 1] = 1;
    }
  }

  for (auto &&e : ans) {
    cout << e << endl;
  }
}

int main() {
  ll n;
  while (cin >> n and n > 0) {
    Solve(n);
  }
  // NS::LoopUntilZeroInpput();
}



Measured memory_bytes: 3928
/*

                              Jai Shree Krishna !!
                                 Radhe Radhe !!
                                 
             उद्यमेन हि सिद्ध्यन्ति कार्याणि न मनोरथैः। नहि सुप्तस्य सिंहस्य मुखे प्रविशन्ति मृगाः।।
             
*/
   
   
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
typedef long long ll;
#define loop(i,n)  for(int i=0;i<n;i++)
#define read(a) int a; cin >>a;
#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin >> a[i][j];
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pi pair<int,int>
#define vvi vector<vector<int>>
#define sti set<int>
#define vpi vector<pair<int,int>>
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define printmat(a,n,m) for(int i=0;i<n;i++) {for(int j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define endl "\n"
#define mp make_pair
#define ins insert
#define rep(i,s,e)   for(int i=s;i<=e;i++)
#define repd(i,s,e)  for(int i=e;i>=s;i--)
#define vb vector<bool>
#define read2(n,m) int n,m; cin >> n >> m;
#define range(v) v.begin(),v.end()
#define sortd(v) sort(v.begin(),v.end(),greater<int>())
#define sorti(v) sort(v.begin(),v.end())

const ll inf = 1e18;
const ll mod = 1e9 + 7;
 
signed main()
{
 
    fast;
    read2(h1,m1);
    read2(h2,m2);
    read(k);
    int t = (h2-h1)*60;
    t+=(m2-m1);
    cout<<t-k<<endl;
    return 0;
}

/* Pooja Yadav */

Measured memory_bytes: 3648
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <unordered_map>
#include <bitset>

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;

const ll nmax=2*100000+1;

//ll par[nmax];
//ll rank[nmax];


int main()
{
    map<ll, ll> mp;
    ll n,a,k;
    cin>>n;
    for(ll i=0;i<n;i++){
        cin>>a;
        mp[a]=1;
    }
  	k=0;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr)k++;
    if(k%2==1)cout<<k<<endl;
    else cout<<k-1<<endl;
    return 0;
}



Measured memory_bytes: 6528
#include <iostream>
    #include <bits/stdc++.h>
    #define int long long
    using namespace std;
    vector<vector<int> > data;
    bool can;
    void dfs(int vertex, int last, int A, int B){
        for (int i=0; i < data[vertex].size(); i++){
            int to = data[vertex][i];
            if (to==last) continue;
            if (to==A) continue;
            if (to == B){
                can=true;
                continue;
            }
            dfs(to, vertex, A, B);
        }
    }
    main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        int n, m;
        cin >> n >> m;
        vector<int> deg(n);
        fill(deg.begin(), deg.end(), 0);
        data.resize(n, {});
        for (int i=0;i<m;i++){
            int u, v;
            cin >> u >> v;
            deg[u-1]++, deg[v-1]++;
            data[u-1].push_back(v-1);
            data[v-1].push_back(u-1);
        }
        for (int i=0;i<n;i++){
            if (deg[i] % 2 != 0){
                cout << "No";
                return 0;
            }
        }
        int sum = 0, T=0;
        int A=-1, B=-1;
        for (int i=0;i<n;i++){
            sum += (deg[i]-2);
            if (deg[i] == 4){
                if (A==-1) A = i;
                else B = i;
            }
            T += (deg[i] > 4);
        }
        if (sum > 4){
            cout << "Yes";
            return 0;
        }
        if (sum < 4){
            cout << "No";
            return 0;
        }
        if (T>0) cout << "Yes";
        else{
            for (int e=0;e<2;e++){
                for (int j=0; j < data[A].size(); j++){
                    int to = data[A][j];
                    if (to == B) continue;
                    can = false;
                    dfs(to, -1, A, B);
                    if (!can){
                        cout << "Yes";
                        return 0;
                    }
                }
            }
            cout << "No";
        }
    }


Measured memory_bytes: 8064
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    ll sum = 0;
    rep(i, 0, n) {
        cin >> a[i];
        sum += a[i];
    }
    ll ans = 0;
    ll tmp = 0;
    if(sum%(4*m) == 0) {
        tmp = sum/(4*m);
    }
    else {
        tmp = sum/(4*m)+1;
    }
    rep(i, 0, n) {
        if(a[i] < tmp) {
            
        }
        else {
            ans++;
        }
    }
    if(ans >= m) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

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

int x,y;
int ans;

int main()
{
	scanf("%d%d",&x,&y);
	int a=abs(x),b=abs(y);
	if(a>=b)
	{
		if(x<0&&y>0)ans+=a-b+1;
		else if(x<0&&y<=0)ans+=a-b;
		else if(x>=0&&y<=0)ans+=a-b+1;
		else if(x>=0&&y>0)ans+=a-b+2;
	}
	else
	{
		if(x<0&&y>=0)ans+=b-a+1;
		else if(x<0&&y<0)ans+=b-a+2;
		else if(x>=0&&y<0)ans+=b-a+1;
		else if(x>=0&&y>=0)ans+=b-a;
	}
	printf("%d",ans);
	return 0;
}

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

int main(){
    int n,m; cin >> n >> m;
    int c[m+5];
    for(int i = 1; i <= m; i++){
        cin >> c[i];
    }

    int table[50005];
    for(int i = 0; i <= n; i++) table[i] = i;

    for(int i = 2; i <= m; i++){
        if(c[i] <= n){
            for(int j = c[i]; j <= n; j++){
                table[j] = min(table[j], table[j-c[i]]+1);
            }
        }
    }
    cout << table[n] << endl;

    return 0;
}


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

const int N=10;
int n;
long long m,a[N],dp[N];

int main()
{
	n=5;int i;scanf("%lld",&m);
	for(i=1;i<=5;++i) scanf("%lld",&a[i]);
	for(i=2;i<=5;++i) a[i]=min(a[i],a[i-1]);
	for(i=1;i<=5;++i)
	{
		dp[i]=m/a[i];
		if(m%a[i]) ++dp[i];
	}
	printf("%lld\n",dp[n]+4);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
   
 using namespace std;
   
 #define MP make_pair
 #define PB push_back
 typedef long long LL;
 typedef pair<int,int> PII;
 const double eps=1e-8;
 const double pi=acos(-1.0);
 const int K=1e6+7;
 const int mod=1e9+7;
  
 int r,c,n,x,y,ans[200][200];
  
 int main(void)
 {
     scanf("%d%d%d",&r,&c,&n);
     x=1,y=1;
     for(int i=1,cnt;i<=n;i++)
     {
         scanf("%d",&cnt);
         while(cnt--)
         {
             ans[x][y]=i;
             if(y==c&&x%2==1)
                 y=c,x++;
             else if(y==1&&x%2==0)
                 y=1,x++;
             else if(x&1)
                 y++;
             else
                 y--;
         }
     }
     for(int i=1;i<=r;i++)
     for(int j=1;j<=c;j++)
         printf("%d%c",ans[i][j],j==c?'\n':' ');
     return 0;
 }

Measured memory_bytes: 384
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;
typedef long long LL;
const int N = 1e5 + 5;
const int mod = 39999931;

int n, m;
struct edge {
    int to; LL len;
    edge(int y, LL l) : to(y), len(l) { }
};
vector<edge> G[N];

LL fastpow(LL a, LL b, LL c) {
    LL r = 1;
    for (; b; b >>= 1, (a *= a) %= c)
        if (b & 1) (r *= a) %= c;
    return r;
}
LL inverse(LL a) {
    return fastpow(a, mod - 2, mod);
}

bool book[N];
LL val[N];
void solve(int x, int f) {
    book[x] = true;
    for (auto e : G[x]) {
        int y = e.to; LL l = e.len;
        if (y == f) continue;

        if (book[y]) {
            if (val[y] != val[x] * l % mod) {
                cout << "No" << endl;
                exit(0);
            }
        } else {
            val[y] = val[x] * l % mod;
            solve(y, x);
        }
    }    
}

signed main() {
    cin >> n >> m;
    for (int i = 1; i <= m; i++) {
        int u, v; LL w;
        cin >> u >> v >> w;
        G[u].push_back(edge{v, w});
        G[v].push_back(edge{u, inverse(w)});
    }
    
    for (int i = 1; i <= n; i++)
        if (!book[i]) val[i] = 1, solve(i, 0);

    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 17816
N = int(input())
A = list(map(int,input().split()))
M = max(A)
X = [1]*(M+1)
for a in A:
  X[a]-=1
  for i in range(a*2,M+1,a):
    X[i]=-2 

ans = 0
for a in A:
  if X[a]>=0:
    ans+=1
print(ans)



Measured memory_bytes: 132740
N, M = map(int, input().split())
erase = set()
for i in range(N):
    a = list(map(int, input().split())) 
    
    if i == 0:
        food = a[1:]
    for j in range(len(food)): 
        
        if food[j] not in a[1:]:
            erase.add(j)

print(len(food)-len(erase))      

Measured memory_bytes: 3060
#include <cstdio>
#include <cctype>
 
int main(){
    char ch;
     
    while(1){
        scanf("%c", &ch);
         
        if(islower(ch)) printf("%c", toupper(ch));
        else if(isupper(ch)) printf("%c", tolower(ch));
        else printf("%c", ch);
         
        if(ch=='\n') break;
    }
 
    return 0;
}


Measured memory_bytes: 2564
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
typedef pair<int,int> P;
#define mod 1000000007

int main(){
    int a,b,k;
    cin>>a>>b>>k;
    for(int i=a;i<=min(a+k-1,b);i++) cout << i <<endl;
    for(int i=max(a+k,b-k+1);i<=b;i++) cout << i <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
typedef long long i64;
int main(){
    int r,g,b;
    cin >> r >> g >> b;
    cout << ((g*10+b)%4==0 ? "YES":"NO") << endl;
    return 0;
}


Measured memory_bytes: 256
K = 96
N, S = map(int, input().split())
A = [int(a) for a in input().split()]
P = 998244353
pa = (1 << 64) - ((1 << 64) % P)
m = int(("1" * 32 + "0" * 64) * 3030, 2)
modP = lambda x: x - ((x & m) >> 64) * pa
s = 1 << K * S
for a in A:
    s = 2 * s + (s >> K * a)
    s = modP(s)
print((s & ((1 << K) - 1)) % P)

Measured memory_bytes: 9640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
using namespace std;
typedef pair<int,int> P;//Pでpair<-,->を表す。
typedef long long LL; 
LL MOD=1000000007;

int Ctoi(char c){
    return c-'0';
}

int main()
{ 
    int n,p;
    cin>>n>>p;
    string s;
    cin>>s;
    LL dp[p];
    for(int i=0;i<p;i++){dp[i]=0;}
    LL ans=0;
    if(p==2||p==5){
        int k=1;
        for(int i=0;i<n;i++){
            int x=Ctoi(s[i]);
            if(x%p==0){ans=ans+k;}
            k++;
        }
    }
    else{
        int inv=0;
        for(int i=1;i<p;i++){
            if((10*i)%p==1){inv=i;}
        }
        int y[n];
        int cinv=1;
        for(int i=0;i<n;i++){
            int x=Ctoi(s[i])%p;
            y[i]=(x*cinv)%p;
            cinv=(cinv*inv)%p;
        }
        /*for(int i=0;i<n;i++){
            cout<<y[i]<<endl;
        }*/
        int slide=0;
        for(int i=0;i<n;i++){
            //一桁の解
            if(y[i]==0){ans++;}
            //二桁以上
            int k=(2*p-y[i]-slide)%p;
            ans=ans+dp[k];
            //次への調整
            dp[(p-slide)%p]++;
            slide=(slide+y[i])%p;
            /*for(int i=0;i<p;i++){
                cout<<dp[i]<<' ';
            }
            cout<<endl<<ans<<endl;*/
        }

    }

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

Measured memory_bytes: 1412
#include <stdio.h>

int main()
{
	int s;
	scanf("%d", &s);
	
	int i, j, a[10001];
	a[1] = s;
	for (i = 1; i < 10000; i++) {
		if (a[i] % 2 == 0) a[i+1] = a[i] / 2;
		else a[i+1] = a[i] * 3 + 1;
		for (j = i; j >= 1; j--) {
			if (a[j] == a[i+1]) break;
		}
		if (j >= 1) break;
	}

	printf("%d\n", i + 1);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
   map<ll,int> m1;
   map<ll,int> m2;
   ll a,b;
   cin >> a >> b;
   for (ll i=2;i*i <= a;i++){
     while (a%i == 0){
       m1[i]++;
       a/=i;
     }
   }
   if (a != 1) m1[a]++;

   for (ll i=2;i*i <= b;i++){
     while (b%i == 0){
       m2[i]++;
       b/=i;
     }
   }
   if (b != 1) m2[b]++;
  ll ans=1;
  for (auto q:m1){
    //printf("factor = %lld\n",q.first);
    if (m2.count(q.first)) ans++;
  }
  //for (auto w:m2){
    //cout << w.first << " " << w.second << endl;
  //}
  cout << ans << endl;
  
  return 0;
}



Measured memory_bytes: 256
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long k = sc.nextLong();
		if(n>k&&k!=1) {
			long mod = n%k;
			long ans = Math.min(mod, Math.abs(k-mod));
			System.out.println(ans);
		}
		else if(n<k&&k!=1) {
			System.out.println(Math.min(n,k-n));
		}
		else {
			System.out.println(0);
		}
		
	}
}

Measured memory_bytes: 21844
n, k = list(map(int, input().split() ))
nums = list(map(int, input().split() ))

summ = sum(nums)
divisors = []

for d in range(1, summ):
	if d * d > summ:
		break
	if summ % d == 0: #約数
		divisors.append(d)
		divisors.append(int(summ // d))

divisors.sort(reverse = True)

# print(divisors)

for d in divisors:

	residues = [0] * n
	for i in range(n):
		residues[i] = nums[i] % d

	residues.sort(reverse = True)

	init_sum = sum(residues)
	num_reverse = init_sum // d

#	times_operation = 0
#	for i in range(num_reverse):
#		times_operation -= num_reverse
	times_operation = d * num_reverse - sum(residues[0:num_reverse])

# 	print(d, residues, num_reverse,  times_operation)

	if times_operation <= k:
		print(d)
		exit()


Measured memory_bytes: 3064
N=int(input())
L=list(map(int,input().split()))
L.sort()
count=0
for i in range(N):
    for j in range(N):
        for k in range(N):
            x,y,z=L[i],L[j],L[k]
            if x < y and y < z and x + y > z:
                count+=1
print(count)

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

int main() {
	int n,m;cin>>n>>m;
	long long x[n],y[n],z[n];
	for(int i=0;i<n;i++){
		cin>>x[i]>>y[i]>>z[i];
	}
	long long ans=0;
	vector<vector<long long>> sum(8);
	for(int j=0;j<8;j++){
//		cout<<j<<' ';
		for(int i=0;i<n;i++){
			sum[j].push_back((1-2*(j/4))*x[i]+(1-2*((j/2)%2))*y[i]+(1-2*(j%2))*z[i]);
//			cout<<sum[j][i]<<' ';
		}
		sort(sum[j].begin(),sum[j].end());
		long long temp=0;
		for(int i=0;i<m;i++){
			temp+=sum[j][n-1-i];
//			cout<<temp<<' ';
		}

		if(temp>ans)ans=temp;
//		cout<<endl;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 384
def combi_2(n):
    if n < 2:
        return 0
    return n * (n-1) // (2 * 1)

def combi_3(n):
    if n < 3:
        return 0
    return n * (n-1) * (n-2) // (3 * 2 * 1)


def main():

    n = int(input())
    s = input()
    #条件1
    numR = s.count("R")
    numG = s.count("G")
    numB = s.count("B")
    total = combi_3(len(s))

    red_pair = combi_2(numR) * numB + combi_2(numR) * numG
    gre_pair = combi_2(numG) * numR + combi_2(numG) * numB
    blu_pair = combi_2(numB) * numR + combi_2(numB) * numG
    three_red = combi_3(numR)
    three_gre = combi_3(numG)
    three_blu = combi_3(numB)


    first_error = red_pair + gre_pair + blu_pair + three_red + three_gre + three_blu


    #条件２をカウント　ただし、条件１に当てはまるものは除外
    second_error = 0
    for i in range(1,n+1-2):
        for j in range(i+1,n+1-1):
            k = j + (j-i)
            if k > n:
                continue
            #print(i-1,j-1,k-1)
            if s[i-1] == s[j-1] or s[i-1] == s[k-1] or s[j-1] == s[k-1]:
                continue
            second_error += 1
            #print(i,j,k)
    #print("total:",total)
    #print("first_error:",first_error)
    #print("second_error:",second_error)

    print(total - first_error - second_error)











if __name__ == '__main__':
    pass
    main()


Measured memory_bytes: 9284