akhauriyash/Code-Regression huggingface dataset:
n,m = map(int,input().split())
s = [0]*m
c = [0]*m
for i in range(m):
    s[i],c[i]=map(int,input().split())

res = "a"*n
for i in range(m):
    if res[s[i]-1] == "a" or res[s[i]-1] == str(c[i]):
        res = res[:s[i]-1] + str(c[i]) + res[s[i]:]
    else:
        print(-1)
        exit()

if n>1 and res[0] == "0":
    print(-1)
    exit()

if n>1 and res[0] == "a":
    res = "1" + res[1:]

res = res.replace("a","0") 
print(int(res))





Measured memory_bytes: 3064
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


k,x = list(map(int, input().split()))
ans = list(range(x-k+1, x+k))
print(" ".join(map(str, ans)))

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

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  bool five=false,seven=false;
  if ((a==5 && b==5) || (a==5 && c==5) || (b==5 && c==5)) five=true;
  if (a==7 || b==7 || c==7) seven=true;
  if (five && seven) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =998244353;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 

  int main(){      
   lint n,m,k;
   cin>>n>>m>>k;
   lint mod=998244353;
   COMinit();
   lint ans=0;
   rep(i,k+1){
       lint x=modpow(m-1,n-i-1,mod)*m;
       x%=mod;
       x*=COM(n-1,i);
        x%=mod;
       ans+=x;
       ans%=mod;
   }
   
   cout<<ans;
    }
      
      
    

  
          
  

Measured memory_bytes: 27120
def main():
    n = int(input())
    array_s = []
    array = []
    for i in range(n):
        array_s.append(input())
 
    for s in array_s:
        array.append(''.join(sorted(s)))
    array = sorted(array)
    ans = 0
    count = 1
    for i in range(n-1):
        if array[i] == array[i+1]:
            count += 1
            if i != n-2:
                continue
        ans += int(count*(count-1)/2)
        count = 1
    print(ans)
 
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 18520
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
    ll sum = 0;
    for(int i = n-1; i >= 0; i--)
    {
        ll rem = (a[i]+sum) % b[i];
        sum += (b[i] - rem) % b[i];
    }
    cout << sum << endl;
}



Measured memory_bytes: 4852
//be name khoda
#include<bits/stdc++.h>

typedef long long ll;
typedef long double ld;

using namespace std;

const ll INF = 1e18;
const ll maxn = 3e3+100;
const ll K = 510;
const ll mod = 1e9+7;

ll n , m , k, d;
ll dp[maxn][maxn];
pair<ll,ll> up[maxn][maxn];
string s, s1;
vector<char> lcs;

int main()
{
    cin>> s; n = s.size();
    cin>> s1; m = s1.size();

    for(ll i = 0; i < n; i++){
        for(ll j = 0; j < m; j++)
        {
            if(i == 0 && j == 0){
                dp[i][j] = (s[i] == s1[j]);
                up[i][j] = {-1,-1};
                continue;
            }
            if(i == 0){
                if(s[i] == s1[j]){
                    dp[i][j] = 1;
                    up[i][j] = {-1,-1};
                }
                else{
                    dp[i][j] = dp[i][j-1];
                    up[i][j] = {i,j-1};
                }
                continue;
            }
            if(j == 0){
                if(s[i] == s1[j]){
                    dp[i][j] = 1;
                    up[i][j] = {-1,-1};
                }
                else{
                    dp[i][j] = dp[i-1][j];
                    up[i][j] = {i-1,j};
                }
                continue;
            }

            if(s[i] == s1[j]){
                dp[i][j] = dp[i-1][j-1] + 1;
                up[i][j] = {i-1,j-1};
                continue;
            }
            if(dp[i-1][j] < dp[i][j-1]){
                dp[i][j] = dp[i][j-1];
                up[i][j] = {i,j-1};
            }
            else{
                dp[i][j] = dp[i-1][j];
                up[i][j] = {i-1,j};
            }
        }
    }

    ll i = n-1, j = m-1;
    while(i >= 0 && j >= 0)
    {
        if(s[i] == s1[j]){
            lcs.push_back(s[i]);
            i--; j--;
            continue;
        }
        ll x = up[i][j].first, y = up[i][j].second;
        i = x; j = y;
    }
    reverse(lcs.begin(), lcs.end());
    for(ll i = 0; i < lcs.size(); i++)
        cout<< lcs[i];
}











Measured memory_bytes: 219392
N = int(input())
K = int(input())
x = list(map(int, input().split()))

import math
ans = []
for i in range(N):
  a = math.sqrt((x[i] - 0) ** 2) * 2
  b = math.sqrt((x[i] - K) ** 2) * 2
  ans.append(min(a, b))
print(round(sum(ans)))

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		sc.nextLine();
		char[][] array = new char[h][];
		boolean[] uncompressRows = new boolean[h];
		boolean[] uncompressColumns = new boolean[w];

		for (int i = 0; i < h; i++) {
			array[i]  = sc.nextLine().toCharArray();
			for (int j = 0; j < w; j++) {
				if (array[i][j] == '#') {
					uncompressRows[i] = true;
					uncompressColumns[j] = true;
				}
			}
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < h; i++) {
			if (!uncompressRows[i]) {
				continue;
			}
			for (int j = 0; j < w; j++) {
				if (uncompressColumns[j]) {
					sb.append(array[i][j]);
				}
			}
			sb.append('\n');
		} 
		System.out.println(sb.toString());      
	}
}

Measured memory_bytes: 22100
// ABC156C.cpp

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main(){
	long long ans,min = 10000000000;
	int N;
	cin>>N;
	int X[N];
	for(int i=0;i<N;i++){
		cin>>X[i];
	}
	for(int i=1;i<=100;i++){
		ans=0;
		for(int j=0;j<N;j++){
			ans+=(X[j]-i)*(X[j]-i);
		}
		if(min>ans)min=ans;
	}
	cout<<min<<endl;
}

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

int main(){
    int N;
    cin >> N;
    int tmp;
    long dp0 = 0;
    long dp0dummy;
    long dp1 =  -1000000001;
    long dp1dummy;

    for(int i = 0; i < N; i++){
        cin >> tmp;
        dp0dummy = dp0;
        dp1dummy = dp1;
        dp0 = max(dp0dummy+tmp, dp1dummy-tmp);
        dp1 = max(dp0dummy-tmp, dp1dummy+tmp);
    }

    cout << dp0 << '\n';

    return 0;
}

Measured memory_bytes: 504
#include <iostream>
#include <algorithm>
#include <utility>
using namespace std;
#define ll long long

ll l[90] = {};

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

  l[0] = 2;
  l[1] = 1;

  for(int i=2; i<=n; ++i) {
    l[i] = l[i-1] + l[i-2];
  }

  cout << l[n] << endl;

  return 0;
}


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

int main() {
	int n, k; cin >> n >> k;
	vector<int>x(n); for (auto&& i : x)cin >> i;

	vector<int>cnt;
	for (int i = 0; i + k - 1 < n; i++) {
		int xl = x[i], xr = x[i + k - 1];
		int time1 = abs(xl) + abs(xr - xl), time2 = abs(xr) + abs(xr - xl);
		cnt.push_back(min(time1, time2));
	}
	sort(cnt.begin(), cnt.end());
	cout << cnt[0] << endl;

	return 0;
}

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

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

  vector<int> a(n);
  rep(i, n) cin >> a.at(i);

  vector<bool> put(n, false);
  put.at(0) = true;
  bool can = true;
  int now = 0;
  int cnt = 0;
  while (can) {
    cnt++;
    now = a.at(now) - 1;
    if (now == 1) break;
    if (put.at(now)) can = false;
    put.at(now) = true;
  }

  int ans;
  if (can) {
    ans = cnt;
  } else {
    ans = -1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
import math
def fact(x):
    if x == 0 or x == 1:
        return 1

    ans = 1
    for i in range(1,x+1):
        ans *= i
    return ans
def combi(n,r):
    return fact(n)//((fact(r))*(fact(n-r)))


N = int(input())
T = [0 for _ in range(N)]
for i in range(N):
    x,y = list(map(int,input().split()))
    T[i] = [x,y]

D = 0
for i in range(N):
    for j in range(i+1,N):
        D += math.sqrt( (T[i][0]-T[j][0])**2 + (T[i][1]-T[j][1])**2 )

print(D*fact(N-1)/( fact(N-2)*(combi(N,2)) ))

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

int main(){
    string s;
    int l = 0;
    cin >> s;
    for(int i = 0;i < s.size();i ++){
        if(s[i]=='x') l ++;
    }
    if(l>7) cout << "NO" << endl;
    else cout << "YES" << endl; 
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int times = sc.nextInt();
		
		for (int t = 0; t < times; t++){
			int[] data = new int[sc.nextInt()];
			int upmax = 0, downmax = 0;
			
			for (int i = 0; i < data.length ; i++){
				data[i] = sc.nextInt();
			}
			
			for (int i = 0; i < data.length - 1; i++){
				int s = data[i+1] - data[i];
				if((s > 0) && (s > upmax)){
					upmax = s;
				}
				
				if((s < 0) && (-s > downmax)){
					downmax = -s;
				}
			}
			
			System.out.print(upmax + " " + downmax + "\n");
		}
	}
}

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

int main()
{
	int n;
	cin>>n;
	complex<double> a,b,c,d;
	while(n--)
	{
		cin>>a.real()>>a.imag()>>b.real()>>b.imag()>>c.real()>>c.imag()>>d.real()>>d.imag();
		a=a-b;
		c=c-d;

		cout<<(a.real()*c.imag()-a.imag()*c.real()==0?"YES":"NO")<<endl;
	}
	return 0;
}

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

using namespace std;

using ll = long long;

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

const double EPS = 1e-5;
const int MOD = 1e9+7;


int main(){
  string str;

  cin >> str;

  //反転させれば除去する文字列は一意
  //反転させなければ除去する文字列は一意でない
  reverse(str.begin(),str.end());
  //cout << str << endl;

  while(str.length() > 0){
    if(str.substr(0,5) == "maerd"){
      str.erase(str.begin(),str.begin() + 5);
    }else if(str.substr(0,5) == "esare"){
      str.erase(str.begin(),str.begin() + 5);
    }else if(str.substr(0,7) == "remaerd"){
      str.erase(str.begin(),str.begin() + 7);
    }else if(str.substr(0,6) == "resare"){
      str.erase(str.begin(),str.begin() + 6);
    }else{
      cout << "NO" << endl;
      return 0;
    }

    //cout << str << endl;
  }

  cout << "YES" << endl;
  return 0;

}


Measured memory_bytes: 512
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#define MAX_N 100001
#define INF 2147483647
#define REP(i,n) for(int i=0;i<(int)(n);i++)
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;
int main()
{
  int a=1,b=1,c=1;
  char S[100];
  cin >> S;
  REP(i,3){
    if(S[i] == 'a')
      a--;
    else if(S[i] == 'b')
      b--;
    else
      c--;
  }
  if((a == 0) && (b == 0) && (c==0))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

//木の根を求める
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
 
int main(){
	ll n,q,k;
	cin >> n;
	vector<ll> a(n);
	FOR(i,0,n){
		cin >> a[i];
	}
	cin >> q;
	FOR(i,0,q){
		cin >> k;
		cout << POSL(a,k) << " " << POSU(a,k) << endl;
	}
}


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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin>>n>>k;
	if(n == k || n % k == 0)
	cout<<0<<"\n";
	else
	cout<<1<<"\n";
	return 0;
}

Measured memory_bytes: 256
#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),cout.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(){
   int s;
   cin>>s;
   set<int> v;
   int cnt=1;
   while(v.find(s)==v.end()){
	    v.insert(s);
	    if(s&1)s=3*s+1;
	    else s=s>>1;
	    cnt++; 
	  }
	cout<<cnt<<endl;
}
int32_t main(){
   IOS;
   solve();
   //debug();
  #ifdef LOCAL_DEFINE
   cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
  #endif	
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    double[]x = new double[n];
    String[]y = new String[n];
 
    for(int i=0; i<n; i++) {
    	x[i] = sc.nextDouble();
    	y[i] = sc.next();
    }
    double all = 0;
    for(int i=0; i<n; i++) {
    	if(y[i].equals ("BTC")) {
    		all += x[i]*380000.0;
    	}else {
    		all += x[i];
    	}
    }
    System.out.println(all);
      }
}


Measured memory_bytes: 37292
#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
int bit[7];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    int temp=n;
    int m=0;
    while(temp){
        ++m;
        temp/=10;
    }
    int ans=0;
    bit[1]=1;
    for(int i=2;i<=6;++i)
        bit[i]=10*bit[i-1];
    for(int i=1;i<=n;++i){
        int tt=i;
        int x=0,y=0;
        y=tt%10;
        if(!y)
            continue;
        while(tt){
            x=tt%10;
            tt/=10;
        }
        for(int j=1;j<=m;++j){
            if(j==1){
                if(x==y)
                    ++ans;
            }
            else if(j<m)
                ans+=bit[j-1];
            else{
                int mn=y*bit[m]+x;
                int mx=mn;
                for(int k=2;k<m;++k)
                    mx+=9*bit[k];
                if(n>=mn)
                    ans+=(min(n,mx)-mn)/10+1;
            }
        }
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
namespace dinic{
	const int maxvertex = 111111;
	const int maxedges = 411111;
	int head[maxvertex];
	int from[maxedges], to[maxedges], flow[maxedges], cap[maxedges], nxt[maxedges];
	int edges_count;
	void init(){
		edges_count = 0;
		memset(head, - 1, sizeof(head));
	}
	void add_uedge(int u, int v, int c){
		nxt[edges_count] = head[u]; head[u] = edges_count;
		from[edges_count] = u; to[edges_count] = v; flow[edges_count] = 0; cap[edges_count] = c;
		edges_count++;
	}
	void add_edge(int u, int v, int c){
		add_uedge(u, v, c);
		add_uedge(v, u, 0);
	}
	int dist[maxvertex], qq[maxvertex];
	bitset<maxvertex> bb;
	bool bfs(int s, int t){
		bb.reset();
		int top = 0;
		bb.set(s);
		qq[top++] = s;
		dist[s] = 0;
		for(int t = 0; t < top; t++){
			int cur = qq[t];
			for(int ed = head[cur]; ~ed; ed = nxt[ed]){
				if(bb.test(to[ed])) continue;
				if(flow[ed] == cap[ed]) continue;
				bb.set(to[ed]);
				dist[to[ed]] = dist[cur] + 1;
				qq[top++] = to[ed];
			}
		}
		return bb.test(t);
	}
	int ptr[maxvertex];
	int dfs(int s, int t, int mi){
		if(s == t) return mi;
		for(int & ed = ptr[s]; ~ed; ed = nxt[ed]){
			if(flow[ed] == cap[ed]) continue;
			if(dist[to[ed]] == dist[s] + 1){
				int df = dfs(to[ed], t, min(mi, cap[ed] - flow[ed]));
				if(df){
					flow[ed] += df;
					flow[ed^1] -= df;
					return df;
				}
			}
		}
		return 0;
	}
	int mf(int s, int t){
		int ans = 0;
		while(bfs(s, t)){
			memcpy(ptr, head, sizeof(ptr));
			int df;
			while((df = dfs(s,t,1<<30))) ans += df;
		}
		return ans;
	}
};
struct union_find{
	static const int DEFAULT = 200200;
	vector<int> parent;
	int N, num_comps;
	union_find(int N = DEFAULT) : N(N) {
		clear();
	}
	void clear(){
		num_comps = N;
		parent.assign(N, -1);
	}
	int find(int u){
		return (parent[u] < 0) ? u : parent[u] = find(parent[u]);
	}
	bool is_connected(int u, int v){
		return find(u) == find(v);
	}
	bool join(int u, int v){
		u = find(u);
		v = find(v);
		if (u != v){
			num_comps--;
			if (parent[u] > parent[v])
				swap(u, v);
			parent[u] += parent[v];
			parent[v] = u;
		}
		return u != v;
	}
	int size(int u){
		return -parent[find(u)];
	}
	int comps(){
		return num_comps;
	}
};
const int maxn = 100100;
int a[2][maxn], t[2][maxn], nds;
int main(){
	int n; cin >> n;
	union_find uf(n);
	for(int rot = 0; rot < 2; rot++){
		for(int i = 0; i < n; i++){
			cin >> a[rot][i];
			uf.join(i, a[rot][i]);
		}
		for(int i = 0; i < n; i++) if(i == uf.find(i)) t[rot][i] = nds++;
		for(int i = 0; i < n; i++) t[rot][i] = t[rot][uf.find(i)];
		uf.clear();
	}
	int source = nds++, sink = nds++;
	dinic::init();
	int ans = n;
	for(int i = 0; i < n; i++){
		if(a[0][i] == i && a[1][i] == i) ans--;
		else if(a[1][i] == i) dinic::add_edge(source, t[0][i], 1);
		else if(a[0][i] == i) dinic::add_edge(t[1][i], sink, 1);
		else {
			dinic::add_edge(t[1][i], t[0][i], 1);
			if(a[0][i] == a[1][i]){
				dinic::add_edge(t[0][i], t[1][i], 1);
			}
		}
	}
	cout << ans - dinic::mf(source, sink) << endl;
	return 0;
}


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

int main() {
    int n;
    cin >> n;
    ll h[n];
    for (int i = 0; i < n; i++) cin >> h[i];

    bool can = true;
    for (int i = n-1; i >= 1; i--) {
        if (h[i-1] -1 > h[i]) can = false;
        if (h[i-1] - 1 == h[i]) h[i-1] --;
    }

    if (can) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
int H, W; string s;
int main() {
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		cin >> s;
		cout << s << endl << s << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int N;
    int K;
    int X;
    int Y;
    cin >> N >> K >> X >> Y;
    int sum = 0;
    for(int i=1; i<= N; i++){
        if(i <= K){
            sum += X;
        }else{
            sum += Y;
        }
    }
    cout << sum << endl;
    return 0;
}

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

import sys
import os
import math

N = 24
A = []
for i in range(N):
    id, t = map(float, input().split())
    id = int(id)
    A.append((t, id))

B = A[:8]
C = A[8:16]
D = A[16:]

B.sort()
C.sort()
D.sort()

def print_data(A, index):
    data = A[index]
    t = data[0]
    id = data[1]
    print(id, t)

print_data(B, 0)
print_data(B, 1)
print_data(C, 0)
print_data(C, 1)
print_data(D, 0)
print_data(D, 1)

B = B[2:]
C = C[2:]
D = D[2:]

E = B + C + D
E.sort()
print_data(E, 0)
print_data(E, 1)

Measured memory_bytes: 7572
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int m,n;
	cin>>m>>n;
	char c[m+1][n+1];
	int f[m+1][n+1];
	int i,j;
	for (i=1;i<=m;i++)
	{
		for (j=1;j<=n;j++)
		{
			cin>>c[i][j];
			if (c[i][j]=='.')
			{
				f[i][j]=0;
			}
			else
			{
				f[i][j]=1;
			}
		}
	}
	bool flag;
	for (i=1;i<=m;i++)
	{
		flag=true;
		for (j=1;j<=n;j++)
		{
			if (f[i][j]==1)
			{
				flag=false;
			}
		}
		if (flag==true)
		{
			for (j=1;j<=n;j++)
			{
				f[i][j]=2;
			}
		}
	}
	for (i=1;i<=n;i++)
	{
		flag=true;
		for (j=1;j<=m;j++)
		{
			if (f[j][i]==1)
			{
				flag=false;
				break;
			}
		}
		if (flag==true)
		{
			for (j=1;j<=m;j++)
			{
				f[j][i]=2;
			}
		}
	}
	for (i=1;i<=m;i++)
	{
		for (j=1;j<=n;j++)
		{
			if (f[i][j]==0)
			{
				cout<<'.';
			}
			else if (f[i][j]==1)
			{
				cout<<'#';
			}
		}
		flag=false;
		for (j=1;j<=n;j++)
		{
			if (f[i][j]!=2)
			{
				flag=true;
			}
		}
		if (flag==true) cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define chmax(x,y) x = max(x,y)

 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
typedef vector<LL> VL;
typedef vector<vector<long long>> VVLL;
const int MOD = 1e9+7;
const int INF = 1e9;
const LL LINF = 1e18;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int lcm(int a, int b)
{
   return a * b / gcd(a, b);
}

int main() {
    int n,x,y;
    cin >> n >> x >> y;
    --x; --y;
    VI ans(n);
    rep(sv,n) {
        VI dist(n,INF);
        queue<int> q;
        auto push = [&](int v,int d) {
            if(dist[v] != INF) return;
            dist[v] = d;
            q.push(v);
        };
        push(sv,0);
        while(!q.empty()) {
            int v = q.front(); q.pop();
            int d = dist[v];
            if(v-1 >= 0) push(v-1,d+1);
            if(v+1 < n) push(v+1,d+1);
            if(v == x) push(y, d+1);
            if(v == y) push(x, d+1);
        }
        rep(i,n) ans[dist[i]]++;
    }

    rep(i,n) ans[i] /= 2;
    for(int i = 1;i <= n-1; i++) {
        cout << ans[i] << endl;
    }


}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main() {
string n;
cin >> n;
int sum = 0;
for (int i = 0; i < n.length(); i++) {
        sum += n[i] - '0';
}
if (stoi(n) % sum == 0) cout << "Yes";
else cout << "No";
}

Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>
#include <bitset>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

bool is_prime(ll N){
  if (N == 1) return false;
  for (ll i = 2; i * i <= N; ++i){
    if (N % i == 0) return false;
  }
  return true;
}

int main(){
  int N; cin >> N;
  vector<int> prime;
  for (int i = 1; i <= 55555; ++i){
    if (is_prime(i) && i % 5 == 1) prime.push_back(i);
  }
  rep(i, N) cout << prime[i] << " ";
  cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<functional>
using namespace std;
#define ll long long int
#define ld long double
using namespace __gnu_pbds;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,
tree_order_statistics_node_update> in_set;
#define rep(n) for(ll i=0;i<(n);i++)
#define jrep(n) for(ll j=0;j<(n);j++)
#define krep(n) for(ll k=0;k<(n);k++)
#define all(a) (a).begin(), (a).end()
#define dpp(a) cout<<(a).first<<" "<<(a).second<<endl;
#define append push_back
#define mod 1000000007
#define ff first
#define ss second
#define ffast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fast ios::sync_with_stdio(0);
ll pw(ll x,ll y,ll p=mod){ll r=1; x=x%p;while(y>0){ if(y&1)r=(r*x)%p;
y=y>>1;x=(x*x)%p;} return r; } vector<ll> uniq(vector<ll> arr)
{vector<ll>brr;sort(all(arr));brr.append(arr[0]);
for(auto i:arr)if(brr.back()!=i)brr.append(i);return brr;}

ll comb(ll x, ll y){
    return 1000000*x+y;
}
void solve(ll ts){
    ll h,w,m; cin>>h>>w>>m; map<ll,ll> mp1,mp2; ll a,b;
    set<ll> x; set<ll> y;
    rep(m){
        cin>>a>>b; mp1[a]++; mp2[b]++;
        x.insert(comb(a,b));
    }
    ll me = 0; ll me1=0;
    for(auto i:mp1) me=max(me,i.ss);
    for(auto i:mp2) me1=max(me1,i.ss);
    vector<ll> arr,brr;
    for(auto i:mp1) if(i.ss==me) arr.append(i.ff);
    for(auto i:mp2) if(i.ss==me1) brr.append(i.ff);
    //for(auto i:arr) cout<<i<<" "; cout<<endl;
    //for(auto i:brr) cout<<i<<" "; cout<<endl;
    ll lim = m+1;
    for(auto i:arr){
        for(auto j:brr){
            if(lim<0){ cout<<me + me1 - 1<<endl; return; } lim--;
            //cout<<i<<" "<<j;
            if((x.find(comb(i,j))==x.end())){
                cout<<me+me1<<endl; return;
            } //else cout<<" NOT HERE!!\n";
        }
    }cout<<me + me1 - 1<<endl;
}
 
int main(){
    ffast
    ll t=1;
//    cin>>t;
    rep(t) solve(i+1);
}
 
 
// *p.find_by_order(n) : nth value (0 indexed)
// p.order_of_key(7): index of 7 (0 indexed)


Measured memory_bytes: 63096
//coded by not_surrender

#pragma GCC optimize( "Ofast" )

#include <bits/stdc++.h>

#define MAXN 100010
#define oo (1<<30)
#define MOD 998244353
#define mid ((a+b)/2)
#define L (nod*2)
#define R (nod*2+1)
#define pb push_back

using namespace std;

typedef long long ll;
typedef vector <int> vi;

int N, K, A[MAXN], dp[MAXN];

int main(){

    #ifndef ONLINE_JUDGE
        //~ freopen( "a.txt", "r", stdin );
    #endif // ONLINE_JUDGE

    ios_base::sync_with_stdio( false );
    cin.tie( NULL ), cout.tie( NULL );
    
    cin >> N >> K;
    
    for ( int i = 1; i <= N; ++i )
		cin >> A[i], dp[i] = oo;
	
	dp[1] = 0;
	for ( int i = 1; i < N; ++i )
		for ( int j = 1; i+j <= N && j <= K; ++j )
			if ( dp[i+j] > dp[i]+abs( A[i]-A[i+j] ) )
				dp[i+j] = dp[i]+abs( A[i]-A[i+j] );
	
	cout << dp[N] << '\n';
	
return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N; cin >> N;
  vector<int> L(N);
  for(auto& it:L)
    cin >> it;

  sort(L.begin(), L.end());
 
  int sol = 0;

  for(int i=0; i<N-2; i++){
    for(int j=i+1; j<N-1; j++){
      
      auto it = lower_bound(L.begin(), L.end(), L.at(i)+L.at(j));
      if(it-L.begin() > j)
        sol += it-L.begin()-j-1;
    }
  }
  
  cout << sol << endl;
}

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

int main() {

  long long int n, m, p, input;

  while( true ) {

    cin >> n >> m >> p;

    if ( n == 0 ) break;

    vector< long long int > x;

    long long int s = 0;

    for ( long long int i = 0; i < n; i++ ) {

      cin >> input;

      s += input;

      x.push_back( input );

    }

    if ( x[m-1] == 0 ) {
      cout << 0 << endl;
    }else {
      cout << s * 100 * ( 100 - p ) / x[m-1] / 100 << endl;
    }

  }

  return 0;

}

Measured memory_bytes: 1216
#!/usr/bin/env python3
a=int(input())
N = input()
N =N.split(' ')
for i in range(int(a)):
    N[i]=int(N[i])
    #print(N[i]," ",end="")
#print()

b=0
for i in range(int(a)):
    #print(1/N[i])
    b=b+(1/N[i])
#print(b)
print(1/b)


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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> llVEC;
typedef vector<P> PVEC;
typedef priority_queue<P,PVEC,greater<P> > PPQ;
typedef priority_queue<ll, llVEC, greater<ll> > llPQ;

#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n-1; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue;
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

template<typename T>
ll sz(vector<T> &vec){ return (ll)vec.size(); }
ll sz(string &s){ return (ll)s.size(); }

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

ll dp[101][101][301] = {};
int main(){
    ll n,W;
    cin >> n >> W;
    ll w[n],v[n];
    
    ll wmemo = 0;
    rep(i,0,n){
        cin >> w[i] >> v[i];
        if(i == 0) wmemo = w[i];
        w[i] -= wmemo;
    }

    rep(i,1,n+1){
        rep(j,1,n+1){
            rep(k,0,301){
                dp[i][j][k] = max(dp[i-1][j][k], dp[i][j-1][k]);
                if(k-w[i-1] >= 0) dp[i][j][k] = max(dp[i][j][k],dp[i-1][j-1][k-w[i-1]]+v[i-1]);
            }
        }
    }

    ll ans = 0;
    rep(j,0,n+1) rep(k,0,301) if(j*wmemo+k <= W) ans = max(ans,dp[n][j][k]);
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 27324
def main():
    n = int(input())
    s = input()
    t = input()

    if s == t:
        print(n)
        return

    for i in reversed(range(0, n)):
        target = s + t[i:]
        if target.startswith(s) and target.endswith(t):
            print(len(target))
            return

main()


Measured memory_bytes: 9136
S = input()
reverse = S[::-1]
devide = ["dream", "erase", "dreamer", "eraser"]
r_devide = [devide[i][::-1] for i in range(len(devide))]
i=0
while i < len(S):
  can = False
  for j in r_devide:
    if j in reverse[i:i+len(j)] :
      can = True
      i += len(j)
  
  if can == False:
    break
    
if can == True:
  print("YES")
else:
  print("NO")

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
struct N {
  int i, j, d;
  char c;
};

bool operator<(const N &l, const N &r) {
  return l.d > r.d;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int h, w;
  cin >> h >> w;
  vector<string> mp(h);
  for (int i = 0; i < h; i++) cin >> mp[i];
  priority_queue<N> q;

  if (mp[0][0] == '#') q.push(N{0, 0, 1, '#'});
  else q.push(N{0, 0, 0, '.'});
  vector<vector<bool>> used(h, vector<bool>(w, 0));
  while (q.size()) {
    auto now = q.top();
    q.pop();
    if (now.i == h - 1 && now.j == w - 1) {
      cout << (now.d + 1) / 2 << endl;
      return 0;
    }
    if (used[now.i][now.j]) continue;
    used[now.i][now.j] = true;
    if (now.i < h - 1 && !used[now.i + 1][now.j]) {
      if (now.c == mp[now.i + 1][now.j])
        q.push(N{now.i + 1, now.j, now.d, mp[now.i + 1][now.j]});
      else q.push(N{now.i + 1, now.j, now.d + 1, mp[now.i + 1][now.j]});
    }
    if (now.j < w - 1 && !used[now.i][now.j + 1]) {
      if (now.c == mp[now.i][now.j + 1])
        q.push(N{now.i, now.j + 1, now.d, mp[now.i][now.j + 1]});
      else q.push(N{now.i, now.j + 1, now.d + 1, mp[now.i][now.j + 1]});
    }
  }
  return 0;
}


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

int main() {
	int n;
	string s;
	cin >> n >> s;
	//それぞれの文字の個数をかけて-1する
	map<char,long long> mp;
	for(int i=0;i<n;i++)
	{
		mp[s.at(i)]++;
	}
	const long long c = 1000000007;
	long long sm=1;
	for(auto itr = mp.begin();itr != mp.end();itr++)
	{
		sm *= itr->second + 1;
		sm %= c;
	}
	cout << sm - 1 << endl;
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  int n=s.size();
  string rev=s;
  reverse(rev.begin(),rev.end());
  if(s!=rev){cout<<"No";return 0;}
  s='*'+s;
  int i=1,j=(n-1)/2;
  string f=s.substr(1,j-i+1);
  rev=f;
  reverse(rev.begin(),rev.end());
 // cout<<f<<endl;
  if(f!=rev)
  {
    cout<<"No";
    return 0;
  }
  i=(n+3)/2;
  j=n;
  f=s.substr(i,j-i+1);
  rev=f;
  reverse(rev.begin(),rev.end());
  //cout<<f<<endl;
  if(f!=rev)
  {
    cout<<"No";return 0;
  }
  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 256
//Deep Godhani
//DAIICT

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

#define N 100000000000
#define PI acos(-1)
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define ll long long int
#define ld long double
#define precision(x,d) cout << fixed << setprecision(d) << x
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))

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

void solve()
{
	int n;
	cin >> n;
	cout << 2*PI*n << endl;
}
int main()
{
    FAST;
    ll t=1;
    //cin >> t;
    while(t--)
    {
      //cout << "************" << endl;
      solve();
      //cout << "************"  << endl;
    }
		return 0;
}


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

using namespace std;


int main(){
    string S;

    cin >> S ;

    int N = S.size();
    int cnt1 = 0,cnt2 = 0;
    for(int i=0;i<N;i++){
        if(S.at(i) == '0') cnt1++;
        else cnt2++;
    }

    cout << N - abs(cnt1-cnt2) << endl;
}


Measured memory_bytes: 512
import java.util.*;


class Main{
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		
		List<Integer> A = new ArrayList<Integer>();
		
		
		int numAllice = 0;
		int numBob = 0;
		
		for(int i = 0 ; i < N ; i ++){
			A.add(sc.nextInt());
		}
		
		A.sort(Comparator.reverseOrder());  
		
		for(int i = 0 ; i < A.size() ;i++  ){
			if(i % 2 == 0){
				numAllice = numAllice + A.get(i);
			}else{
				numBob = numBob + A.get(i);;
			}
			
//			System.out.println(i + " " + " " + numAllice + " " + numBob);
			
		}
		
		System.out.println(numAllice - numBob);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define setDP(arr) memset(arr,-1,sizeof arr)
#define oo 2000000000
#define inf 1000000000000000LL
#define M 1000000007
typedef long long ll;
using namespace std;
const int N = 105001;

int n;

signed main(){
    cin >> n ;
    double d = n;
    double nod = ceil(n/2.0);
    d = nod/d;
    printf("%.8lf",d);


    return 0;
}


Measured memory_bytes: 256
num = int(input())
def gcd(a,b,c):
    if(b > a):
        sub = b
        b = a
        a = sub
    while(a%b != 0):
        sub = b
        sub2 = a
        a = b
        b = sub2 % sub
    if(c > b):
        sub = c
        c = b
        b = sub
    while(b%c != 0):
        sub = c
        sub2 = b
        b = c
        c = sub2 % sub
    return(c)
sum = 0
for i in range(1,num + 1):
    for l in range(i,num + 1):
        for k in range(l,num + 1):
            if(i == l and l == k):
                sum += gcd(i,l,k)
            elif(i ==l or l == k or k == i):
                sum += 3 * gcd(i,l,k)
            else:
                sum += 6 * gcd(i,l,k)
print(sum)


Measured memory_bytes: 9236
#include <iostream>
using namespace std;
int main() {
	string a, b;
	while (cin>>a>>b) {
		if (a=="0"&&b=="0") break;
		int hit=0, blow=0;
		for (int i=0; i<4; i++) {
			if (a[i]==b[i]) {
				hit++;
			} else {
				for (int j=0; j<4; j++) {
					if (a[i]==b[j]) blow++;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
}

Measured memory_bytes: 916
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) ((int)(x).size())
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int A,B; cin>>A>>B;
    int ans=0;
    if(B-A<100000){
        for(int i=A;i<=B;i++) ans^=i;
    }
    else{
        for(int i=A;i%4!=0;i++) ans^=i;
        for(int i=B;i%4!=3;i--) ans^=i;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

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

    vector<int> cnt(N+1, 0);
    for(int i=0; i<M; ++i){
        int a,b; cin >> a >> b;
        ++cnt[a]; ++cnt[b];
    }

    bool flg = true;
    for(auto e:cnt) if(e%2 == 1) flg = false;

    if(flg) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 640
#include<map>
#include<array>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

struct Data {
    int cnt, kind;
    Data() {
	cnt = 0;
	kind = 0;
    }
    bool operator<(const Data &o) const {
	return false;
    }
};

using Arr = array<int, 4>;

int N;
Arr C[411];
Arr Z[4];

void normal(Arr &src) {
    Arr b = src;
    REP (_, 3) {
	int tmp = b[0];
	REP (i, 3) b[i] = b[i+1];
	b[3] = tmp;
	amin(src, b);
    }
}

map<Arr, Data> mp;

void MAIN() {
    scanf("%d", &N);
    REP (i, N) {
	REP (t, 4) scanf("%d", &C[i][t]);
	normal(C[i]);
	mp[C[i]].cnt++;
    }
    EACH (e, mp) {
	const Arr &a = e->first;
	int r = 0;
	REP (s, 4) {
	    bool ok = true;
	    REP (i, 4) if (a[i] != a[(i+s)%4]) { ok = false; break; }
	    if (ok) r++;
	}
	e->second.kind = r;
    }

    LL ans = 0;

    REP (i, N) {
	mp[C[i]].cnt--;
	for (int j=i+1; j<N; j++) {
	    mp[C[j]].cnt--;
	    REP (b, 4) {
		vector<pair<Arr, Data> > v; v.reserve(4);
		REP (c, 4) {
		    Z[c][2] = C[i][(c+1)%4];
		    Z[c][3] = C[i][(c)%4];
		    Z[c][0] = C[j][(b-c+4)%4];
		    Z[c][1] = C[j][(b-c+3)%4];
		    normal(Z[c]);

		    auto it = mp.find(Z[c]);
		    if (it == mp.end()) {
			break;
		    } else {
			v.push_back(*it);
		    }
		}

		if (v.size() == 4u) {
		    sort(v.begin(), v.end());
		    LL tmp = 1;
		    for (int l=0; l<4; ) {
			int r = l;
			LL p = v[l].second.cnt;
			while (r < 4 && v[l].first == v[r].first ) {
			    tmp *= p*v[l].second.kind;
			    p--;
			    r++;
			}
			l = r;
		    }
		    ans += tmp;
		}
	    }
	    mp[C[j]].cnt++;
	}
    }

    printf("%lld\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
  ll n;cin >> n;
  vvl g(n,vl(n));rep(i,n)rep(j,n)cin >> g[i][j];
  vl sum(1<<n);
  rep(bit,1<<n){
    ll ret=0;
    rep(i,n)rep(j,n)if((bit&(1<<i))&&(bit&(1<<j)))ret+=g[i][j];
    sum[bit]=ret/2;
  }
  //rep(i,1<<n)cout << sum[i] <<" ";cout << endl;
  rep(bit,1<<n){
    vl z;rep(i,n)if(bit&(1<<i))z.pb(i);
    rep(cit,1<<z.size()){
      ll d=0,e=0;
      rep(j,z.size()){
        if(cit&(1<<j))d+=1<<z[j];
        else e+=1<<z[j];
      }
      //cout << bit <<" " << d << " " << e <<endl;
      chmax(sum[bit],sum[d]+sum[e]);
    }
  }
  //rep(i,1<<n)cout << sum[i] <<" ";cout << endl;
  cout << sum[(1<<n)-1] <<endl;
}

Measured memory_bytes: 3740
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

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

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

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	int n, m;
	cin >> n >> m;
	vi top(m);
	REP(i, m)
		cin >> top[i];
	vi num(n);
	REP(i, n)
		num[i] = n-i;
	REP(i, m) {
		num.push_back(top[i]);
	}
	set<int> si;
	REP(i, num.size()) {
		if(si.find(num[num.size() - i - 1])==si.end())
		cout << num[num.size() - i - 1] << endl;
		si.insert(num[num.size() - i - 1]);
	}
}

Measured memory_bytes: 13820
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <functional>
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;
int main() {
	ll n, m, ans = 0, A[10101];
	cin >> n >> m;
	rep(i, m - n + 1)
		ans += i;
	cout << ans - m << endl;
	return 0;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e15;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll a(n), b(n);
  rep(i,n) cin>>a[i];
  rep(i,n) cin>>b[i];
  vll s(n+1), t(n+1);
  rep(i,n) s[i+1]=s[i]+a[i];
  rrep(i,n) t[i]=t[i+1]+b[i];
  ll ans=0;
  rep(i,n){
    chmax(ans,s[i+1]+t[i]);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import math

A,B = map(int,input().split())

a = []
b = []

for i in range(1,1001):
  if math.floor(i*0.08) == A:
    a.append(i)
    
  else:
    pass

for i in range(1,1001):
  if math.floor(i*0.1) == B:
    b.append(i)
    
  else:
    pass
   
a_and_b = set(a) & set(b)


if len(a_and_b) == 0:
  print(-1)
else:
  print(min(a_and_b))



Measured memory_bytes: 3064
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

vector<int> a;

bool read() {
  int n;
  if (scanf("%d", &n) < 1) {
    return false;
  }
  a.clear();
  a.resize(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  return true;
}

int get(int x) {
  int y = 1;
  int mb = 32 - __builtin_clz(x);
  for (int bit = 1; bit < mb; bit++) {
    if (!(x & (1 << bit))) {
      y ^= (1 << bit);
    }
  }
  return y;
}

int rec(vector<int> a) {
  bool ok = true;
  for (int i = 0; i < sz(a); i++) {
    if (!(a[i] & 1)) {
      ok = false;
    }
  }
  int res = 0;
  if (!ok) {
    vector<int> b;
    int k = 0;
    for (int i = 0; i < sz(a); i++) {
      if (a[i] & 1) {
        a[k++] = a[i];
      } else {
        b.push_back(a[i] >> 1);
      }
    }
    a.resize(k);
    res += rec(b);
  }
  sort(a.begin(), a.end(), greater<int>());
  set<pair<int, int>> st;
  for (int i = 0; i < sz(a); i++) {
    st.insert(make_pair(a[i], i));
  }
  for (int i = 0; i < sz(a); i++) {
    if (!st.count(make_pair(a[i], i))) {
      continue;
    }
    st.erase(make_pair(a[i], i));
    int x = get(a[i]);
    auto it = st.lower_bound(make_pair(x, -1));
    if (it != st.end() && it->first == x) {
      st.erase(it);
      res++;
    }
  }
  return res;
}

void solve() {
  printf("%d\n", rec(a));
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 56692
a, b, c, x, y = map(int,input().split())

mast = max(x,y)
ans = float('INF')

for i in range(mast+1):
    price = a * max(x-i,0) + b * max(y-i,0) + c *2 *i
    ans =min(ans,price) 
    
print(ans)

Measured memory_bytes: 9204