akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); i++)
//#define int long long
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define all(x) x.begin(), x.end()
using pii = pair<int, int>;
using ll = long long;

bool solve() {
    vector<int> rec;
    while (true) {
        int x;
        cin >> x;
        if (x == 0) break;
        rec.push_back(x);
    }
    int las = 0;
    stack<int> stk;
    // stk.push(0);
    int N = rec.size();
    vector<int> dist(N + 1), rem(N + 1);
    int now = 0;
    int pos = 0;
    rem[1] = rec[0];
    las = 1;
    stk.push(1);
    vector<vector<int>> st(N + 1);
    FOR(i, 1, N) {
        while (true) {
            now = stk.top();
            stk.pop();
            if (rem[now] > 0) break;
        }
        // cerr << now << endl;
        rem[now]--;
        int c = rec[i];
        if (c > 0) {
            las++;
            int nxt = las;
            dist[las] = dist[now] + 1;
            rem[nxt] = c - 1;
            if (now == 0) rem[nxt]++;
            if (now != 0) {
                st[now].push_back(nxt);
                st[nxt].push_back(now);
            }
            REP(_, c - 1) stk.push(nxt);
        } else {
            REP(j, las + 1) {
                if (rem[j] && dist[j] - dist[now] == c) {
                    rem[j]--;
                    st[now].push_back(j);
                    st[j].push_back(now);
                    break;
                }
            }
        }
    }
    FOR(i, 1, las + 1) {
        cout << i;
        sort(all(st[i]));
        for (auto x : st[i]) {
            cout << " " << x;
        }
        cout << endl;
    }
}

signed main() {
    // while (solve())
    int q;
    cin >> q;
    while (q--) solve();
}



Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
char c[105];
int main()
{
	int a,b;
    cin>>c;
    for(int i=0;i<=100;i++)
    {
        if(c[i]=='C')
        {
            a=i; break;
        }
    }
    for(int i=a+1;i<=105;i++)
    {
    	if(c[i]=='F')
    	{
    		cout<<"Yes";
    		exit(0);
		}
	}
	cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
  
int n,pos;
vector<int> pre,in,post;
  
void rec(int l,int r){
    if(l>=r)
        return;
    int root = pre[pos++];
    int m = distance(in.begin(),find(in.begin(),in.end(),root));
    rec(l,m);
    rec(m+1,r);
    post.push_back(root);
}
  
void solve(){
    pos = 0;
    rec(0,pre.size());
    for(int i=0;i<n;i++){
        if(i)
            cout<<" ";
        cout<<post[i];
    }
    cout<<endl;
}
  
int main(){
    int k;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>k;
        pre.push_back(k);
    }
  
    for(int i=0;i<n;i++){
        cin>>k;
        in.push_back(k);
    }
    solve();
}


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

int main(){
  int A, B, K;
  cin >> A >> B >> K;
  
  if(B-A+1<=K*2){
    for(int i=A; i<=B; i++) cout << i << endl;
  }
  else{
    for(int i=A; i<A+K; i++){
      cout << i << endl;
    }
    for(int i=B-K+1; i<=B; i++){
      cout << i << endl;
    }
  }
}

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

int main() {
    int n,k,sum=0;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<k;i++) sum+=a[i];
    cout<<sum;
	return 0;
}


Measured memory_bytes: 3652
#include <stdio.h>

#define INF 0x3f3f3f3f

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

	scanf("%d%d", &a, &b);
	max = -INF;
	if (max < a + b)
		max = a + b;
	if (max < a - b)
		max = a - b;
	if (max < a * b)
		max = a * b;
	printf("%d\n", max);
	return 0;
}


Measured memory_bytes: 128
a = []
for i in range(3):
    a.append(list(map(int, input().split())))

n = int(input())

if n < 3:
    print('No')
    exit()

b = []
for i in range(n):
    b.append(int(input()))

hit = [[False for _ in range(3)] for _ in range(3)]
for i in range(3):
    for j in range(3):
        for k in range(n):
            if a[i][j] == b[k]:
                hit[i][j] = True

for i in range(3):
    if hit[i][0] and hit[i][1] and hit[i][2]:
        print('Yes')
        exit()
    if hit[0][i] and hit[1][i] and hit[2][i]:
        print('Yes')
        exit()

if hit[0][0] and hit[1][1] and hit[2][2]:
    print('Yes')
    exit()

if hit[0][2] and hit[1][1] and hit[2][0]:
    print('Yes')
    exit()

print('No')


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

class Program
{
    static void Main(string[] args) {
        int n = int.Parse(Console.ReadLine());
        List<string> s = new List<string>();
        for(int i = 0; i < n; i ++) s.Add(Console.ReadLine());
        int m = int.Parse(Console.ReadLine());
        List<string> t = new List<string>();
        for(int i = 0; i < m; i ++) t.Add(Console.ReadLine());
        Console.WriteLine(solve(s, t));
    }
    static int solve(List<string> s, List<string> t) {
        List<string> l = new List<string>(s.Distinct());
        int[] ans = new int[l.Count()];
        for(int i = 0; i < l.Count(); i ++) {
            ans[i] = s.Count(x => x == l[i]) - t.Count(y => y == l[i]);
            if(ans[i] < 0) ans[i] = 0;
        }
        return ans.Max();
    }
}

Measured memory_bytes: 13280
package main

import (
    "bufio"
    "fmt"
    "os"
)

var r = bufio.NewReader(os.Stdin)

func main() {
    var a, b int
    fmt.Fscan(r, &a, &b)
    
    x1 := a*b
    x2 := (a+b)*2
    fmt.Printf("%v %v\n",x1,x2)
}



Measured memory_bytes: 1144
n, c = list(map(int, input().split()))
tv = []
for i in range(n):
    x, y, z = list(map(int, input().split()))
    tv.append([x, y, z])
channels = [[0 for _ in range(max(tv, key=lambda lst: lst[1])[1] + 1)] for _ in range(c + 1)]
for program in tv:
    start = program[0]
    end = program[1]
    channel = program[2]
    for time in range(start, end+1):
        channels[channel][time] = 1
res = 0
for time in range(len(channels[0])):
    now = 0
    for channel in range(c+1):
        now += channels[channel][time]
    if res < now:
        res = now
print(res)

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

vector<ll> a;

void dfs(int d, ll v) {
    a.push_back(v);
    if (d == 10) return;

    for (int i = -1; i <= 1; i++) {
        int b = v % 10 + i;
        if (b >= 0 && b <= 9) dfs(d + 1, v * 10 + b);
    }
}

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

    for (int i = 1; i < 10; i++) {
        dfs(1, i);
    }

    sort(a.begin(), a.end());
    cout << a[k - 1] << endl;
    return 0;
}


Measured memory_bytes: 5312
#include <stdio.h>

int     main(void)
{
    int x;
    int y;
    int tmp;
    
    while(1)
    {
        scanf("%d %d",&x,&y);
        if (x == 0 && y == 0)
            break;
        if (x > y)
        {
            tmp = x;
            x = y;
            y = tmp;
        }
        printf("%d %d\n",x,y);
    }
    return(0);
}


Measured memory_bytes: 2144
#include <algorithm>
    #include <vector>
    #include <iostream>
     
    using std::cout;
    using std::endl;
    using std::cin;
     
    int main()
    {
    	int N;
    	int K;
     
    	cin >> N;
    	cin >> K;
     
    	std::vector<int> H;
    	int h;
     
    	for (int i = 0; i < N; i++) {
    		cin >> h;
    		H.push_back(h);
    	}
     
    	std::sort(H.begin(), H.end());
     
    	unsigned int M = 0xFFFFFFFF;
    	int b;
     
    	for (int i = 0; i <= N - K; i++) {
    		b = H[i + K - 1] - H[i];
    		if (M > b) {
    			M = b;
    		}
    	}
     
    	cout << M << endl;
     
    	return 0;
    }

Measured memory_bytes: 892
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#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 MOD 1000000007
using namespace std;

ll aa[205][205];
long  arr[10];

int main(int argc, char* argv[])
{
    char str[100005]={0};
    scanf("%s", str);

    char str2[100005]={0};
    long i;
    long k=0;
    for(i=0; i<strlen(str); i++) {
        if(i%2==0) {
            str2[k]=str[i];
            k++;
        }
    }
    printf("%s\n", str2);

    return 0;
}


Measured memory_bytes: 384
def main():
    N = int(input())

    freq = {}
    for i in range(1, N+1):
        pair = str(i)[0] + str(i)[-1]
        freq.setdefault(pair, 0)
        freq[pair] += 1
    
    ans = 0
    freq_keys = freq.keys()
    for i in range(1, N+1):
        pair_rev = str(i)[-1] + str(i)[0]
        if pair_rev in freq_keys:
            ans += freq[pair_rev]
    
    print(ans)    


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define __ ios_base::sync_with_stdio(0);cin.tie(0);
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define forn(i,a,n) for(int i=a; i < n; i++)
typedef long long int lli;
typedef long double Double;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int mod = 1e9+7;
const int maxn = 1000005;
const int inf = 1e9;
lli dp[maxn][2][2];
int n;

int main(){__
	cin >> n;
	//push dp
	dp[0][0][0] = 1ll;
	for(int i=0; i <n; i++){
		for(int f1=0; f1 < 2; f1++){
			for(int f2=0; f2 < 2; f2++){
				dp[i+1][f1][f2] =(dp[i+1][f1][f2] +(dp[i][f1][f2] * 8ll)) % mod;
				dp[i+1][1][f2] = (dp[i+1][1][f2] +  dp[i][f1][f2]) % mod;
				dp[i+1][f1][1] = (dp[i+1][f1][1] + dp[i][f1][f2]) % mod;
			}
		}
	}

	cout << dp[n][1][1] << endl;
	return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> p(N+1);
    for(int i = 1;i <= N;i++)   cin >> p[i];
    int ans = 0;
    for(int i = 1;i <= N;i++){
        if(p[i] == i){
            if(i < N)   swap(p[i], p[i+1]);
            else    swap(p[i], p[i-1]);
            ans++;
        }
    }
    cout << ans << endl;
}

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

#define MOD (1000000000+7)
#define N 100000

using namespace std;

typedef long long int ll;

ll f[250000],f_inv[250000],inv[250000];

void init(void)
{
    f[0] = 1;

    for(int i = 1;i < 250000;i++)
	f[i] = f[i-1]*i%MOD; //Calc factorial
    
    inv[1] = 1;
    for(int i = 2;i < 250000;i++)
	inv[i] = inv[MOD%i] * (MOD - MOD/i)%MOD;

    f_inv[0] = 1;
    for(int i = 1;i < 250000;i++)
	f_inv[i] = f_inv[i-1]*inv[i]%MOD;

    return;
}

ll Comb(int n,int r)
{
    if(r > n || r < 0)
	return 0;

    return f[n]*f_inv[r]%MOD * f_inv[n-r]%MOD;
}

int main(void)
{
    ll sum = 0;
    int h,w,a,b;

    cin>>h>>w>>a>>b;

    init();

    int position = h-1-a;
   
    for(int i = b;i < w;i++)
    {
	sum = (sum + Comb(position+i,i)*Comb(w+h-2-(position+1+i),a-1))%MOD;
	
    }

    cout<<sum<<endl;

    return 0;
}



Measured memory_bytes: 6144
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    string s;
    cin >> s;
 
    int cnt[3] = {0};
    for(int i=0;i<s.size();++i){
        cnt[s[i]-'a']++;
    }
 
    sort(cnt, cnt+3);
 
    int a[3]={0};
    for(int i=0;i<s.size();++i){
        a[2-i%3]++;
    }
 
    bool flag = true;
    for(int i=0;i<3;++i){
        if(cnt[i] != a[i]){
            flag = false;
            break;
        }
    }
 
    if(flag)cout << "YES" << endl;
    else cout << "NO" << endl;
 
    return 0;
}

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

int main()
{
  int h, w;
  vector<vector<char>> c(100, vector<char>(100));

  cin >> h >> w;
  for (int i = 0; i < h; i++)
  {
    for (int j = 0; j < w; j++)
      cin >> c[i][j];
  }
  for (int i = 0; i < h; i++)
  {
    for (int j = 0; j < w; j++)
      cout << c[i][j];
    cout << endl;
    for (int j = 0; j < w; j++)
      cout << c[i][j];
    cout << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>

#include<climits>

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

    std::vector<long long > A(N);
    long long ans=1;
    long long s=1000000000000000000;

    for (int i=0;i<N;++i){
        std::cin >> A[i];
        if (A[i]==0){
            ans=0;
            std::cout << ans;
            return 0;
        }
    }
    for (long long  v : A) {
        if (ans > LLONG_MAX /v){
            ans = -1;
            break;
        }
        ans *= v;
        if (ans > s) {
           ans = -1;
            break;
        }
    }

    std::cout << ans;
    return 0;
}

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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
constexpr ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }

int n;
ll l[2005];
void solve() {
    cin >> n;

    rep(i, n) cin >> l[i];

    sort(l, l + n);

    ll ans = 0;
    rep(i, n) rep(j, i) {
        auto le = abs(l[i] - l[j]);
        auto ri = abs(l[i] + l[j]);
        auto lp = upper_bound(l + i + 1, l + n, le);
        auto rp = lower_bound(l + i + 1, l + n, ri);

        ans += max<ll>(0, rp - lp);
    }

    cout << ans << endn;
}

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


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  int sum = 0;
  int x;
  for (int i = 0; i < m; i++) {
    cin >> x;
    sum += x;
  }
  cout << (sum <= n ? n - sum : -1) << endl;
  return 0;
}


Measured memory_bytes: 3180
n,m = $stdin.gets.split.map(&:to_i)
ans_n = ans_m = 0
if n >= 1
  ans_n = n * (n-1)
else
  ans_n = 0
 end
if m >= 1
  ans_m = m * (m-1)
else
  ans_m = 0
end
puts (ans_n+ans_m)/2

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int N;
int a[100010];
int dp[100010];

int main() {

  cin >> N;
  rep(i, N) {
    cin >> a[i];
  }

  int x = 0;
  rep(i, N) {
    x --;
    if(a[i] == 0)
      x = inf;
    if(a[i] < 0)
      minimize(x, -a[i]);
    maximize(dp[i], x);
  }

  x = 0;
  for(int i=N-1; i>=0; i--) {
    x --;
    if(!a[i])
      x = inf;
    if(a[i] < 0)
      minimize(x, -a[i]);
    maximize(dp[i], x);
  }

  int ans = 0;
  rep(i, N) {
    if(a[i] > 0)
      ans += min(dp[i], a[i]);
  }

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

Measured memory_bytes: 3892
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<functional>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};




signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n;
    ll ans=0;
    cin>>n;
    ll a[100010];
    map<ll,ll> mp;
    vll v;
    rep(i,n){
        cin>>a[i];
        mp[a[i]]++;
    }
    for(auto i:mp){
        if(i.sc>=2) v.pb(i.fi);
        if(i.sc>=4) ans=max(ans,i.fi*i.fi);
    }
    sort(all(v));
    reverse(all(v));
    if(v.size()>=2){
        ans=max(ans,v[0]*v[1]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 7296
import sys
input = sys.stdin.readline

U = 4*10**6
MOD = 998244353
 
fact = [1]*(U+1)
fact_inv = [1]*(U+1)
 
for i in range(1,U+1):
    fact[i] = (fact[i-1]*i)%MOD
fact_inv[U] = pow(fact[U], MOD-2, MOD)
 
for i in range(U,0,-1):
    fact_inv[i-1] = (fact_inv[i]*i)%MOD
 
def perm(n, k):
    if k < 0 or k > n:
        return 0
    z = fact[n]
    z *= fact_inv[n-k]
    z %= MOD
    return z

def comb(n, k):
    if k < 0 or k > n:
        return 0
    z = fact[n]
    z *= fact_inv[k]
    z %= MOD
    z *= fact_inv[n-k]
    z %= MOD
    return z

n, m = map(int, input().split())
ans = 0
for k in range(m%2, min(n, m)+1, 2):
  ans += comb((3*m-k)//2+n-1, n-1) * comb(n, k)
  ans %= MOD
cnt = 0
for k in range(m):
  cnt += comb(k+n-2, n-2)
  cnt %= MOD
cnt *= n
cnt %= MOD
ans -= cnt
ans %= MOD
print(ans)

Measured memory_bytes: 179164
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();		
			switch (S) {
				case "MON":
					System.out.println(6);
					break;
				case "TUE":
					System.out.println(5);
					break;
				case "WED":
					System.out.println(4);
					break;
				case "THU":
					System.out.println(3);
					break;
				case "FRI":
					System.out.println(2);
					break;
				case "SAT":
					System.out.println(1);
					break;
				default:
					System.out.println(7);
					break;
			}
	}
}

Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
const int M=1e9+7;
int n,x,y,z,i,ans,k,now,s,st,f[42][1<<17],ban;
int main(){
	scanf("%d%d%d%d",&n,&x,&y,&z);
	ans=1;
	for (i=1;i<=n;i++) ans=10ll*ans%M;
	ban=(1<<z-1)|(1<<y+z-1)|(1<<x+y+z-1),st=(1<<x+y+z)-1;
	f[0][0]=1;
	for (i=0;i<n;i++)
		for (s=0;s<=st;s++) if (f[i][s])
			for (k=1;k<=10;k++){
				now=((s<<k)|(1<<k-1))&st;
				if ((now&ban)!=ban) (f[i+1][now]+=f[i][s])%=M;
			}
	for (i=0;i<=st;i++) (ans-=f[n][i])%=M;
	printf("%d",(ans+M)%M);
}

Measured memory_bytes: 19328
/* [Template].cpp 
Example code to use when starting new code. This particular problem was problem 
977A_Wrong_Subtraction from CodeForces

Compile: g++  -o C.exe C.cpp 
Execute: ./C
*/ 

#include <cstdio>
#include <iostream>
#include <cmath> 
#include <limits> 
#include <iomanip>
#include <cstring> 
#include <bits/stdc++.h>
#include <string>  
using namespace std;

int main() { 	
	long long int x, k, d, 
		opt_num_moves,
		result; 
	
	cin >> x >> k >> d; 
	
	opt_num_moves = x / d; 
	if(abs(opt_num_moves) >= k)
		result = min(
			abs(x - d*k),
			abs(x + d*k)
			); 
	else {// Deal with even/odd parity? 
		k -= abs(opt_num_moves); 
		if(k % 2 == 0) 
			result = abs(x - d*opt_num_moves); 
		else 
			result = min(
						abs(x - d*opt_num_moves - d), 
						abs(x - d*opt_num_moves + d)); 
	}
	
	cout << result << endl; 	
	
	return 0; 
} 


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include<string>
#include<cmath>
#include<stack>
#include <vector>
#include<queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
#include<utility>
using namespace std;
using ll = long long;

int main() {
	int n, a,ans=0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		while (a % 2 == 0) {
			a /= 2;
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>

int main()
{ //受け取る文字列の最大の長さ＋１の配列を用意する
    char s[1201];
    scanf("%[^\n]", s);

    //ヌル文字に遭遇するまでループする
    for (int i = 0; s[i] != '\0'; i++)
    {
        //i番目の文字
        char c = s[i];

        if (c >= 65 && c <= 90)
        {
            s[i] = c + 32;
        }

        else if (c >= 97 && c <= 122)
        {
            s[i] = c - 32;
        }
    }
    printf("%s\n", s);
}



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

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

	if(a == 1)
		cout << '0';
	else
	{
		cout << '1';
	}

}


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

int main()
{
int x,y;
  cin>>x>>y;
  cout<<x%y<<endl;
  
  
}


Measured memory_bytes: 764
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

int main()
{
	string s;
	cin>>s;
	if (s=="Sunny") printf("Cloudy\n");
	else if (s=="Cloudy") printf("Rainy\n");
	else printf("Sunny\n");
	return 0;
}

Measured memory_bytes: 256
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N,M,R;
	cin >> N >> M >> R;
	vector<int> path(R);
	for(int i=0;i<R;++i){
		cin >> path[i];
		--path[i];
	}
	vector< vector<LL> > dist(N,vector<LL>(N,LINF));
	for(int i=0;i<N;++i){
		dist[i][i] = 0;
	}
	int a,b,c;
	for(int i=0;i<M;++i){
		cin >> a >> b >> c;
		--a;--b;
		dist[a][b] = c;
		dist[b][a] = c;
	}

	for(int k=0;k<N;++k){
		for(int i=0;i<N;++i){
			if( dist[i][k] >= LINF ) continue;
			for(int j=0;j<N;++j){
				if( dist[k][j] >= LINF ) continue;
				dist[i][j] = min(dist[i][j],dist[i][k]+dist[k][j]);
			}
		}
	}

	sort( path.begin(), path.end() );
	LL ans = LINF;
	do{
		LL res = 0;
		for(int i=1;i<R;++i){
			res += dist[ path[i-1] ][ path[i] ];
		}
		ans = min(ans,res);
	}while( next_permutation( path.begin(), path.end() ) );

	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 640
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int House[][][] = new int[4][3][10];
    int N = scanner.nextInt();
    int x,y,z,p;

    for(int i=0;i<N;i++){
      x = scanner.nextInt();
      y = scanner.nextInt();
      z = scanner.nextInt();
      p = scanner.nextInt();
      House[x-1][y-1][z-1] += p;
    }

    for(x=0;x<4;x++){
      for(y=0;y<3;y++){
        for(z=0;z<10;z++){
          System.out.print(" " + House[x][y][z]);
        }
        System.out.print("\n");
      }
      if(x!=3){
        System.out.println("####################");
      }
    }
  
  }
}



Measured memory_bytes: 29252
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}

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

    ll r; cin >> r;
    cout << 3 * r * r << endl;

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdio>
#define EPS 1e-10
#define F first
#define S second
using namespace std;
typedef pair<int,double> P;

bool cmp(const P &p,const P &q){
  if(!(fabs(p.S-q.S)<=EPS))return p.S < q.S;
  return p.F > q.F;
}


int main(){
  P info[30];
  bool used[30];
  for(int i=0;i<24;i++){cin >> info[i].F >> info[i].S;used[i] = false;}
  sort(info,info+7,cmp);
  printf("%d %.2lf\n",info[0].F,info[0].S);used[info[1].F] = true;
  printf("%d %.2lf\n",info[1].F,info[1].S);used[info[0].F] = true;
  sort(info+8,info+15,cmp);
  printf("%d %.2lf\n",info[8].F,info[8].S); used[info[8].F] = true;
  printf("%d %.2lf\n",info[9].F,info[9].S); used[info[9].F] = true;
  sort(info+16,info+23,cmp);
  printf("%d %.2lf\n",info[16].F,info[16].S); used[info[16].F] = true;
  printf("%d %.2lf\n",info[17].F,info[17].S); used[info[17].F] = true;
  sort(info,info+23,cmp);
  int cnt = 0;
  for(int i=0;i<24;i++){
    if(!used[info[i].F]){
      cnt++;
      printf("%d %.2lf\n",info[i].F,info[i].S);
    }
    if(cnt == 2)break;
  }
}

Measured memory_bytes: 1252
n, m = map(int, input().split())
A = [input() for i in range(n)]
B = [input() for i in range(m)]

flag = False
for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            for l in range(m):
                if A[i+k][j+l] == B[k][l]:
                    flag = True
                else:
                    flag = False
                    break
    if k == m-1 and l == m-1 and flag:
        break

if flag:
    print('Yes')
else:
    print('No')


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

using namespace std ;

const int MAX = 5000 + 10 ;

int to[MAX] ;
long long c[MAX] , pref[MAX] ;
int n , k , k2 ;

bool vis[MAX] ;

long long x = 0 , sum ;

long long ans = -4e18 ;

int dfs(int node)
{
	if(vis[node])
		return node ;
	x += c[node] ;
	if(k > 0)
		ans = max(ans , x) ;
	--k ;
	vis[node] = 1 ;
	return dfs(to[node]) ;
}

int len ;

void check(int a)
{
	if(a < 0)
		return ;
	int y = min(len , k - a * len) ;
	ans = max(ans , sum * a + pref[y] + x) ;
}

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n>>k ;
	for(int i = 1 ; i <= n ; ++i)
		cin>>to[i] ;
	for(int i = 1 ; i <= n ; ++i)
		cin>>c[i] ;
	k2 = k ;
	for(int i = 1 ; i <= n ; ++i)
	{
		k = k2 ;
		memset(vis , 0 , sizeof(vis)) ;
		x = 0 ;
		int node = dfs(to[i]) ;
		if(k <= 0)
			continue ;
		int cur = to[node] ;
		sum = c[node] , pref[0] = 0 , pref[1] = max(0ll , c[node]) ;
		int idx = 1 ;
		while(cur != node)
		{
			idx++ ;
			sum += c[cur] ;
			pref[idx] = max(pref[idx-1] , sum) ;
			cur = to[cur] ;
		}
		len = idx ;
		check(0) ;
		check(k / idx) ;
		check(k / idx - 1) ;
	}
	return cout<<ans<<"\n" , 0 ;
}		

Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'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'};
char moji2[26]={'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'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)
template<class T> bool chmax(T &a,  T b) {if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a,  T b) {if(a>b){a=b; return 1;} return 0;}
bool Add(int &a,int b){a = (a + b) % MOD;}
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

signed main(){
    int n;
    cin >> n;
    pair<int,int> A[n];
    REP(i,n){
        cin >> A[i].fi;
        A[i].se = i + 1;
    }
    sort(A,A+n);
    REP(i,n) cout << A[i].se << " ";
    cout << endl;


}

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

int main(){
    string a, b;
    cin >> a >> b;
    int size = a.length();
    int i;
    int cnt = 0;
    for (i = 0; i < size; i++){
        if (a[i] == b[i]) {
            cnt++;
        }
    }
    if(cnt == size){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


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

int main () {
  int N, ans;
  cin >> N;
  ans = 0;
  vector<int> A(N);
  
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A.at(i) = a;
  }
  
  bool flag = true;
  while (flag) {
    for (int i = 0; i < N; i++) {
      if (A.at(i) % 2 == 1) {
        flag = false;
        break;
      }
    }
    if (flag) {
      ans++;
      for (int i = 0; i < N; i++) {
        A.at(i) /= 2;
      }
    }
  }
  
  cout << ans << endl;
}
  
    

Measured memory_bytes: 256
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
typedef long long ll;

struct K {
  int p, y, i;
};
K ks[100000+10];
bool operator<(const K& k1, const K& k2) {
  return k1.y < k2.y;
}

int sz[100000+10];
char buf[100000+10][50];

int main(void) {
  int n, m;
  scanf("%d%d", &n, &m);
  REP(i, m) {
    scanf("%d%d", &ks[i].p, &ks[i].y);
    ks[i].i = i;
  }
  sort(ks, ks + m);
  REP(i, m) {
    sz[ks[i].p]++;
    sprintf(buf[ks[i].i], "%06d%06d", ks[i].p, sz[ks[i].p]);
  }
  REP(i, m) {
    puts(buf[i]);
  }
  
  return 0;
}


Measured memory_bytes: 7936
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W, D = lr()
A = [lr() for _ in range(H)]
Q = ir()
grid = [None] * (H*W + 1) # 1-indexed
for i in range(H):
    for j in range(W):
        grid[A[i][j]] = (i, j)

next_D = [0] * (H*W + 1)
for i in range(1+D, H*W + 1):
    next_D[i] = abs(grid[i][0] - grid[i-D][0]) + abs(grid[i][1] - grid[i-D][1])
    next_D[i] += next_D[i-D]

for i in range(Q):
    l, r = lr()
    answer = next_D[r] - next_D[l]
    print(answer)

# 49


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

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//template <typename T> using orderMSet =
//tree <T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef unsigned long long llu;
#define filein freopen("input.txt", "r", stdin)
#define fileout freopen("output.txt", "w", stdout)
#define inf 1000000000000000018
#define mod 1000000007
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>

string s;

bool isPal(int l, int r)
{
    while(l < r) {
        if(s[l] != s[r]) return false;
		l++, r--;
    }
    return true;
}

int main()
{
	cin>>s;

	int l = 0, r = s.size()-1, pl = 0, pr = (r/2)-1, tl = ((r+4)/2)-1, tr = r;

    if(isPal(l, r) && isPal(pl, pr) && isPal(tl, tr)) {
		cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 *
 * @author lenovo
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        System.out.println((n-1)*(m-1));
    }
    
}


Measured memory_bytes: 21844
#include <cstdio>
#include <map>
#include <vector>
using namespace std;
#define sz(x)          (int)((x).size(x))
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define REP(i, x, y)  for (__typeof(x) i = x; i < y; i++)
#define REPI(i, x, y)  for (__typeof(x) i = x; i > y; i--)
typedef long long      ll;
typedef pair<int, int> P;
typedef pair<P, int>   PP;
typedef vector<int>    VV;
typedef vector<P>      VVP;
typedef vector<PP>     VVPP;
const   int            INF = 2<<20;
const   double         EPS = 1E-8;

bool rec(int g, int k) {
  if (g+k<1||g<0||k<0) return false;
  if (g+k==1) return true;

  bool a = false;
  bool b = false;
  if (k > 1)
    a=rec(g+1, k-2);
  else if (g > 1)  b = rec(g-1, k);
  return a || b;
}

int main() {
  sci(N);
  int a;
  int g = 0;
  int k = 0;
  for(int i=0; i<N; i++) {

    scanf("%d", &a);
    if (a%2==0) g++;
    else k++;
  }
  printf(rec(g,k)?"YES":"NO");
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef complex<ld> compd;
#define quickIO()	{cin.tie(0);	cout.sync_with_stdio(false);}
#define reach(i,a)	for(auto i:a)
#define rep(i,n)	for(int i=0;i<((int)n);i++)
#define REP(i,n)	for(int i=0;i<=((int)n);i++)
#define srep(i,a,n)	for(int i=a;i<((int)n);i++)
#define SREP(i,a,n)	for(int i=a;i<=((int)n);i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define RREP(i,n)	for(int i=n;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define mt	make_tuple
#define pb	push_back
int bitcnt(ll x) {
	x = ((x & 0xAAAAAAAAAAAAAAAA) >> 1) + (x & 0x5555555555555555);
	x = ((x & 0xCCCCCCCCCCCCCCCC) >> 2) + (x & 0x3333333333333333);
	x = ((x & 0xF0F0F0F0F0F0F0F0) >> 4) + (x & 0x0F0F0F0F0F0F0F0F);
	x = ((x & 0xFF00FF00FF00FF00) >> 8) + (x & 0x00FF00FF00FF00FF);
	x = ((x & 0xFFFF0000FFFF0000) >> 16) + (x & 0x0000FFFF0000FFFF);
	x = ((x & 0xFFFFFFFF00000000) >> 32) + (x & 0x00000000FFFFFFFF);
	return x;
}
int bitcnt(int x) {
	x = ((x & 0xAAAAAAAA) >> 1) + (x & 0x55555555);
	x = ((x & 0xCCCCCCCC) >> 2) + (x & 0x33333333);
	x = ((x & 0xF0F0F0F0) >> 4) + (x & 0x0F0F0F0F);
	x = ((x & 0xFF00FF00) >> 8) + (x & 0x00FF00FF);
	x = ((x & 0xFFFF0000) >> 16) + (x & 0x0000FFFF);
	return x;
}
ll sqrtll(ll x) {
	ll left = 0, right = x;
	rep(i, 100) {
		ll mid = (left + right) >> 1;
		if (mid*mid <= x)	left = mid;
		else	right = mid;
	}
	return left;
}
ll gcd(ll a, ll b) {
	return a % b == 0 ? b : gcd(b, a%b);
}
#define debug(x)	printf("Case #%d: ", x)
#define DEBUG 0
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ld eps = 1e-9;
const int dx[] = { 1,0,-1,0,0 };
const int dy[] = { 0,1,0,-1,0 };

int main() {
	int n;	cin >> n;
	string head = "MARCH";
	vector<ll> cnt(5);
	rep(i, n) {
		string s;	cin >> s;
		rep(j, 5) {
			if (head[j] == s[0]) {
				cnt[j]++;
				break;
			}
		}
	}
	ll ret = 0;
	rep(i, 5)	rep(j, i)	rep(k, j) {
		ret += cnt[i] * cnt[j] * cnt[k];
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) V.begin(), V.end()
#define L_B lower_bound
#define U_B upper_bound
#define pb push_back
#define ll long long
#define rep(i,n) for (i = 0; i < n; ++i) 
#define REP(i,k,n) for (i = k; i <= n; ++i) 
#define REPR(i,k,n) for (i = k; i >= n; --i)
using namespace std;
template<class T, class T1> int chkmin(T &x, const T1 &y) { return x > y ? x = y, 1 : 0; }
template<class T, class T1> int chkmax(T &x, const T1 &y) { return x < y ? x = y, 1 : 0; }
const int MAXN = (1 << 20);

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE 
   freopen("input.txt", "r", stdin); 
   //freopen("error.txt", "w", stderr); 
  freopen("output.txt", "w", stdout); 
#endif   
 ll T = 1 ;
 //cin>>T;
 for(ll t=1;t<=T;t++)
{
  ll n;
  cin>>n;
 cout<<n*n;

}
  return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>

#define SIZE 200000

using namespace std;

int main() {
    long long int A,B,i,j,k,M,K,Q;
    long X,N,Y,Z;
    long p[200];
    long h[202];
  //  long long int A[100][100];

cin >> X >> N;
for (i=0;i<N;i++)
  cin >> p[i];

 for (i=0;i<202;i++)
  h[i] = 1;

  for (i=0;i<N;i++)
    h[p[i]] = 0;

 long encore;
 encore = 1;

 Y=X;
 Z=X;
 while (encore) {
   if (h[Y]) {
     encore = 0;
     cout << Y << endl;
   }
   else {
     Y--;
     if (h[Z]) {
       encore = 0;
       cout << Z << endl;
     }
     else Z++;
   }
 }

  return 0;

}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  string s;
  cin>>s;
  if(s.size()<2||s.size()%2!=0) {
    cout << "No" << endl;
    return 0;
  }
  rep(i,s.size()) {
    if(i%2==0) {
      if(s[i]!='h') {
	cout << "No" << endl;
	return 0;
      }
    } else {
      if(s[i]!='i') {
	cout << "No" << endl;
	return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
N, C, K = map(int,input().split())
T = [int(input()) for k in range(N)]
T = sorted(T)

p = C
d = T[0]+K
ans = 1
for t in T:
    if p == 0 or t > d:
        d = t+K
        p = C-1
        ans += 1
    else:
        p -= 1

print(ans)

Measured memory_bytes: 8280
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<P,P> PP;
const ll MOD=998244353;
const ll MAX_N=500010;
const ll INF=100100100100100;


int main(){
    map<string, vector<P> > mp;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        string s;
        int p;
        cin>>s>>p;
        mp[s].push_back(P(-p,i+1));
    }
    for(auto vp:mp){
        sort(vp.second.begin(), vp.second.end());
        for(auto p:vp.second){
            cout<<p.second<<endl;
        }
    }
}

Measured memory_bytes: 3232
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset> 
using namespace std;
typedef long long ll;
ll n;
ll a[200005];
ll b[1000006]={0};
int main(void)
{
	scanf("%lld",&n);
	for(ll i=0;i<n;i++) scanf("%lld",&a[i]);
	for(ll i=0;i<n;i++)
	{
		b[a[i]]++;
	}
	sort(a,a+n);
	ll cnt=0;
	for(ll i=0;i<n;i++)
	{
		bool ok=true;
		if(b[a[i]]!=1||(a[i]>1&&b[1]!=0)) ok=false;
		else
		{
			for(ll j=2;j*j<=a[i];j++)
			{
				if(a[i]%j==0&&(b[a[i]/j]!=0||b[j]!=0))
				{
					ok=false;
					break;
				}
			}
		}
		if(ok) cnt++;
	}
	printf("%lld",cnt);
}

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

int main()
{
    int h,w;
    cin >> h >> w;
    vector<string> c(h);
    for(int i = 0;i < h;i++){
        cin >> c[i];
    }
    for(int i = 0;i < h;i++){
        cout << c[i] << endl;
        cout << c[i] << endl;
    }
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
namespace io{
    #define re register
    #define ll long long
    #define inf 0x3f3f3f3f
    #define il inline 
    #define in1(a) read(a)
    #define in2(a,b) in1(a),in1(b)
    #define in3(a,b,c) in2(a,b),in1(c)
    #define in4(a,b,c,d) in2(a,b),in2(c,d)
    il void readl(ll &x){
        x=0;ll f=1;char c=getchar();
        while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
        while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
        x*=f;
    }
    il void read(int &x){
        x=0;int f=1;char c=getchar();
        while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
        while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
        x*=f;
    }
}using namespace io;
int main(){
	int k,x;
	in2(k,x);
	for(re int i=x-k+1;i<=x+k-1;i++) printf("%d ",i);
	return 0;
} 

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Numerics;


class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        int num = int.Parse(Reader.ReadLine());

        int ans = (num) * (num + 1) / 2;
        Console.WriteLine(ans);

    }


    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"

10

";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}

Measured memory_bytes: 2776
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
total = sum(A)
ans = 0
for a in A:
    if total <= a * (4 * M):
        ans += 1
if ans >= M:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
  int N, M;
  std::cin >> N >> M;

  std::vector<int> ans(N, -1);

  for (int i=0; i<M; i++) {
    int s, c;
    std::cin >> s >> c;

    if (ans[s-1] != -1 && ans[s-1] != c) {
      std::cout << -1 << std::endl;
      return 0;
    }

    ans[s-1] = c;
  }

  if (N==1) {
    if (ans[0] > 0) {
      std::cout << ans[0] << std::endl;
    } else {
      std::cout << 0 << std::endl;
    }
    return 0;
  } else {
    if (ans[0] == 0) {
      std::cout << -1 << std::endl;
      return 0;
    } else {
      for (int i=0; i<ans.size(); i++) {
        if (ans[i] == -1) {
          if (i==0) {
            std::cout << 1;
          } else {
            std::cout << 0;
          }
        } else {
          std::cout << ans[i];
        }
      }
      std::cout << std::endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
// dile a la jardinera que traigo flores
// corner cases // int vs ll // cin vs scanf
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define sz(x) int(x.size())
#define fill(x,v) memset(x,v,sizeof(x))
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define N 100020
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int n,k,a[128],dp[N];

int main(){

	fastio;
	cin >> n >> k;
	FER(i,0,n) cin >> a[i];

	dp[0] = 0;
	for(int i = 1; i <= k; ++i){
		int mex[102];
		fill(mex,0);
		FER(j,0,n)
			if(i >= a[j]) mex[dp[i-a[j]]] = 1;
		for(int j = 0; ; ++j)
			if(!mex[j]){
				dp[i] = j;
				break;
			}
	}

	if(dp[k]) cout << "First" << endl;
	else cout << "Second" << endl;

	return 0;
}


Measured memory_bytes: 640