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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod=MOD){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
ll const N=(ll)1e5+111;
ll const LG=(ll)log2(N)+1;


void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
        
        cin>>n>>m>>k;
        
        vector<string> s(n);
        ll tot=0;
        for(i=0;i<n;i++){
                cin>>s[i];
                for(j=0;j<m;j++){
                        if(s[i][j]=='#')tot++;
                }
        }
        ll ans=0;
        for(i=0;i<(1<<n);i++){
                for(j=0;j<(1<<m);j++){
                        ll tt=tot;
                        for(x=0;x<n;x++){
                                for(y=0;y<m;y++){
                                        if(((1<<x)&i) || ((1<<y)&j) ){
                                                if(s[x][y]=='#')tt--;
                                        }
                                }
                        }
                        if(tt==k)ans++;
                }
        }
        cout<<ans<<endl;


}       
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        while(q--){
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}


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


using namespace std;

using ll   = long long;
using ii   = pair   < int , int >;
using i3   = pair   < int , ii  >;
using li   = pair   < ll  , int >;
using lii  = pair   < ll  , ii  >;
using pll  = pair   < ll  , ll  >;
using vi   = vector < int       >;
using vl   = vector < ll        >;
using vii  = vector < ii        >;
using vli  = vector < li        >;
using vpll = vector < pll       >;
using vi3  = vector < i3        >;
using vlii = vector < lii       >;


const int N = 2e5 + 5;
const ll INF = 1e17 + 7;
const double eps = 1e-9 , PI = acos(-1);


ll n , m;

void solve(int testCase){

    scanf("%lld %lld" , &n , &m);

    n = n%m;

    printf("%lld\n" , min(n , abs(n - m)));

}

main(){

    int t = 1;
    // scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.*;import java.io.*;import java.math.*;

public class Main
{

    public static void process()throws IOException
    {
        String s=nln();
        if(s.charAt(0)=='7' || s.charAt(1)=='7' || s.charAt(2)=='7')
            pn("Yes");
        else
            pn("No");
    }


    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

       // oj = System.getProperty("ONLINE_JUDGE") != null;
        if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();  
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;



/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
    
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
    
    
    

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

#define ll long long

int main(void){
    int n,m,x;
    cin >>n >> m >>x;
    vector<int>a(m);
    for(int i=0;i<m;i++){
        cin >> a[i];
    }
    // sort(a.begin(),a.end());
    int l=0,r=0;
    for(int i=0;i<m;i++){
        if(a[i] < x) l++;
        else r++;
    }
    int ans = min(l,r);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

struct xyz{
    uint64 x;
    uint64 y;
    uint64 z;
};

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    uint N, M; cin >> N >> M;
    vector<xyz> vXYZ(N);
    
    for(uint i=0; i<N; ++i){
        cin >> vXYZ[i].x >> vXYZ[i].y >> vXYZ[i].z;
    }
    
    int64 maxn=0;
    vector<int64> vec(N);
    for(uint i=0; i<8; ++i){
        int sign_x = (i & 0b001) ? 1:-1;
        int sign_y = (i & 0b010) ? 1:-1;
        int sign_z = (i & 0b100) ? 1:-1;
        for(uint i=0; i<N; ++i){
            vec[i] = sign_x*vXYZ[i].x + sign_y*vXYZ[i].y + sign_z*vXYZ[i].z;
        }
        sort(vec.begin(), vec.end(), greater<int64>());
        int64 sum = accumulate(&vec[0], &vec[0]+M, 0ll);
        maxn = max(maxn, sum);
    }
    cout << maxn << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <functional>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	long N;
	cin>>N;
	long* A=new long[N];
	for(int i=0;i<N;i++){
		cin>>A[i];
	}
	sort(A,A+N,greater<int>());
	long repeat=1;
	long Ans=0;
	while(repeat<N){
		Ans+=A[repeat/2];
		repeat++;
	}
	cout<<Ans;
	return 0;
}


Measured memory_bytes: 5172
#include<bits/stdc++.h>
using namespace std;	
long long n;
long long a[3],b[3],go[5005],back[5005*5005];
int main(){
	scanf("%lld",&n);
	for(int i=0;i<3;i++){
		scanf("%lld",&a[i]);
	}
	for(int i=0;i<3;i++){
		scanf("%lld",&b[i]);
	}
	for(int i=1;i<=n;i++){
		for(int j=0;j<3;j++){
			if(i-a[j]>=0) go[i]=max(go[i],go[i-a[j]]+b[j]-a[j]);
		}
	}
	n+=go[n];
	for(int i=1;i<=n;i++){
		for(int j=0;j<3;j++){
			if(i-b[j]>=0) back[i]=max(back[i],back[i-b[j]]+a[j]-b[j]);
		}
	}
	n+=back[n];
	printf("%lld",n);
}

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



int mod = 1000000007;
int add(int x, int y) { return (x += y) >= mod ? x - mod : x; }
void chadd(int &x, int y) { x = add(x, y); }
int N, M;
int dp[3010][3010][2];
// dp[i][j][k] := i回積んで箱にj個赤い積み木があってj==0を通過したかどうか(k=1した)
//-----------------------------------------------------------------------------------
int main() {
    cin >> N >> M;

    rep(j, 0, N + 1) dp[0][j][j == 0] = 1;
    rep(i, 0, M) rep(j, 0, N + 1) rep(k, 0, 2) {
        int cu = dp[i][j][k];
        if (0 < j) chadd(dp[i + 1][j][k | (j == 1)], cu); // ←→
        if (0 < j) chadd(dp[i + 1][j - 1][k | (j == 1)], cu); // ←
        if (j < N) chadd(dp[i + 1][j][k], cu); // →←
        if (j < N) chadd(dp[i + 1][j + 1][k], cu); // →
    }

    int ans = 0;
    rep(j, 0, N + 1) chadd(ans, dp[M][j][1]);
    cout << ans << endl;
}

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

using namespace std;

int main() {

    int N, L;
    cin >> N >> L;

    vector<string> v(N);
    for(int i = 0; i < N; i ++)
        cin >> v[i];

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

    string res = "";
    for(const string& s: v) res += s;
    cout << res << endl;

    return 0;
}


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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    for(int i = 1; i <= b; i++){
        if(a * i % b == c){
            cout << "YES\n";
            return 0;
        }
    }
    cout << "NO\n";
    return 0;
}

Measured memory_bytes: 3624
////////////////////////
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
namespace my {
char itoc(int i) { return i + '0'; }
int ctoi(char c) { return c - '0'; }
ll gcd(ll a, ll b) {
  a = abs(a);
  b = abs(b);
  if (a < b) swap(a, b);
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
ll lcm(ll a, ll b) { return a * b / my::gcd(a, b); }
vector<pair<ll, ll>> primeFac(ll n) {
  vector<pair<ll, ll>> ret;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i != 0) continue;
    ll exp = 0;
    while (n % i == 0) {
      n /= i;
      exp++;
    }
    ret.push_back(make_pair(i, exp));
  }
  if (n != 1) ret.push_back(make_pair(n, 1));
  return ret;
}
}  // namespace my
////////////////////////

int main() {
  int n;
  cin >> n;
  map<string, int> mp;
  for (int i = 0; i < n; i++) {
    string tmp;
    cin >> tmp;
    if (!mp.count(tmp))
      mp[tmp] = 1;
    else
      mp.at(tmp)++;
  }

  cout << "AC"
       << " x " << mp["AC"] << endl;
  cout << "WA"
       << " x " << mp["WA"] << endl;
  cout << "TLE"
       << " x " << mp["TLE"] << endl;
  cout << "RE"
       << " x " << mp["RE"] << endl;
}

Measured memory_bytes: 3628
n,m,q = map(int,input().split())
arr = [list(map(int,input().split())) for i in range(q)]

ans  = 0
from itertools import combinations_with_replacement

for kumi in combinations_with_replacement(range(1,m+1),n):
    tmp = 0
    for ar in arr:
        if kumi[ar[1]-1]-kumi[ar[0]-1]==ar[2]:
            tmp+=ar[3]
    ans = max(ans,tmp)
print(ans)

Measured memory_bytes: 9064
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
#define mod ((ll)1e9+7)
#define inf ((ll)1e18+5)
#define maxx ((ll)1e6+5)
#define pb push_back
#define endl "\n"
#define time(i) cout<<"\nTime Elapsed "<<i<<" : " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
#define usefile freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll expm(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
/*
bool sv[maxx]={0};    // returns 0 if a num is prime
int sp[maxx]={0};     // gives smallest prime factor of the number
void Sieve() {for(int i= 2; i< maxx; i+= 2) sv[i]=1,sp[i] = 2;sv[2]=0;for(ll i = 3; i < maxx; i += 2){if (!sv[i]){sp[i] = i;for (ll j = i; (j*i) < maxx; j += 2){if (!sv[j*i])sv[j*i] = true, sp[j*i] = i;}}}}
ll fact[maxx]={0}; // returns factorial of that number
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<maxx;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncrm(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(expm(fact[r],mod-2)))%mod; res=(res*(expm(fact[n-r],mod-2)))%mod; return res;}
ll inv[maxx];   // returns the modular inverse of number
void inversify( ll m){inv[1]=1;for(int i=2;i<maxx;i++){inv[i]= m- m/i*inv[m%i]%m;}}
ll ncr(ll n,ll r,ll m){int ans=1;for (int i = 0; i < r; i++){ans=ans*(n-i)%m*inv[i+1]%m;}return ans;}
*/
signed main(){
  fast;
  //usefile;
  //test
  {
    int n,k;
    cin>>n>>k;
    n=n%k;
    cout<<min(n,k-n);
  }
  //time("");
  return 0;
}

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

public static partial class Program
{
    public static void Main()
    {
        var x = CRL().ToInt();
        
        var list = new List<double>();
        for (int b = 1; b <= 1000; b++)
        {
            for (int p = 2; p <= 1000; p++)
            {
                list.Add(Math.Pow(b, p));
            }
        }

        CWL(list.Distinct().Where(a => a <= x).OrderBy(a => a).Last());
    }
}

public static partial class Program
{
    //テンプレここから
    public static int Sigma(int n, int next = 1, int val = 0) => next > n ? val : Sigma(n, next + 1, val + next);  
    public static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);
    public static int GCD(int a, int b) => b == 0 ? a : GCD(b, a % b);
    public static long LCM(long a, long b) => a * b / GCD(a, b);
    public static int LCM(int a, int b) => a * b / GCD(a, b);
    public static string CRL() => Console.ReadLine();
    public static void CWL(object obj) => Console.WriteLine(obj);
    public static int ToInt(this double d) => (int) d;
    public static long ToLong(this double d) => (long) d;
    public static int ToInt(this string str) => int.Parse(str);
    public static long ToLong(this string str) => long.Parse(str);
    public static long[] ToLong(this IEnumerable<string> strs) => strs.Select(x => x.ToLong()).ToArray();
    public static int[] ToInt(this IEnumerable<string> strs) => strs.Select(x => x.ToInt()).ToArray();
    public static long[] ArrayLongs(this string str, char opr = ' ') => str.Split(opr).ToLong();
    public static int[] ArrayInts(this string str, char opr = ' ') => str.Split(opr).ToInt();
    public static long Diff(long a, long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static int Diff(int a, int b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static long Sign(this long i) => Math.Sign(i);
    public static bool IsEven(this long i) => i % 2 == 0;
    public static bool IsEven(this int i) => i % 2 == 0;
    public static readonly int[] Dx = new[] {0, -1, 0, 1};
    public static readonly int[] Dy = new[] {-1, 0, 1, 0};
    public const int Mod = 1000000007;
    public static string alphabet = "abcdefghijklmnopqrstuvwxyz";
    public static long ToLong(this char c) => c.ToString().ToInt();
    public static long[] Sort(this long[] array) => array.OrderBy(x => x).ToArray();
    public static int[] Sort(this int[] array) => array.OrderBy(x => x).ToArray();
    public static long[] DSort(this long[] array) => array.OrderByDescending(x => x).ToArray();
    public static int[] DSort(this int[] array) => array.OrderByDescending(x => x).ToArray();
    public static string Join(this IEnumerable<string> array, string sep = "") => string.Join(sep, array);
    public static string Join(this IEnumerable<char> array, string sep = "") => string.Join(sep, array);

    public static string JoinToStr(this IEnumerable<int> array, string sep = "")
        => array.Select(x => x.ToString()).Join(sep);

    //テンプレここまで
}

Measured memory_bytes: 29408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 200000;
char ci[cm];
int cn;
inline char getcha() { 
	if (!cn) { fread(ci, 1, cm, stdin); cn = cm; }
	cn--;
	return ci[cm - cn - 1];
}

inline int getint() {
	int A = getcha() - '0';
	char C = getcha();
	while (isdigit(C)) {
		A = A * 10 + C - '0';
		C = getcha();
	}
	return A;
}


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


	int N, X;
	N = getint();
	X = getint();

	int A = 0;
	ll kotae = 0;
	rep(i, N) {
		int B = getint();
		int k = max(A + B - X, 0);
		kotae += k;
		A = B - k;
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int r = sc.nextInt();
		int d = sc.nextInt();
		int[] x = new int[11];
		x[0] = sc.nextInt();
		for (int i = 1; i < 11; i++) {
			x[i] = r * x[i - 1] - d;
			sb.append(x[i] + "\n");
		}
		System.out.print(sb);
	}
}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
long long sum[100100];
long long cost[100100];
int to[100100];
long long K;
long long count(int x)
{
	int it=0;
	int now=x;
	while(true)
	{
		now=to[now];
		it++;
		sum[it]=sum[it-1]+cost[now];
		if(now==x)
			break;
	}
	if(K<=it)
	{
		return *max_element(sum+1,sum+K+1);
	}
	else
	{
		if(sum[it]<=0)
		{
			return *max_element(sum+1,sum+it+1);
		}
		else
		{
			int x1=K/it,x2=K%it;
			return max(x1*sum[it]+*max_element(sum,sum+x2+1),(x1-1)*sum[it]+*max_element(sum+(x1==1),sum+it+1));
		}
	}
}
int main()
{
	int N;
	cin>>N>>K;
	for(int i=0;i<N;i++)
	{
		cin>>to[i];
		to[i]--;
	}
	for(int i=0;i<N;i++)
		cin>>cost[i];
	long long ans=-1e10;
	for(int i=0;i<N;i++)
		ans=max(ans,count(i));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

int _;
int st[]={2,3,5};
int c[10],d;
ll n;
map<ll,ll> hs;

ll calc(ll n) {
	if (hs.count(n)) return hs[n];
	if (n==0) return hs[0]=0;
	hs[n]=1ll<<60;
	if (hs[n]/d/n) hs[n]=min(hs[n],d*n);
	for (int i=0;i<3;i++) {
		ll x=n;
		if (x%st[i]==0) hs[n]=min(hs[n],calc(x/st[i])+c[i]);
		else {
			hs[n]=min(hs[n],calc(x/st[i])+(x%st[i])*d+c[i]);
			hs[n]=min(hs[n],calc(x/st[i]+1)+(st[i]-x%st[i])*d+c[i]);
		}
	}
	//printf("%lld %lld\n",n,hs[n]);
	return hs[n];
}

int main() {
	for (scanf("%d",&_);_;_--) {
		scanf("%lld%d%d%d%d",&n,c,c+1,c+2,&d);
		hs.clear();
		printf("%lld\n",calc(n));
	}
}


Measured memory_bytes: 4524
#include <stdio.h>
#include <stdlib.h>
int main()
{
  int i,j,v,A[100],k,N;

  scanf("%d",&N);
  if(N < 0 || N > 100) exit(2);
  for(i = 0; i < N ; i++){
    scanf("%d",&A[i]);
    if(A[i] < 0 || A[i] > 1000) exit(2);
  }

  for(k = 0 ; k < N ; k++){
    printf("%d",A[k]);
    if(k != N-1) printf(" ");
  }
  printf("\n");

  for(i = 1 ; i <= N-1 ; i++){
    v = A[i];
    j = i-1;

    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;

    for(k = 0 ; k < N ; k++){
      printf("%d",A[k]);
    if(k != N-1) printf(" ");
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 604
from sys  import stdin,stdout

import bisect
import math
def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")

def soe(limit):
    l=[1]*(limit+1)
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0

    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
            n=n-1
        else:
            a=(a*a)
            n=n>>1
    return r
    
def solve():
    n=inp()
    d={'AC':0,'WA':0,'TLE':0,'RE':0}
    for i in range(n):
        s=input()
        d[s]+=1
    print('AC x',d['AC'])
    print('WA x',d['WA'])
    print('TLE x',d['TLE'])
    print('RE x',d['RE'])
    


solve()


Measured memory_bytes: 9344
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <complex>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;
constexpr ll LL_MAX = numeric_limits<ll>::max();
constexpr ull ULL_MAX = numeric_limits<ull>::max();

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

int main() {
    ll N, M;
    cin >> N >> M;
    ll left = 1;
    ll right = N;
    bool shifted = false;
    rep(i,0,M) {
        if ((N%2 == 0) && !shifted && 2 * (right - left) <= N) {
            right--;
            shifted = true;
        }
        cout << left << " " << right << endl;
        left++;
        right--;
    }
}



Measured memory_bytes: 3136
//abc168_a.cpp
//Sun May 17 20:36:57 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

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

int main(){
	int n;
	cin >> n;
	int x = n%10;

	if (x==3){
		cout << "bon" << endl;
	}else if (x==0 || x==1 || x==6 || x==8) {
		cout << "pon" << endl;
	}else {
		cout << "hon" << endl;
	}

}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<vector>
#include<map>
using namespace std;

struct Node{
  vector<int> con;
  vector<int> cost;
};

const int inf = 1<<27;

bool BellmanFord(const vector<Node> &Graph, int s, int A[], bool vis[])
{
  bool ret = false;
  const int n = Graph.size();
  for(int k = 0; k < n; ++k){
    for(int i = 0; i < n; ++i){
      for(int e = 0; e < (int)Graph[i].con.size(); ++e){
        int dst = Graph[i].con[e];
        int src = i;
        if( A[dst] > A[src] + Graph[i].cost[e] ){
          A[dst] = A[src] + Graph[i].cost[e];
          
          if( k == n-1 ){
            A[dst] = -inf;
            ret = true;
          }
        }
      }
    }
  
  }
  return ret;
}

int main()
{
  int n;
  while(cin>>n&&n){
    // A km = 10^B km
    // A == 1 , B == 0
    int id = 0;
    vector<Node> Graph(200);
    map<string,int> D;
    for(int i = 0; i < n; ++i){
      char c;
      string A,B;
      int power;
      cin >> c >> A >> c >> c >> c >> c >> power >> B;
      //cout << A << ' ' << power << ' ' << B << endl;
      if( D.find(A) == D.end() ){
        D[A] = id++;
      }
      if( D.find(B) == D.end() ){
        D[B] = id++;
      }
      Graph[D[A]].con.push_back( D[B] );
      Graph[D[A]].cost.push_back( power );
      Graph[D[B]].con.push_back( D[A] );
      Graph[D[B]].cost.push_back( -power );
    }
    Graph.resize( id );
    bool vis[id];
    int A[id];
    for(int i = 0; i < id; ++i){
      vis[i] = false;
      A[i] = inf*2;
    }
    bool res = true;
    for(int i = 0; i < id; ++i){
      if( !vis[i] ){
        if( BellmanFord( Graph, i, A, vis ) ){
          res = false;
        }
      }
    }

    if( res ){
      puts("Yes");
    }else{
      puts("No");
    }
                 
    
  }
  return 0;
}

Measured memory_bytes: 952
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mod 1000000007
#define wi while
#define vl vector<ll>
#define vi vector<int>
#define map map<char,ll>
#define endl "\n"
const int mxN = 200001;
int main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    
    int n;
    cin>>n;
    int a[n+1][3];
    for(int i=1;i<=n;++i)
    {
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    }
    int dp[n+1][3];
    dp[0][0]= 0;
    dp[0][1] = 0;
    dp[0][2] = 0;
    for(int i=1;i<=n;++i)
    {
        dp[i][0] = a[i][0] + max(dp[i-1][1],dp[i-1][2]);
        dp[i][1] = a[i][1] + max(dp[i-1][0],dp[i-1][2]);
        dp[i][2] = a[i][2] + max(dp[i-1][0],dp[i-1][1]);
    }
    cout<<max(dp[n][0],max(dp[n][1],dp[n][2]));

    
    return 0;

}


Measured memory_bytes: 5924
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#define maxn 1005
#define _ 0
using namespace std;
struct nod
{
	int nex,id;
	nod(int a,int b)
	{
		nex=a;
		id=b;
	}
	nod(){}
};
int n,m,tim;
int vis[maxn];
int bel[maxn][maxn][2];
int u[maxn*maxn],v[maxn*maxn];
vector<nod> edge[maxn];
void dfs(int now,int fa,int b,int f)
{
	vis[now]=tim; bel[fa][now][f]=b;
	int len=edge[now].size();
	for(int i=0;i<len;i++)
		if(vis[edge[now][i].nex]!=tim)
			dfs(edge[now][i].nex,fa,b,f);
}
void solve(int now)
{
	tim++; vis[now]=tim;
	int len=edge[now].size();
	for(int i=0;i<len;i++)
		if(vis[edge[now][i].nex]!=tim)
			dfs(edge[now][i].nex,now,edge[now][i].id,0);
 
	reverse(edge[now].begin(),edge[now].end());
 
	tim++; vis[now]=tim;
	for(int i=0;i<len;i++)
		if(vis[edge[now][i].nex]!=tim)
			dfs(edge[now][i].nex,now,edge[now][i].id,1);
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d%d",&u[i],&v[i]);
		edge[u[i]].push_back(nod(v[i],i));
	}
	for(int i=1;i<=n;i++)
		solve(i);
	for(int i=1;i<=m;i++){
		if( (bel[v[i]][u[i]][0]!=0) ^ _ ^ (bel[u[i]][v[i]][0]!=i || bel[u[i]][v[i]][1]!=i) )
			printf("diff\n");
		else
			printf("same\n");
	}
}


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

int main() {
	int h, w, m;
	cin >> h >> w >> m;
	set<pair<int, int>> b;
	vector<ll> vh(h), vw(w);
	rep(i, m) {
		int H, W;
		cin >> H >> W;
		H--; W--;
		b.insert({H, W});
		vh[H]++;
		vw[W]++;
	}
	ll mx_h = 0;
	int hi = 0;
	rep(i, h) {
		if (vh[i] > mx_h) {
			mx_h = vh[i];
			hi = i;
		}
	}
	ll mx_w = 0;
	int wi = 0;
	rep(i, w) {
		if (vw[i] > mx_w) {
			mx_w = vw[i];
			wi = i;
		}
	}
	ll ans;
	if (mx_h > mx_w) {
		ans = mx_h;
		ll mx = 0;
		rep(i, w) {
			if (b.count({hi, i})) vw[i]--;
			mx = max(mx, vw[i]);
		}
		ans += mx;
	} else {
		ans = mx_w;
		ll mx = 0;
		rep(i, h) {
			if (b.count({i, wi})) vh[i]--;
			mx = max(mx, vh[i]);
		}
		ans += mx;
	}
	
	cout << ans << endl;
	return 0;
}

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




typedef long long ll;
#define PI 3.14159265359
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define _GLIBCXX_DEBAC
#include <functional>
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

ll lcm(ll a, ll b) {
	ll c;
	c = a * b / gcd(a, b);
	return c;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

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

const ll mod = 1000000007;
struct mint {
	ll x;
	mint(ll x = 0):x(x%mod){}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		res -= a;
	}
	mint operator*(const mint a)const {
		mint res(*this);
		return res *= a;
	}
};

map<string, int> memo;

using P=pair<int, int>;




/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/

ll nCr(ll n, ll r) {
	ll a = 1;
	for (ll i = n; i > n - r; --i) {
		a = a * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		a = a / i;
	}
	return a;
}

void comb(vector<vector <long long int> >& v) {
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}


int main() {
	string s;
	cin >> s;
	int a = stoi(s.substr(5, 2));
	if (a <= 4)cout << "Heisei";
	else cout << "TBD";
	return 0;
}










Measured memory_bytes: 256
n = int(input())
a = input()
b = input()
c = input()
k = 0
for i in range(n):
    p = 0
    if a[i] != b[i]:
        p+=1
    if b[i] != c[i]:
        p+=1
    if c[i] != a[i]: 
        p+=1

    if p == 2:
        k += 1
    elif p == 3:
        k+=2
print(k)

Measured memory_bytes: 3060
import java.util.*;

public class Main{
	static public void main(String[] args){
		Scanner sc=new Scanner(System.in);
		char[] ch=new char[3];
		for(int i=0;i<3;i++){
			String str=sc.next();
			ch[i]=str.charAt(i);
		}
		for(char c:ch)System.out.print(c);
		sc.close();
		return;
	}
}

Measured memory_bytes: 35676
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<n;++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

void pV(vector<ll> A){
    cout << "[vector]";
    for(int i=0; i<A.size(); i++){
        cout << A[i] << " ";
    }
    cout << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    // input
    string S, T;
    cin >> S >> T;

    int N = S.length();

    bool isSame = false;
    FOR(i, 0, N){
        if(S == T){
            isSame = true;
            break;
        }else{
            S = S.back() + S.substr(0, N-1);
        }
    }

    if(isSame){
        p("Yes");
    }else{
        p("No");
    }
    
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <deque>
#include <set>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPL(i,f,n) for(int i=f, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
typedef vector<long long> vll;

// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	return a/ gcd(a,b)*b;
}
bool vis[60];
bool graph[60][60];
int N;
void dfs(int x) { // 現在の頂点
	if (vis[x])return;
	vis[x] = true; // 頂点xを訪問済みにする
	REP(i, N) { //頂点i:頂点xに隣接している do
		if (graph[x][i]) {
			dfs(i);
		}
	}
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int M,ans = 0,a[60], b[60];
	scanf("%d %d", &N, &M);
	REP(i, M) {
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
	}
	REP(j, M) {
		graph[a[j]][b[j]] = graph[b[j]][a[j]] = false;
		REP(i, N) vis[i] = false;
		dfs(0);
		bool connected = true;
		REP(i, N) {
			if (!vis[i]) {
				connected = false;
			}
		}
		if (!connected)ans++;
		graph[a[j]][b[j]] = graph[b[j]][a[j]] = true;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    string s; cin >> s;
    s[3] = '8';
    cout << s << endl;
}

Measured memory_bytes: 256
s = raw_input()
n1,  n2 = s.split()
n1 = int(n1)
n2 = int(n2)
flag = True
if n1 < 0 or n1 > 9:
	flag = False
if n2 < 0 or n2 > 9:
	flag = False
if flag:
	print n1 * n2
else:
	print -1

Measured memory_bytes: 84916
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long A = sc.nextLong();
    long B = sc.nextLong();
    long K = sc.nextLong();
    
    if(K <= A){
      A = A - K;
    }else if(A < K && K <= A + B){
      B = B - (K -A);
      A = 0;
    }else if(A + B <= K){
      A = 0;
      B = 0;
    }
    System.out.println(A + " " + B);
}
}


Measured memory_bytes: 23764
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;

int balls[10];

bool dfs(int i, int a, int b)
{
	if (i == 10) return true;
	bool ans = false;
	if (a < balls[i]) ans = dfs(i + 1, balls[i], b);
	if (b < balls[i]) ans = dfs(i + 1, a, balls[i]);
	return ans;
}

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < 10; ++j)
		{
			cin >> balls[j];
		}
		if (dfs(0, 0, 0)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

int main(){
 int n,m,x,y,i;
 int amax=-101,bmax=101;
 int a[100];
 int b[100];
 cin>>n>>m>>x>>y;

 for(i=0;i<n;i++){
     cin>>a[i];
 }
 for(i=0;i<m;i++){
     cin>>b[i];
 }

 for(i=0;i<n;i++){
     if(amax<=a[i]){
         amax=a[i];
     }
 }

 for(i=0;i<m;i++){
     if(bmax>=b[i]){
         bmax=b[i];
     }
 }
 
 if(amax<bmax){
     if(x<=amax && bmax<y){
         cout<<"No War";
     }
   	 else{
       cout<<"War";
     }
 }
 else{
 	cout<<"War";
 }
 
}

Measured memory_bytes: 256
/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <stdio.h>
#include <math.h>
    signed short* x;
    signed short* y;
    signed short* index;
    signed char n;
    double result = 0;
    signed long factorial(signed short n) 
{ 
    if (n == 0) 
        return 1; 
    return n * factorial(n - 1); 
} 
void swap(short *x, short *y) 
{ 
    short temp; 
    temp = *x; 
    *x = *y; 
    *y = temp; 
} 

void permute(short *a, short l, short r) 
{ 
   short i; 
   if (l == r) 
     {
         for(short z = 1;z<n;z++)
         {
             
             result = result + pow(pow(x[index[z]]-x[index[z-1]],2)+pow(y[index[z]]-y[index[z-1]],2),.5);
             //printf("result %f\n",result);
         }
     }
   else
   { 
       for (i = l; i <= r; i++) 
       { 
          //printf("L: %d   I: %d\n",l,i); 
          swap((a+l), (a+i)); 
          //printf("First swap\n");
          permute(a, l+1, r); 
          swap((a+l), (a+i)); //backtrack 
       } 
   } 
}

int main() 
{ 
    signed char i;
    x = (signed short*) malloc(n * sizeof(signed short));
    y = (signed short*) malloc(n * sizeof(signed short));
    index = (signed short*) malloc(n * sizeof(signed short));
    scanf("%hd",&n);
    for(i=0;i<n;i++)
    {
     index[i] = i;
     scanf("%hd %hd",x+i,y+i);
    }
    //printf("n: %d\n",n);
    permute(index,0,n-1);
    //printf("final result: %.6f \n",result);
    //printf("final result: %ld \n",factorial(n));
    result = result/factorial(n);
    printf("%f\n",result);
    return 0; 
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<math.h>
using namespace std;
#define int long long int
#define endl "\n"
#define PI 3.14159265
const int mod=1e9+7;
//const int mod=1e9+7;
const int INF =LONG_LONG_MAX;
inline int gcd(int a,int b){if(a==0) return b;return gcd(b%a,a);}
inline int pow(int a,int n,int mod){if(n==0)return 1;int p=pow(a,n/2,mod);p=(p%mod*p%mod)%mod;if(n%2) return (p%mod*a%mod)%mod;else return p;}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++){cin>>a[i];}
    int dp[n+1][k+1];
    int pre[n+1][k+1];

    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=k;j++)
        {
            dp[i][j]=0;
            if(j==0){dp[i][j]=1;pre[i][j]=dp[i][j];continue;}
            if(i==0){dp[i][j]=0;pre[i][j]=1;continue;}
              int d=min(a[i-1],j);
              dp[i][j]=(pre[i-1][j]%mod-((j-d-1)>=0?pre[i-1][j-d-1]:0)%mod+mod)%mod;
             pre[i][j]=(pre[i][j-1]%mod+dp[i][j]%mod)%mod;
        }
    }
    cout<<dp[n][k]%mod<<endl;

    return 0;
}


Measured memory_bytes: 158080
#include<bits/stdc++.h>
    #define ll long long
    using namespace std;
    int main()
    {
        int n;
        cin>>n;
        ll a[n];
        for(int i=0;i<n;++i)
            cin>>a[i];
        std::sort(a,a+n);
        if(a[0]==0)
            cout<<"0";
        else
        {
            double ans = 0;
            for(int i=0;i<n;++i)
            {
                ans += log10(a[i]);
            }
            if(ans>18.1)
                cout<<"-1";
            else
            {
                ll prod = 1;
                for(int i=0;i<n;++i)
                {
                    prod *= a[i];
                }
                if(prod>1000000000000000000)
                    cout<<"-1";
                else
                    cout<<prod;
            }
        }
    }


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

int main() {
  int N,K;
  cin>>N>>K;
  vector<pair<int,int64_t>> p(N);
  for(int i=0;i<N;i++){
    int a;
    int64_t b;
    cin>>a>>b;
    p[i]=make_pair(a,b);
  }
  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  vector<int64_t> q;
  vector<int64_t> r;
  for(int i=0;i<N;i++){
    if(i==0){
      q.push_back(p[i].second);
    }
    else if(p[i].first!=p[i-1].first){
      q.push_back(p[i].second);
    }
    else{
      r.push_back(p[i].second);
    }
  }
  q.push_back(-167167167167167);
  r.push_back(-167167167167167);
  q.push_back(167167167167167);
  r.push_back(167167167167167);
  sort(q.begin(),q.end());
  reverse(q.begin(),q.end());
  sort(r.begin(),r.end());
  reverse(r.begin(),r.end());
  int M=q.size();
  int L=r.size();
  q[0]=0;
  r[0]=0;
  for(int i=1;i<M;i++){
    q[i]+=i*2-1;
    q[i]+=q[i-1];
  }
  for(int i=1;i<L;i++){
    r[i]+=r[i-1];
  }
  int64_t Z=0;
  for(int i=0;i<=min(K,M-1);i++){
    if(!(K-i>=L||K-i<0)){
      Z=max(Z,q[i]+r[K-i]);
    }
  }
  cout<<Z<<endl;
}

Measured memory_bytes: 6052
//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

constexpr int bm = 2500;
ll BIT[50][bm];
int zero[50];
//priority_queue<ll> PQ;
const int AS = 100000;
class saidai_tekitou_heap {
public:
	int HS = 0;
	const ll IM = -8e18;
	ll dat[AS * 2 + 2];
	saidai_tekitou_heap() : dat() {
		dat[0] = -IM;
		rep1(i, AS * 2 + 1) dat[i] = IM;
	}
	void push(ll v) {
		int p = ++HS;
		while (v > dat[p >> 1]) dat[p] = dat[p >> 1], p >>= 1;
		dat[p] = v;
	}
	ll pop() {
		if (HS == 1) {
			HS = 0;
			return dat[1];
		}
		ll ret = dat[1];
		ll v = dat[HS];
		dat[HS--] = IM;
		int j = 2 + (dat[2] < dat[3]);
		while (v < dat[j]) {
			dat[j >> 1] = dat[j];
			j <<= 1;
			j += dat[j] < dat[j + 1];
		}
		dat[j >> 1] = v;
		return ret;
	}
} PQ;
inline ll query(int A, int gin) {
	ll kotae = 0;
	while (gin < bm) {
		kotae = max(BIT[A][gin], kotae);
		gin += gin & -gin;
	}
	return kotae;
}
inline void query2(int A, int gin, ll ti) {
	int tmp = gin;
	while (gin < bm) {
		if (BIT[A][gin] >= ti) return;
		gin += gin & -gin;
	}
	gin = tmp;
	while (gin > 0) {
		if (BIT[A][gin] >= ti) break;
		BIT[A][gin] = ti;
		gin -= gin & -gin;
	}
	PQ.push(ti << 18 | A << 12 | tmp);
}

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


	int N, M, S;
	cin >> N >> M >> S;
	if (S >= 2460) S = 2460;

	vector<ll> E[50];
	rep(i, M) {
		int u, v, a;
		ll b;
		cin >> u >> v >> a >> b;
		u--;
		v--;
		b = a << 8 | b << 16;
		E[u].pb(v | b);
		E[v].pb(u | b);
	}
	int C[50], D[50];
	rep(i, N) {
		cin >> C[i] >> D[i];
	}

	query2(0, S + 1, 4e12);
	ll zenbu = 0;
	ll owari = (1ll << N) - 1;

	while (PQ.HS) {
		auto p = PQ.pop();
		ll ti = p >> 18;
		int i = p >> 12 & 63;
		int gin = p & 4095;
		if (ti < query(i, gin)) continue;

		ll ti2 = ti - D[i];
		int gin2 = gin + C[i];
		if (gin2 > 2460) gin2 = 2460;
		query2(i, gin2, ti2);

		for (auto pp : E[i]) {
			int to = pp & 255;
			ti2 = ti - (pp >> 16);
			gin2 = gin - (pp >> 8 & 255);
			if (gin2 > 0) query2(to, gin2, ti2);
		}
		zenbu |= 1ll << i;
		if (zenbu == owari) break;
	}

	for (int i = 1; i < N; i++) {
		co(ll(4e12 - query(i, 1)));
	}



	Would you please return 0;
}

Measured memory_bytes: 6204
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const int SIZE = 1e6+5;
const LL INF = 1LL<<60;
const double eps = 1e-7;

int a[100009];
int dc[100009];

int main(){
	DRI(n);
	REP(i,n){
		RI(a[i]);dc[i]=a[i];
	}
	sort(dc,dc+n);
	int ans=0;
	REP(i,n){
		a[i]=lower_bound(dc,dc+n,a[i])-dc;
		if(a[i]%2!=i%2)ans++;
	}
	printf("%d",ans/2);
}


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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int N, M;
    cin >> N >> M;
    vector<int> C = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
    vector<int> A(M);
    for (int i = 0; i < M; i++) {
        cin >> A[i];
    }
    vector<vector<int>> dp(N / 2 + 1, vector<int>(N + 1, -1));
    dp[0][N] = 0;
    for (int i = 0; i < N / 2 + 1; i++) {
        for (int j = 0; j < N + 1; j++) {
            if (dp[i][j] == -1) continue;
            for (int k = 0; k < M; k++) {
                if (j - C[A[k]] >= 0) {
                    dp[i + 1][j - C[A[k]]] = max(dp[i + 1][j - C[A[k]]], A[k]);
                }
            }
        }
    }


    for (int i = N / 2; i >= 0; i--) {
        if (dp[i][0] != -1) {
            string ans = "";
            int now = 0;
            for (int i2 = i; i2 > 0; i2--) {
                ans += '0' + dp[i2][now];
                now += C[dp[i2][now]];
            }
            cout << ans << endl;
            return;
        }
    }
    
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

Measured memory_bytes: 195840