akhauriyash/Code-Regression huggingface dataset:
N=int(input())
alpha=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
name=''
for _ in range(11):
    name=alpha[N%26-1]+name
    if N<=26:
        break
    N=(N-1)//26

print(name)

Measured memory_bytes: 9124
//██████╗ ██╗   ██╗██╗      ██████╗ ███████╗
//██╔══██╗██║   ██║██║      ██╔══██╗██╔════╝
//██████╔╝██║   ██║██║█████╗██║  ██║█████╗
//██╔══██╗██║   ██║██║╚════╝██║  ██║██╔══╝
//██║  ██║╚██████╔╝██║      ██████╔╝███████╗
//╚═╝  ╚═╝ ╚═════╝ ╚═╝      ╚═════╝ ╚══════╝
#include <bits/stdc++.h>

//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <algorithm>
using namespace std;

#define fst first
#define snd second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back

#define all(v) (v).begin(), (v).end()
#define sz(v) ((int)(v).size())
#define sqr(x) ((x) * (x))

#define ADD_OPERATORS_IN(T, COMP) \
    bool operator < (const T& ot) const { return COMP(ot) == -1; } \
    bool operator > (const T& ot) const { return COMP(ot) == 1; } \
    bool operator == (const T& ot) const { return COMP(ot) == 0; } \
    bool operator != (const T& ot) const { return COMP(ot) != 0; }

#define ADD_OPERATORS_OUT(T, COMP) \
    bool operator < (const T& a, const T& b) const { return COMP(a, b) == -1; } \
    bool operator > (const T& a, const T& b) const { return COMP(a, b) == 1; } \
    bool operator == (const T& a, const T&b) const { return COMP(a, b) == 0; } \
    bool operator != (const T& a, const T&b) const { return COMP(a, b) != 0; }


typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;

mt19937_64 mt_rand(chrono::system_clock::now().time_since_epoch().count());

template<typename T1, typename T2> inline bool upmax(T1& a, T2 b) { return (a < b ? (a = b, true) : false); }
template<typename T1, typename T2> inline bool upmin(T1& a, T2 b) { return (b < a ? (a = b, true) : false); }

const int maxn = (int) 1e6+10;
const int maxlog = 21;
const int base = 998'244'353;
const ld eps = (ld) 1e-9;
const ld PI = acos(-1.);
const int pp = 41;
const int INF = (int) 2e9;
const ll llinf = (ll) 1e18;

struct edge {
  int a, b, cost;
};

int n, m, p;
vector<edge> e, e1;
//const int INF = 1000000000;

vector<int> g[maxn];
bool used[maxn];

void dfs(int v) {
  used[v] = 1;
  for (int to : g[v]) {
    if (used[to]) continue;
    dfs(to);
  }
}


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

//  freopen("input.txt", "r", stdin);
  cin >> n >> m >> p;
  for (int i = 0; i < m; i ++) {
    int a, b, c;
    cin >> a >> b >> c;
    a --; b --;
    c -= p;
    e1.pb({a, b, -c});
    g[b].pb(a);
  }

  dfs(n - 1);
  for (auto & t : e1) {
    if (used[t.a] && used[t.b]) {
      e.pb(t);
    }
  }
  m = sz(e);

  vector<int> d (n, INF);
  d[0] = 0;
  vector<int> p (n, -1);
  int x;
  for (int i=0; i<n; ++i) {
    x = -1;
    for (int j=0; j<m; ++j)
      if (d[e[j].a] < INF)
        if (d[e[j].b] > d[e[j].a] + e[j].cost) {
          d[e[j].b] = max (-INF, d[e[j].a] + e[j].cost);
          p[e[j].b] = e[j].a;
          x = e[j].b;
        }
  }

  if (x != -1) {
    cout << -1;
  } else {
    cout << max(0, -d[n - 1]);
  }

  return 0;
}

Measured memory_bytes: 24064
n = int(input())
x = list(map(int,input().split()))
a = sorted(x)
#print(a)
ans1 = a[int(n/2-1)]
ans2 = a[int(n/2)]
#print(ans1,ans2)
if ans1 == ans2:
    for i in range(n):
        print(ans1)
else:
    for i in range(n):
        if x[i] < ans2:
            print(ans2)
        else:
            print(ans1)

Measured memory_bytes: 26180
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define all_acc(x) (x).begin(),(x).end(),0LL
#define int long long
using namespace std;
using P=pair<int,int>;
using Graph=vector<vector<int>>;
using ll=long long;

int accumulate(int* a,int n){
    return accumulate(a,a+n,0LL);
}

int accumulate(vector<int> a){
    return accumulate(a.begin(),a.end(),0LL);
}

signed main(){ 
    int d,n; cin>>d>>n;




    string s="";
    
    if(n==100){
        s+=to_string(n+1);
    }else{
        s+=to_string(n);
    }

    for(int i=0;i<d;i++){
        s+="00";
    }
    cout<<s<<endl;
}  

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

typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<long long,long long> pll;

#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define int long long
#define sz(v) (int)v.size()
#define inf 2147483647
#define llinf 9223372036854775807
#define all(v) v.begin(),v.end()
#define bp(n) __builtin_popcountll(n)
#define f(i,l,r) for(long long i=l;i<=r;i++)
#define rf(i,r,l) for(long long i=r;i>=l;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }


const int N=1e5+5,mod=1e9+7,bit=61;

template<typename T>
class segment	// pass argument as (L,R+1) to process the query from L to R
{
	public:
		vector<T> st;
		ll n;
		segment(){}
		segment(ll _n)
		{
			n=_n;
			st.resize(2*n);
		}
		T merge(T a,T b)
		{
			return max(a,b);
		}
		void create()
		{
			for(ll i=n-1;i>0;i--)
			{
				st[i]=merge(st[i<<1],st[(i<<1) | 1]);
			}
		}
		void update(ll idx,T val)
		{
			for(st[idx+=n-1]=val;idx>1;idx>>=1)
			{
				st[idx>>1]=merge(st[min(idx,idx^1)],st[max(idx,idx^1)]);
			}
		}
		T query(ll l,ll r)
		{
			T ans{};
			T ansl{};
			T ansr{};
			for(l+=n-1,r+=n-1;l<r;l>>=1,r>>=1)
			{
				if(l & 1)
				{
					ansl=merge(ansl,st[l++]);
				}
				if(r & 1)
				{
					ansr=merge(st[--r],ansr);
				}
			}
			ans=merge(ansl,ansr);
			return ans;
		}
};


signed main()
{
    fast;

    int t=1;
    //cin>>t;
    f(tc,1,t)
    {
        int n,k;
        cin>>n>>k;
        int a[n];
        f(i,0,n-1)
        {
            cin>>a[i];
            a[i]++;
        }
        segment<int> obj(300001);
        obj.create();
        int ans=0;
        f(i,0,n-1)
        {
            int l=max(1ll,a[i]-k);
            int r=min(300001ll,a[i]+k);
            int curr=1+obj.query(l,r+1);
            ans=max(ans,curr);
            obj.update(a[i],max(curr,obj.st[a[i]+300001-1]));
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 10328
import java.io.*;
import java.util.*;
/**
 * Main
 */
public class Main {

    public static void main(String[] args) {
       MyScanner ms  = new MyScanner();
       String line = ms.nextLine();
       System.out.println(line.equals("ABC")?"ARC":"ABC");
    }public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
   
        public MyScanner() {
           br = new BufferedReader(new InputStreamReader(System.in));
        }
   
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
   
        int nextInt() {
            return Integer.parseInt(next());
        }
   
        long nextLong() {
            return Long.parseLong(next());
        }
   
        double nextDouble() {
            return Double.parseDouble(next());
        }
   
        String nextLine(){
            String str = "";
        try {
           str = br.readLine();
        } catch (IOException e) {
           e.printStackTrace();
        }
        return str;
        }
  
     }
}

Measured memory_bytes: 32292
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;
ll N,M;
const ll MAX_M=10,MAX_N=10;
ll k[MAX_M],s[MAX_M][MAX_N],p[MAX_M],sch[MAX_N];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>N>>M;
	REP(i,M){
		cin>>k[i];
		REP(j,k[i]){
			cin>>s[i][j];
			s[i][j]--;
		}
	}
	REP(i,M)cin>>p[i];
	ll ans=0;
	REP(bt,1<<N){
		REP(i,N){
			sch[i]=(bt>>i)&1;
		}
		bool f=true;
		REP(i,M){
			ll c=0;
			REP(j,k[i]){
				c+=sch[s[i][j]];
			}
			if(c%2!=p[i]){
				f=false;
			}
		}
		if(f)ans++;
	}
	cout<<ans<<endl;
}

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

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

using namespace std;

int main(void)
{
	string in_text{ 0 };
	cin >> in_text;

	string text{};

	for (string::size_type i = 0; i < in_text.size(); ++i)
	{
			if (in_text[i] == 'B'
				&& i + 1 < in_text.size()
				&& in_text[i + 1] == 'C')
			{
				text += "D";
				++i;
			}
			else
			{
				text += in_text[i];
			}
	}

	ul cnt_unusedA{ 0 };
	ul ans{ 0 };
	for (char c : text)
	{
		if (c == 'A')
		{
			++cnt_unusedA;
		}
		else if (c == 'D')
		{
			ans += cnt_unusedA;
		}
		else
		{
			cnt_unusedA = 0;
		}
	}

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


Measured memory_bytes: 776
#include <iostream>

using namespace std;

int main(){
  int a, b, c, count = 0;
  cin >> a >> b >> c;
  if(a>b)
    count = 0;
  else if(a==b)
    count = 1;
  else{
    if(b>=(a*c))
      count = c;
    else
      count = b/a;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
/*
Author: CNYALI_LK
LANG: C++
PROG: Cf2017C_B.cpp
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define all(x) x.begin(),x.end()
using namespace std;
const double eps=1e-8;
const double PI=acos(-1.0);
typedef long long ll;
template<class T>ll chkmin(T &a,T b){return a>b?a=b,1:0;}
template<class T>ll chkmax(T &a,T b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
#define min mmin
#define max mmax
#define abs aabs
ll a[23];
int main(){
#ifdef cnyali_lk
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
	ll n,s=1,t=1;
	scanf("%lld",&n);

	for(ll i=1;i<=n;++i){
		scanf("%lld",a+i);
		s*=3;
		t*=2-(a[i]&1);
	}
	printf("%lld\n",s-t);
	return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp11
{
    class Class10
    {
        static void Main()
        {
            var v = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int K = v[0];
            int X = v[1];
            List<int> R = new List<int>();
            for (int i = X - K + 1; i <= X + K - 1; i++)
                R.Add(i);
            Console.WriteLine(string.Join(" ", R));
        }
    }
}


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

typedef long long ll;
typedef pair<ll, ll> pll;

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define vuni(v) v.erase(unique(v.begin(), v.end()), v.end());
#define mins(m, s) m.insert(make_pair(s, 1));
#define mfin(m, s) m.find(s) != m.end()

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl

const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9 + 7;

int main() {
    ll n;
    ll a[100005], b[100005];
    cin >> n;
    for(ll i = 0; i < n + 1; i++) {
        cin >> a[i];
    }
    for(ll i = 0; i < n; i++) {
        cin >> b[i];
    }

    ll ans = 0;
    for(ll i = 0; i < n; i++) {
        if(a[i] > b[i]) {
            ans += b[i];
            a[i] -= b[i];
        } else {
            ans += a[i];
            b[i] -= a[i];
            a[i] = 0;
            if(a[i + 1] > b[i]) {
                ans += b[i];
                a[i + 1] -= b[i];
            } else {
                ans += a[i + 1];
                a[i + 1] = 0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5112
import sys
from itertools import accumulate
n, m = [int(i) for i in sys.stdin.readline().split()]
ls = [0 for i in range(n+1)]
for i in range(m):
    l, r = [int(i) for i in sys.stdin.readline().split()]
    l, r = l - 1, r - 1
    ls[l] += 1
    ls[r + 1] -= 1
ls = [i for i in accumulate(ls)]
cnt = 0
for l in ls[:-1]:
    if l == m:
        cnt += 1
print(cnt)

Measured memory_bytes: 49328
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

#define ll long long
//typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll Mypow(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}


ll INFL = 1LL << 60;//10^18 = 2^60
int INF = 1 << 30;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

int main(){
  int a, b, h; cin >> a >> b >> h;
  cout << (a+b) * h / 2 << endl;
}


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

int main() {
    cin.tie(0)->sync_with_stdio(false);

    ll n, a, b;
    cin >> n >> a >> b;

    ll ans = 0;
    if ((b - a) % 2) ans = min(n - a, b - 1) - (b - a - 1) / 2;
    else ans = (b - a) / 2;

    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    A, V = [int(i) for i in input().strip().split()]
    B, W = [int(i) for i in input().strip().split()]
    T = int(input().strip())
    if abs(A - B) <= (V - W) * T:
        return "YES"
    else:
        return "NO"


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
//struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;

int N;
int A[20];
int x[20][20];
int y[20][20];
 
int counter(int x) {
    if(x == 0) return 0;
    return counter(x >> 1) + (x & 1);
}
 
void solve() {
    cin >> N;
    for(int i = 1; i <= N; i++) {
        cin >> A[i];
        for(int j = 1; j <= A[i]; j++) {
            cin >> x[i][j] >> y[i][j];
        }
    }
    int ans = 0;
    for(int bits = 1; bits < (1 << N); bits++) {
        bool ok = true;
        for(int i = 1; i <= N; i++) {
            if(!(bits & (1 << (i-1)))) continue;
            for(int j = 1; j <= A[i]; j++) {
                if(((bits >> (x[i][j]-1)) & 1) ^ y[i][j]) ok = false;
            }
        }
        if(ok) ans = max(ans, counter(bits));
    }
    cout << ans << endl;
    return;
}
 
int main() {
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7;
string s,t;
vector<int> cntas,cntbs,cntat,cntbt;
int n,m;
int mod3(int x){
    return (x%3+3)%3;
}
bool solve(int l1, int r1, int l2, int r2){
    return mod3(cntas[r1]-cntas[l1-1]+cntbs[l1-1]-cntbs[r1]) == mod3(cntat[r2]-cntat[l2-1]+cntbt[l2-1]-cntbt[r2]);
}
int main(){
    cin >> s >> t;
    n = s.size();
    m = t.size();
    cntas.resize(n+1);
    cntbs.resize(n+1);
    cntat.resize(m+1);
    cntbt.resize(m+1);
    for(int i = 1; i <= n; ++i) cntas[i] = cntas[i-1]+(s[i-1]=='A');
    for(int i = 1; i <= n; ++i) cntbs[i] = cntbs[i-1]+(s[i-1]=='B');
    for(int i = 1; i <= m; ++i) cntat[i] = cntat[i-1]+(t[i-1]=='A');
    for(int i = 1; i <= m; ++i) cntbt[i] = cntbt[i-1]+(t[i-1]=='B');
    int q;
    cin >> q;
    while(q--){
        int l1,r1,l2,r2;
        scanf("%d %d %d %d",&l1,&r1,&l2,&r2);
        if(solve(l1,r1,l2,r2))
            puts("YES");
        else
            puts("NO");
    }
}


Measured memory_bytes: 2432
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <vector>
#include <stack>
#define Clear( x , y ) memset( x , y , sizeof(x) );
#define Qcin() std::ios::sync_with_stdio(false);
using namespace std;
typedef long long LL;
const int Maxn = 1e6 + 7;
const int Inf = 1e9 + 7;
int N , M;
int main()
{
	while( cin >> N >> M ){
		int S = N * M - M - N + 1;
		cout << S << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define reps(i, n , m) for(ll i = n; i <= m; i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
const int mod = 1000000007; 
long long inv[200000],fact[200000],ifact[200000];
long long comb(ll n, ll k){
	if(n<k)return 0;
	else if (n<0||k<0) return 0;
	else return fact[n] * ifact[k] % mod * ifact[n-k] % mod;
}
 
 
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	/*inv[1] = fact[0] = fact[1] = ifact[0] = ifact[1] = 1; for (int i=2;i<200000;i++){ inv[i] = (mod - mod / i) * inv[mod % i] % mod; fact[i] = fact[i-1] * i % mod;ifact[i] = ifact[i-1] * inv[i] % mod;
	}*/ //nCr
	int N;
	cin>>N;
	vi Af(N);
	vi As(N);
	vector<pii> A(N);
	rep(i,N){
		cin>>Af[i];
		As[i]=i+1;
		
		A[i]=make_pair(Af[i],As[i]);
	}
	sort(A.begin(),A.end());
	rep(i,N) cout<<A[i].second<<endl;
}

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

class Program
{
    static void Main(string[] args)
    {
        // N=夏休み日数 M=宿題数
        int[] nm = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int[] A = Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();
        int a = nm[0]-A.Sum();

        if (a >= 0)
        {
            Console.WriteLine(a);
        }
        else
        {
            Console.WriteLine(-1);
        }
    }
}




Measured memory_bytes: 29088
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int nh,nw,h,w,H,W,a[114][514]={0};
	char c;
	cin>>H>>W;
	for(h=1;h<=H;h++)for(w=1;w<=W;w++)
	{
		cin>>c;
		if(c=='#')a[h][w]=1;
	}
	int dh[4]={1,0,-1,0},dw[4]={0,1,0,-1};
	h=w=1;
	for(;;)
	{
		int f=0;
		a[h][w]=0;
		for(int d=0;d<4;d++)
		{
			if(a[h+dh[d]][w+dw[d]]==1)
			{
				f++;
				if(d>1||f>1)
				{
					cout<<"Impossible"<<endl;
					return 0;
				}
				nw=w+dw[d],nh=h+dh[d];
			}
		}
		if(w==W&&h==H&&a[h-1][w]==0&&a[h][w-1]==0)
		{
			cout<<"Possible"<<endl;
			return 0;
		}
		else if(W==w&&H==h)
		{
			cout<<"Impossible"<<endl;
			return 0;
		}
		h=nh,w=nw;
	}
	cout<<"Impossible"<<endl;
}

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

int N;
vector<vector<pair<int,int> > > v;

bool judge(int bit){
  for (int i = 0; i < N; i++){
    if ( ! (bit & (1 << i)) ) continue;

    for (pair<int,int> xy : v[i]) {
      int x = xy.first;
      int y = xy.second;

      if (  (bit & (1 << x)) && y == 0) return false;
      if ( !(bit & (1 << x)) && y == 1) return false;
    }

  }
  return true;
}

int main(){
  cin >> N;
  v.resize(N);
  for (int i = 0; i < N; i++) {
    int M;
    cin >> M;
    v[i].resize(M);
    for (int j = 0; j < M; j++) {
      cin >> v[i][j].first >> v[i][j].second;
      v[i][j].first--;
    }
  }

  int res = 0;
  for (int bit = 0; bit < (1 << N); bit++) {
    int cnt = 0;
    if (judge(bit)) {
      for (int i = 0; i < N; i++){
        if ( bit & ( 1 << i ) ){
          cnt++;
        }
      }
      res = max(res, cnt);
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

int main(){
	// 入力用変数
	//double x,y;
	unsigned long long x,y;
	
	// その他の変数
	int counter=0;
	
	std::cin >> x >> y;
	
	//--------------------------------
	// ここから
	//--------------------------------
	
	while(x<=y){
		counter++;
		x*=2;
	}
	
	std::cout << counter;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
long long inf=1e18+7;
struct Node{
  int no;
  int par;
  int col;
  long long dist;
  vector<pair<Node*,long long>> child;
  void build(int i){
    no=i;par=i;col=0;dist=inf;
  }
};
bool operator >(const Node &a,const Node &r){
        return a.dist > r.dist;
    }
struct Graph{
    int n;
    bool direct;
    vector<Node> node;
    Graph(int N){
        n=N;
        node.resize(n+1);
        for(int i=1;i<=n;++i){
            node[i].build(i);
        }
    }
    void input(int m,bool flag){
        direct=flag;
        for(int i=0;i<m;++i){
            int l=1;
            int a,b;cin>>a>>b>>l;
            node[a].child.push_back({&node[b],l});
            if(!direct){
                node[b].child.push_back({&node[a],l});
            }
        }
    }
    void dijkstra(int s){
        for(int i=1;i<=n;++i){
            node[i].dist=inf;
        }
        node[s].dist=0;
        priority_queue<Node,vector<Node>,greater<Node>> que;
        que.push(node[s]);
        while(!que.empty()){
            Node buf=que.top();que.pop();
            int num=buf.child.size();
            for(int i=0;i<num;++i){
                if(buf.child[i].first->dist>buf.child[i].second+buf.dist){
                    buf.child[i].first->dist=buf.child[i].second+buf.dist;
                    que.push(*buf.child[i].first);
                }
            }
        }
    }
    bool binary_graph(){
        node[1].col=1;
        queue<Node> que;
        que.push(node[1]);
        bool res=true;
        while(!que.empty()){
            Node buf=que.front();que.pop();
            int num=buf.child.size();
            for(int i=0;i<num;++i){
                if(buf.child[i].first->col==0){
                    buf.child[i].first->col=buf.col*2%3;
                    que.push(*buf.child[i].first);
                }
                else{
                    if(buf.child[i].first->col==buf.col){
                        res=false;
                    }
                }
            }
        }
        return res;
    }
};

int main(){
    int n;cin>>n;
    Graph g(n);
    for(int i=1;i<=n;++i){
        string buf;cin>>buf;
        for(int j=1;j<=n;++j){
            if(buf[j-1]=='1'){
                g.node[i].child.push_back({&g.node[j],1});
            }
        }
    }
    if(!g.binary_graph()){
        cout<<-1<<"\n";
        return 0;
    }
    long long res=0;
    for(int i=1;i<=n;++i){
        g.dijkstra(i);
        for(int j=1;j<=n;++j){
            res=max(res,g.node[j].dist);
        }
    }
    cout<<res+1<<"\n";
    return 0;
}

Measured memory_bytes: 1664
import java.util.*;
import java.math.*;
class Main{
	public static void main(String[] args){
		Scanner s=new Scanner(System.in);
		int a=s.nextInt();
		BigInteger bi=new BigInteger("1");
		for(int i=0;i<a;i++)bi=bi.multiply(new BigInteger(""+(i+2)));
		bi=bi.add(new BigInteger("2"));
		System.out.println(bi.toString());
		for(int i=0;i<a;i++)System.out.println(2+i);
	}
}

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

int main(){
    int n;
    long long m,max=-1000000,min=1000000,sum=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>m;
        if(m>max)max=m;
        if(m<min)min=m;
        sum+=m;
    }
    cout<<min<<" "<<max<<" "<<sum<<endl;
    
    return 0;
}


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

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> height(n);
    for(int i = 0; i < n;i++){
        cin >> height[i];
    }
    vector<vector<int> > root(n);
    for(int i = 0; i < m; i++){
        int a,b;
        cin >> a >> b;
        root[a-1].push_back(b-1);
        root[b-1].push_back(a-1);
    }
    int cnt = 0;
    for(int i = 0;i < n;i++){
        if(root[i].size() == 0){
            cnt++;
        }else{
            for(int j = 0;j < root[i].size();j++){
                if(height[i] <= height[root[i][j]]){
                    break;
                }else if(j == root[i].size()-1){
                    cnt++;
                }
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 8748
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

int n,p;
pair<int,int> dp[101][50001];

int main() {
    while (cin>>n && n != 0) {
        memset(dp,-1,sizeof(dp));
        dp[0][0] = pair<int,int>(0,0);
        for (int i = 0; i < n; i++) {
            cin>>p;
            for (int t = 0; t < 500*n; t++) {
                if (dp[i][t] == pair<int,int>(-1,-1)) continue;
                dp[i+1][t] = max(dp[i][t],dp[i+1][t]);
                if (p%1000<500 && p%1000) dp[i+1][t+(500-p%500)] = max(dp[i+1][t+(500-p%500)], pair<int,int>(dp[i][t].first+1,dp[i][t].second-p));
                if (p%1000==0 && t>=500) dp[i+1][t-500] = max(dp[i+1][t-500],pair<int,int>(dp[i][t].first+1,dp[i][t].second-p));

                if (p%1000>=500) {
                    if (t>=p%500) dp[i+1][t-p%500] = max(dp[i+1][t-p%500], pair<int,int>(dp[i][t].first+1,dp[i][t].second-p));
                    else dp[i+1][t+(500-p%500)] = max(dp[i+1][t+(500-p%500)], pair<int,int>(dp[i][t].first, dp[i][t].second-p));
                }
            }
        }
        pair<int,int> ans = pair<int,int>(0,0);
        for (int i = 0; i < 50000; i++) ans = max(ans, dp[n][i]);
        cout<<ans.first<<" "<<-ans.second<<endl;
    }
}

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

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

    if(n % 4 == 0 || n % 7 == 0){
        cout << "Yes" << endl;
        return 0;
    }
    if(n < 4 || n == 5 || n == 6){
        cout << "No" << endl;
        return 0;
    }

    int tmp = n;
    while(true){
        if(tmp < 4){
            cout << "No" << endl;
            return 0;
        }
        tmp -= 4;
        if(tmp % 7 == 0){
            cout << "Yes" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
n = int(input())
numbers = list(map(int, input().split(' ')))

counters = {}
cevap_list = {}
sayilar = set(numbers)
for i in numbers:
    if i in counters:
        counters[i] += 1
    else:
        counters[i] = 1

sonuc = 0
for sayi in counters:
    count = counters[sayi]
    sonuc += int(count * (count - 1) / 2)


for i in range(n):
    print(sonuc-counters[numbers[i]]+1)

Measured memory_bytes: 29476
n, k = map(int, input().split())
vs = [int(i) for i in input().split()]


def getv(takel, taker, drop):
    g = vs[:takel] + vs[len(vs) - taker:] + [0] * drop
    return sum(sorted(g, reverse=True)[:takel + taker])


def getm(take):
    if take >= n:
        return getv(n, 0, k - take)
    else:
        m = 0
        for takel in range(take + 1):
            m = max([m, getv(takel, take - takel, k - take)])
        return m


def solve():
    return max([getm(take) for take in range(k + 1)])


print(solve())


Measured memory_bytes: 3188
#include <iostream>

int main(void){
    int a,b = 0;
    
    std::cin >> a >> b;
    
    if (((-1000 <= a) && (a <= 1000)) && ((-1000 <= b) && (b <= 1000))) {
        
        std::string daisyou = "a == b";
        
        if (a < b) {
            
            daisyou = "a < b";
            
        }else if(a > b){
            
            daisyou = "a > b";
            
        }
        
        std::cout << daisyou << std::endl;
        
    }


    return 0;
}


Measured memory_bytes: 3220
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace hitachi2020_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            s = s.Replace("hi", "");
            Console.WriteLine(s == "" ? "Yes" : "No");
        }
    }
}


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

using namespace std;
typedef long long ll;

ll Search(ll a, ll b) {
	ll ans = a * b;
	vector<ll> d(3);
	for (int i = 1; i <= a / 2 + 1; i++) {
		d[0] = i * b;
		d[1] = (b / 2) * (a - i);
		d[2] = a * b - d[0] - d[1];
		sort(d.begin(), d.end());
		ans = min(ans, d[2] - d[0]);
	}
	return ans;
}

int main(void) {
	int a, b;
	ll ans;
	cin >> a >> b;
	if (a % 3 == 0 || b % 3 == 0)
		printf("0\n");
	else {
		ans = min(a, b);
		ans = min(ans, Search(a, b));
		ans = min(ans, Search(b, a));
		cout << ans << "\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int x, a;
	cin >> x >> a;
	if(x<a) cout << 0 << endl;
	else cout << 10 << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val H = sc.next().toInt()
        val W = sc.next().toInt()
        val K = sc.next().toInt()
        val C = Array(H) { sc.next().toCharArray().map { it == '#' }.toBooleanArray() }
        var hmax = 1
        repeat(H) { hmax *= 2 }
        var wmax = 1
        repeat(W) { wmax *= 2 }
        var ans = 0L
        for (hr in 0 until hmax) for (wr in 0 until wmax) {
            var n = 0
            loop@ for (h in 0 until H) for (w in 0 until W) {
                if (C[h][w] && (hr and (1 shl h)) == 0 && (wr and (1 shl w)) == 0) {
                    n++
                    if (n > K) break@loop
                }
            }
            if (n == K) {
                //dprint("($hr, $wr) : $n")
                ans++
            }
        }
        pw.println(ans)
    }
}


Measured memory_bytes: 38128
#include <bits/stdc++.h>
int main(void)
{
  long long n, x[5] = {}, t ,a = 0;
  char name[11];
  std::cin >> n;
  for(int i = 0; i != n; i++){
    std::cin >> name;
    if(name[0] == 'M') x[0]++;
    if(name[0] == 'A') x[1]++;
    if(name[0] == 'R') x[2]++;
    if(name[0] == 'C') x[3]++;
    if(name[0] == 'H') x[4]++;
  }
  for(int i = 0; i != 3; i++)
    for(int j = i + 1; j != 4; j++)
      for(int k = j + 1; k != 5; k++)
        a += x[i] * x[j] * x[k];
  std::cout << a << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e4 + 10;
int dp[N], a[N], b[N];
int main() {
    int h, n;
    cin >> h >> n;
    int inf = 1e9;
    for(int i = 0; i <= h; i++) dp[i] = inf;
    dp[0] = 0;
    for(int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        if(a[i] > h) dp[h] = min(dp[h], b[i]);
        for(int j = 1; j <= h; j++) {
            if(j <= a[i]) dp[j] = min(dp[j], b[i]);
            else dp[j] = min(dp[j], dp[j-a[i]] + b[i]);
        }
    }
    cout << dp[h] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
#include <map>
#include <sstream>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-9

int main(){
	long long n;
	while(scanf("%lld",&n),n){
		long long sum = 1;
		long long K = (long long)n;
		for(long long i=2; i*i<=n; i++){
			if( n%i==0 ){
				long long cnt = 1;
				for(long long k=(long long)i;n%i==0;n/=i,k*=i)cnt+=k;
				sum *= (long long)cnt;
				//printf("i:%lld , cnt:%lld  ,  sum:%lld\n",i,cnt,sum);
			}
			//if( sum-2*K>0 ){ break; }
		}
		if( n>1 )sum*=(long long)(n+1);
		//printf("n:%lld , sum:%lld\n",n,sum);
		if( sum-2*K==0 ){
			puts("perfect number");
		}else if( sum-2*K<0 ){
			puts("deficient number");
		}else{
			puts("abundant number");
		}
	}
	return 0;
}

Measured memory_bytes: 0
#define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES 1

#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <random>

const long long INF = 10000000000000000;

using namespace std;

int main(){
	long long N,x;
	cin>>N>>x;
	vector<long long> a(N);
	long long ret=0;
	for(int i=0;i<N;i++){
		cin>>a[i];
	}
	if(a[0]>x){
		ret+=a[0]-x;
		a[0]=x;
	}
	for(int i=0;i<N-1;i++){
		if(a[i]+a[i+1]>x){
			ret+=a[i]+a[i+1]-x;
			a[i+1]=x-a[i];
		}
	}
	cout<<ret<<endl;
	return 0;	
}


Measured memory_bytes: 1152
#include <stdio.h>
long long ans, n, x;
long long l[100002], r[100002];
int id[100001];
int main() {
	scanf("%lld", &n);
	l[0] = 0;
	r[n + 1] = n + 1;
	for (int i = 1; i <= n; i++) {
		scanf("%lld", &x);
		id[x] = i;
		l[i] = i - 1;
		r[i] = i + 1;
	}
	for (int i = 1; i <= n; i++) {
		x = id[i];
		ans += ((l[x] - l[l[x]]) * (r[x] - x) + (r[r[x]] - r[x]) * (x - l[x])) * i;
		r[l[x]] = r[x];
		l[r[x]] = l[x];
	}
	printf("%lld\n", ans);
}


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

int main(){
    map<ll, ll> a;
    int n, k;   cin >> n >> k;
    for(int i=0; i<n; i++){
        ll x; cin >> x;
        a[x] += 1;
    }
    vector<ll> v;
    for(auto x: a)
        v.push_back(x.second);
    sort(v.begin(), v.end());
    ll sum=0;
    if(k<v.size())
        for(int i=0; i<v.size()-k; i++)
            sum += v.at(i);
    cout << sum << endl;
    

}

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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++)

#define INF (1ll<<50)



int main() {
	li a, b;
	cin >> a >> b;
	li g = __gcd(a, b);
	cout << (a / g)*b << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

map<ll, int> prime_factor(ll n) {
  map<ll, int> ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n; cin >> n;
  auto prm = prime_factor(n);
  int ans = 0;
  for(auto p: prm){
    int cnt = 1;
    int num = p.second;
    while(num>=cnt){
      num -= cnt;
      cnt++;
    }
    ans += cnt-1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3672
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
 
signed main() {
	IOS;
	int n, k;
	cin >> n >> k;
	int p = n%k;
	cout << min(p, k-p);	
	return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return float64(i)
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

const Mod = 1000000007

func ModComb(n, k int) int {
	if k == 0 {
		return 1
	}
	x, y := n, k
	for i := 1; i < k; i++ {
		x = x * (n - i) % Mod
		y = y * (k - i) % Mod
	}
	inv := ModInv(y)
	return x * inv % Mod
}

func ModFact(x int) int {
	fact := 1
	for i := 1; i <= x; i++ {
		fact = fact * i % Mod
	}
	return fact
}

func ModInv(x int) int {
	return ModPow(x, Mod-2)
}

func ModPow(a, n int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % Mod
		}
		a = a * a % Mod
		n /= 2
	}
	return res
}

func pow(a, n int) int {
	if n == 0 {
		return 1
	}

	ans := 0
	if n%2 == 0 {
		ans = pow(a*a, n/2)
	} else {
		ans = a * pow(a*a, (n-1)/2)
	}
	return ans
}

func main() {
	sc.Split(bufio.ScanWords)

	n := readInt()

	ans := 0
	for i := 1; i <= n; i++ {
		k := i
		keta := 0
		for k > 0 {
			k /= 10
			keta++
		}
		if keta%2 != 0 {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using pi = pair<int, int>;
using pll = pair<ll, ll>;
constexpr int INF = 0x3f3f3f3f; constexpr ll LLINF = 0x3f3f3f3f3f3f3f3f;
#define db(x) { cerr << #x << " = " << x << endl; }
template <typename T> void _dbarr(T* a, size_t sz){ for(int i = 0; i < sz; i++) cerr << a[i] << " \n"[i == sz-1]; }
template <typename T> void _dbarr(vector<T> a, size_t sz){ for(int i = 0; i < sz; i++) cerr << a[i] << " \n"[i == sz-1]; }
#define dbarr(x, n) {cerr << #x << ": "; _dbarr((x),(n));}
#define all(x) begin(x), end(x)
#define pb push_back
#define eb emplace_back
#define mpr make_pair
#define fs first
#define sn second

int main() {
	//cin.tie(0)->sync_with_stdio(0);
    int n;
    cin >> n;
    unordered_map<string,int> f;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        f[s]++;
    }

    cout << "AC" << " x " << f["AC"]<< "\n";
    cout << "WA" << " x " << f["WA"]<< "\n";
    cout << "TLE" << " x " << f["TLE"]<< "\n";
    cout << "RE" << " x " << f["RE"]<< "\n";
}


Measured memory_bytes: 3620
#include <iostream>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

int main()
{
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  int cnt = 0;
  REP (i, a + 1) {
    REP (k, b + 1) {
      REP (j, c + 1) {
        if ((500 * i) + (100 * k) + (50 * j) == x) {
          ++cnt;
        }
      }
    }
  }
  cout << cnt << endl;
}


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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

int f_dir[2][4] = {{-1, 0, 1, 0}, {0, 1, 0, -1}}; //↑→↓←
int e_dir[2][8] = {{-1, -1, -1, 0, 0, 1, 1, 1}, {-1, 0, 1, -1, 1, -1, 0, 1}};
bool is_in_field(int y, int x, int h, int w){
  return (y >= 0 && y < h && x >= 0 && x < w);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  ll n, k;
  cin >> n >> k;
  vi used(n, -1);
  vi a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
    a[i]--;
  }
  int nex = 0;
  ll ans = 0;
  vi road(n+2, 0);
  for(int i = 0; i < n+1; i++){
    road[i+1] = nex;
    if(used[nex] == -1) used[nex] = i;
    else{
      ans = road[min(k,(k - ll(used[nex])) % ll(i - used[nex]) + used[nex])+1]+1;
      break;
    }
    nex = a[nex];
  }
  cout << ans << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 5636
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val h = sc.nextLong()
    val w = sc.nextLong()
    if (h == 1L || w == 1L) {
        println(1)
        return
    }
    println(((w + 1) / 2) * ((h + 1) / 2) +
    (w / 2) * (h / 2))
}

Measured memory_bytes: 31392
import itertools
import math
N = int(input())
position = [list(map(int, input().split())) for i in range(N)]
l = [0, 1, 2, 3, 4, 5, 6, 7]
length = 0
for v in itertools.permutations(l[:N], N):
    for k in range(N-1):
        length += ((position[v[k]][0] - position[v[k+1]][0]) ** 2 +
                   (position[v[k]][1] - position[v[k+1]][1]) ** 2)**0.5
print(length/math.factorial(N))

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

using namespace std;

struct edge { int src, dest, cost; };
using P = pair<int, int>; //距離、ノード番号

const int INF = INT_MAX;
int V;                      //Node数
map<int, vector<edge>> G; //edge集合、G[src][index]
map<int, int> DIST;         //現状のコスト　DIST[Node][Cost]
map<int ,int> preNode;      //最短経路上の1ホップ前のノード 


void init() {
    for (int i = 0; i < V; i++) {
        DIST[i] = INF;
    }
}

void setEdge(int src, int dest, int cost) {
    edge e = { src,dest,cost };
    G[src].push_back(e);
}

void dijkstra(int s) {
    //要素の型,内部コンテナの型、並べ替え方法
    //P->first＝距離で昇順にソート
    priority_queue<P, vector<P>, greater<P> > que;

    DIST[s] = 0;
    preNode[s]=s;
    que.push(P(0, s));

    while (!que.empty()) {

        P p = que.top(); que.pop();

        int tmp_node = p.second;
        if (DIST[tmp_node] < p.first) { continue; }
        for (auto g : G[tmp_node]) {
            edge e = g;
            if (DIST[e.dest] > DIST[tmp_node] + e.cost) {
                DIST[e.dest] = DIST[tmp_node] + e.cost;
                que.push(P(DIST[e.dest], e.dest));
                preNode[e.dest]=tmp_node;
            }
        }
    }


}

int main(void) {

    int N, M, A, B;
    cin >> N >> M;

    V = N;//頂点数を登録


    //初期化
    init();

    //エッジの作成
    for (int i = 0; i < M; i++) {
        cin >> A >> B;
        setEdge(A - 1, B - 1, 1);
        setEdge(B - 1, A - 1, 1);
    }

    //ダイクストラ法実行
    dijkstra(0);

    for(int i=0;i<N;i++){
      if(DIST[i] == INF){
        cout<<"No"<<endl;
        return 0;
      }
    }

    cout<<"Yes"<<endl;


    for(int i=1;i<N;i++){
      cout<<preNode[i]+1<<endl;
    }

    return 0;
}

Measured memory_bytes: 29592
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		boolean ans = true;

		for (int i = 0; i < S.length(); i++) {
			char c = S.charAt(i);

			if (c=='U' || c == 'D') {
				continue;
			}
			if (i%2==0) {
				if (c!='R') {
					ans = false;
				}
			} else {
				if (c!='L') {
					ans = false;
				}
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
}



Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> grid(h);
    rep(i, h) { cin >> grid.at(i); }
    vvi left(h, vi(w)), right(h, vi(w)), up(h, vi(w)), down(h, vi(w));
    rep(i, h) {
        int left_count = 0, right_count = 0;
        rep(j, w) {
            if (grid.at(i).at(j) == '.') {
                left_count++;
            } else {
                left_count = 0;
            }
            left.at(i).at(j) = left_count;
            if (grid.at(i).at(w - 1 - j) == '.') {
                right_count++;
            } else {
                right_count = 0;
            }
            right.at(i).at(w - 1 - j) = right_count;
        }
    }
    rep(j, w) {
        int up_count = 0, down_count = 0;
        rep(i, h) {
            if (grid.at(i).at(j) == '.') {
                up_count++;
            } else {
                up_count = 0;
            }
            up.at(i).at(j) = up_count;
            if (grid.at(h - 1 - i).at(j) == '.') {
                down_count++;
            } else {
                down_count = 0;
            }
            down.at(h - 1 - i).at(j) = down_count;
        }
    }
    int ans = 0;
    rep(i, h) {
        rep(j, w) { ans = max(ans, up.at(i).at(j) + down.at(i).at(j) + left.at(i).at(j) + right.at(i).at(j) - 3); }
    }
    cout << ans << endl;
}


Measured memory_bytes: 73640
import os

Q,H,S,D = (int(x) for x in input().split())
N = int(input())
h = min(Q*2,H)
s = min(h*2,S)
d = min(s*2,D)

ans = 0

ans += d*(N//2)
if N%2:
    ans += s
print(ans)


Measured memory_bytes: 3060
from collections import deque
Sa = deque(input())
Sb = deque(input())
Sc = deque(input())

#%%
turn = 'a'
while True:
    if turn == 'a':
        if len(Sa) == 0:
            ans = 'A'
            break
        turn = Sa.popleft()
    elif turn == 'b':
        if len(Sb) == 0:
            ans = 'B'
            break
        turn = Sb.popleft()
    else:
        if len(Sc) == 0:
            ans = 'C'
            break
        turn = Sc.popleft()

print(ans)


Measured memory_bytes: 38384
n = int(input())
s = input().split(" ")
nums = list(map(int,s))
koukan = 0
for i in range(n):
    minj = i
    for j in range(i+1,n):
        if nums[j] < nums[minj]:
            minj = j
    w = nums[i]
    nums[i] = nums[minj]
    nums[minj] = w
    if i != minj:
        koukan += 1
for i in range(n):
    if i == n-1:
        print(nums[i])
    else:
        print(nums[i],end=" ")
print(koukan)

Measured memory_bytes: 7668