akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;
void produce(int N, int X, vector<vector<int>>& arrays, vector<int> list = vector<int>()){
    if(N == 0){
        arrays.push_back(list);
    }else {
        for(int i = 0; i <= X; i++){
            vector<int> next = list;
            next.push_back(i);
            produce(N - 1, X, arrays, next);
        }
    }
}

bool satisfy(vector<int>& L, vector<int>& R, vector<int>& S, vector<int>& array){
    for(int i = 0; i < L.size(); i++){
        int sum = 0;
        for(int j = L[i] - 1; j <= R[i] - 1; j++){
            sum += array[j];
        }
        if(sum != S[i]) return false;
    }
    return true;
}

int main(){
    int N, X, M;
    while(cin >> N >> X >> M){
        vector<int> L(M), R(M), S(M);
        REP(i, M) cin >> L[i] >> R[i] >> S[i];
        vector< vector<int> > arrays;
        produce(N, X, arrays);
        vector<int> answer;
        for(vector<int>& array : arrays){
            if(satisfy(L, R, S, array)){
                answer = array;
            }
        }
        if(answer.empty()){
            cout << -1 << endl;
        }else{
            for(int i = 0; i < answer.size(); i++){
                cout << answer[i];
                if(i + 1 == answer.size()) cout << endl;
                else cout << " ";
            }
        }
    }
    return 0;
}

Measured memory_bytes: 99888
#include <iostream>
#include <numeric>

int main()
{
    int r, c;
    std::cin >> r >> c;

    int table[r+1][c+1] = {};

    for (int i = 0; i < r + 1; ++i) {
        if (i == r) {
            for (int j = 0; j < c + 1; ++j) {
                int sum = 0;
                for (int k = 0; k < r; ++k) {
                    sum += table[k][j];
                }
                table[i][j] = sum;
            }
        } else {
            for (int j = 0; j < c; ++j) {
                std::cin >> table[i][j];
            }
            table[i][c] = std::accumulate(table[i], table[i] + c, 0);
        }
    }

    for (int i = 0; i < r + 1; ++i) {
        for (int j = 0; j < c + 1; ++j) {
            std::cout << table[i][j];
            if (j != c) {
                std::cout  << " ";
            }
        }
        std::cout << std::endl;
    }

    return 0;
}


Measured memory_bytes: 3076
#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;
  if(A >= 13) {
    cout << B << endl;
  } else if(5 < A) {
    cout << B/2 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}



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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{

	int r;
	cin >> r;
	ce(r*r)
    return 0;
}



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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define rtr(ds, it) for(auto it=ds.rbegin(); it!=ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue <int> pq;
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
#define o_set tree<ii, null_type,less<ii>, rb_tree_tag,tree_order_statistics_node_update>
#define graph vector<vi>
#define Mod 998244353
#define Mod2 1000000007
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define T int t;cin>>t;rep(i,t)

ll power (ll m, ll n) {
	
	ll ans = 1;
	
	while (n > 0) {
		
		if (n & 1)
			ans = (ans * m) % Mod;
			
		m = (m * m) % Mod;
		n >>= 1;
	}
	
	return ans;
}

ll nCr (ll n, ll r, ll fact[]) {
	
	if (r > n)
		return 0;
		
	ll ans = fact[n];
	ans = (ans * power(fact[r], Mod - 2)) % Mod;
	ans = (ans * power(fact[n - r], Mod - 2)) % Mod;
	
	return ans;
}




void solve() {

	ll n, m, k;
	cin >> n >> m >> k;
	
	ll fact[n + 1];
	
	fact[0] = 1;
	fact[1] = 1;
	
	rep_a(i,2, n + 1)
		fact[i] = (fact[i - 1] * i) % Mod;
		
	ll ans = 0;
	
	rep(i, k + 1) {
		
		ans += (((m * power(m - 1, n - 1 - i)) % Mod) * nCr(n - 1, i, fact) ) % Mod;
		ans %= Mod;
	}
	
	cout << ans;
	
}

int main()
{
    fastio;
//    T
    solve();
	//code
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int>vec(100);
  for(int i = 0;i < n;i++) cin >> vec[i];
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  int a = 0;
  int b = 0;
  for(int i = 0;i < n;i++){
      if(i%2 == 0) a+=vec[i];
      else b+=vec[i];
  }
  cout << a-b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long m=1e9+7;
long long fact[1000001],inv[1000001];

long long modRecursive(long long a,long long b,long long c)
{
	if(b == 0) return 1;
	if(b%2 ==0) return modRecursive((a*a)%c,b/2,c);
	else return ((a%c)*(modRecursive((a*a)%c,b/2,c)))%c;
}

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


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

const long long inf = 2e18;
const int M = 1010;

int n, m;
long long dp[M][1 << 12];
int a[M], b[M], mask[M];

long long dfs(int at, int cmask) {
  if (at == m)
    return (cmask == (1 << n) - 1 ? 0 : inf);
  if (dp[at][cmask] != -1)
    return dp[at][cmask];
  return dp[at][cmask] = min(dfs(at + 1, cmask), a[at] + dfs(at + 1, cmask | mask[at]));
}

int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d %d", &a[i], &b[i]);
    for (int j = 0; j < b[i]; ++j) {
      int x;
      scanf("%d", &x);
      --x;
      mask[i] |= (1 << x);
    }
  }
  memset(dp, -1, sizeof dp);
  long long ans = dfs(0, 0);
  if (ans == inf)
    ans = -1;
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 32640
#include<stdio.h>
#define N 100
int main(){
  int M[N][N];
  int n,u,k,v,i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++) M[i][j]=0;
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j)printf(" ");
      printf("%d",M[i][j]);
    }
    printf("\n");
  }
  return 0;
}

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

#define ll long long
#define ull unsigned long long
using namespace std;

ull f(ull n)
{
    ull cnt = 0 ;
    for (ull i = 5; n / i >= 1; i *= 5)
        cnt += (ull)n/(ull)i;
    return cnt;
}

int main()
{
       ull n;
       cin>>n;
       ull ans = 0 ;
        if(n%2!=0)
        {
            cout<<0<<endl;
        }
        else
        {
            ull m =0;
            ull ans = f(n/2);
            cout<<ans<<endl;
        }


       //cout<<125000001278287908-124999999999999995<<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"
typedef long long ll;
const ll MOD = 1e9 + 7;

int main(void) {
    IOS;
    int x, y, sum;
    bool flag = false;
    cin >> x >> y;
    for(int i = 0; i <= x; i++) {
        sum = 2 * i + 4 * (x - i);
        if(sum == y) {
            flag = true;
            break;
        }
    }
    if(flag)
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 3600
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;
typedef string::const_iterator State;
class ParseError {};

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

//ll dx[4] = {1, 0, -1, 0};
//ll dy[4] = {0, 1, 0, -1};

int main() {
	IOS();
	ll n, l;
	cin >> n >> l;
	ll ans;
	if (l >= 0) {
		ans = 0;
		for (int i = 1; i < n; i++) {
			ans += (l + i);
		}
		dump(ans);
	} else if (l + n - 1 <= 0) {
		ans = 0;
		for (int i = 0; i < n - 1; i++) {
			ans += (l + i);
		}
		dump(ans);
	} else {
		ans = 0;
		for (int i = 0; i < n; i++) {
			ans += (l + i);
		}
		dump(ans);
	}
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define hhh cerr<<"hhh"<<endl
#define see(x) cerr<<(#x)<<'='<<(x)<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&(c<'0'||c>'9'))c=getchar();if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return f*x;}

const int maxn = 3e5+7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;

ll fac[maxn], inv[maxn];
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll k){ll s=1;while(k){if(k&1)s=s*a%mod;a=a*a%mod,k>>=1;}return s;}
ll comb(int n, int m) {
    if(n<m||m<0||n<0) return 0;
    return fac[n]*inv[m]%mod*inv[n-m]%mod;
}

bool check(string l) {
    for(int i=0; i<l.size(); ++i) {
        if(l[i]!=l[l.size()-1-i]) return 0;
    }
    return 1;
}

int main() {
    string l; cin>>l;
    if(check(l)&&check(l.substr(0,l.size()/2))&&check(l.substr(l.size()/2+1))) printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var n = Sarray()[0];
            var Ai = Sarray();
            var ans = new long[Ai.Length];
            for (var i = 0; i < Ai.Length; ++i)
            {
                if (i % 2 == 0)
                    ans[i / 2] = Ai[Ai.Length - 1 - i];
                else
                    ans[ans.Length - 1 - i / 2] = Ai[Ai.Length - 1 - i];
            }
            foreach (var a in ans)
                Write($"{a} ");
            Out.Flush();
        }
    }
}

Measured memory_bytes: 42536
s = input()

def is_easy_to_tap(s):
    for i, c in enumerate(s):
        if((i % 2 == 0) and (c == 'L')):
            return 'No'
        if((i % 2 != 0) and (c == 'R')):
            return 'No'
    return 'Yes'

print(is_easy_to_tap(s))


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,q,a,b,c;
    cin >> n;
    std::list<int> list[n];
    cin >> q;
    for (int i=0;i<q;i++) {
        cin >> a;
        if ( a==0 ) {
            cin >> b >> c;
            list[b].emplace_back(c);
        } else if ( a==1 ) {
            cin >> b;
            if ( list[b].empty()!=true ) {
                for (auto itr=list[b].begin();itr !=list[b].end();++itr) {
                    if ( itr==list[b].begin() ) {
                        cout << *itr;
                    } else {
                        cout << " " << *itr;
                    }
                }
                cout << endl;
            } else {
                cout << endl;
            }
        } else if ( a==2 ) {
            cin >> b >> c;
            list[c].splice(list[c].end(),std::move(list[b]));
            list[b].erase(list[b].begin(),list[b].end());
        }
    }
}



Measured memory_bytes: 18652
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;


struct Data
{
	int team1 , team2;
	int point1 , point2;
};



int main(void)
{
	int point[110] = {0};
	int zyuni[110] = {0};
	
	struct Data data;

	int n;

	cin >> n;

	for (int i = 0; i < n * (n - 1) / 2; i++)
	{
		cin >> data.team1 >> data.team2 >> data.point1 >> data.point2;
		if (data.point1 == data.point2)
		{
			point[data.team1 - 1]++;
			point[data.team2 - 1]++;
		}
		else if (data.point1 > data.point2)
		{
			point[data.team1 - 1] += 3;
		}
		else
		{
			point[data.team2 - 1] += 3;
		}
	}

	bool flag = true;
	int cnt = 1;
	while (flag)
	{
		flag = false;

		int m = -1;
		for (int i = 0; i < n; i++)
		{
			m = max(m , point[i]);
		}
		if (m == -1)
		{
			break;
		}
		int now = 0;
		for (int i = 0; i < n; i++)
		{
			if (m == point[i])
			{
				zyuni[i] = cnt;
				now++;
				point[i] = -1;
				flag = true;
			}
		}
		cnt += now;
	}

	for (int i = 0; i < n; i++)
	{
		cout << zyuni[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 1164
#include <cstdio>
#include <map>

using namespace std;

#define R register
typedef long long ll;
map<int, int> cnt;
int main()
{
	R int n; scanf("%d", &n);
	R int maxx = 0, sec = 0;
	for (R int i = 1; i <= n; ++i) {R int x; scanf("%d", &x); ++cnt[x];
		if (cnt[x] == 2 || cnt[x] == 4) maxx < x ? sec = maxx, maxx = x : sec < x ? sec = x : 0;}
	printf("%lld\n", 1ll * maxx * sec);
	return 0;
}

Measured memory_bytes: 4864
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100005];
int main(){
	ll h,n;
	cin>>h>>n;
	ll sum=0;
	for(ll i=1;i<=n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	if(sum>=h) cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
typedef long long ll;
using namespace std;
#define int long long

//素数判定
inline bool IsPrime(int p) {
	if (p == 1) return false;
	for (int i = 2; i <= sqrt(p); i++) {
		if (p%i == 0) return false;
	}
	return true;
}

//10進数の自然数の桁数を返す
inline int GetDigit(int num) {
	return (int)log10(num) + 1;
}

//各位の和を返す
int GetDigitsSum(int num) {
	int N = 0;
	while (num > 0) {
		N += num % 10;
		num /= 10;
	}
	return N;
}

//互除法
ll gcd(ll a, ll b) {
	if (a < b) {
		return gcd(b, a);
	}
	else if (a%b) {
		return gcd(b, a%b);
	}
	else {
		return b;
	}
}

//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b; // Be careful not to overflow

}


//異なるn個からr個の整数を取り出す組合せの数を求める
int combination(int n, int r) {
	if (r == 0 || n == r) {
		return 1;
	}
	else if (r == 1) {
		return n;
	}
	else {
		return combination(n - 1, r - 1) + combination(n - 1, r);
	}

}

//Ｏ(√n)
//素因数分解
map<int, int> prime_factor(int n) {
	map<int, int> res; // map[i]:=ｎを素因数分解したときiは何乗か。
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			while (n % i == 0) {
				res[i]++;
				n /= i;
			}
		}
	}
	if (n != 1)
		res[n] = 1;
	return res;
}

//Ｏ(√n)
//素因数分解
map<int, int> prime_factor_ver2(int n, map<int, int> res) {
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			while (n % i == 0) {
				res[i]++;
				n /= i;
			}
		}
	}
	if (n != 1)
		res[n]++;
	return res;
}

struct Mystr
{
	int a, b, c;
};

bool cmp(const Mystr &X, const Mystr &Y) {
	return X.c>Y.c;
}


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

	int N;
	cin >> N;

	vector<Mystr> v(N);

	for (int i = 0; i < N; i++)
	{
		cin >> v[i].a >> v[i].b;
		v[i].c = v[i].a + v[i].b;
	}

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

	int T = 0;
	int A = 0;

	for (int i = 0; i < N; i++)
	{
		if (i % 2 == 0) {
			T += v[i].a;
		}
		else {
			A += v[i].b;
		}
	}
	
	cout << T - A << endl;

	return 0;
}


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

using namespace std;

int main() {
	int K;
	cin >> K;
	int odd = 0, even = 0;
	for (int i = 1; i <= K; i++) {
		if (i % 2 == 0) odd++;
		else even++;
	}
	cout << odd * even << endl;
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
string s[50],t;
int n,a[50],x,ans,rui[50];
vector<string>v[50];
vector<int>vp[50];
set<string>st[50];
bool used[50];
map<string,int>m;
void dfs(int d,int p){
    if(used[d]){
        dfs(d+1,p);
        return ;
    }
    if(d==n)ans=max(ans,p);
    else{
        if(rui[d]+p<=ans)return ;
        vector<int>vv;
        r(i,vp[d].size()){
            if(!used[vp[d][i]])
              used[vp[d][i]]=1,
              vv.push_back(vp[d][i]);
        }
        dfs(d+1,p+a[d]);
        r(i,vv.size())used[vv[i]]=0;
        if(rui[d]+p<=ans)return ;
        dfs(d+1,p);
    }
}
int main(){
    while(cin>>n,n){
        m.clear();
        ans=0;
        memset(used,0,sizeof(used));
        r(i,50)v[i].clear();
	r(i,50)vp[i].clear();
        r(i,n){
            cin>>s[i];
            cin>>a[i]>>x;
            r(j,x){
                cin>>t;
                v[i].push_back(t);
            }
            m[s[i]]=i;
        }
	r(i,n){
	  r(j,v[i].size()){
	    vp[i].push_back(m[v[i][j]]);
	  }
	}
        rui[n-1]=a[n-1];
        for(int i=n-2;i>=0;i--)
            rui[i]=rui[i+1]+a[i];
        used[0]=1;
        r(i,v[0].size()){
            used[m[v[0][i]]]=1;
        }
        dfs(1,a[0]);
        cout<<ans<<endl;
    }
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(a) (a).begin(),(a).end()
#define fs first
#define sc second
#define pb push_back
#define sz size()

using namespace std;
typedef pair<int,int> P;
typedef pair<P,P> L;
typedef vector<int> vi;

inline int dot(const P &a, const P &b){return a.fs*b.fs + a.sc*b.sc;}
inline int cross(const P &a, const P &b){return a.fs*b.sc - a.sc*b.fs;}
inline int norm(const P &a){return a.fs*a.fs + a.sc*a.sc;}

inline int ccw(const P &a,P b,P c){
  b.fs -= a.fs; b.sc -= a.sc;
  c.fs -= a.fs; c.sc -= a.sc;
  if (cross(b,c)>0) return 2;
  if (cross(b,c)<0) return -2;
  if (dot(b, c)<0) return 1;
  if (norm(b)<norm(c)) return -1;
  return 0;
}

vector<vi> g;
vi cols;
int n,m,ans;

void dfs(int d, int num){
  if(num >= ans || num>=m)return;
  if(d==m){ ans = num; return; }

  vi use(num,0);
  rep(i,d){
    if(g[d][i])use[cols[i]] = 1;
  }
  
  rep(i,num){
    if(!use[i]){
      cols[d] = i;
      dfs(d+1,num);
      if(num>=ans)return;
    }
  }

  cols[d] = num;
  dfs(d+1,num+1);
}

int main(){
  cin.tie(0); ios::sync_with_stdio(0);
  while(cin >> n){
    if(n==0)break;

    map<string,int> country;
    vi id(n);
    vector< vector<L> > poly(n);

    m = 0;
    rep(i,n){
      string name;
      cin >> name;

      if(country.find(name)==country.end()){
	country[name] = m++;
      }
      id[i] = country[name];
      
      int x,y;
      vector<P> points;

      for(;;){
	cin >> x;
	if(x<0)break;
	cin >> y;
	points.pb( P(x,y) );
      }

      rep(j,points.sz){
	poly[i].pb(L(points[j],points[(j+1)%points.sz]));
	if(poly[i][j].sc < poly[i][j].fs)swap(poly[i][j].fs, poly[i][j].sc);
      }
    }

    g = vector<vi>(m,vi(m,0));

    rep(i,n)rep(j,i){
	bool f = false;
	for(L a : poly[i]){
	  for(L b: poly[j]){
	    if(abs(ccw(a.fs,a.sc,b.fs))<=1 && abs(ccw(a.fs,a.sc,b.sc))<=1){
	      if( (b.fs < a.sc && a.fs < b.sc) || (a.fs < b.sc && b.fs < a.sc) ){
		f = true; break;
	      }
	    }
	  }
	  if(f)break;
	}
	if(f)g[id[i]][id[j]] = g[id[j]][id[i]] = 1;
    }

    cols.resize(m);
    ans = m;
    dfs(0,0);
    cout << ans << endl;
  }
}

Measured memory_bytes: 1260
#include <bits/stdc++.h>
#define FAST_INPUT ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long

using namespace std;

void solve() {
    int n;
    cin >> n;
    ll res=0;
    for(int i=0; i<n; i++) {
        res+=(i+1LL)*(n-i);
    }
    for(int i=0; i<n-1; i++) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        int mn=min(u,v), mx=max(u,v);
        res-=(mn+1LL)*(n-mx);
    }
    cout << res << endl;
}

int main() {
    FAST_INPUT;

    solve();
    return 0;
}


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

const int MaxN=1e5+5;

int N;
int A[MaxN];

bool Check(){
	int i,f=0,cnt=0,g=0;
	for(i=1;i<=N;i++)
		A[i]&1?cnt++:f^=1;
	if(f)
		return true;
	if(cnt>1)
		return false;
	for(i=1;i<=N;i++)
		if(A[i]&1){
			if(A[i]<2)
				return false;
			A[i]--;
		}
	for(i=1;i<=N;i++)
		g=__gcd(g,A[i]);
	for(i=1;i<=N;i++)
		A[i]/=g;
	return Check()^1;
}

int main(){
	int i;
	scanf("%d",&N);
	for(i=1;i<=N;i++)
		scanf("%d",&A[i]);
	puts(Check()?"First":"Second");
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long       ll;
#define pb                emplace_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define F first
#define S second
#define fore(i, b, e)     for (int i = b; i < e; i++)
#define forr(i, b, e)     for (int i = b; i < e; i++)
int faster_in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
//using namespace __gnu_pbds;

typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int INF = int(1e9 + 7);
const double EPS = 1e-9;
const double PI = acos(-1);
const int tam =3000;
ll base[tam][tam],tot[tam];
int main()
{
    std::ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin>>n;
    forr(i,2,tam)
    {
        int num=i;
        forr(j,2,i+1)
        {
            while (num%j==0)
                base[i][j]++,num/=j;
        }
    }
    forr(i,2,n+1)
    {
        forr(j,0,tam)
        tot[j]+=base[i][j];
    }
    ll answer=1;
    forr(i,0,tam)
    {
        answer=(answer*(tot[i]+1LL))%INF;
    }
    cout<<answer<<endl;
}
// PLUS ULTRA!

Measured memory_bytes: 68352
import sys

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

X, K, D = MAP()

if X < 0:
    X = -X

d = X // D
if d >= K:
    ans = X - D*K
else:
    ans = X - D*d
    K -= d
    if K % 2 == 1:
        ans = -(ans - D)
print(ans)


Measured memory_bytes: 9264
import java.io.*;
import java.util.*;
import java.util.zip.Inflater;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni(),  k = in.ni();
        ArrayList<Integer> L = new ArrayList<>();
        ArrayList<Integer> R = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int x = in.ni();
            if(x < 0) L.add(-x);
            else if(x > 0) R.add(x);
            else k--;
        }
        long min = INF;
        if(k==0) min = 0;
        else if(L.isEmpty()){
            min = R.get(k-1);
        }else if(R.isEmpty()){
            Collections.sort(L);
            min = L.get(k-1);
        }else{
            Collections.sort(L);
            if(R.size() >= k) min = R.get(k-1);
            if(L.size() >= k) min = Math.min(min, L.get(k-1));
            for (int i = 0; i < k-1 && i < R.size(); i++) {
                if(k-i-2 >= L.size()) continue;
                min = Math.min(min, R.get(i)*2+L.get(k-i-2));
            }
            for (int i = 0; i < k-1 && i < L.size(); i++) {
                if(k-i-2 >= R.size()) continue;
                min = Math.min(min, L.get(i)*2+R.get(k-i-2));
            }
        }
        out.println(min);
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 43172
N, K = map(int, input().split())
R = N - K
mod = pow(10, 9) + 7

fact = [0] * 2001
inv = [0] * 2001
inv_cal = [0] * 2001

fact[:2] = [1, 1]
inv[1] = 1
inv_cal[:2] = [1, 1]

for i in range(2, 2001):
    fact[i] = fact[i-1] * i % mod
    inv[i] = mod - (mod // i) * inv[mod % i] % mod
    inv_cal[i] = inv_cal[i-1] * inv[i] % mod

def comb(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fact[n] * (inv_cal[k] * inv_cal[n-k] % mod) % mod

for k in range(1, K+1):
    if R+1 >= k:
        print(comb(R+1, k) * comb(K-1, k-1) % mod)
    else:
        print(0)

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
long long ans;
int a[1005];
int main()
{
	int n,k;cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+1+n);
	for(int i=1;i<=k;i++)
	{
		ans+=a[i];
	}
	cout<<ans;
}

Measured memory_bytes: 3540
def main():
    H, N = (int(i) for i in input().split())
    AB = [[int(i) for i in input().split()] for j in range(N)]
    dp = [10**12 for i in range(H+1)]  # dp[i] := 体力をi減らすときの魔力の最小値
    dp[0] = 0
    for h in range(H):
        for damage, cost in AB:
            next_index = min(h + damage, H)
            dp[next_index] = min(dp[next_index], dp[h] + cost)
    print(dp[H])


if __name__ == '__main__':
    main()


Measured memory_bytes: 42092
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iostream>
#include<queue>
#include<stack>
#include<vector>
#include<math.h>
#define Max 100005*2
#define INF 1000000000000000000
#define getMax(a,b) a<b?b:a
#define getMin(a,b) a<b?a:b
using namespace std;

vector<long long int>vec;

int main(){

	int n,k;
	long long int x,sum=0;
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++){
		scanf("%lld",&x);
		vec.push_back(x);
	}
	sort(vec.begin(),vec.end());
	if(n-k > 0){
		for(int i=0;i<(n-k);i++){
			sum += vec[i];
		}
	}
	printf("%lld\n",sum);

	return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#pragma warning(disable : 4996)
 
using namespace std;
 
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
 
//最大公約数
long gcd(long a, long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}
 
//最小公倍数
long lcm(long a, long b){
	return (a*b) / gcd(a,b);
}
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
 
typedef long long ll;
 
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;

int p[102345];

int main(){
	int n, m;
	
	cin >> n >> m;
	
	REP(i,m*2){
		int num;
		scanf("%d", &num);
		p[num-1]++;
	}
	
	REP(i,n){
		if (p[i]%2 == 1){
			cout << "NO" << endl;
			break;
		}
		if (i == n-1) cout << "YES" << endl;
	}
	
	return 0;
}

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

int a, b;
int main() {
  cin >> a >> b;
  
  for (int i = 1; i <= 1009; i++) {
    if (a == int(i * 0.08) && b == int(i * 0.1)) {
      cout << i << endl;
      return 0;
    }
  }
  
  cout << -1 << endl;
}

Measured memory_bytes: 256
def examA():
    C = [SI()for _ in range(3)]
    ans = C[0][0]+C[1][1]+C[2][2]
    print(ans)
    return

def examB():
    N, M = LI()
    P = [0]*N
    S = [LSI()for _ in range(M)]
    pena = 0
    ac = set()
    for p,s in S:
        p = int(p)-1
        if s=="WA":
            P[p] += 1
        else:
            if p in ac:
                continue
            ac.add(p)
            pena += P[p]

    print(len(ac),pena)
    return

def examC():
    W, H, N = LI()
    lx, rx, ly, ry = 0, W, 0, H
    A = [LI()for _ in range(N)]
    for x,y,a in A:
        if a==1:
            lx = max(lx,x)
        elif a==2:
            rx = min(rx,x)
        elif a==3:
            ly = max(ly,y)
        elif a==4:
            ry = min(ry,y)
    ans = max(0,rx-lx)*max(0,ry-ly)
    print(ans)
    return

def examD():
    N, H = LI()
    B = [0]*N
    maxa = 0
    ans = 0
    for i in range(N):
        a, B[i] = LI()
        if a>maxa:
            maxa = a
    B.sort(reverse=True)
    for b in B:
        if b<maxa:
            break
        H -= b
        ans += 1
        if H<=0:
            print(ans)
            return
    ans += -(-H//maxa)
    print(ans)
    return

def examE():
    A, B = LI()
    ans = [["#"]*100 for _ in range(50)] + [["."]*100 for _ in range(50)]
    i = 0; j = 0
    for _ in range(A-1):
        ans[i][j] = "."
        j += 2
        if j>=100:
            j = 0; i += 2
    i = 0; j = 0
    for _ in range(B-1):
        ans[99-i][j] = "#"
        j += 2
        if j>=100:
            j = 0; i += 2
    print(100,100)
    for v in ans:
        print("".join(map(str,v)))
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(readline())
def LI(): return list(map(int,readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examE()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 40636
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    while(true){
      int x = sc.nextInt();
      if(x == 0) break;
      String oct = Integer.toString(x,8).replaceAll("7","9").replaceAll("6","8").replaceAll("5","7").replaceAll("4","5");
      System.out.println(oct);
    }
  }
}

Measured memory_bytes: 13000
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007LL;
const int INF = LLONG_MAX;

signed main(){
    
    string s; cin >> s;
    int n = (int)s.size();
    for(int i = 0; i < n; i += 2){
        cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 512
N = int(input())
X = list(map(int, input().split()))
SUM = 0
DIF = 0
for i in range(N):
    SUM = SUM + X[i]

AVG = round((SUM / N))



for i in range(N):
    DIF = DIF + (abs(X[i] - AVG))**2
print(DIF)

Measured memory_bytes: 61984
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#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>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 100100100;
const double EPS = 1e-9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;  cin >> s;
    int len = s.size();
    int count = 0;
    int ans;
    rep(i, len) {
      if (s[i] == '0') {
        count++;
      }
    }
    ans = min(count, len - count);
    ans *= 2;

    cout << ans << '\n';

    return 0;
}


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

int main(){
    int N,M;
    cin >> N >> M;
    int a[60],b[60],c[60],d[60];
    int i,j;

    for(i=0; i<N; i++){
        cin >> a[i] >> b[i];
    }
    for(i=0; i<M; i++){
        cin >> c[i] >> d[i];
    }

    long int dist;
    int point;
    for(i=0; i<N; i++){
        dist=abs(a[i]-c[0])+abs(b[i]-d[0]);
        point=0;
        for(j=1; j<M; j++){
            if(dist>abs(a[i]-c[j])+abs(b[i]-d[j])){
                dist=abs(a[i]-c[j])+abs(b[i]-d[j]);
                point=j;
            }
        }
        cout << point+1 << endl;
    }

    return 0;

}

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

using namespace std;

int main()
{
    int a,b,c,i;
    b = 0;
    c = 0;
    for(i=0;i<3;i++)
    {
        scanf("%d",&a);
        if(a==5)
            b++;
        if(a==7)
            c++;
    }
    if(b==2&&c==1)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}


Measured memory_bytes: 256
h,n = map(int,input().split())
magic=[]
for i in range(n):
    a,b=map(int,input().split())
    magic.append([a,b])
dp = [1000000000000 for i in range(h+1)]
dp[0] = 0
for i in range(h):
    for a,b in magic:
        rest = min(i+a,h)
        dp[rest] = min(dp[rest],dp[i]+b)
print(dp[-1])

Measured memory_bytes: 41580
#include<iostream>
#include<iomanip>
#include<string>
#include<array>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
#include<ctype.h>
using namespace std;


int main() {
	string x, y;
	cin >> x >> y;
	if (x<y) {
		cout << "<" << endl;
	}
	else if(y<x){
		cout << ">" << endl;
	}
	else {
		cout << "=" << endl;
	}
}

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


 
int main() {
    int n,a,i;
    cin>>n;
    vector<pair<pair<string,int>,int>> v;
    string s;
    for(i=1;i<=n;i++){
        cin>>s>>a;
        v.push_back({{s,100-a},i});
    }
    sort(v.begin(),v.end());
    
    for(i=0;i<n;i++) cout<<v[i].second<<endl;
    return 0;
}

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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main(){
   int n;
   cin >> n;
   vector<ll>a(n);
   rep(i, 0, n)cin >> a[i];
   ll s = a[0];
   rep(i, 1, n)s=s^a[i];
   rep(i, 0, n){
       ll ans = s^a[i];
       cout << ans << " ";
   }
   cout << endl;
}

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

path = [[] for _ in range(n)]
for _ in range(m):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    path[a].append(b)
    path[b].append(a)

def solve(route):
    if len(route) == n:
        return 1
    count = 0
    for i in path[route[-1]]:
        if i in route: continue
        count += solve(route + [i])
    return count

print(solve([0]))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define intt long long int
#define intu unsigned long long int
#define vi vector<int>
#define ii pair<int,int>
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define fast_io ios::sync_with_stdio(0);cin.tie(NULL);std::cout.tie(NULL);
# define PI           3.14159265358979323846 
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
int mod = 1000000007;
int gcd(int a, int b) {return b ? gcd(b, a % b) : a;}
int lcm(int a, int b) {return a * b / gcd(a, b); }
intt bpow(intt a,intt b) 
{
  intt res = 1;
  while (b > 0) {
    if (b & 1)res = ((res%mod) * (a%mod))%mod;
      a = ((a%mod) * (a%mod))%mod;
      b >>= 1;
  }
  return res;
}
intt fact(intt n) { 
   if ((n==0)||(n==1))
      return 1; 
   else
      return n*fact(n-1);
}
void go()
{
#ifndef ONLINE_JUDGE
  freopen("inn.txt","r",stdin);
  freopen("ouut.txt","w",stdout);
  #endif
}
///////////U L R D
int dx[4]={0,-1,1,0};
int dy[4]={1,0,0,-1};


int main() 
{ 
    fast_io
    go();
    int l,r,k;cin>>l>>r>>k;
    int ans=0;
    for(int i=l;i<=r;i++)
    {
      if(i%k==0)
        ans++;
    }
    cout << ans <<"\n";
}

/*!
    You are under no obligation to be the same person you were a minute ago,
    You have the right to grow !
*/




















Measured memory_bytes: 3636
#1:????????¨???????????????????????????..#?????¢???each??§??\?????????
loop do
h, w = gets.chomp.split.map(&:to_i)
    if h == 0 && w == 0
        break
    end
line = "#" * w
puts "#{line}"
    (h - 2).times do |row|
        print "#"
        print "#{"." * (w - 2)}"
        puts "#"
    end
puts "#{line}"
puts ""
end

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

signed main()
{
  int a, b;
  int n;
  cin >> a >> b;

  n = a + b;
  if (n < 24) {
    cout << n << endl;
  }
  else {
    cout << n - 24 << endl;
  }

  return (0);
}

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

typedef long long ll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

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

int main() {
	int n; cin >> n;
	vi a(n);
	vb checked(n, false);
	rep(i, n) {
		cin >> a.at(i);
	}
	int ans = 0;
	int i = 0;
	while (true) {
		ans++;
		if (checked.at(i)) {
			cout << "-1" << endl;
			return 0;
		}
		checked.at(i) = true;
		if (a.at(i) == 2) {
			break;
		}
		i = a.at(i) - 1;
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> vec(q), num(n,0);
    for(int i=0; i<q; i++) {
        cin >> vec.at(i);
        num.at(vec.at(i)-1)++;
    }
    for(int i=0; i<n; i++) {
        if(k-(q-num.at(i))>0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 1408
// Problem Code: abc161_b

#include <bits/stdc++.h>

using namespace std;

string B(int N, int M, vector<int>& A) {
	int n = ceil(accumulate(A.begin(), A.end(), 0.0) / (4 * M));
	sort(A.rbegin(), A.rend());
	for (int i = 0; i < M; i++)
		if (A[i] < n)
			return "No";
	return "Yes";
}

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> A(N);
	for (int i = 0; i < N; i++)
		cin >> A[i];
	cout << B(N, M, A);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long aa;
__int128 a;
__int128 now=100;
int ans;
int main(){
	cin>>aa;
	a=aa;
	while(now<a){
		now*=101;
		now/=100;
		ans++;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <cassert>
#include <algorithm>
#include <math.h> 
#include <set>
#include <map>
#include <utility>
#include <deque>
#include <queue>


using namespace std;

#define ll long long int
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repp(i, n) for(int i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define riverse(v) reverse((v).begin(), (v).end())
#define pb push_back
#define mp make_pair
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<ll>;
using vvi = vector<vi>;
const ll MOD = 1e9 + 7;
vi alphabet = { 'a','b','c','d','e','f','g','h','i','j','k','l','m',
               'n','o','p','q','r','s','t','u','v','w','x','y','z' };


int main() {
    int N;
    cin >> N;
    string S1, S2;
    cin >> S1 >> S2;
    vi frag(N, 0);
    ll ans = 1;
    rep(i, N) {
        if (S1[i] == S2[i]) {
            frag[i]++;
        }
    }
    int fragg;
    if (frag[0] == 0 ) {
        ans *= 6;
        fragg = 1;
    }
    else if (frag[0] == 1) {
        ans *= 3;
        fragg = 0;
    }
    repp(i, N-1) {
        if (fragg != 0) {
            fragg--;
            continue;
        }

        if (frag[i] == 0 && frag[i - 1] == 0) {
            fragg = 1;
            ans *= 3;
            ans = ans % MOD;
        }
        else if (frag[i] == 0 && frag[i - 1] == 1) {
            fragg = 1;
            ans *= 2;
            ans = ans % MOD;
        }
        else if (frag[i] == 1 && frag[i - 1] == 0) {
            fragg = 0;
        }
        else {
            fragg = 0;
            ans *= 2;
            ans = ans % MOD;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
if __name__ == '__main__':
    # ??????????????\???
    loop = int(input())
    for i in range(loop):
        num1 = int(input())
        num2 = int(input())

        # ???????????????
        result = num1 + num2

        # ???????????????
        if len(str(result)) > 80:
            print('overflow')
        else:
            print(result)

Measured memory_bytes: 7484
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.Arrays;
import java.util.StringTokenizer;

class Main{
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		int N=sc.nextInt();
		int M=sc.nextInt();
		int[] suki=new int[M];
		Arrays.fill(suki, 0);
		for(int i=0; i<N; i++) {
			int s=sc.nextInt();
			for(int j=0; j<s; j++) {
				suki[sc.nextInt()-1]++;
			}
		}
		int c=0;
		for(int i=0; i<M; i++) {
			if(suki[i]==N) {
				c++;
			}
		}
		pl(c);
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
}


Measured memory_bytes: 23380