akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int a, b, c, x, y;
    scan(a, b, c, x, y);

    long ans = infl;

    foreach (i ; 0 .. max(x, y) + 1) {
        long t = 1L * i * 2 * c;
        t += 1L * max(0, x - i) * a;
        t += 1L * max(0, y - i) * b;
        chmin(ans, t);
    }

    writeln(ans);
}








void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 256
def factorization(n):
    res = []
    tmp = n
    for i in range(2, int(n**0.5)+1):
        if tmp % i == 0:
            p = 0
            while tmp % i == 0:
                p += 1
                tmp //= i
            res.append((i, p))

    if tmp != 1:
        res.append((tmp, 1))

    # 素数
    if len(res) == 0:
        res.append((n, 1))

    return res

n = int(input())
if n == 1:
    print(0)
    exit()
cnt = 0
l = factorization(n)
for i, p in l:
    for pp in range(1, p+1):
        if n % (i**pp) == 0:
            n //= i**pp
            cnt += 1
print(cnt)


Measured memory_bytes: 9460
#include <stdio.h>
#include <stdlib.h>

void CountingSort(int *,int *,int,int);

int main()
{
  int n,*A,*B,i,max=0;
  
  scanf("%d",&n);

  A = (int *)malloc((n+1) *sizeof(int));
  B = (int *)malloc((n+1) *sizeof(int));

  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
    if(max<A[i]) max = A[i];
  }

  CountingSort(A,B,max,n);

  for(i=1;i<=n;i++){
    printf("%d",B[i]);
    if(i<n) printf(" ");
    else printf("\n");
  }

  free(A);
  free(B);

  return 0;
}

void CountingSort(int *A,int *B,int k,int n)
{
  int *C,i,j;

  C = (int *)malloc((k+1) * sizeof(int));
  
  for(i=0;i<=k;i++){
    C[i] = 0;
  }

  for(j=1;j<=n;j++){
    C[A[j]]++;
  }

  for(i=1;i<=k;i++){
    C[i] = C[i]+C[i-1];
  }

  for(j=n;j>0;j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  free(C);
}

    
    
  
  



Measured memory_bytes: 17248
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll di=1000000007;
int n;
string s[2];
bool vis[55][2];
bool pan(){
    memset(vis,0,sizeof(vis));
    for(int i=0;i<n;i++){
        for(int j=0;j<2;j++){
            if(vis[i][j])continue;
            if(!vis[i][j^1]&&s[j^1][i]==s[j][i]){
                vis[i][j^1]=1;
            }
            else if(i+1<n&&!vis[i+1][j]&&s[j][i]==s[j][i+1]){
                vis[i+1][j]=1;
            }
            else{
                return 0;
            }
        }
    }
    return 1;
}
int main(){
    while(cin>>n){
        cin>>s[0]>>s[1];
        if(!pan()){
            printf("0\n");
            continue;
        }
        ll ans=1;
        for(int i=0;i<n;i++){
            if(s[0][i]==s[1][i]){
                if(!i){
                    ans*=3ll;
                }
                else if(s[0][i-1]==s[1][i-1]){
                    ans*=2ll;
                }
                else{

                }
            }
            else{
                if(i&&s[0][i]==s[0][i-1])continue;
                if(!i){
                    ans*=6ll;
                }
                else if(s[0][i-1]==s[1][i-1]){
                    ans*=2ll;
                }
                else{
                    ans*=3ll;
                }
            }
            ans%=di;
        }
        printf("%lld\n",ans);
    }
}


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

int main() {
  int i, N, M, count=0, x;
  
  cin >> N >> M;
  
  vector<int> num(N);
  
  rep(i,2*M) {
    cin >> x;
    num[x-1] +=1;
  }
  
  rep(i,N) cout << num[i] << endl;
}

  

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <ctime>
#define ll long long int
#define MOD 1000000007
using namespace std;
#define pb push_back
#define rep(i, x, n) for (ll i = x; i < n; i++)
#define rev(i, n, x) for (ll i = n; i > x; i--)
clock_t start;

void FAST(int argc)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    start = clock();
    if (argc == 2)
        freopen("std.in", "r", stdin);
}
/*vector<ll> v;
void seive()
{
    v.pb(2);
    for (int i = 3; i < 100000; i += 2)
    {
        for (int j = 0; j < v.size(); j++)
        {
            if (i % v[j] == 0)
                break;
            if (v[j] * v[j] > i)
            {
                v.pb(i);
                break;
            }
        }
    }
}
/*
void prime_factor(ll x, vector<ll> &r)
{
    ll sqrt_x = sqrt(x);

    for (ll i : v)
    {
        if (i > sqrt_x)
            break;

        if (x % i == 0)
            r.pb(i);

        while (x % i == 0)
        {
            x /= i;
        }
    }

    if (x >= 2)
        r.pb(x);
}
*/
/*
ll power(ll x, ll y)
{
    ll res = 1;
    x = x % MOD;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % MOD;
        y = y >> 1;
        x = (x * x) % MOD;
    }
    return res;
}
*/
/*
inline void dfs(long long int curr, long long int prev)
{

    for (long long int i : a[curr])
        if (i != prev)
            dfs(i, curr);
}
*/
/*
ll multi(ll a, ll b)
{
    return ((a * b) % MOD);
}
*/
//---------------------CODE STARTS HERE---------------------

int main(int argc, char *argv[])
{
    FAST(argc);

    ll testcase = 1;
    //cin >> testcase;

    while (testcase--)
    {
        int n;
        cin >> n;
        int a[n], b[n], c[n];
        int ansa[n], ansb[n], ansc[n];
        cin >> a[0] >> b[0] >> c[0];
        ansa[0] = a[0];
        ansb[0] = b[0];
        ansc[0] = c[0];
        rep(i, 1, n)
        {
            cin >> a[i] >> b[i] >> c[i];
            ansa[i] = a[i] + max(ansb[i - 1], ansc[i - 1]);
            ansb[i] = b[i] + max(ansc[i - 1], ansa[i - 1]);
            ansc[i] = c[i] + max(ansa[i - 1], ansb[i - 1]);
        }
        cout << max({ansa[n - 1], ansb[n - 1], ansc[n - 1]}) << endl;

        //--------??--------CLEAR VECTORS--------??--------
    }

    //v.clear();
    //cout << "time: " << (clock() - start) / (double)CLOCKS_PER_SEC << '\n';
    return 0;
}
//vector <pair <int,int> > vect;

Measured memory_bytes: 2560
a = int(input())
b = int(input())
c = int(input())
x = int(input())
counter = 0
for s in range(1 + min(a, x//500)):
	for t in range(1 + min(b, (x-500*s)//100)):
		money = 500*s + 100*t
		amari = x - money
		if amari % 50 == 0 and amari <= 50 * c:
			counter += 1
print(counter)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
    string b;
    cin>>b;
    if(b[0]=='A')
    {
        cout<<'T';
    }
    else if(b[0]=='T')
    {
        cout<<'A';
    }
    else if(b[0]=='C')
    {
        cout<<'G';
    }
    else
    {
        cout<<'C';
    }
}

Measured memory_bytes: 3608
<?PHP
$s=fgets(STDIN);
$m=0;
$p=0;
for($i=0;$i<strlen($s);$i++){
  $p++;
  if(strcmp($s[$i],"A")&&strcmp($s[$i],"T")&&strcmp($s[$i],"G")&&strcmp($s[$i],"C"))$p=0;
  $m=$m<$p?$p:$m;
}
echo $m;

Measured memory_bytes: 3700
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static int aa = 0;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int tmp = s;
        Set<Integer> set = new HashSet<>();
        set.add(tmp);
        int ans = 0;
        for (int i = 2; i < 1000000; i++) {
            set.add(tmp);
            if (tmp % 2 == 0) {
                tmp /= 2;
            } else {
                tmp = 3 * tmp + 1;
            }
            if (set.contains(tmp)) {
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
using ii = pair<int,int>;
using ll = long long;

constexpr int MAXN = 5+1000;
constexpr int INF = 1e8;

int h,w,dist[MAXN][MAXN];
char mat[MAXN][MAXN];

bool ok(int x, int y) {
  return x >= 1 && x <= h && y >= 1 && y <= w;
}

void bfs(const ii& s) {
  for (int i = 0; i < MAXN; ++i) {
    for (int j = 0; j < MAXN; ++j) {
      dist[i][j] = INF;
    }
  }

  priority_queue<array<int,3>, vector<array<int,3>>, greater<array<int,3>>> q;
  q.push({0, s.first, s.second});
  dist[s.first][s.second] = 0;

  while (!q.empty()) {
    auto u = q.top(); q.pop();
    if (u[0] != dist[u[1]][u[2]]) continue;

    for (int dx = -2; dx <= 2; ++dx) {
      for (int dy = -2; dy <= 2; ++dy) {
        if (dx == 0 && dy == 0) continue;
        int newx = u[1]+dx, newy = u[2]+dy, newcost = 1+dist[u[1]][u[2]];
        if (abs(dx) + abs(dy) <= 1) {
          newcost--;
        }

        if (ok(newx, newy) && newcost < dist[newx][newy] && mat[newx][newy] == '.') {
          q.push({newcost, newx, newy});
          dist[newx][newy] = newcost;
        }
      }
    }
  }
}

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  ii start, en;

  cin >> h >> w;
  cin >> start.first >> start.second;
  cin >> en.first >> en.second;

  for (int i = 1; i <= h; ++i) {
    for (int j = 1; j <= w; ++j) {
      cin >> mat[i][j];
    }
  }
  bfs(start);
  int ans = dist[en.first][en.second];
  if (ans == INF) ans = -1;
  cout << ans << '\n';
  return 0;
}


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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

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

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

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

bool graph[8][8];

int dfs(int v,int n, bool visited[8]){

	bool all=true;
	for (int i = 0; i < n; i++){
		if(visited[i]==false)all=false;
	}

	if(all)return 1;

	int ret=0;
	for (int i = 0; i < n; i++){
		if(graph[v][i]==false)continue;
		if(visited[i])continue;

		visited[i]=true;
		ret+=dfs(i,n,visited);
		visited[i]=false;

	}

	return ret;

}


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

	for (int i = 0; i < m; i++){
		int a,b;
		cin>>a>>b;
		graph[a-1][b-1]=true;
		graph[b-1][a-1]=true;
	}

	bool visited[8];
	memset(visited,false,sizeof(visited));

	visited[0]=true;

	cout<< dfs(0,n,visited) <<endl;

	return 0;
}

Measured memory_bytes: 256
import numpy as np

def main():
    a=int(input())
    b=int(input())
    if(a>b):
        print("GREATER")
    elif(a<b):
        print("LESS")
    else:
        print("EQUAL")

def inputList():
    a=list(map(int,input().split()))
    return a

def multisort(li,index):
    return sorted(li,key=lambda x: x[index])

if(__name__=='__main__'):
    main()


Measured memory_bytes: 12452
n=int(input())
a=list(map(int,input().split()))
a.sort()
f=[1]*(10**6+10)
from collections import Counter
c=Counter(a)
ans=0
for ai in a:
  if c[ai]==1 and f[ai]==1:ans+=1
  if f[ai]==1:
    for i in range(ai,10**6+10,ai):
      f[i]=0
print(ans)



Measured memory_bytes: 131568
#pragma comment(linker, "/STACK:1024000000,1024000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
 
#include <stdio.h>
#define abs(x) ((x) > 0 ? (x) : -(x))
#define neg(x) (((x) == 1) ? 1 : -1)
#define ptc(x) (*st ++ = (x), (__builtin_expect(st == ed, false) && (fwrite(outbuf, 100000, 1, stdout), st = outbuf)))
 
int main() {
	static char outbuf[100000];
	register char *st = outbuf, *ed = outbuf + 100000;
	long long k, x, y;
	scanf("%lld\n%lld %lld", &k, &x, &y);
	if (!(k & 1) && (x + y & 1))
		return puts("-1") & 0;
	static int sz = 0;
	static int ansx[239017];
	static int ansy[239017];
	long long px = 0, py = 0;
	while (abs(px - x) + abs(py - y) > k * 2) {
		if (abs(px - x) > k) px += (px > x) ? -k : k;
		else py += (py > y) ? -k : k;
		ansx[++ sz] = px, ansy[sz] = py;
	}
	if (abs(px - x) + abs(py - y) != k) {
		if ((k & 1) && (x - px + y - py & 1)) {
			if (abs(py - y) <= k) {
				px += (k - abs(py - y)) * neg(px < x);
				py = y;
			}
			else {
				py += (k - abs(px - x)) * neg(py < y);
				px = x;
			}
			ansx[++ sz] = px, ansy[sz] = py;
		}
		long long t = k * 2 - abs(px - x) - abs(py - y) >> 1;
		if (abs(px - x) < abs(py - y))
			if (px <= x) {
				ansx[++ sz] = x + t;
				ansy[sz] = py + (k - (x + t - px)) * neg(py < y);
			}
			else {
				ansx[++ sz] = x - t;
				ansy[sz] = py + (k - (px + t - x)) * neg(py < y); 
			}
		else
			if (py <= y) {
				ansy[++ sz] = y + t;
				ansx[sz] = px + (k - (y + t - py)) * neg(px < x);
			}
			else {
				ansy[++ sz] = y - t;
				ansx[sz] = px + (k - (py + t - y)) * neg(px < x);
			}
	}
	ansx[++ sz] = x, ansy[sz] = y;
	const static int ssz = sz;
	register char stk[20], top = 0;
	while (sz) stk[top++] = sz % 10, sz /= 10;
	while (top--) ptc(stk[top] + 48); ptc('\n');
	for (int i = 1; i <= ssz; ++i) {
		if (!ansx[i]) ptc('0');
		else {
			if (ansx[i] < 0) ptc('-'), ansx[i] = -ansx[i];
			top = 0;
			while (ansx[i]) stk[top++] = ansx[i] % 10, ansx[i] /= 10;
			while (top--) ptc(stk[top] + 48);
		}
		ptc(' ');
		if (!ansy[i]) ptc('0');
		else {
			if (ansy[i] < 0) ptc('-'), ansy[i] = -ansy[i];
			top = 0;
			while (ansy[i]) stk[top++] = ansy[i] % 10, ansy[i] /= 10;
			while (top--) ptc(stk[top] + 48);
		}
		ptc('\n');
	}
	if (st != outbuf)
		fwrite(outbuf, st - outbuf, 1, stdout);
}

Measured memory_bytes: 3840
// Set - Disjoint Set: Union Find Tree
// 問題URL: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_1_A&lang=jp
//
//
#include <iostream>

using namespace std;

int n, q, P[1000000], buff1, buff2, buff3;
int x[100000], y[100000];
bool com[100000];

int root(int x){
  if(P[x]==x) return x;
  P[x] = root(P[x]);
  return P[x];
}

bool is_same_set(int x, int y){
  return root(x) == root(y);
}

void unite(int x, int y){
  P[root(x)] = root(y);
}

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

  for(int i = 0; i < q; ++i){
    cin >> buff1 >> buff2 >> buff3;
    com[i] = buff1; x[i] = buff2; y[i] = buff3;
  }

  for (int i = 0; i < n; ++i){
    P[i] = i; //親配列の初期化
  }

  for(int i = 0; i < q; ++i){
      if(com[i]){
        cout << is_same_set(x[i], y[i]) << endl;
      } else {
        unite(x[i], y[i]);
      }
  }
}



Measured memory_bytes: 3932
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    double N;
    cin >> N;
    double ans = (((int)N + 1) / 2) / N;
    printf("%.8lf\n", ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define BUF (5005)
#define ll long long 


string str;
set<string> s;
int n;
int k;

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

	n= str.length();
	for(int i=1;i<=k;++i){
		for(int j=0;j<n-i+1;j++){
			s.insert(str.substr(j,i));
		}
	}	


//	for(auto x : s) cout << x << "\n";

	int cnt = 0;
	for(auto x : s){
		cnt++;
		if(cnt==k){
			cout << x<<endl;
			break;
		}
	}	

	return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define isSquare(x) (sqrt(x)*sqrt(x) == x)
template<class T>bool chmax(T &a, const T &b) {if(a<b){a = b; return 1;} return 0; };
template<class T>bool chmin(T &a, const T &b) {if(a>b){a = b; return 1;} return 0; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long LLINF = 1e18;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    iosetup;
    string S; cin >> S;
    int N = S.size();
    int cS = 0, cT = 0;
    rep(i, 0, N){
        if(S[i] == 'S') cS++;
        else{
            if(cS > cT) cT++;
        }
    }
    cout <<N - cT*2 << endl;
    return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin>>n;
	ll cntac=0;
	ll cntwa=0;
	ll cnttle=0;
	ll cntre=0;
	string x;
	ll i;
	for(i=1;i<=n;i++)
	{
		cin>>x;
		if(x=="AC")
		{
			cntac=cntac+1;	
		}
		else if(x=="WA")
		{
			cntwa=cntwa+1;
		}
		else if(x=="TLE")
		{
			cnttle=cnttle+1;
		}
		else if(x=="RE")
		{
			cntre=cntre+1;
		}
	}
	cout<<"AC "<<"x "<<cntac<<"\n";
	cout<<"WA "<<"x "<<cntwa<<"\n";
	cout<<"TLE "<<"x "<<cnttle<<"\n";
	cout<<"RE "<<"x "<<cntre<<"\n";
	return 0;
}



Measured memory_bytes: 3640
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-8;

long long int N, M, K, L, R, H, W;
//int N, M, K, L, R, H, W;

int Search(long long int box) {
	long long int bag = N;
	while (bag%box == 0)bag /= box;
	return (bag%box) == 1;
}

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

	cin >> N >> M;
	cout << min(N%M, M - (N%M)) << endl;
}

Measured memory_bytes: 256
class UnionFind:

    # n要素で初期化
    def __init__(self,n):
        self.par = list(range(n))
        self.rank = [0]*n

    # 木の根を求める
    def find(self,x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    
    # xとyの属する集合を併合
    def unite(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return None
        
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # xとyが同じ集合に属するか否か
    def same(self,x,y):
        return self.find(x) == self.find(y)

if __name__ == '__main__':
    n,m = map(int,input().split())
    p = list(map(int,input().split()))
    uf = UnionFind(n)
    for i in range(m):
        x,y = map(int,input().split())
        uf.unite(x-1,y-1)
    res = 0
    for i in range(n):
        if uf.same(i,p[i]-1):
            res += 1
    print(res)


Measured memory_bytes: 94444
nmax = 10**6
mod = 10**9+7

fac = [1]*nmax
finv = [1]*nmax
inv = [1]*nmax
def ncr_pre():
    for i in range(2,nmax):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) %mod
        finv[i] = finv[i-1] * inv[i] %mod

def ncr(n,r):
    if n<r:
        return 0
    if n<0 or r<0:
        return 0
    return fac[n]* (finv[r] * finv[n-r] %mod) %mod
ncr_pre()
n,k = map(int,input().split())
for i in range(1,k+1):
    print((ncr(n-k+1,i)*ncr(k-1,i-1))%mod )


Measured memory_bytes: 121972
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define F first
#define S second
#define pb push_back
mt19937 rnd;


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    int n, m;
    cin >> n >> m;
    if (n & 1) {
        for (int i = 1; i <= m; i++) {
            cout << i << " " << n + 1 - i << "\n";
        }
    }
    else if (n % 4 == 2) {
        int l = n / 2, r = n / 2 + 1;
        while (m--) {
            if (r - l == n / 2) {
                l--;
            }
            cout << l-- << " " << r++ << "\n";
        }
    }
    else {
        int l = n / 2, r = n / 2 + 1;
        while (m--) {
            if (l == n / 4) l--;
            cout << l-- << " " << r++ << "\n";
        }
    }

#ifdef LOCAL
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 3656
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;
//|\_
//g++ -std=c++1z temp.cpp
//./a.out





int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    int i,n,j;
    char c;
    while(1){
        cin>>n;
        bool ch=false;
        if(n==0)break;
        map<char,int> m;
        int mmax=0,other=0,ansd,msec=0;
            char mmaxc,ansc;
        rep(i,n){
            cin>>c;
            if(m.find(c)!=m.end()){
                m[c]++;
            }
            else m[c]=1;
            mmax=0;
            other=0;
            msec=0;
            for(auto it=m.begin();it!=m.end();it++){
                if(mmax< it->second){
                    other+=msec;
                    msec=mmax;
                    mmax=it->second;
                    mmaxc=it->first;
                }
                else if(msec<it->second){
                    other+=msec;
                    msec=it->second;
                }
                else other+=it->second;
            }
            // cout<<mmax<<" "<<msec<<" "<<other<<endl;
            if(mmax>msec+(n-mmax-msec-other)&&!ch){
                ansc=mmaxc;
                ch=true;
                ansd=i+1;
            }
        }
        if(ch)cout<<ansc<<" "<<ansd<<endl;
        else cout<<"TIE"<<endl;
    }
//////////////////////////////////////////////////////
return 0;}



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

using namespace std;

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

const double pi = 3.14159265358979323846;

// #define fio() cin.tie(0); ios::sync_with_stdio(false);
// template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
// template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define TG0 get< 0 >
#define TG1 get< 1 >
#define TG2 get< 2 >
#define F first
#define S second
#define VL vector< ll >

// to_string(123)
// atoi("123"); atoi(s.c_str());
// "abc".size()
// s.find('+') == string::npos
// 1e18

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

  double A, B;
  cin >> A >> B;
  double d8, d10;
  for (ll i = 1; i <= 100000; i++) {
    d8 = i * 0.08;
    d10 = i * 0.1;
    // cerr << i << " " << d8 << " " << d10 << endl;

    if (floor(d8) == A && floor(d10) == B) {
      cout << i << endl;
      return 0;
    }
  }

  cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 256
# Take both input K & S, then compare the length of S with K and assign it to length
# If the length is <= K print all
# And if length is >K print some of the character

K = int(input())
S = input()

x = 0

length = len(S)

if length <= K:
    print(S)
else:
    while x < K:
        print(S[x], end=(""))
        x += 1
    print("...")

Measured memory_bytes: 9168
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int N,a[200000];
	scanf("%d",&N);
	for(int i=0;i<N;i++)
	scanf("%d",&a[i]);
	sort(a,a+N);
	for(int i=1;i<N;i++)
	{
		if(a[i]==a[i-1])
		{
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define db double
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
	#define debug(A,args...) fprintf(stderr,A,##args)
#else
	#define debug(A,args...) printf("")
#endif
#define deb debug("line %d\n",__LINE__)
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void GG(){puts("-1");exit(0);}
	
	const db eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int MM=1e6+10;
	ll fac[MM],facinv[MM],Inv[MM];ll Comb(int n,int m){return n<0 or n<m?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}
	void PRE()
	{
		fac[0]=1;fo(i,1,MM-1) fac[i]=fac[i-1]*i%MOD;
		facinv[MM-1]=invm(fac[MM-1]);fd(i,MM-1,1) facinv[i-1]=facinv[i]*i%MOD;
		Inv[1]=1;fo(i,2,MM-1) Inv[i]=(MOD-MOD/i)*Inv[MOD%i]%MOD;
	}
	const int N=2e3+10;
	//------------------FIXED------------------
	
	void main()
	{
		int n=qread(),m=qread();
		write( bin(m)*(1900*m+100*(n-m)) );
	}
};//����������
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	//freopen("a.out","w",stdout);
	#endif
	srand(time(0));
	mine::PRE();
	mine::main();
	debug("\n------------------------------------------\nTime: %.2lf s",1.0*clock()/CLOCKS_PER_SEC);
}

Measured memory_bytes: 23680
/*  -*- coding: utf-8 -*-
 *
 * 1367.cc: Rearranging a Sequence
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;
const int MAX_M = 100000;

/* typedef */

/* global variables */

int es[MAX_M];
bool used[MAX_N + 1];

/* subroutines */

/* main */

int main() {
  int n, m;
  scanf("%d%d", &n, &m);

  for (int i = 0; i < m; i++) scanf("%d", es + i);

  for (int i = m - 1; i >= 0; i--)
    if (! used[es[i]]) printf("%d\n", es[i]), used[es[i]] = true;
  for (int i = 1; i <= n; i++)
    if (! used[i]) printf("%d\n", i);
  return 0;
}



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

int main(){

  int n,tmp;
  int debt = 100000;

  cin >> n;

  while(n){
    debt *=  1.05;
    if( debt % 1000 > 0 ){
      debt += 1000;
      debt -= debt%1000;
    }
    n--;
  }

  cout << debt << endl; 
  return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
int main() {
	long long n, k, a, b, an[100002] = { 0 }, cnt=0, i=0;
	scanf("%lld %lld", &n, &k);
	rep(i, n) { scanf("%lld %lld", &a, &b); an[a] += b; }
	
	while (1){ 
		cnt += an[i];
		if (cnt >= k) { printf("%lld", i); return 0; }
		i++;
	}
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,K;
ll A[202020];
ll S[202020];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	map<ll,int> M;
	ll ret=0;
	M[0]=1;
	FOR(i,N) {
		cin>>A[i];
		S[i+1]=S[i]+A[i]+K-1;
		if(i+1-K>=0) M[S[i+1-K]%K]--;
		ret+=M[S[i+1]%K];
		M[(S[i+1])%K]++;
	}
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

int main() {
  long long N,D; cin >> N >> D;
  vector<long long> X(N,0);
  vector<long long> Y(N,0);
  for (long long i = 0; i < N; i++) cin >> X.at(i) >> Y.at(i);
  int ans = 0;
  for (long long i = 0; i < N; i++){
    if (X.at(i) * X.at(i) + Y.at(i) * Y.at(i) <= D * D) ans++; 
  }

  cout << ans << endl;
}


Measured memory_bytes: 6368
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
# from numba import njit


def main():
    N = int(input())
    A = list(map(int,input().split()))

    Aset = set(A)

    if 0 in Aset:
        print(0)
        sys.exit()

    A.sort(reverse=True)

    res = 1
    INF = 10 ** 18

    for i in range(N):
        res *= A[i]
        if res > INF:
            res = -1
            break

    print(res)



main()


Measured memory_bytes: 21772
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

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

	int A[5] = {0};
	for(int i=0; i<4; i++){
		char c[2] = {0};
		c[0] = s[i];
		A[i]= atoi(c);
	}

	for(int b=0; b < (1<<3); b++){
		int sum = A[0];
		char ans[4] = {0};
		for(int j=0; j<3; j++){
			int u = b & (1<<j) ;
			if(u == 0){
				sum += A[j+1];
				ans[j] = '+';
			}
			else{
				sum -= A[j+1];
				ans[j] = '-';
			}
		}
		if(sum == 7){
			printf("%d", A[0]);
			for(int i=0; i<3; i++){
				printf("%c%d", ans[i], A[i+1]);
			}
			printf("=7\n");
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#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()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

int main(){
    ll n;cin>>n;
    cout<<n*(n-1)/2<<endl;
}

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

int main()
{
  int a, b;
  cin >> a >> b;
  
  if((a + b) == 15)
    cout << "+" << endl;
  else if((a * b) == 15)
    cout << "*" << endl;
  else
    cout << "x" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long T1, T2, A1, A2, B1, B2;
    cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
    if(T1 * A1 + T2 * A2 == T1 * B1 + T2 * B2) puts("infinity");
    else {
        if(T1 * A1 + T2 * A2 > T1 * B1 + T2 * B2) {
            swap(A1, B1);
            swap(A2, B2);
        }
        if(A1 < B1) puts("0");
        else {
            cout << (A1 - B1) * T1 / ((T1 * B1 + T2 * B2) - (T1 * A1 + T2 * A2)) * 2 + 1 - ((A1 - B1) * T1 % ((T1 * B1 + T2 * B2) - (T1 * A1 + T2 * A2)) == 0)<< endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int A,B;
    cin>>A>>B;
    int a2=A+A-1,b2=B+B-1,ab=A+B;
    if(a2>b2&&a2>ab)
        cout<<a2<<"\n";
    else if(b2>a2&&b2>ab)
        cout<<b2<<"\n";
    else
        cout<<ab<<"\n";
    return 0;
}


Measured memory_bytes: 384
// Best practice
 
#include<bits/stdc++.h>
 
#define int         long long
#define pb          push_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define pii 		pair<int,int>
#define psi 		pair<string,int>
#define vi 			vector<int>
#define vpii  		vector<pii>
#define vvi 		vector<vi>
#define sz(x)	    (int)(x).size()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007
#define hell        998244353
#define prec(n) 	fixed<<setprecision(n)
#define ini(a, i) 	memset(a, i, sizeof(a))
#define output(x)   cout << (x ? "YES" : "NO")<<endl;
using namespace std;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge {c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
	#ifndef LOCAL
	~debug() { cerr << endl; }
	eni(!=) cerr << boolalpha << i; ris; }
	eni(==) ris << range(begin(i), end(i)); }
	sim, class b dor(pair < b, c > d) {
	  ris << "(" << d.first << ", " << d.second << ")";
	}
	sim dor(rge<c> d) {
	  *this << "[";
	  for (auto it = d.b; it != d.e; ++it)
	    *this << ", " + 2 * (it == d.b) << *it;
	  ris << "]";
	}
	#else
	sim dor(const c&) { ris; }
	#endif
};
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
 
// const int dx[4] = { -1, 1, 0, 0};
// const int dy[4] = {0, 0, -1, 1};
// int dX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
// int dY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
 
 
// Code from Here -------------------------------------------------------------------------------

signed main() {
	tezz
 
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt", "r", stdin);
	// 	freopen("output.txt", "w", stdout);
	// #endif

	int n;
	cin >> n;
	string s;
	cin >> s;
	int l=0, r=n-1, ans=0;
	while(l<r){
		while(s[l] == 'R' && l<r)l++;
		while(s[r] == 'W' && l<r)r--;
		if(l<r){
			swap(s[l], s[r]);
			l++;
			r--;
			ans++;
		}
	}
	cout << ans << endl;


 
	return 0;
}  

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

using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
template<class T>
inline bool chmax(T &a, T b) {
    if (a == "~" || a.size() < b.size()) {
        a = b;
        return 1;
    }

    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

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

string dp[10010];


void solve(long long N, long long M, std::vector<long long> A) {
    for (int i = 0; i < 10010; i++)
        dp[i] = "~";


    int cnt[10] = {-1, 2, 5, 5, 4, 5, 6, 3, 7, 6};


    dp[0] = "";
    for (int i = 0; i <= N; i++) {
        for (int j = 0; j < A.size(); j++) {
            if( dp[i] == "~" ) continue;
            //cout << i << " " << dp[i] << endl;
            if (i + cnt[A[j]] > N) continue;
            //cout << dp[i] + string(1, '0' + A[j]) << endl;
            chmax(dp[i + cnt[A[j]]], dp[i] + string(1, '0' + A[j]));
            //cout << dp[i+cnt[A[j]]] << endl;
        }
    }
    //cout << dp[0] << endl;
    cout << dp[N] << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    std::vector<long long> A(M);
    for (int i = 0; i < M; i++) {
        scanf("%lld", &A[i]);
    }
    solve(N, M, std::move(A));
    return 0;
}


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

int min(int x, int y, int z){
  if(x>=y&&z>=y) return y;
  else if(z>=x&&y>=x) return x;
  else return z;
}

int abs(int x){
  if(x>=0) return x;
  else return -x;
}

int main(){
  int n, x, y;
  cin >> n >> x >> y;
  int d[n][n]={0};
  for(int i=0;i<n;i++){
    for(int j=i;j<n;j++){
      int p = abs(x-1-i);
      int q = abs(x-1-j);
      int r = abs(y-1-i);
      int s = abs(y-1-j);
      int t = abs(i-j);
      d[i][j] = min(p+s+1,t,r+q+1);
    }
  }
  int ans[n]={0};
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      int z = d[i][j];
      //cout << z << endl;
      ans[z-1] += 1;
    }
  }
  for(int i=0;i<n-1;i++){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 15872
package main

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

func main() {

	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	in_string := scanner.Text()
	new_string := ""

	for _, v := range in_string { //v:rune

		if ('a' <= v) && (v <= 'z') {
			v -= 'a' - 'A'
		} else if ('A' <= v) && (v <= 'Z') {
			v += 'a' - 'A'
		}
		new_string += string(v)
	}

	fmt.Println(new_string)

}



Measured memory_bytes: 1804
#include <cstdio>
#include <algorithm>

using namespace std;

const int N = 10;
int a[N];

int main() {
  for(int i = 0; i < N; i++) {
    scanf("%d", &a[i]);
  }
  sort(a, a+N);
  for(int i = 1; i < 4; i++) printf("%d\n", a[N-i]);
}

Measured memory_bytes: 2744
import java.util.*

fun main() {
    val sc = Scanner(System.`in`)
    val mod = 998244353.toLong()

    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    val d = sc.nextInt()

    val dp = Array(c+1){LongArray(d+1){-1L} }

    fun solve(r:Int, c:Int): Long {
        if(r < a || c < b)
            return 0L
        if(r==a && c == b) {
            return 1L
        }
        if(dp[r][c] != -1L) {
            return dp[r][c]
        }
        // column 붙인 경우
        var cnt = 0L
        cnt += solve(r-1, c) * c
        cnt %= mod
        cnt += solve(r, c - 1) * r
        cnt %= mod
        var x = ((r-1) * (c-1)).toLong()
        x *= solve(r - 1, c - 1)
        x %= mod
        cnt = cnt - x + mod
        cnt %= mod
        dp[r][c] = cnt
        return cnt
    }
    print(solve(c, d))
    //println(".")


    //[a,b] -> [c,d]
    //



}

Measured memory_bytes: 109316
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class BSomeSums {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n, a, b;
	    in >> n >> a >> b;
	    int res = 0;
	    for(int i=1; i<=n; i++){
	        int num = i;
	        int sum = 0;
	        while(num > 0){
	            sum += num % 10;
	            num /= 10;
	        }
	        if(a <= sum && sum <= b) res += i;
	    }

	    out << res << endl;
	}
};


int main() {
	BSomeSums solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using System.Text;
 
class DandA {
    static void Main(string[] args) {
        int n = ReadLineInt();
        Console.WriteLine(String.Format("{0:0.0000000000}", (double)((n / 2) + (n % 2)) / n));
    }
 
    static string[] ary = new string[] {"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", "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"};
  
    static private string ReadLineStr() {return Console.ReadLine();}
    static private int ReadLineInt() {return int.Parse(Console.ReadLine());}
    static private long ReadLineLong() {return long.Parse(Console.ReadLine());}
    static private double ReadLineDouble() {return double.Parse(Console.ReadLine());}
    static private string[] ReadLineStrArray() {return Console.ReadLine().Trim().Split();}
    static private int[] ReadLineIntArray() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToArray();}
    static private long[] ReadLineLongArray() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToArray();}
    static private double[] ReadLineDoubleArray() {return Console.ReadLine().Trim().Split().Select(a => double.Parse(a)).ToArray();}
    static private decimal[] ReadLineDecimalArray() {return Console.ReadLine().Trim().Split().Select(a => decimal.Parse(a)).ToArray();}
    static private string[][] ReadMLineStrArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split()).ToArray();}
    static private int[][] ReadMLineIntArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();}
 
    static private bool IsPrime(int num) {
        if (num < 2) return false;
        if (num == 2) return true;
        else if (num % 2 == 0) return false;
        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }
}

Measured memory_bytes: 11220
#include<cstdio>
#include<algorithm>
#define N 310

using namespace std;

typedef long long LL;
int n;
int a[N][N], b[N][N];
LL ans;

int main(){
	int i, j, k, t;
	scanf("%d", &n);
	for(i = 1; i <= n; ++i)
		for(j = 1; j <= n; ++j){
			scanf("%d", &a[i][j]);
			b[i][j] = a[i][j];
		}
	for(k = 1; k <= n; ++k)
		for(i = 1; i <= n; ++i)
			for(j = 1; j <= n; ++j)
				b[i][j] = min(b[i][j], b[i][k] + b[k][j]);
	
	for(i = 1; i <= n; ++i)
		for(j = i + 1; j <= n; ++j){
			t = 1e9+7;
			for(k = 1; k <= n; ++k)
				if(k != i && k != j) t = min(t, b[i][k] + b[k][j]);
			if(a[i][j] > t){puts("-1"); return 0;}
			if(a[i][j] < t)	ans += (LL)a[i][j];
		}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 896