akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <numeric>
#include <bits/stdc++.h>
using namespace std;
using lint = long long;

int main(){
    // input
    lint N;
    cin >> N;
    vector<int> a(N);
    for( int n=0; n<N; n++ ){
        cin >> a[n];
    }

    // calc
    int p = 1; 
    int ans = 0;
    for( int n=0; n<N; n++ ){
        if(a[n] == p){
            p++;
        }else{
            ans++;
        }
    }
    if( ans==N ){
        ans = -1;
    }

    // out
    cout << ans << endl;
} 

Measured memory_bytes: 1024
N = int(input())

def concat(li):
  return ''.join([str(l) for l in li])

import itertools
def init_dp(n):
  dp = {}
  for s in itertools.product(['A', 'G', 'C', 'T'],['A', 'G', 'C', 'T'],['A', 'G', 'C', 'T']):
    st = concat(s)
    if check3(st) == 0:
        dp[st] = n
  return dp

def check3(s):
  s1 = s
  s2 = s[0] + s[2] + s[1]
  s3 = s[1] + s[0] + s[2]
  if 'AGC' in '_'.join([s1, s2, s3]):
  	return 1
  return 0

def check4(s):
  s1 = s
  s2 = s[1] + s[0] + s[2] + s[3]
  s3 = s[0] + s[2] + s[1] + s[3]
  s4 = s[0] + s[1] + s[3] + s[2]
  if 'AGC' in '_'.join([s1, s2, s3, s4]):
  	return 1
  return 0
  
def update_dp(dp, next_dp, k, s):
  next4 = k + s  
  if check4(next4) == 0:
	  next_dp[next4[1:]] += dp[k]
  return next_dp

dp = init_dp(1)
for i in range(3, N):
  next_dp = init_dp(0)
  for k in dp.keys():
    for s in ['A', 'G', 'C', 'T']:
      next_dp = update_dp(dp, next_dp, k, s)
  dp = next_dp.copy()

mx = 10**9 + 7
ans = 0
for k in dp.keys():
  ans += dp[k] 
  ans %= mx
print(ans)

Measured memory_bytes: 3188
/*

Polygon - Area(https://onlinejudge.u-aizu.ac.jp/problems/CGL_3_A)
前

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

//********************************template END****************************************//

//外積を計算する関数
double gaiseki(comp a, comp b)
{
	return (conj(a)*b).imag();
}

void solve(void){

	int N;
	cin >> N;

	//compは複素数のtypedefです
	vector <comp> ps(N);

	rep(N, i)
	{
		double x, y;
		cin >> x >> y;
		ps[i] = comp(x, y);
	}

	double ans = 0;

	rep(N-2, i)
	{
		ans += gaiseki(ps[i+1]-ps[0], ps[i+2]-ps[0]) / 2;
	}

	cout << fixed << setprecision(1) << ans << endl;
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}



Measured memory_bytes: 3288
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define dbg(x) cout<<#x<<"="<<x
#define nl cout<<"\n"
#define frn(i,n) for(int i = 0;i < n;i++)
#define fr(i,a,b) for(int i = a;i < b;i++)
#define pb push_back
#define trav(x,c) for(auto &x:c)
using namespace std;
const int mod = 1e9+7;
int toint(string s) {
  int ans = 0;
  for(char x: s) ans = ans*10 + (x - '0');
  return ans;
}

int lcs(string a, string b) {
  int n = a.size(), m = b.size();
  int dp[2][m+1];
  for(int i = 0;i <= n;i++) {
    for(int j = 0;j <= m;j++) {
      if(i==0||j==0) dp[i%2][j] = 0;
      else {
        if(a[i-1] == b[j-1]) dp[i%2][j] = 1 + dp[1-i%2][j-1];
        else dp[i%2][j] = max(dp[i%2][j-1], dp[1-i%2][j]);
      }
    }
  }
  return dp[n%2][m];
}

int sum(int x) {
  int s = 0;
  while(x) {
    s += x%10;
    x /= 10;
  }
  return s;
} 

bool equal(string s) {
  for(int i = 0,j = s.size()/2;j < s.size();i++,j++) {
    if(s[i] != s[j]) return false;
  }
  return true;
}

ll fact(int n) {
  ll ans = 1;
  fr(i,2,n+1) ans = (ans*i)%mod;
  return ans;
}

ull f(ll a, ll x) {
  if(a < 0) return 0;
  return (a/x+1);
}

int main() {
  string s[3];
  queue<char> q[3];
  frn(i,3) {
    cin>>s[i];
    trav(x,s[i]) q[i].push(x);
  }
  int turn = 0;
  string players[] = {"Alice", "Bob", "Charlie"};
  while(true) {
    if(q[turn].empty()) {
      cout<<(char)(turn + 'A');
      return 0;
    }
    int x = q[turn].front()-'a';
    q[turn].pop(); 
    turn = x;
  }
}



Measured memory_bytes: 256
S = input()
K = int(input())

"""
Sが2なら22,3なら333,4なら4444
nならstr(n)*n
5000兆日後のK文字目は何か

1234
1223334444
12222333333333444444444444444
i日後にはn^i増えてる

"""
# 頭が1
# どこまで1を持っているか調べておく
if S[0] == "1":
    for ind,s in enumerate(S):
        if s != "1":
            break
    ind += 1
    if K < ind:
        print(1)
    else:
        print(s)
else:
    print(S[0])   

Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
int x;
  
  int a=0,flag=0;
  scanf("%d",&x);
  for(int i=0;x!=0;i++)
    {
    a=x%10;
  if(a==7)
    {
  
    flag=1;
    break;
  }
    x=x/10;
  }
  if(flag==1)
    printf("Yes");
  else
    printf("No");
      
}


Measured memory_bytes: 1732
#include<bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,n) REP(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;
typedef long long ll;

int main() {
    int n, m, Q;
    cin >> n >> m >> Q;
    int map[n][n];
    int memo[n][n];
    rep(i, n) rep(j, n){
        map[i][j] = 0;
        memo[i][j] = -1;
    }
    rep(i, m) {
        int l, r;
        cin >> l >> r;
        map[--l][--r] += 1;
    }
    rep(i, Q) {
        int p, q;
        cin >> p >> q;
        p--; q--;
        if (memo[p][q] != -1) {
            cout << memo[p][q] << endl;
            continue;
        }
        int count = 0;
        for (int i = p; i <= q; i++) {
            for (int j = 0; j + p <= q; j++)
                count += map[i][j + p];
        }
        memo[p][q] = count;
        cout << count << endl;
    }
    return 0;
}




Measured memory_bytes: 2816
first = list(map(int,input().split()))
second = list(map(int,input().split()))
third = list(map(int,input().split()))

kekka = "Yes"

for i in range(2):
    fsa = first[i+1] - first[i]
    ssa = second[i+1] - second[i]
    tsa = third[i+1] - third[i]
    if fsa == ssa and fsa == tsa:
        pass
    else:
        kekka = "No"

zentai = [first,second,third]

for i in range(2):
    fsa = zentai[i][0] - zentai[i+1][0]
    ssa = zentai[i][1] - zentai[i+1][1]
    tsa = zentai[i][2] - zentai[i+1][2]
    if fsa == ssa and fsa == tsa:
        pass
    else:
        kekka = "No"

print(kekka)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  int min;
  cin >> a >> b >> c;
  for(int i=1; i<=a*b; i++){
    if((a*i)%b==0){
      min = i;
      break;
    }
  }
  for(int i=1; i<=min; i++){
    if((a*i)%b==c){
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}

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

int n, a;

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

    cin >> n;

    for (int i = 0; i < n; i++) {
    	cin >> a;
    	if(a % 2 == 0 && a % 3 != 0 && a % 5 != 0) {
    		cout << "DENIED\n";
    		return 0;
    	}
    }

    cout << "APPROVED\n";
 
    return 0;
}

Measured memory_bytes: 256
input_nums = [int(c) for c in input().split(" ")]
x = input_nums[0]
y = input_nums[1]
ad = 0

if x > y:
  ad = 2
if (x < 0 and y > 0) or (x >= 0 and y <= 0):
  ad = 1
if x == y:
  ad = 0

x, y = abs(x), abs(y)

print(abs(x-y)+ad)


Measured memory_bytes: 3064
#include<iostream>
#include<set>
using namespace std;
struct data{
  int l,r,id;
  bool operator < (const data &p)const{
    return l < p.l;
  }
};
typedef set<data> :: iterator  Iterator;

set < data > t;
int W,Q;

void deletef(){
  int id;
  cin>>id;
  Iterator it=t.begin();
  while(it->id!=id)it++;
  t.erase(it);
}

void insertf(){
  int id,w;
  cin>>id>>w;
  for(Iterator it=t.begin();it->l!=W;it++){
    Iterator it2=it;
    data a=*it,b=*(++it2);    
    if(b.l-a.r<w)continue;
    t.insert((data){a.r,a.r+w,id});
    cout<<a.r<<endl;
    return;
  }
  cout<<"impossible"<<endl;
}

void init(){
  t.clear();
  t.insert((data){-1,0,-1});
  t.insert((data){W,W+1,-1});
}

int main(){
  while(1){
    cin>>W>>Q;
    if(W==0&&Q==0)break;
    init();
    for(int i=0;i<Q;i++){
      char ch;
      cin>>ch;
      if(ch=='s')insertf();
      else deletef();
    }
    cout<<"END"<<endl;
  }
  return 0;
}

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

typedef long double ld;									//XD
#define int long long   
#define PB push_back 
#define all(x) (x).begin(),(x).end()
#define ii pair <int,int>
#define mii map <int,int>
#define vi vector<int> 
#define vii vector< ii >
#define F first
#define S second 
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define repd(i,a,b) for(int i=a; i>=b; --i)
#define sz(x) (int)((x).size())
const long double PI=3.141592653589793238462643383279502884197169399375105820974944;
inline void io(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);         
#endif
}

const int mod = 1e18+7;
const int maxn = 2e3+5;

void solve(){
	int n; cin>>n;
	string s[4] = {"AC", "WA", "TLE", "RE"};
	map <string , int> mp;
	rep(i, 0, n){
		string t; cin>>t; mp[t]++;
	}
	rep(i, 0, 4){
		cout<<s[i]<<" x "<<mp[s[i]]<<"\n";
	}
}
signed main() 
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);// io();
    cout<<setprecision(16);
    int tc=1; //cin>>tc;
    while(tc--){
        solve();cout<<'\n';
    }
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<cmath>
#include<algorithm>
#include <iomanip> 
#include<vector>
#include<queue>
#include<set>
#define fo(i,n) for(ll i=0;i<n;i++)
#define f(i,n) for(ll i=1;i<n;i++)
#define ff(i,k,n) for(ll i=k;i<n;i++)
#define ll long long
#define  vt  vector<ll>
#define pb(x)  push_back(x)
#define   vts  vector<string>
/*Elegizip, elegizip otken sol bir shaktar-ai
 Elendeter zamanymnyn otip bara zhatkanny-ai
Umytylmas-Umytylmas Kairan esil shaktar-ai
Zamanymnyn kolyn bulgap otip bara jatkany-ai
 kairan esil , kairan esil shaktar-ai
kolyn bulgap zamanymnyn otip bara jatkany-ai;*/
using namespace std;



int main()
{ios::sync_with_stdio(0);
string s,t;
cin>>s>>t;
ll ans=0;

fo(i,s.size()-t.size()+1){
    ll ans1=0;
    ff(j,i,t.size()+i){
        if(s[j]==t[j-i]){
            ans1++;
        }

    }
    ans=max(ans1,ans);
}
cout<<t.size()-ans;
}





Measured memory_bytes: 3636
#!/usr/bin/env python3
import sys


def solve(s: str, K: int):
    n = len(s)
    ss = {
        s[i:j]
        for i in range(n)
        for j in range(i + 1, min(n + 1, i + K + 1))
    }
    print(sorted(ss)[K - 1])
 

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    K = int(next(tokens))  # type: int
    solve(s, K)


if __name__ == '__main__':
    main()


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

using namespace std;

#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

#define int long long

const int MOD = 1e9 + 7;

int n;
vector<int> g[6000];
int dp[6000][2][6000];
int where[6000];
int f[6000];
int sz[6000];

void dfs(int v, int p)
{
    sz[v] = 1;
    dp[v][0][1] = 1;
    for (auto u : g[v])
    {
        if (u != p)
        {
            dfs(u, v);
            vector<int> ar0(sz[v] + 1), ar1(sz[v] + 1);
            for (int selV = sz[v]; selV >= 0; selV--) ar0[selV] = dp[v][0][selV], ar1[selV] = dp[v][1][selV];
            for (int selV = sz[v]; selV >= 0; selV--)
            {
                for (int selU = sz[u]; selU >= 0; selU--)
                {
                    int v1 = (dp[v][0][selU + selV] + dp[v][0][selV] * dp[u][0][selU] + dp[v][1][selV] * dp[u][1][selU]) % MOD;
                    int v2 = (dp[v][1][selU + selV] + dp[v][1][selV] * dp[u][0][selU] + dp[v][0][selV] * dp[u][1][selU]) % MOD;
                    dp[v][0][selU + selV] = v1;
                    dp[v][1][selU + selV] = v2;
                }
            }
            for (int selV = sz[v]; selV >= 0; selV--) dp[v][0][selV] = (dp[v][0][selV] + MOD - ar0[selV]) % MOD, dp[v][1][selV] = (dp[v][1][selV] + MOD - ar1[selV]) % MOD;
            sz[v] += sz[u];
        }
    }
    /*cout << v << " " << sz[v] << endl;
    for (int i = 0; i <= sz[v]; i++)
    {
        cout << i << " : " << dp[v][0][i] << " " << dp[v][1][i] << endl;
    }
    cout << endl;*/
    for (int s = 2; s <= sz[v]; s++)
    {
        dp[v][1][0] = (dp[v][1][0] + dp[v][0][s] * f[s]) % MOD;
        dp[v][0][0] = (dp[v][0][0] + dp[v][1][s] * f[s]) % MOD;
    }
    /*cout << v << " " << sz[v] << endl;
    for (int i = 0; i <= sz[v]; i++)
    {
        cout << i << " : " << dp[v][0][i] << " " << dp[v][1][i] << endl;
    }
    cout << endl;*/
}

signed main()
{
    //freopen("input_02.txt", "r", stdin);
    //freopen("output_02.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    f[0] = 1;
    for (int i = 2; i < 6000; i++) f[i] = f[i - 2] * (i - 1) % MOD;
    cin >> n;
    for (int i = 0; i < n - 1; i++)
    {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfs(1, 0);
    cout << (dp[1][1][0] + MOD - dp[1][0][0]) % MOD;
}


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

int main() {
  int n, t, d = 0, m = 1001001001;
  set<int> p;
  scanf("%d %d", &n, &t);
  for(int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    m = min(m, a);
    if(a - m >= d) {
      if(a - m > d) p = set<int>();
      p.insert(m);
      d = a - m;
    }
  }
  printf("%d\n", p.size());
}

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

int tmp,i,ar[11],idx,n;

int main(){
	ios_base::sync_with_stdio(false);

	tmp=111;
	for(i=1;i<=9;i++)ar[i]=i*tmp;

	cin>>n; idx=9;
	while(idx>=1 && n<=ar[idx]){
		idx--;
	}
	cout<<ar[idx+1]<<"\n";
}


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

int main() {
    long long N, K, ans=0;    
    cin >> N >> K;
    vector<long long> a(N);
    for(int i=0; i<N; i++){
	cin >> a[i];
    }

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

    for(int i=0; i<N-K; i++){
	ans+=a[i];
    }
    cout <<ans<<endl;
}



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

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	string s;
	cin >> s;
	string v;
	bool seenb = false;
	for(char x : s){
		if(x == 'A'){
			if(seenb){
				v += 'D';
			}
			seenb = false;
			v += 'A';
		} else if (x == 'B'){
			if(seenb){
				v += 'D';
			}
			seenb = true;
		} else if(x == 'C'){
			if(seenb){
				seenb = false;
				v += 'B';
			} else {
				seenb = false;
				v += 'D';
			}
		}
	}
	int na = 0;
	long long ans = 0;
	for(char x : v){
		if(x == 'D'){
			na = 0;
		} else if(x == 'A'){
			na += 1;
		} else if(x == 'B'){
			ans += na;
		}
	}
	cout << ans << '\n';
}

Measured memory_bytes: 916
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
typedef long long ll;
using namespace std;
int main()
{
    int a[100][100],h,w,n,i,k,b[10000],j,m;
    while(cin>>h>>w)
    {
        cin>>n;
        for(i=0;i<n;i++)
            cin>>b[i];
        j=k=0;
        for(i=0;i<n;i++)
        {
            for(m=0;m<b[i];m++)
            {
                if(j%2==0)
                {
                    a[j][k]=i+1;
                    k++;
                    if(k==w)
                    {
                        j++;
                        k--;
                    }
                }
                else
                {
                    a[j][k]=i+1;
                    k--;
                    if(k==-1)
                    {
                        j++;
                        k++;
                    }
                }
            }
        }
        for(i=0;i<h;i++)
        {
            for(j=0;j<w;j++)
            {
                cout<<a[i][j];
                if(j!=w-1)
                    cout<<" ";
            }
            cout<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 384
def resolve():
    import math
    a, b, h, m = map(int, input().split())
    t1 = math.pi * (h / 6 + m / 360)
    t2 = math.pi * m / 30
    print(((a * math.sin(t1) - b * math. sin(t2)) ** 2 +
           (a * math.cos(t1) - b * math.cos(t2)) ** 2) ** 0.5)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9544
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int n,ans=1; cin>>n;
    vector<vector<int>> path(n);
    rep(i,n)rep(j,n){
        char s; cin>>s;
        if(s-'0'==1) 
        path[i].push_back(j);
    }
    vector<int> seq(n,0);
    queue<int> q;
    q.push(0); seq[0]=1;
    while(!(q.empty())){
        int s=q.front();
        q.pop();
        for(auto to : path[s]){
            if(seq[to]==0){
            seq[to]=(seq[s]==1 ? -1 : 1);
            q.push(to);
            }
        }
    }
    rep(i,n){
        for(auto to : path[i]){
            if(seq[i]*seq[to]==1){
                ans=-1;
            }
        }
    }
    if(ans==-1){
        cout<<ans<<endl;
    }
    else{
        vector<vector<int>> dis(n,vector<int>(n,inf));
        rep(i,n){
            dis[i][i]=0;
            for(auto to : path[i]) dis[i][to]=1;
        }
        rep(k,n)rep(i,n)rep(j,n){
            if(dis[i][j]>dis[i][k]+dis[k][j]){
            dis[i][j]=dis[i][k]+dis[k][j];
            }
        }
        rep(i,n)rep(j,n){
            ans=max(ans,dis[i][j]);
        }
        cout<<ans+1<<endl;
    }
}

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

int main() {
    int n, a;
    cin >> n; 
    vector<double> arr(n);
    double t, min_so_far = 1000000.0;
    int ans = -1;
    cin >> t >> a;

    for (int i = 0; i < n; i++) {
        double x;
        cin >> x;

        if (abs(t - x * 0.006 - a) < min_so_far) {
            min_so_far = abs(t - x * 0.006 - a);
            ans = i + 1;
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 256
/*
author: Apoorv Singh
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds;

typedef vector <int> vi;
typedef vector <long long> vl;
typedef pair <int, int> pii;
typedef pair <long long, long long> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define ll long long
#define pb push_back   
#define all(c) c.begin(), c.end()
#define watch(x) cout << (#x) << " " << (x) << endl;
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second

ll modulo = 1e9 + 7;

template <class X>

void printarr(X arr[], int n)
{
    for (int i = 0; i < n; ++i)
        cout << arr[i] << " ";
    cout << endl;
}

ll fpow(ll a, ll n)
{
    ll ans = 1;
    while (n)
    {
        if (n&1)
            ans = (ans * a)%modulo;
        a = (a*a)%modulo;
        n = n >> 1;
    }
    return ans;
}

/*
const int M = 1e6 + 10;
int composite[M] = {0};

void sieve()
{
    FOR(i,2,M)
    {
        if (!composite[i])
        {
            for (int j = 2*i; j < M; j += i)
                composite[j] = max(composite[j], i);
        }
    }
}
*/

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);   int n;
    cin >> n;
    int k = 0;
    for (int i = 2; i <= 2*n; ++i)
    {
        if ((i*(i-1))/2 == n)
        {
            k = i;
            break;
        }
        if ((i*(i-1))/2 > n)
            break;
    }
    if (!k)
        cout << "No" << endl;
    else
    {
        cout << "Yes" << endl << k << endl;
        vi ans[k];
        int cnt = 0, curr = 1;
        while (curr <= n)
        {
            for (int i = cnt+1; i < k; ++i)
            {
                ans[i].pb(curr);
                ans[cnt].pb(curr);
                ++curr;
            }
            ++cnt;
        }
        for (int i = 0; i < k; ++i)
        {
            cout << k-1;
            for (int a : ans[i])
                cout << ' ' << a;
            cout << endl;
        }
    }
    return 0;
}


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

int main(){
 int R, G, B, N;
 int count = 0;
 
 cin >> R >> G >> B >> N;
 
 for(int i = 0; i <= N/R; i++){
      for(int j = 0; j <= (N-R*i)/G; j++){
           if((N-R*i-G*j)%B == 0) count++; 
        }
    }
    cout << count << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 8080
#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)
#define ALL(c) (c).begin(), (c).end()

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;

typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

long long int MOD = 1000000007;
int N;

int main(){
	string str;
	cin>>str;
	int cnt[27]={0};
	string ans;
	bool flag1=true;
	for(int i=0;i<str.size();i++){
		
		int hoge=str[i]-'a';
		if(cnt[hoge]!=0){
			break;
		}else{
			ans+=str[i];
			cnt[hoge]++;
		}
	}
	bool flag=false;
	char x='a';
	for(int i=0;i<26;i++){
		if(!flag&&cnt[i]==0){
			flag=true;
			ans+=x;
		}
		x=x+1;
	}
	//cout<<x<<endl;
	if(flag){
		cout<<ans<<endl;
	}else{
		//char x;
		int memo=0;
		bool fuga=false;
		for(int i=25;i>=1;i--){
			int X=str[i]-'a';
			int Y=str[i-1]-'a';
			if(!fuga&&Y<X){
				fuga=true;
				memo=i-1;
			}
		}
		//cout<<memo<<endl;
		if(fuga){
			string ans;
			for(int i=0;i<=memo-1;i++){
				ans+=str[i];
			}
			int memoi=str[memo]-'a';
			int check=memo+1;
			for(int i=memo+1;i<=25;i++){
				int hikaku=str[i]-'a';
				if(memoi<hikaku)check=i;
			}
			ans+=str[check];
			cout<<ans<<endl;
		}else{
			cout<<-1<<endl;
		}
	}
}

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

int main()
{
    int n, a;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++)
    {
        a = floor(log10(i) + 1);
        if (a % 2 != 0)
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
satisfaction = b[a[0]-1]
for i in range(1,n):
  if a[i]-a[i-1] == 1:
    satisfaction += b[a[i]-1] + c[a[i]-2]
  else:
    satisfaction += b[a[i]-1]
print(satisfaction)

Measured memory_bytes: 3064
def digit_sum(a):
    res = 0
    while a:
        res += a % 10
        a /= 10
        a = int(a)
    return res

def main():

    d = {}
    MAX = 10**17
    for i in range(18):
        for j in range(1000):
            if i == 0 and j == 0: continue
            tmp = int(str(j) + str(9) * i)
            if tmp > MAX: continue
            d[tmp] = tmp / digit_sum(tmp)

    ls = []
    for a, b in d.items():
        ls.append([b, a])
    ls.sort()

    ls.append([0, MAX])

    k = int(input())

    idx, last = 0, 0
    while k:
        while ls[idx][1] < last: idx += 1
        print(ls[idx][1])
        k -= 1
        last = ls[idx][1]
        idx += 1

    """while True:
        k = int(input())
        if k == 0:
            return True
        print(">", k / digit_sum(k))
    """

if __name__ == "__main__":
    main()



Measured memory_bytes: 6048
#include <stdio.h>
int main(){
    int a[101][101]={{0}};
    int b[101]={0};
    int d[101]={0};
    int i,j,r,c;
    int x;
    int e=0;

    scanf("%d %d",&r,&c);

    for(j=0;j<r;j++){
        for(i=0;i<c;i++){
            scanf("%d",&x);
        a[j][i]=x;
        }
    }

    for(j=0;j<r;j++){
        for(i=0;i<c;i++){
            b[i]+=a[j][i];
        }
    }

    for(j=0;j<r;j++){
        for(i=0;i<c;i++){
            d[j]+=a[j][i];
        }
    }

    for(j=0;j<r;j++){
        for(i=0;i<c;i++){
            printf("%d ",a[j][i]);
        }
        printf("%d\n",d[j]);
    }
    for(i=0;i<c;i++){
        printf("%d ",b[i]);
        e+=b[i];
    }
    printf("%d\n",e);

    return 0;
}


Measured memory_bytes: 2104
#include <iostream>

using namespace std;

int main() {
  while (1) {
    int m, f, r;
    cin >> m >> f >> r;
    if (m == -1 && f == -1 && r == -1) {
      break;
    }

    if (m == -1 || f == -1) {
      cout << "F" << endl;
    } else if (m + f >= 80) {
      cout << "A" << endl;
    } else if (m + f >= 65 && m + f < 80) {
      cout << "B" << endl;
    } else if (m + f >= 50 && m + f < 65) {
      cout << "C" << endl;
    } else if (m + f >= 30 && m + f < 50) {
      if (r >= 50) {
        cout << "C" << endl;
      } else {
        cout << "D" << endl;
      }
    } else {
      cout << "F" << endl;
    }
  }

  return 0;
}


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

int main(){
    int n; cin >> n;
    string s; cin >> s;
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'R') ans ++;
    }
    if(ans > n-ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
const int INF = 1e9 + 5;

int		main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	ll k, n;
	cin >> k >> n;
	vector<ll> houses(n);
	ll ans = -INF;
	rep(i, n) {
		cin >> houses.at(i);
		if (i) {
			chmax(ans, houses[i] - houses[i - 1]);
		}
	}
	chmax(ans, k + houses.front() - houses.back());
	cout << k - ans << endl;
}


Measured memory_bytes: 1792
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

signed main(){
    int N;
    int A[200000];
    int sum=0;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>A[i];
        sum+=A[i];
        sum%=MOD;
    }

    int ans=0;
    for(int i=0;i<N;i++){
        sum-=A[i];
        sum%=MOD;
        ans+=sum*A[i];
        ans%=MOD;
    }
    while(ans<0) ans+=MOD;
    cout<<ans<<endl;
}


Measured memory_bytes: 4724
#include <stdio.h>

#define SET_LIMIT 3000
#define EXIT_NUMBER 0

typedef struct {
    int x;
    int y;
} Point;

void InputNumber(int* number, int limitLow, int limitHigh);
int SetDataSet(Point* pPoint);

int main(void) {
    int idx;
    int size;
    Point dataSet[SET_LIMIT];
    
    size = SetDataSet(dataSet);
    
    for (idx = 0; idx < size; idx++) {
        Point curPoint = dataSet[idx];
        int curX = curPoint.x;
        int curY = curPoint.y;
        int prev = curX > curY ? curY : curX;
        int post = curX > curY ? curX : curY;
        
        printf("%d %d\n", prev, post);
    }
}

void InputNumber(int* number, int limitLow, int limitHigh) {
    int x;
    do {
        scanf("%d", &x);
    } while (x < limitLow || x > limitHigh);
    *number = x;
}

int SetDataSet(Point* pPoint) {
    int idx;
    for (idx = 0; idx < SET_LIMIT; idx++) {
        Point curPoint = *pPoint;
        
        int x;
        int y;
        
        InputNumber(&x, 0, 10000);
        InputNumber(&y, 0, 10000);
        
        if (x == 0 && y == 0) {
            break;
        }
        
        curPoint.x = x;
        curPoint.y = y;
        
        *pPoint++ = curPoint;
    }
    
    return idx;
}


Measured memory_bytes: 2040
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[2005][2005];   // dp[i][j] 前 i 个人放了 j 个左边的
ll n,ma;
struct stu
{
    ll pos,w;
}a[2004];
bool cmp(stu u,stu v)
{
    return u.w<v.w;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i].w);
        a[i].pos=i;
    }
    sort(a+1,a+n+1,cmp);
    for(int i=1;i<=n;i++) dp[i][i]=a[1].w*abs(a[1].pos-i);  // 枚举最小的挪到每一个位置
    for(int len=2;len<=n;len++)
    {
        for(int i=1;i+len-1<=n;i++)
        {
            int j=i+len-1;
            dp[i][j]=max(dp[i+1][j]+a[len].w*abs(a[len].pos-i),  // 放右边
                         dp[i][j-1]+a[len].w*abs(a[len].pos-j)); // 放左边
        }
    }
    cout<<dp[1][n];
    return 0;
}


Measured memory_bytes: 26268
#include<bits/stdc++.h>
#include <iostream> 
#include <utility> 
using namespace std; 
int main()
{
	int n,count=0;
	cin>>n;
	int a[n],b[n];
	for(int i=0;i<n;i++)
	{
	    cin>>a[i];
	    b[i]=a[i];
	}
	sort(b,b+n);
	for(int i=0;i<n;i++)
	{
	    if(a[i]!=b[i])
	    count++;
	}
	if(count==2||count==0)
	cout<<"YES";
	else
	cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
S = input()

cnt = 0
j = len(S) - 1

for i in range(len(S) - 1, -1, -1):
    if j - i > len("dreamer"):
        break
    for dd in ("dream", "dreamer", "erase", "eraser"):
        if S[i:j + 1] == dd:
            j = i - 1
            cnt += len(dd)

print(("NO", "YES")[len(S) == cnt])


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

#define MAX 100000

bool comp(P lhs, P rhs) {
  return lhs.second > rhs.second;
}

int main()
{
  int n;
  int res = 0;
  P v[MAX] = {make_pair(0,0)};
  P w[MAX] = {make_pair(0,0)};
  cin >> n;
  rep(i,n) {
    int m;
    cin >> m;
    if(i%2) {
      w[m-1].second++;
      w[m-1].first = m;
    }
    else {
      v[m-1].second++;
      v[m-1].first = m;
    }
  }

  sort(v, v+MAX, comp);
  sort(w, w+MAX, comp);
  if(v[0].first != w[0].first) {
    res =  n - v[0].second - w[0].second;
  }
  else {
    res = min( n - v[0].second - w[1].second, n - v[1].second - w[0].second);
  }
  cout << res << endl;
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
/*int fibonacci(int n) {
	if (n == 0|| n== 1)return 1;
	else return fibonacci(n - 1) + fibonacci(n - 2);
}*/
int fibonacci(int n) {
	int F[44];
	F[0] = 1;
	F[1] = 1;
	for (int i = 2; i <= n; i++) {
		F[i] = F[i - 2] + F[i - 1];
	}
	return F[n];
}
int main() {
	int n;
	cin >> n;
	cout<<fibonacci(n)<<endl;
	return 0;
}




Measured memory_bytes: 3108
//2020 2.16 最大公約数

#include <stdio.h>
void swap(int *,int *);
int GCD(int a,int b);

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

    scanf("%d %d",&a,&b);
    if(a<b) swap(&a,&b);
    c=GCD(a,b);
    printf("%d\n",c);
    return 0;
}

int GCD(int a,int b)
{
    int c;
    while(1)
    {
    c=a%b;
    if(c==0) break;
    a=b;
    b=c;
    }
    return b;
}

void swap(int *a,int *b)
{
    int *temp;
    temp = a;
    a=b;
    b=temp;
}


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

int main(){
  double w,h,x,y;cin>>w>>h>>x>>y;
  double area=w*h/double(2);
  int ok;
  if((x==(w/2))&&(y==(h/2))){
    ok=1;
  }else{
    ok=0;
  }
  cout<<setprecision(10)<<area<<" "<<ok<<endl;
  
  
  return 0;
}

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

using namespace std;

#define ll long long

int main(void){
    int n, m;
    cin >> n >> m;

    int ans = 0;
    ans += n*(n-1) / 2;
    ans += m*(m-1) / 2;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))



int main(){
    ll ans,n,m;

    cin>>n>>m;
    {
        if(n==m)cout <<"Yes"<<endl;
        else cout <<"No"<<endl;
    }


    return 0;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] a = new int[n][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				a[i][j] = sc.nextInt();
			}
		}
		sc.close();

		int n2 = 1 << n;
		long[] dp = new long[n2];
		dp[0] = 1;
		for (int i = 0; i < n2 - 1; i++) {
			int j = Integer.bitCount(i);
			for (int j2 = 0; j2 < n; j2++) {
				if (a[j][j2] == 0 || (i >> j2 & 1) == 1) {
					continue;
				}
				int next = i + (1 << j2);
				dp[next] += dp[i];
				dp[next] %= 1000000007;
			}
		}
		System.out.println(dp[n2 - 1]);
	}
}


Measured memory_bytes: 54784
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl '\n'
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(){
   vector<int> v(11);
   int r,d;
   cin>>r>>d>>v[0];
   v[1]=r*v[0]-d;
   cout<<v[1]<<endl;
   for(int i=2;i<(int)v.size();i++){
	    v[i]=r*v[i-1]-d;
	    cout<<v[i]<<endl;
	  }
}
int32_t main(){
  IOS;
  solve();
  //debug();
 #ifdef LOCAL_DEFINE
 cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
 #endif	
}



Measured memory_bytes: 384
#include<stdio.h>
#include <iostream>
#include<string>

int main()
{
	std::string str[3];
	int cnt=0,cnt1=0;
	int n, m;
	std::string str1[1000];
	int num[1000];
	double sum = 0;
	double re;


	for (int i = 0; i < 2; i++) {
		std::cin >> str[i];
	}

	n = stoi(str[0]);
	m = stoi(str[1]);
	
	for (int i = 0; i < n; i++) {
		std::cin >> str1[i];
		num[i] = stoi(str1[i]);
		sum += num[i];
	}
	
	re = (double)(sum / (4 * m));
	

	for (int i = 0; i < n; i++) {
		if (re <= num[i]) {
			cnt1++;
		}
	}

	
	if (cnt1>=m) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	return 0;

}



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

#define long long long int

using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            if (i * j == n) {
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";

    return 0;
}

Measured memory_bytes: 256
import re
n = input()
s = input()
k = input()
chlist = list(s)
ked = int(k) - 1
nonreplace = chlist[int(ked)]
for num in range(int(n)):
  #numed = num - 1
  if chlist[num] == nonreplace:
    pass
  else:
    chlist[num] = "*"
stred = ''.join(chlist)
print(stred)


Measured memory_bytes: 3188
#include <iostream>

using namespace std;

int main()
{
  int a, b;
  cin >> a >> b;
  if (a == b)
    cout << "a == b" << endl;
  else if (a < b)
    cout << "a < b" << endl;
  else
    cout << "a > b" << endl;
  return 0;
}

Measured memory_bytes: 3104
n, a, b = map(int, input().split())
sum = 0
for i in range(1, n + 1):
    c = int(i / 10000)
    d = int(i / 1000) % 10
    e = int(i / 100) % 10
    f = int(i / 10) % 10
    g = i % 10
    if c + d + e + f + g >= a and c + d + e + f + g <= b:
        sum += i
print(sum)

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

int main () {

    int N;
    cin >> N;

    string S;
    cin >> S;

    for (int i = 0; i < S.size(); i++) {
        S[i] += N;
        if (S[i] > 'Z') {
            S[i] = S[i] - 26;
        }
    }
    cout << S << endl;

    return 0;
}


Measured memory_bytes: 256
input_s = input().split()
s = input_s[0]
t = input_s[1]

input_a = input().split()
a = int(input_a[0])
b = int(input_a[1])

u = input()

if(u == s):
    a = a - 1
    
if(u == t):
    b = b - 1

result = str(a)+" "+str(b)

print(result)

Measured memory_bytes: 3060
import java.io.*;
import java.util.*;

public class Main{
    static MyReader in = new MyReader();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args){
        int N = in.i();
        int[][][] xy = new int[N][][];
        for(int i = 0; i < N; i++){
            int a = in.i();
            xy[i] = new int[a][];
            for(int j = 0; j < a; j++){
                xy[i][j] = in.ii();
            }
        }
        int ans = 0;
        loop: for(int i = 0; i < 1 << N; i++){
            int count = 0;
            for(int j = 0; j < N; j++){
                if((i&(1 << j)) != 0){
                    count++;
                    int[][] xyj = xy[j];
                    for(int k = 0; k < xyj.length; k++){
                        int[] z = xyj[k];
                        int b = (i >> (z[0]-1))&1;
                        if(b != z[1]){
                            continue loop;
                        }                        
                    }
                }
            }
            if(ans < count) ans = count;
        }
        out.println(ans);
        out.flush();    
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        ArrayList<Integer> li(){
            String[] ss = ss();
            ArrayList<Integer> li = new ArrayList<>();
            for(int j = 0; j < ss.length; j++) li.add(Integer.parseInt(ss[j]));
            return li;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


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

using namespace std;

int n, ta;
set< int > s;

int main() {
	scanf("%d", &n);
	while (n--) {
		scanf("%d", &ta);
		if (s.find(ta) == s.end())
			s.insert(ta);
		else
			s.erase(ta);
	}
	printf("%d\n", s.size());
	return 0;
}

Measured memory_bytes: 4864
#include<bits/stdc++.h>
#include<bitset>
#include<random>
#include<time.h>

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 1e5 + 10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code

int main()
{
  int n;
  cin>>n;
  int ans = INT_MAX;
  rep(i, 0, n)
  {
    ll a;
    int aa = 0;
    cin>>a;
    while((a&1) == 0) {
      a = a >> 1;
      aa++;
    }
    ans = min(ans, aa);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#pragma comment(linker, "/STACK:250000000")

#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <complex>
#include <functional>
#include <numeric>
#include <random>
#include <cstring>
#include <ctime>
#include <cassert>

#define y1 klfjvkldfngldf

using namespace std;

typedef long long LL;

int n, m;

char s[100][101];

struct Edge
{
	int u, v, c, f;
};

vector<int> G[2 * 100 * 100];
vector<Edge> E;

void addEdge(int u, int v, int c)
{
	G[u].push_back(E.size());
	E.push_back({u, v, c, 0});
	G[v].push_back(E.size());
	E.push_back({ v, u, 0, 0 });
}

int p[2 * 100 * 100];
int d[2 * 100 * 100];
int q[2 * 100 * 100];
int qt, qh;

bool bfs(int s, int t)
{
	qt = qh = 0;
	q[qt++] = s;
	memset(d, -1, sizeof(d));
	d[s] = 0;
	while (qh < qt)
	{
		int v = q[qh++];
		for (int i = 0; i < G[v].size(); ++i)
		{
			int e = G[v][i];
			if (E[e].c - E[e].f > 0 && d[E[e].v] == -1)
			{
				d[E[e].v] = d[v] + 1;
				q[qt++] = E[e].v;
			}
		}
	}
	return d[t] != -1;
}

int dfs(int v, int t)
{
	if (v == t)
		return 1;
	for (; p[v] < G[v].size(); p[v]++)
	{
		int e = G[v][p[v]];
		if (E[e].c - E[e].f == 0)
			continue;
		if (d[v] + 1 == d[E[e].v] && dfs(E[e].v, t))
		{
			E[e].f++;
			E[e ^ 1].f--;
			return 1;
		}
	}
	return 0;
}

int main()
{
	cin >> n >> m;
	cin.ignore();
	for (int i = 0; i < n; ++i)
		cin.getline(s[i], 101);

	int sx = -1, sy = -1;
	int tx = -1, ty = -1;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			if (s[i][j] == 'S')
				sx = i, sy = j;
			if (s[i][j] == 'T')
				tx = i, ty = j;
		}
	}

	if (sx == tx || sy == ty)
	{
		cout << -1 << '\n';
		return 0;
	}

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			if (s[i][j] == 'o')
				addEdge(2 * (i * m + j), 2 * (i * m + j) + 1, 1);
			if (s[i][j] == '.')
				continue;
			for (int k = 0; k < n; ++k)
				if (k != i && s[k][j] != '.')
					addEdge(2 * (i * m + j) + 1, 2 * (k * m + j), 1);
			for (int k = 0; k < m; ++k)
				if (k != j && s[i][k] != '.')
					addEdge(2 * (i * m + j) + 1, 2 * (i * m + k), 1);
		}
	}

	int from = 2 * (sx * m + sy) + 1;
	int to = 2 * (tx * m + ty);
	int flow = 0;
	while (bfs(from, to))
	{
		memset(p, 0, sizeof(p));
		while (dfs(from, to))
			flow++;
	}

	cout << flow << '\n';

	return 0;
}

Measured memory_bytes: 84932
#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(){
  int N, M, K;
  cin >> N >> M >> K;

  vector<int> v(N*M+1, 0);
  v[0] = 1;
  v[N*M] = 1;
  for(int i=N; i<v.size(); i+=N) v[i] = 1;
  for(int i=M; i<v.size(); i+=M) v[i] = 1;
  REP(i,1,N+1){
    REP(j,1,M+1){
      v[j*(N-i)+i*(M-j)] = 1;
    }
  }

  
  if(v[K]==1){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
}




Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define mm map<ii>
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf LONG_MAX
#define minf LONG_MIN
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 

/*
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
#define si short int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
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()
{
	fast

	ll n;
	cin>>n;
	cout<<3*n*n;


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;

int main() {
    ll N;
    cin >> N;

    ll H[N+1];

    REP(i,N)
    {
        cin >> H[i+1];
    }

    string res = "Yes";


    H[0] = 0;
    REP(i,N)
    {
        if(H[i+1]-1 >= H[i])
        {
            --H[i+1];
        }
        else if(H[i+1] == H[i])
        {
            continue;
        }
        else
        {
            res = "No";
            break;
        }
    }

    cout << res <<endl;

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
using namespace std;

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

    bool flag = false;
    for(int i=1; i<4; i++){
        if(s[i-1] == s[i])
            flag = true;
    }

    if(!flag)
        cout << "Good" << endl;
    else
        cout << "Bad" << endl;
    
    return 0;
}

Measured memory_bytes: 256