akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iostream>
#define ll long long int
using namespace std;
#define mod 1000000009
int max(int a, int b)
{
	return a > b ? a : b;
}

string lcs(string a, string b, int n, int m)
{
	int dp[n + 1][m + 1];
	for (int i = 0; i <= n; i++)
		dp[i][0] = 0;
	for (int i = 0; i <= m; i++)
		dp[0][i] = 0;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			if (a[i - 1] == b[j - 1])
				dp[i][j] = 1 + dp[i - 1][j - 1];
			else
				dp[i][j] = max(dp[i - 1][j] , dp[i][j - 1]);
		}
	}
	string ans;
	int i = n,j = m;
	while(i > 0 && j > 0)
    {
        if(a[i-1] == b[j-1])
        {
            ans = a[i-1] + ans;
            i--;
            j--;
        }
        else
        {
            if(dp[i-1][j] > dp[i][j-1])
                i--;
            else
                j--;
        }
    }
	return ans;
}

int main()
{
	string a, b;
	cin >> a >> b;
	cout << lcs(a, b, a.length(), b.length());
	return 0;
}




Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
int gcd( int m, int n )
{
  // 引数に０がある場合は０を返す
  if ( ( 0 == m ) || ( 0 == n ) )
    return 0;

  // ユークリッドの方法
  while( m != n )
    {
      if ( m > n ) m = m - n;
      else         n = n - m;
    }
  return m;
}//gcd
long long lcm(long long x,long long y){
  return x * y /__gcd(x,y);
}

int main(){
  long long n,m,l,minl,i;
  string s,t;
  cin>>n>>m>>s>>t;
  l = lcm(n,m);
  minl = lcm(l/m,l/n);
  bool flag=true;
  for(i==1;i<(l/minl);i++){
    if (s[i*(minl/(l/n))] != t[i*(minl/(l/m))]){
      flag = false;
      break;
    }
  }
  if (flag){
      cout<<l;
  }else{
    cout<<-1;
  }

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int H, W;
vector<vector<char>> maze;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cin >> H >> W;
maze.resize(H, vector<char>(W));
int s_cnt=0;
rep(i,H){
    rep(j,W){
        cin >> maze[i][j];
        if(maze[i][j]=='#'){
            s_cnt++;
        }
    }
}
if(s_cnt==H+W-1){
    cout << "Possible" << endl;
}
else{
    cout << "Impossible" << endl;
}

//system("pause");
return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long num = 0;

        if (a % 2 == 1) {
            a = a - 1;
            num = a;
        }

        long sub = b - a;
        if (sub % 4 == 0) {
            System.out.println(b ^ num);

        } else if (sub % 4 == 1) {
            System.out.println(b ^ (b - 1) ^ num);

        } else if (sub % 4 == 2) {
            System.out.println(b ^ 1 ^ num);

        } else if (sub % 4 == 3) {
            System.out.println(b ^ (b - 1) ^ 1 ^ num);

        }
    }
}



Measured memory_bytes: 22996
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;



void solve()
{
    int a, b, K;
    scanf("%d%d%d", &a, &b, &K);
    int i;
    for (i = 0; i < K; i++) {
        if (i % 2 == 0) {
            if (a % 2) a--;
            a = a / 2;
            b += a;
        }
        else {
            if (b % 2) b--;
            b = b / 2;
            a += b;
        }
    }
    printf("%d %d\n", a, b);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if(!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if(t & 1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
mint fact(int n) {
  if(n == 1 || n == 0) return 1;
  mint res = n;
  return res * fact(n - 1);
}

struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < mod);
    fact[0] = 1;
    for(int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for(int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) {
    if(k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

combination c(1e6 * 3);

int main() {
  int r1, r2, c1, c2;
  cin >> r1 >> c1 >> r2 >> c2;
  mint ans1 = c(r2 + c2 + 2, c2 + 1);
  mint ans2 = c(r2 + 1 + c1, c1);
  mint ans3 = c(c2 + 1 + r1, r1);
  mint ans4 = c(c1 + r1, c1);
  mint ans = ans1 - ans2 - ans3 + ans4;
  cout << ans.x << endl;
}

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

bool iseven(int *a , int size){
    for(int i=0;i<size;i++)
        if(a[i]%2==1)return false;
    return true;
}


int main()
{
    // スペース区切りの整数の入力
    int n;
    cin >> n;
    int a[300];
    for(int i=0;i<n;i++)cin >> a[i];

    int count=0;
    while(true){
        if(iseven(a,n)){
            ++count;
            for(int i=0;i<n;i++)a[i]/=2;
        }else{
            break;
        }
    }
    cout << count << endl;
    return 0;
}






Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<list>

using namespace std;

static const int MAX = 100000;
static const int INFTY = (1LL << 29);

vector<int> G[MAX];
list<int> out;
bool V[MAX];
int N;
int indeg[MAX];

void bfs(int s) {
  queue<int> q;
  q.push(s);
  V[s] = true;
  while (!q.empty()) {
    int u = q.front(); q.pop();
    out.push_back(u);
    for (int i = 0; i < G[u].size(); i++) {
      int v = G[u][i];
      indeg[v]--;
      if (indeg[v] == 0 && !V[v]) {
        V[v] = true;
        q.push(v);
      }
    }
  }
}

void tsort() {
  for (int i = 0; i < N; i++) {
    indeg[i] = 0;
  }

  for (int u = 0; u < N; u++) {
    for (int i = 0; i < G[u].size(); i++) {
      int v = G[u][i];
      indeg[v]++;
    }
  }

  for (int u = 0; u < N; u++) {
    if (indeg[u] == 0 && !V[u]) {
      bfs(u);
    }
  }

  for (list<int>::iterator it = out.begin(); it != out.end(); it++) {
    cout << *it << endl;
  }
}

int main() {
  int s, t, M;

  cin >> N >> M;

  for (int i = 0; i < N; i++) {
    V[i] = false;
  }

  for (int i = 0; i < M; i++) {
    cin >> s >> t;
    G[s].push_back(t);
  }

  tsort();

  return 0;
}



Measured memory_bytes: 6252
S = input()

if S[0] == S[1] and S[2] == S[3] and S[1] == S[2]:
  print('No')
elif S[0] == S[1] and S[2] == S[3]:
  print('Yes')
elif S[0] == S[2] and S[1] == S[3]:
  print('Yes')
elif S[0] == S[3] and S[1] == S[2]:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>

int main(void)
{
    int n,i=0;
    char a[4];
    scanf("%s",a);
    if(a[0]=='7')
      i=1;
    if(a[1]=='7')
      i=1;
    if(a[2]=='7')
      i=1;
    if(i==1)
      printf("Yes");
    else
      printf("No");

	return 0;
}


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

using namespace std;

int main()
{
    long long int a, b, s, x;

    scanf("%lld%lld%lld", &a, &b, &x);
    //cout << a << b << x << endl;
    if(a%x == 0) s = ((b/x) - (a/x)) + 1;
    else s = ((b/x) - (a/x));

    printf("%lld\n", s);

    return 0;
}


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

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) (i64)(a / (f64)__gcd(a, b) * b) /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    i32 A, B;
    cin >> A >> B;
    cout << LCM(A, B) << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr long long LLINF = 1LL << 60;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
} initializer;

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    if (it != vec.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }

template<typename T>
vector<T> dijkstra(const vector<vector<pair<int, T>>> &graph, int root) {
  using P = pair<T, int>;
  vector<T> dists(graph.size(), numeric_limits<T>::max());
  priority_queue<P, vector<P>, greater<P>> que;
  dists[root] = 0;
  que.emplace(dists[root], root);
  while (!que.empty()) {
    P x = que.top(); que.pop();
    if (dists[x.second] < x.first) continue;
    for (auto e : graph[x.second]) {
      if (dists[e.first] > dists[x.second] + e.second) {
        dists[e.first] = dists[x.second] + e.second;
        que.emplace(dists[e.first], e.first);
      }
    }
  }
  return dists;
}

int main() {
  int n; cin>>n;
  vector<vector<pair<int, long long>>> g(n);
  rep(i, n-1) {
    int a, b, c; cin>>a>>b>>c;
    --a; --b;
    g[a].emplace_back(b, c);
    g[b].emplace_back(a, c);
  }
  int q, k; cin>>q>>k;
  --k;
  auto dists = dijkstra(g, k);
  rep(i, q) {
    int x, y; cin>>x>>y;
    --x; --y;
    print(dists[x]+dists[y]);
  }

  return 0;
}

Measured memory_bytes: 11120
N = int(input())
A = [0, 0, 0]
b = map(int, input().split())
for a in b:
    if a % 4 == 0:
        A[2] += 1
    elif a % 2 == 0:
        A[1] += 1
    else:
        A[0] += 1

# print(A)

for i in range(3):
    if A[i] != 0:
        s = i
        A[i] -= 1
        break


def judge(A, s, N):
    for i in range(N - 1):
        if s == 0:  # 割り切れない場合
            if A[2] != 0:
                A[2] -= 1
                s = 2
            else:
                return "No"
        elif s == 1:
            if A[1] != 0:
                A[1] -= 1
                s = 1
            elif A[2] != 0:
                A[2] -= 1
                s = 2
            else:
                return "No"
        else:
            if A[0] != 0:
                A[0] -= 1
                s = 0
            elif A[1] != 0:
                A[1] -= 1
                s = 1
            elif A[2] != 0:
                A[2] -= 1
                s = 2
            else:
                return "No"
    return "Yes"


print(judge(A, s, N))


Measured memory_bytes: 11096
/*|-----------|
  | templatka |
  |  Tomasz   |
  |   Zyla    |
  |-----------|*/

#include <bits/stdc++.h>

#define mp make_pair
#define pb push_back
#define f first
#define s second

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tiii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef set<int> si;
typedef set<ll> sll;
typedef list<int> li;
typedef list<ll> lll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef map<string,int> msi;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
typedef unordered_map<string,int> umsi;
typedef queue<int> qi;
typedef queue<ll> qll;
typedef priority_queue<int> pqi;
typedef priority_queue<ll> pqll;

msi M;
vector <string> V;

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	
	int maks = 0;
	int n; cin >> n;
	while(n--) {
		string s; cin >> s;
		M[s] ++;
		maks = max(maks, M[s]);
	}
	
	for (auto it : M) {
		if (it.s == maks) {
			V.pb(it.f);
		}
	}
	
	sort(V.begin(), V.end());
	for (auto it : V) cout << it << '\n';
	
	return 0;
}


Measured memory_bytes: 25584
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=5000 +117;
const int MM= +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.cpp.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}


int m,n;
vector<int> p[NN]={};
LL dp[NN][NN]={};
LL v[NN]={};
int siz[NN]={};
LL tp[NN]={};
const int mod=1e9+7;
void dfs(int x,int fa){
	dp[x][1]=1;
	siz[x]=1;
	for(int i=0;i<p[x].size();++i){
		int cur=p[x][i];
		if(cur!=fa){
			dfs(cur,x);
			for(int i=0;i<=siz[x]+siz[cur];++i)tp[i]=0;
			for(int i=siz[x];i>=0;--i){
				for(int j=siz[cur];j>=0;--j){
					tp[i+j]+=dp[x][i]*dp[cur][j];
					tp[i+j]%=mod;
				}
			}
			siz[x]+=siz[cur];
			for(int i=0;i<=siz[x];++i)dp[x][i]=tp[i];
		}
	}
	for(int i=1;i<=siz[x];++i){
		dp[x][0]+=dp[x][i]*v[i];
		dp[x][0]%=mod;
	}
}
int main(){
	//open();
	n=read();
	v[0]=-1;
	for(int i=2;i<=n;i+=2)v[i]=v[i-2]*(i-1)%mod;
	for(int i=1;i<n;++i){
		int x=read(),y=read();
		p[x].push_back(y);
		p[y].push_back(x);
	}
	dfs(1,0);
	LL ans=-dp[1][0];
	ans=(ans+mod)%mod;
	printf("%lld\n",ans);

	close();
	return 0;
}

Measured memory_bytes: 200704
stack = []
lst = input().split()
for i in range(len(lst)) :
    if lst[i] in ['+', '-', '*', '/'] :
        b = stack.pop(-1)
        a = stack.pop(-1)
        if lst[i] == '+' :
            stack.append(a + b)
        elif lst[i] == '-' :
            stack.append(a - b)
        elif lst[i] == '*' :
            stack.append(a * b)
        else :
            stack.append(a // b)
    else :
        stack.append(int(lst[i]))
        
print(stack[0])


Measured memory_bytes: 5600
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<cassert>
using namespace std;
int inf = 1000000000;

bool comp(vector<int> l, vector<int> r){
  if( l[0] != r[0] ) return l[0] > r[0];
  if( l[1] != r[1] ) return l[1] < r[1];
  return l[2] < r[2];
}

int main(void) {

  int t, p, r;
  while(cin >> t >> p >> r){
    if( t == 0 && p == 0 && r == 0 ) break;
    vector< vector<int> > team(t, vector<int> (3));
    for(int i=0; i<t; i++) team[i][2] = i+1;
    vector< vector<int> > pe(t, vector<int>(p, 0));

    int tID, pID, ti;
    string m;
    for(int i=0; i<r; i++){
      cin >> tID >> pID >> ti >> m;
      tID--;
      pID--;
      if( m == "WRONG" ) pe[tID][pID]++;
      else{
        team[tID][0]++;
        team[tID][1] += pe[tID][pID] * 1200 + ti;
        pe[tID][pID] = -1;
      }
    }
    sort(team.begin(), team.end(), comp);

    for(int i=0; i<t; i++){
      cout << team[i][2] << " " << team[i][0] << " " << team[i][1] << endl;
    }

  }


  return 0;
}


// EOF

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

int n;
string s;

int main(){
    cin>>n>>s;
    if (n%2==1) cout<<"No";
    else{
        string s1=s.substr(0,n/2);
        string s2=s.substr(n/2,n/2);
        if (s1==s2) cout<<"Yes";
        else cout<<"No";
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long int lint;
typedef vector<char> vchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
#define vsort(v) sort((v).begin(), (v).end())
#define vreverse(v) reverse((v).begin(), (v).end())
#define pb(a) push_back(a)
#define INF 1000000007
int main(){
  int h,w,i,j;
  cin>>h>>w;
  vvchar s(h+2,vchar(w+2));
  vvint ps(h+2,vint(w+2));
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      cin>>s[i][j];
      if(s[i][j] =='#'){ps[i][j]=1;/*null*/}else{ps[i][j]=0;/*nulan*/}
    }
  }
  for(i=0;i<=h+1;i++){
    for(j=0;j<=w+1;j++){
      if((i==0)||(j==0)||(i==h+1)||(j==w+1)){ps[i][j]=0;}
    }
  }
  bool ans=true;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
     if(ps[i][j]){
       if((ps[i-1][j]==0)&&(ps[i+1][j]==0)&&(ps[i][j-1]==0)&&(ps[i][j+1]==0)){
         ans=false;i=h;j=w;
       }
     }
    }
  }
  cout<<(ans?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
  vector<pair<ll,int>> factor(ll x) {
    vector<pair<ll,int>> res;
    for (int p : primes) {
      int y = 0;
      while (x%p == 0) x /= p, ++y;
      if (y != 0) res.emplace_back(p,y);
    }
    if (x != 1) res.emplace_back(x,1);
    return res;
  }
};

int main() {
  int n;
  cin>>n;
  Sieve sieve(n);
  ll ans = 0;
  REPe(i, n) {
    vp fc = sieve.factor(i);
    ll tmp = 1;
    REP(i, fc.size()) {
      tmp *= (fc[i].second+1);
    } 
    ans += (ll)i*tmp;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 46504
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
using namespace std;

typedef pair<int,int> P;

int H,W,N;
int ans = 0;
int dx[] = {1,-1,0,0}, dy[] = {0,0,1,-1};
string map[1000];

P sg[20] = {};	// 要素番号＝数字(０はスタート地点)
				// P(x,y)

int main(void)
{

	cin >> H >> W >> N;
	
	char c;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cin >> c;
			map[i] += c;

			if(c == 'S')
				sg[0] = P(j,i);
			else if(c >= '0' && c <= '9')
				sg[c-'0'] = P(j,i);
		}
		cin.get();
	}

//	for(int i = 0; i <= N; i++)
//		cout << sg[i].first << ' ' << sg[i].second << endl;

	int ans = 0;
	for(int now = 0; now < N; now++){
		queue<P> que;
		int **d;	d = new int *[H];	for(int aa = 0; aa < H; aa++){d[aa] = new int [W]; for(int bb = 0; bb < W; bb++)d[aa][bb] = 0;}
		que.push(sg[now]);
		d[sg[now].second][sg[now].first] = 0;

		while(que.size()){
			P pos = que.front();
			que.pop();

			if(sg[now+1] == pos){
//				cout << d[pos.second][pos.first] << ' ' << sg[now+1].first << ',' << sg[now+1].second << endl;
				ans += d[pos.second][pos.first];
				break;
			}

			for(int i = 0; i < 4; i++){
				int nx = pos.first + dx[i];
				int ny = pos.second+ dy[i]; 
				if(nx < 0 || ny < 0 || nx >= W || ny >= H)
					continue;
				if(map[ny][nx] == 'X' )
					continue;

				if(d[ny][nx] == 0){
					d[ny][nx] = d[pos.second][pos.first] + 1;
					que.push(P(nx,ny));
				}
			}
		}
		for(int aa = 0; aa < H; aa++)
			delete[]d[aa];
		delete [] d;
		

	}

	cout << ans << endl;
}

Measured memory_bytes: 6048
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

int main()
{
    ll M;
    cin >> M;
    ll cnt, sum;
    cnt = sum = 0;
    rep(i, 0, M)
    {
        ll d, c; 
        cin >> d >> c;
        cnt += c;
        sum += d*c;
    }
    // cout << 9*cnt + sum << endl;
    ll num = 9LL*cnt + sum;
    ll ans = num/9 - 1 - int(num%9 == 0) ;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <stdio.h>

using namespace std;
typedef long long ll;
const int MOD=998244353;

struct SegTree{
  int n;
  vector<int> node;
  int ui=-2000000010;

public:
  SegTree(vector<int> v){
    n=1;
    while((1<<(n-1))<v.size()) n++;
    node.resize((1<<n)-1,ui);
    for(int i=0;i<v.size();i++){
      node[(1<<(n-1))-1+i]=v[i];
    }
    for(int i=(1<<(n-1))-2;0<=i;i--){
      node[i]=max(node[2*i+1], node[2*i+2]);
    }
  }

  int compare(int a,int b){
    return max(a,b);
  }

  int find(int a, int b){
    int l=((1<<(n-1))-1)+a;
    int r=((1<<(n-1))-1)+b;

    return find_(l,r);
  }

  int find_(int l, int r){
    if(l==r || l==r-1) return compare(node[l],node[r]);
    else{
      int ans=ui;
      if(l%2==0){
	ans=compare(ans,node[l]);
      }
      if(r%2==1){
	ans=compare(ans,node[r]);
      }
      ans=compare(ans,find_(l/2,(r-2)/2));
      return ans;
    }
  }

  int get(int p){
    return node[(1<<(n-1))-1+p];
  }
  
  int set(int p, int val){
    int cur=(1<<(n-1))-1+p;
    node[cur]=val;
    for(int i=0;i<n-1;i++){
      cur=(cur-1)/2;
      node[cur]=compare(node[2*cur+1],node[2*cur+2]);
    }
    return 0;
  }
    
  int show(){
    int cur=0;
    for(int i=0;i<n;i++){
      for(int j=cur;j<2*cur+1;j++){
	//cout << "(" << j << ")" << node[j];
      }
      cur=2*cur+1;
      //cout << endl;
    }
    return 0;
  }
};
    

int main(){
  int N;
  cin >> N;
  vector<pair<int,int>> X(N);
  for(int i=0;i<N;i++){
    cin >> X[i].first >> X[i].second;
  }

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

  vector<int> st(N);
  for(int i=0;i<N;i++){
    st[i]=X[i].first+X[i].second;
    //cout << st[i] << endl;
  }
  SegTree T(st);

  X.push_back(make_pair(2000000010,0));
  vector<int> dp(N+1);
  dp[N-1]=2;
  dp[N]=1;
  
  for(int i=N-2;0<=i;i--){
    T.set(i,T.find(i,
		   distance(X.begin(),
			    upper_bound(X.begin(),X.end(),
					make_pair(T.get(i),0)))-1));
    //T.show();
    dp[i]=dp[i+1]+
      dp[distance(X.begin(),upper_bound(X.begin(),X.end(),
					make_pair(T.get(i),0)))];
    dp[i]%=MOD;
  }
  
  cout << dp[0] << endl;
  
  return 0;
}


Measured memory_bytes: 7664
/*
 
 * This code is written by Sanskar Agarwal
 
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;
using namespace std;

#define ll long long
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define VPLL vector<PLL>
#define VPII vector<PII>
#define PQ priority_queue<PLL,VPLL, greater<PLL> > 
#define PQI priority_queue<PII,VPII,greater<PII> >
#define S second
#define F first
#define PB push_back

ll n,dp[400][400],a[400];
const ll MAX=1000000000000000;

ll solve(ll x,ll y)
{
    //cout << x << " " << y << "\n";

    if(x==y) {
        return dp[x][y]=0;
    }
    if(x>y)
        return dp[x][y]=MAX;
    if(dp[x][y]!=-1)
        return dp[x][y];

    ll sm=MAX,msm=0;
    for(ll i=x;i<=y;i++)
        msm+=a[i];
    for(ll i=x;i<y;i++) {
        sm=min(sm,solve(x,i)+solve(i+1,y)+msm);
    }
    return dp[x][y]=sm;
}


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

    
    cin>>n;
    for(ll i=0;i<n;i++) {
        cin>>a[i];
    }
    memset(dp,-1,sizeof dp);

    cout << solve(0,n-1);
  
    return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn=2e3+5;
const ll p=998244353;

int main(){
	ios::sync_with_stdio(false);
	ll L,R;
	cin>>L>>R;
	
	if (R-L>=2019){
		cout<<0<<endl;
	}else{
		ll ans=100000;
		for (int i=L;i<=R;i++){
			for (int j=i+1;j<=R;j++){
				ans=min(ans,(ll)i*j%2019);
			}
		}
		cout<<ans<<endl;
	}
	
	

}


Measured memory_bytes: 256
lunnum = [None for i in range(100)]
lunnum[1] = (1, 2, 3, 4, 5, 6, 7, 8, 9)

def gen_keta(x):
    for y in lunnum[x-1]:
        r = y % 10
        if r > 0:
            yield 10*y + (r-1)
        yield 10*y + r
        if r < 9:
            yield 10*y + (r+1)

for i in range(2,11):
    lunnum[i] = tuple(gen_keta(i))

def ans(x):
    n = 1
    while True:
        if x <= len(lunnum[n]):
            return lunnum[n][x-1]
        x -= len(lunnum[n])
        n += 1

k = int(input())
print(ans(k))

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


vector<ll> divisor(ll n){
    vector<ll> res;
    for(ll i = 1; i * i <= n; i++){
        if(n % i != 0) continue;
        res.push_back(i);
        if(i * i != n)
            res.push_back(n / i);
    }
    return res;
}

int main(){
    ll n;
    cin >> n;
    ll cnt = 0;
    for(auto x : divisor(n)){
        if(x == 1) continue;
        ll cp = n;
        while(cp % x == 0)
            cp /= x;
        if(cp % x == 1)
            cnt++;
    }
    cnt += divisor(n-1).size() - 1;
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  string S;
  cin >> S;

  ll ret = 0;
  map<ll,ll> memo;
  memo[0] = 1;
  
  ll MOD = 2019;
  ll base = 0;
  ll p = 1;
  for(int i=S.size()-1; i>=0; i--){
    ll x = (p * (S[i]-'0'))%MOD;
    base += x;
    base %= MOD;
    //cout << i+1 << " " << S[i] << " " << x << " " << base << endl;
    p *= 10;
    p %= MOD;
    
    ret += memo[base];
    memo[base]++;
  }

  cout << ret << endl;
  
  return 0;
}


Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int ans=0;
	while (n--)
	{
		int a,b;
		cin>>a>>b;
		ans+=1+b-a;

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

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

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<setprecision(9)<<fixed;
	
	int a;
	cin>>a;
	int a1=a;
	int s=0;
	for(int i=0;i<3;i++)
	{
		s+=a;
		a*=a1;
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  set<int>a,b;
  cin>>n;
  while(n--){
    int x;
    cin>>x;
    a.insert(x);
  }
  cin>>n;
  while(n--){
    int x;
    cin>>x;
    b.insert(x);
  }
  vector<int>c;
  set_symmetric_difference(a.begin(),a.end(),b.begin(),b.end(),back_inserter(c));
  for(int i=0;i<c.size();i++)cout<<c[i]<<endl;
}



Measured memory_bytes: 23668
# 下、右、上、左
dy = [1, 0, -1, 0]
dx = [0, 1, 0, -1]

H, W = map(int, input().split())
s = [input() for i in range(H)]


def main():
    for y in range(H):
        for x in range(W):

            if s[y][x] == '.':
                continue

            cnt = 0

            for i, j in zip(dy, dx):
                ny = y + i
                nx = x + j

                if ny < 0 or H <= ny\
                        or nx < 0 or W <= nx\
                        or s[ny][nx] == '.':
                    continue

                cnt += 1

            if cnt == 0:
                print("No")
                return

    print("Yes")
    return


main()


Measured memory_bytes: 3064
import sys

def main():
    n = int(input())
    a_list = []*n
    b_list = []*n
    
    for i in range(n):
        a,b = map(int, input().split())
        a_list.append(a)
        b_list.append(b)
    for ii in range(n-2):
        if a_list[ii] == b_list[ii] and a_list[ii+1] == b_list[ii+1] and a_list[ii+2] == b_list[ii+2]:
            print('Yes')
            sys.exit()
    print('No')
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 9192
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int mood) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%mood;
		x = x * x%mood;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n, k;

signed main() {
	cin >> n >> k;
	for (int i = 1; i <= k; i++) {
		if (n - k + 1 < i)cout << 0 << endl;
		else cout << comb(n - k + 1, i)*comb(k - 1, i - 1) % mod << endl;
	}
}

Measured memory_bytes: 256
//https://emtubasa.hateblo.jp/entry/2019/06/12/170716
//勉強させて頂いた記事

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse

//bitの性質
//1100=12,
//0011=3;
//1111=15　となることから(0,0),(0,1),(1,0)を考慮すれば良い

int main(){
    string A;
    cin>>A;
    int L=A.length();
    vector<vector<ll> > dp(L+1,vector<ll>(2,0));
    dp[0][0]=1;

    rep(i,L){
        if(A[i]-'0'==1){//dp[i][j]のjが0の時a+b=Lを表す。
            //自由に選べる時は(0,0),(1,0),(0,1)の通りがある。
            dp[i+1][1]+=dp[i][0]+dp[i][1]*3;//0にするとa+b<Lとなるのでj=1,また、そのまま加算
            dp[i+1][0]+=dp[i][0]*2;//そのため、A[i]がiになるには(1,0),(0,1)の二通りがあるので2をかける
        }else{
            dp[i+1][0]+=dp[i][0];//0の時、(0,0)しか選べないため
            dp[i+1][1]+=dp[i][1]*3;//自由に選んで良いため。
        }
        dp[i+1][1]%=INF;
        dp[i+1][0]%=INF;
    }

    cout<<(dp[L][0]+dp[L][1])%INF<<endl;

    return 0;
}

//a=97,z=122

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

#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)

int main() {
    string S = "ACL";
    int K;
    cin >> K;
    string ans = "";
    rep(i, K) {
        ans += S;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
const int RANDOM1 = chrono::high_resolution_clock::now().time_since_epoch().count();
struct chash {
    int operator()(int x) const { return hash<int>{}(x ^ RANDOM1); }
};
#define ll long long
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define deb(x) cout<<#x<<" : "<<x<<"\n";
#define debug(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\n";
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define all(a) (a).begin(),(a).end()
#define bs binary_search
#define sz size()
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ld long double
#define clr fflush(stdout);
//#define clr cout.flush();
#define N 100001
#define fpr(i,a,b) for(int i=a;i<b;i++)
#define fdr(i,a,b) for(int i=a;i>b;i--)
#define repp(i,a,b,d) for(int i=a;i<b;i+=d)
#define repd(i,a,b,d) for(int i=a;i>b;i-=d)
#define LLMIN LLONG_MIN
#define LLMAX LLONG_MAX
#define AKASH_PATEL ios_base::sync_with_stdio(false);
#define SVNIT_SURAT cin.tie(NULL);cout.tie(NULL);
#define mset(x,a) memset(x,a,sizeof(x));
#define nl cout<<'\n';
#define print(c) cout<<c<<'\n';
#define setp(n) cout << fixed << setprecision(n)
#define take_arr(a,n) fpr(i,0,n) cin>>a[i];
#define print_arr(a,n) for(int i=0;i<n;i++) {cout<<a[i]<<" ";} cout<<'\n';
#define take_mat(mat,n,m) fpr(i,0,n) fpr(j,0,m) cin>>mat[i][j];
#define set_mat(mat,n,m,k) fpr(i,0,n) fpr(j,0,m) mat[i][j]=k;
#define print_mat(dist,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<dist[i][j]<<" ";}cout<<'\n';}
template< class T > bool inside(T a, T b, T c) { return a<=b && b<=c; }
int main()
{
    AKASH_PATEL;
    SVNIT_SURAT;
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5])
    {
        print("Yes")
    }
    else print("No")
    return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

using tl = tuple<ll, ll, ll>;

ll n;
vvl to;

tl dfs(ll v, ll p, ll d) {
    if (v == n - 1) {
        if (d <= 2) return tl(v, p, 2);
        return tl(d, 0, 1);
    }

    tl res = tl(0, 0, 0);
    for (auto nv : to[v]) {
        if (nv == p) continue;
        tl ret = dfs(nv, v, d + 1);
        if (get<2>(ret) != 0) res = ret;
    }
    if (get<2>(res) == 1) {
        ll nd = get<0>(res) - 1;
        ll nh = get<1>(res) + 1;
        if (nd == nh + 2 || nd == nh + 1) return tl(v, p, 2);
        return tl(nd, nh, 1);
    }
    return res;
}

ll cnt(ll v, ll p, ll c) {
    if (v == c) return 0;

    ll res = 1;
    for (auto nv : to[v]) {
        if (nv == p) continue;
        res += cnt(nv, v, c);
    }
    return res;
}

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

    cin>>n;
    to = vvl(n);
    rep(i, n - 1) {
        ll v1, v2;
        cin>>v1>>v2; v1--; v2--;
        to[v1].push_back(v2);
        to[v2].push_back(v1);
    }

    tl res = dfs(0, -1, 0);
    ll c0 = cnt(0, -1, get<0>(res));
    ll cn = cnt(n - 1, n, get<1>(res));
    if (c0 > cn) cout<<"Fennec"<<endl;
    else cout<<"Snuke"<<endl;
}

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

int main()
{
	int nInput=0;
	int nArr[100]={0};
	cin>>nInput;
	int nCount=nInput;

	int nTemp=0;

	while (nInput--)
	{
		cin>>nTemp;
		nArr[nInput]=nTemp;
	}
	for(int i=0;i<nCount;++i)
	{
		if (nCount-1!=i)
		{
			cout<<nArr[i]<<" ";
		}
		else
		{
			cout<<nArr[i];
		}
	}
	cout<<endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 3064
n = int(input())
a = [[0]*n for i in range(n)]
   
for i in range(n):
    v = list(map(int, input().split()))
    u = v[0] - 1
    for j in v[2:]:
        a[u][j - 1] = 1
  
for i in a:
    print(*i)

Measured memory_bytes: 6384
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

static const long long mod = 1000000007;

void prvll(vvll& mp) {
  printf("    ");
  for (size_t j = 0; j < mp[0].size(); j++)
    printf("%4lu%c", j, ((j == mp[0].size() - 1) ? '\n' : ' '));
  for (size_t i = 0; i < mp.size(); i++) {
    printf("%2lu: ", i);
    for (size_t j = 0; j < mp[i].size(); j++)
      printf("%4lld%c", mp[i][j], ((j == mp[i].size() - 1) ? '\n' : ' '));
  }
  cout << endl;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll w, h, n;
  cin >> w >> h >> n;
  vvll mp(h, vll(w, 0));
  rep(i, n) {
    ll x, y, a;
    cin >> x >> y >> a;
    if (a == 1) {
      repLRE(j, 0, x - 1) rep(i, h) mp[i][j] = 1;
    } else if (a == 2) {
      repLRE(j, x, w - 1) rep(i, h) mp[i][j] = 1;
    } else if (a == 3) {
      repLRE(i, 0, y - 1) rep(j, w) mp[i][j] = 1;
    } else {
      repLRE(i, y, h - 1) rep(j, w) mp[i][j] = 1;
    }
  }

  ll ans = h*w;
  rep(i, h) rep(j, w) ans -= mp[i][j];

  //prvll(mp);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <deque>
#include <math.h>
#include <cstring>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <stack>
#include<cassert>
#include <cfloat>
#include <list>
using namespace std ;
#define ll long long
#define submitStage int TCF = 1 ;
#define testStage int TCF = 1000 ;
#define testMyStupedCode TCF--
void FastInputOutput(){
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
void ReadFromFile( string name , string extention ){
    string fullPath = name + "." + extention ;
    freopen( fullPath.c_str() , "r" , stdin ) ;
}
inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}
inline char C(){
    char c ;
    scanf( "%c" , &c ) ;
    return c ;
}
inline ll power(ll x, ll p, ll m){
    ll res = 1;
    while(p){
        if(p & 1)
            res = (res * x) % m;
        x = (x * x) % m;
        p >>= 1;
    }
    return res;
}
long double ModLog(long double base, long double x) {
    return (logl(x) / logl(base));
}

const int N = 1e5 + 5;
ll dp[N][100];
int w[100], v[100], n;
ll solve(int rem, int idx){
     if(rem < 0)
          return -1e12;
     if(idx == n)
          return 0;
     ll &ret = dp[rem][idx];
     if(~ret)
          return ret;
     ret = 0;
     ret = max(ret, solve(rem - w[idx], idx + 1) + v[idx]);
     ret = max(ret, solve(rem, idx + 1));
     return ret;
}
int main(){
     memset(dp, -1, sizeof(dp));
     n = D();
     int W = D();
     for(int i = 0; i < n; ++i)
          w[i] = D(), v[i] = D();
     printf("%lld", solve(W, 0));
     return 0;
}



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

using namespace std;

typedef unsigned long long ull;

int main()
{
  int n, m;
  string s;
  cin >> n >> m >> s;

  ull base = 9937;
  vector<ull> hashed(n + 1, 0), power(n + 1, 0);
  
  power[0] = 1;
  for(int i = 0; i < n; i++){
    power[i+1] = power[i] * base;
    hashed[i+1] = (hashed[i] + s[i]) * base;
  }

  int l = 0, r = 1;
  set<ull> st;

  for(int i = 0; i < m; i++){
    string q; cin >> q;
    if(q == "L++") l++;
    else if(q == "L--") l--;
    else if(q == "R++") r++;
    else if(q == "R--") r--;
    st.insert(hashed[r]-hashed[l]*power[r-l]);
  }
  cout << st.size() << endl;

  return 0;
}

Measured memory_bytes: 20024
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#define ll long long
using namespace std;
int main()
{
    //int k,i,j,tep,x,a[170],m;
    int a,b,c,d,e,f,n;
   // long long int n;
    for(a=1;a<=9;a++)
        for(b=1;b<=9;b++)
          cout<<a<<"x"<<b<<"="<<a*b<<endl;
   // cout<<endl;

    return 0;
}

Measured memory_bytes: 1116
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007ll)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			(3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
template<class T> void chmax(T &a, const T &b){if(a<b)a=b;}
template<class T> void chmin(T &a, const T &b){if(a>b)a=b;}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int in,sum=0;
	vb st(33,false);
	rep(i,n){
		cin>>in;
		sum^=in;
		st[__builtin_ffs(in)]=true;
	}
	int ans=0;
	rrep(i,31){
		if((1<<i)&sum){
			if(st[i+1]){
				ans++;
				sum^=((1<<i)-1);
			}
			else {
				cout<<-1<<endl;
				return 0;
			}
		}
	}
	cout<<ans<<endl;
}

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


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>


ll a, b, c, d, e, ans;

ll gcd(ll a, ll b) {
	return (b == 0 ? a : gcd(b, a % b));
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
int main() {
	cin >> a >> b >> c >> d;
	ans = b - a + 1;
	//cout << ans << endl;
	ans -= (b / c) - ((a - 1) / c);
	//cout << ans << endl;
	ans -= (b / d) - ((a - 1) / d);
	//cout << ans << endl;
	e = lcm(c, d);
	ans += (b / e) - ((a - 1) / e);
	cout << ans << endl;
}	


Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a = INT()
b = INT()

if a > b:
    print("GREATER")
elif a < b:
    print("LESS")
else:
    print("EQUAL")

Measured memory_bytes: 5528
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)

int main() {
  ll n;cin>>n;
  ll cnta =0,cntb =0,cntba =0, out=0;
  for(ll i=0;i<n;++i){
    string s;cin>>s;
    if(s[0]=='B'&&s[s.size()-1]=='A'){
      ++cntba;
    } else if(s[0]=='B'){
      ++cntb;
    } else if(s[s.size()-1]=='A') {
      ++cnta;
    }
    for(int j=0;j<s.size()-1;++j)if(s.substr(j,2) == "AB")++out;
  }
  out += max(0LL, cntba-1);
  if(cntba>0){
    if(cntb>0){
      ++out;
      --cntb;
    }
    if(cnta>0){
      ++out;
      --cnta;
    }
  }
  out += min(cnta,cntb);
  cout << out << endl;
  return 0;
}


Measured memory_bytes: 384