akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
 
using namespace std;
using ll = long long;
using ull = unsigned long long;
 
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(int i = 0; i < n; i++)


int main()
{
	ll n, m, w[100][100];

	cin >> n >> m;
	REP(i, n){
		REP(j, n){
			if(i == j){
				w[i][j] = 0;
			}
			else{
				w[i][j] = INF;
			}
		}
	}

	vector<pair<ll, pair<ll, ll>>> e;
	REP(i, m){
		ll a, b, c;
		cin >> a >> b >> c;
		a--;b--;
		w[a][b] = c;
		w[b][a] = c;
		e.push_back({a, {b, c}});
	}

	REP(k, n){
		REP(i, n){
			REP(j, n){
				w[i][j] = min(w[i][j], w[i][k] + w[k][j]);
			}
		}
	}

	int ans = 0;
	for(auto x : e){
		ll a = x.first, b = x.second.first, c = x.second.second;
		bool flag = false;
		for(ll i = 0; i < n; i++){
			for(ll j = 0; j < n; j++){
				if(w[i][a] + c + w[b][j] == w[i][j]){
					flag = true;
				}
			}
		}

		if(!flag){
			ans++;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void)
{
    int n;
    int d[101] = {0};
    int max = 1;
    int i;

    while (scanf("%d", &n) != EOF) {
        d[n] += 1;
        if (d[n] > max) {
            max = d[n];
        }
    }

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

    return 0;
}

Measured memory_bytes: 596
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

n = ni()
li = make_divisors(n)
l = len(li)
result = 0
for i in range(l):
    if i >= l // 2:
        break
    else:
        if li[-(i+1)] - li[i] > 1:
            result += (li[-(i+1)] - 1)
print(result)

Measured memory_bytes: 3292
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm> 
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <list>
#include <utility>
#include <set>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <random>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x,T a,T b){return a<=x&&x<=b;}
template<class T> void amin(T &a,T v){if(a>v) a=v;}
template<class T> void amax(T &a,T v){if(a<v) a=v;}
int ROUND(double x) { return (int)(x+0.5); }
bool ISINT(double x) { return fabs(ROUND(x)-x)<=EPS; }
bool ISEQUAL(double x,double y) { return fabs(x-y)<=EPS*max(1.0,max(fabs(x),fabs(y))); }
double SQSUM(double x,double y) { return x*x+y*y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;



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

	vector <pair <ll, int> > a;

	for (int i = 0; i < N; ++i)
	{
		int tmp;
		scanf("%d", &tmp);

		a.push_back(make_pair(-tmp, i+1));
	}
	a.push_back(make_pair(0,0));

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

	vector <ll> ans(N+1);

	int nextNo = a[0].second;
	for (int i = 0; i < N; ++i)
	{
		ll heightdiff = -(a[i].first - a[i+1].first);

		if (heightdiff > 0)
		{
			ans[nextNo] += (i+1LL) * heightdiff;
			amin(nextNo, a[i+1].second);
		}
	}

	for (int i = 1; i <= N; ++i)
	{
		printf("%lld\n",ans[i]);
	}

	return 0;
}


Measured memory_bytes: 3440
#include <stdio.h>
#include <string.h>

int main(void) {
  int i, j, ans = 0, n, w, k, l;
  char s[400], a[400], b[400];
  scanf("%s", s);
  n = strlen(s);
  for(i = 0; i < n; ++i) if(s[i] == 'w') {
    w = i;
    break;
  }
  for(i = w - 2; i >= 0; --i) a[w - i - 2] = s[i];
  a[w - 1] = 0;
  for(i = w + 2; i < n; ++i) b[i - w - 2] = s[i];
  b[n - w - 2] = 0;
  int na = strlen(a), nb = strlen(b);
  int dp[na][nb];
  for(i = 0; i < na; ++i) {
    if(a[i] == '(') a[i] = ')';
    else if(a[i] == ')') a[i] = '(';
    else if(a[i] == '{') a[i] = '}';
    else if(a[i] == '}') a[i] = '{';
    else if(a[i] == '[') a[i] = ']';
    else if(a[i] == ']') a[i] = '[';
  }
  for(i = 0; i < na; ++i) for(j = 0; j < nb; ++j) dp[i][j] = 0;
  for(i = 0; i < nb; ++i) {
    if(a[0] == b[i]) dp[0][i] = 1, ans = 1;
  }
  for(i = 1; i < na; ++i) {
    for(j = 0; j < nb; ++j) {
      if(a[i] == b[j]) {
        int max = 0;
        for(l = 0; l < i; ++l) for(k = 0; k < j; ++k) if(dp[l][k] > max) max = dp[l][k];
        dp[i][j] = max + 1;
        if(dp[i][j] > ans) ans = dp[i][j];
      }
    }
  }
  /*for(i = 0; i < na; ++i) {
    for(j = 0; j < nb; ++j) printf("%d ", dp[i][j]);
    printf("\n");
  }*/
  printf("%d\n", 2 * ans + 3);
  return 0;
}


Measured memory_bytes: 2752
#include <iostream>
#include <cmath>

using namespace std;

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



signed main(){
  long long a[100001];
  long long n;

  cin >> n;
  rep(i,n){
    cin >> a[i];
  }
  
  long long c1 = 0, c2 = 0;
  long long sum = 0;
  long long c = 1;

  // 奇数番目を正
  REP(i,0,n){
    sum += a[i];
    if(sum * c <= 0){
      c1 += (abs(sum)+1);
      sum = c;
    }
    c*=(-1);
  }
  
  // 偶数番目が正
  c = -1;
  sum = 0;
  REP(i,0,n){
    sum += a[i];
    if(sum * c <= 0){
      c2 += abs(sum)+1;
      sum = c;
    }
    c*=(-1);
  }

  cout << min(c1, c2) << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		if(S.length() == 1) System.out.println(S);
		else {
			long ans = 0;
			for(int i = 0; i < (1 << (S.length() - 1)); i++) {
				// 状態iでのSを計算したいなぁという気持ち
				long eval = 0, tmp = (S.charAt(0) - '0');
				for(int j = 0; j < S.length() - 1; j++) {
					if(((i >> j) & 1) == 1) {
						eval += tmp;
						tmp = (S.charAt(j + 1) - '0');
					}else {
						tmp = tmp * 10 + (S.charAt(j + 1) - '0');
					}
				}
				ans += eval + tmp;
			}
			System.out.println(ans);
		}
	}
}

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

int main(void){
    string s;
    cin >> s;
    
    if(s.length() == 2){
        cout << s;
    }else{
        cout << s[2] << s[1] << s[0] << endl;
    }
    
    return 0;
}


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

typedef long long ll;

ll n, s, a, ans;
map<ll, int> cnt;

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cnt[s]++;
	cin >> n;
	while (n--) {
		cin >> a;
		s += a;
		ans += cnt[s]++;
	}
	cout << ans;
}


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

namespace ABC136C
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] Hinput = Console.ReadLine().Split(' ');
            int[] H = new int[N + 1];
            H[0] = 0;
            for(int i = 1; i <= N; i++)
            {
                H[i] = int.Parse(Hinput[i-1]);
            }
            bool hantei = true;
            for(int i = N; i > 0; i--)
            {
                if (H[i - 1] - H[i] > 1)
                {
                    hantei = false;
                    break;
                }
                else if (H[i - 1] - H[i] == 1)
                {
                    H[i - 1] -= 1;
                }
            }
            if (hantei) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 38660
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int sum = 0;
		int max = 0;
		for(int i = 0; i < 3; i++){
			int n = sc.nextInt();
			if(max < n) {
				sum += max;
				max = n;
			}else sum += n;
		}
		System.out.println((int)(sum + max * Math.pow(2, sc.nextInt())));
	}
}


Measured memory_bytes: 21204
#include<stdio.h>

int main(){
  int cnt=0;
  char s[3],t[3];
  scanf("%s",s);
  scanf("%s",t);
//    printf("%c\n",s[0]);
  /*printf("%c\n",t[2]);*/
  for(int i=0;i<3;i++){
  if(s[i]==t[i]) {
    cnt++;
 //   printf("%d\n",i);
  }

}
printf("%d",cnt);
  return 0;
}


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

int n,c[4];
double dp[305][305][305];

int main(){
  scanf("%d",&n);
  for(int i=0,a;i<n;++i){
    scanf("%d",&a),c[a]++;
  }
  for(int c3=0;c3<=n;++c3){
    for(int c2=0;c2<=n;++c2){
      for(int c1=0;c1<=n;++c1){
        if(c1+c2+c3==0)continue;
        if(c1)dp[c3][c2][c1]+=c1*dp[c3][c2][c1-1];
        if(c2)dp[c3][c2][c1]+=c2*dp[c3][c2-1][c1+1];
        if(c3)dp[c3][c2][c1]+=c3*dp[c3-1][c2+1][c1];
        dp[c3][c2][c1]+=n;
        dp[c3][c2][c1]/=c1+c2+c3;
      }
    }
  }
  printf("%.12lf\n",dp[c[3]][c[2]][c[1]]);
}


Measured memory_bytes: 219392
//B
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define MAX 100002


int n;
int m;

vector<int> v[MAX];

bool used[MAX];

int get_nex(int cur){
	for (int i = 0; i < v[cur].size(); i++){
		if (used[v[cur][i]] == false){
			return v[cur][i];
		}
	}
	return -1;
}

deque<int> d;

int main(){
	cin >> n >> m;
	int f1;
	int f2;
	for (int i = 0; i < m; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		a--;
		b--;
		v[a].push_back(b);
		v[b].push_back(a);
		f1 = a;
		f2 = b;
	}
	d.push_back(f1);
	d.push_back(f2);
	used[f1] = used[f2] = true;
	while (get_nex(f1) != -1){
		f1 = get_nex(f1);
		d.push_front(f1);
		used[f1] = true;
	}
	while (get_nex(f2) != -1){
		f2 = get_nex(f2);
		d.push_back(f2);
		used[f2] = true;
	}
	cout << d.size() << endl;
	for (int i = 0; i < d.size(); i++){
		if (i)printf(" ");
		printf("%d", d[i] + 1);
	}
	puts("");
	return 0;
}

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

int main() {
  ll n;
  cin >> n;
  for (ll i = n; i <= 10000000000; i += n) {
    if (i % 2 == 0 && i % n == 0) {
      cout << i << endl;
      return 0;
    }
  }
}

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

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

int main(){
    int h, w; cin >> h >> w;
    vector<string> s(h); vector<vector<int>> cost;
    for (auto i = 0; i < h; i++) cin >> s[i];
    int ans = 0;
    queue<pair<int, int>> q;
    for (auto i = 0; i < h; i++) {
        for (auto j = 0; j < w; j++) {
            if(s[i][j] == '#') continue;
            cost.assign(h, vector<int>(w, -1));
            q.push({i, j}); cost[i][j] = 0;
            while(not q.empty()) {
                auto p = q.front(); q.pop();
                for (auto k = 0; k < 4; k++) {
                    int nx = p.first + dx[k], ny = p.second + dy[k];
                    if(nx < 0 or nx >= h or ny < 0 or ny >= w) continue;
                    if(s[nx][ny] == '#') continue;
                    if(cost[nx][ny] != -1) continue;
                    cost[nx][ny] = cost[p.first][p.second] + 1;
                    q.push({nx, ny});
                }
            }
            for (auto k = 0; k < h; k++) {
                for (auto l = 0; l < w; l++) ans = max(ans, cost[k][l]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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 (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 400010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
struct Edge{
    ll from,to,cost;
};
class Bellman_Ford{
    private:
        vector<Edge> edges;
        vector<ll> d;
        ll V;
    public:
        Bellman_Ford(vector<Edge>& g,ll v):edges(g),V(v){
            d.resize(v,INF);
        }
        bool bellman_ford(ll s){
            d[s] = 0;
            rep(i,V){
                rep(j,edges.size()){
                    Edge e = edges[j];
                    if(d[e.from] != INF && d[e.to] > d[e.from]+e.cost){
                        d[e.to] = d[e.from]+e.cost;
                        if (i == V-1) return true;
                    }
                }
            }
            return false;
        }
        ll operator[](ll a){
            return d[a];
        }
};
vector<vector<ll>> g(2510);
vector<bool> done(2510,0);
void dfs(ll v){
    done[v] = true;
    for (ll u:g[v]){
        if (done[u]) continue;
        dfs(u);
    }
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m,p,a,b,c;
    cin >> n >> m >> p;
    vector<vector<ll>> edge(m,vector<ll>(3));
    rep(i,m){
        cin >> a >> b >> c;
        --a;
        --b;
        c *= -1;
        c += p;
        edge[i] = {a,b,c};
        g[b].push_back(a);
    }
    dfs(n-1);
    vector<Edge> ng;
    rep(i,m){
        if (done[edge[i][0]] && done[edge[i][1]]){
            ng.push_back(Edge{edge[i][0],edge[i][1],edge[i][2]});
        }
    }
    Bellman_Ford solve(ng,n);
    if (solve.bellman_ford(0)){
        PRINT(-1);
    }
    else{
        PRINT(max(-solve[n-1],0ll));
    }
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int a = sc.nextInt(), b = sc.nextInt();
		if (a == b) {
			System.out.println("Draw");
			return;
		}
		if (a == 1) {
			a += 13;
		}
		if (b == 1) {
			b += 13;
		}
		System.out.println(a > b ? "Alice" : "Bob");
	}
}

Measured memory_bytes: 21972
def main():
    import sys
    input=sys.stdin.buffer.readline
    s=b' '+input()[:-1]
    t=b' '+input()[:-1]
    n,m=len(s),len(t)
    dp=[[0]*m for _ in range(n)]
    b=dp[0]
    for i,x in enumerate(s[1:],1):
        dpi=dp[i]
        for j,y in enumerate(t[1:],1):
            if x==y:
                dpi[j]=b[j-1]+1
            else:
                v,w=b[j],dpi[j-1]
                dpi[j]=v if v>w else w
        b=dpi
    ans=[]
    i,j=n-1,m-1
    while dp[i][j]:
        if dp[i][j]==dp[i-1][j]:
            i-=1
        elif dp[i][j]==dp[i][j-1]:
            j-=1
        else:
            ans.append(s[i])
            i-=1
            j-=1
    print(''.join(map(chr,ans))[::-1])
main()

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

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

    cout << ((n < 1000) ? "ABC" : "ABD") << '\n';
    return (0);
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;

int A, B;
char ans[100][100];
bool isMark[100][100];	//A>=2, B>=2で使用

signed main() {
	int i, j, k, l;
	
	cin >> A >> B;
	if (A == 1) {
		for (i = 0; i < 100; i++) for (j = 0; j < 100; j++) ans[i][j] = '.';
		i = 0; j = 0; int cnt = 0, dir = 1;
		while (cnt < B) {
			for (k = 0; k < 3; k++) for (l = 0; l < 3; l++) ans[3 * i + k][3 * j + l] = '.';
			ans[3 * i + 1][3 * j + 1] = '#';
			j += dir;
			if (j >= 33) { j = 32; dir = -1; i++; }
			else if (j < 0) { j = 0; dir = 1; i++; }
			cnt++;
		}
	}
	
	else if (B == 1) {
		for (i = 0; i < 100; i++) for (j = 0; j < 100; j++) ans[i][j] = '#';
		i = 0; j = 0; int cnt = 0, dir = 1;
		while (cnt < A) {
			for (k = 0; k < 3; k++) for (l = 0; l < 3; l++) ans[3 * i + k][3 * j + l] = '#';
			ans[3 * i + 1][3 * j + 1] = '.';
			j += dir;
			if (j >= 33) { j = 32; dir = -1; i++; }
			else if (j < 0) { j = 0; dir = 1; i++; }
			cnt++;
		}
	}
	
	else {
		//A' = 1, B' = B - 1のスネーク
		for (i = 0; i < 100; i++) for (j = 0; j < 100; j++) ans[i][j] = '.';
		i = 0; j = 0; int cnt = 0, dir = 1;
		while (cnt < B - 1) {
			for (k = 0; k < 3; k++) for (l = 0; l < 3; l++) ans[3 * i + k][3 * j + l] = '.';
			for (k = 0; k < 3; k++) for (l = 0; l < 3; l++) isMark[3 * i + k][3 * j + l] = true;
			ans[3 * i + 1][3 * j + 1] = '#';
			j += dir;
			if (j >= 33) { j = 32; dir = -1; i++; }
			else if (j < 0) { j = 0; dir = 1; i++; }
			cnt++;
		}
		
		//A' = A - 1, B' = 1のスネーク
		for (int ii = 0; ii < 100; ii++) for (int jj = 0; jj < 100; jj++) if (!isMark[ii][jj]) ans[ii][jj] = '#';
		cnt = 0;
		while (cnt < A - 1) {
			for (k = 0; k < 3; k++) for (l = 0; l < 3; l++) ans[3 * i + k][3 * j + l] = '#';
			ans[3 * i + 1][3 * j + 1] = '.';
			j += dir;
			if (j >= 33) { j = 32; dir = -1; i++; }
			else if (j < 0) { j = 0; dir = 1; i++; }
			cnt++;
		}
	}
	
	cout << 100 << " " << 100 << endl;
	for (i = 0; i < 100; i++) {
		for (j = 0; j < 100; j++) {
			cout << ans[i][j];
		}
		cout << endl;
	}
	return 0;
}

/*
ooo
oxo
ooo

xxx
xox
xxx

をスネークで配置していけばよい。
*/

Measured memory_bytes: 888
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner stdin = new Scanner(System.in);
    int n = stdin.nextInt();
    int[] x = new int[n];
    for (int i = 0; i < n; i++) {
      x[i] = stdin.nextInt();
    }

    int[] y = new int[n];
    for (int i = 0; i < n; i++) {
      y[i] = stdin.nextInt();
    }

    for (int i = 0; i < 4; i++) {
      double D = 0;
      for (int j = 0; j < n; j++) {
        switch (i) {
          case 0:
            D += Math.abs(x[j] - y[j]);
            break;

          case 3:
            D = Math.max(D, Math.abs(x[j] - y[j]));
            break;

          default:
            D += Math.pow(Math.abs(x[j] - y[j]), i + 1);
            break;
        }
      }

      if (i == 1 || i == 2) {
        D = Math.pow(D, 1.0 / (i + 1));
      }

      System.out.println(D);
    }
  }

}

Measured memory_bytes: 20340
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007ll
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;


ll modpow(ll x, ll n){
    ll res = 1;
    ll mul = x;
    while(n){
        if(n % 2) res = res * mul % 13;
        mul = mul * mul % 13;
        n /= 2;
    }
    return res;
}

ll modinv(ll x, ll n){
    return modpow(x, n - 2);
}

ll dp[100010][13];

int main(){
    string s;
    cin >> s;
    // reverse(s.begin(), s.end());
    ll n = s.size();
    dp[0][0] = 1;

    rep(i, n){
        if (s[i] != '?') {
            // ll p = modpow(10, i);
            ll p = (s[i] - '0');
            rep(j, 13){
                dp[i + 1][(j * 10 + p) % 13] += dp[i][j];
            }
        }
        else {
            rep(t, 10){
                // ll p = modpow(10, i);
                rep(j, 13){
                    dp[i + 1][(j * 10 + t) % 13] += dp[i][j];
                }
            }
        }
        rep(j, 13) dp[i + 1][j] %= MOD;
    }

    cout << dp[n][5] << endl;

    return 0;
}

Measured memory_bytes: 10624
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <numeric>
#include <sstream>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main() {
#ifdef RUN_LOCAL
  ifstream in("../input.txt");
  cin.rdbuf(in.rdbuf());
#endif

  cin.tie(0);
  ios::sync_with_stdio(false);

  string s;
  cin >> s;
  if (s == "ABC")
  {
    cout << "ARC" << endl;
  }
  else {
    cout << "ABC" << endl;
  }

  return 0;
}


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

using namespace std;

const int MAXN = 1e5 + 5;

int n, m, x, a;
int res1, res2;

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n >> m >> x;
    for (int i = 0; i < m; i++) {
        cin >> a;
        if (a <= x)
            res1++;
        else
            res2++;
    }
    cout << min(res1, res2) << endl;
	return 0;
}


Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
x = 0
y = 0

antena = [a, b, c, d, e]



for i in range(5):

    for j in range(i+1, 5):
        result = antena[j] - antena[i]
        

        if result > k:
            x += 1


        else:
            y += 1
            


if x >= 1 and y < 10:
    print(":(")

elif x == 0 and y == 10:
    print("Yay!")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) rep(i,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vout(v) VOUT(v,z);
#define vdbg(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
// template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
// template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
bool is_palindrome(string s){return s == string(s.rbegin(),s.rend());}
#define popcount __builtin_popcount
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
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;
}

const string YES = "Yes";
const string NO = "No";
#define judge(f) cout<<((f)?YES:NO)<<"\n";


int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    if(K==1){
        for (long long i = 1; i < N; i++) {
            judge(A[i]>A[i-1])
        }
        return 0;
    }
    vector<ll> v(N);
    vector<ll> w(N);
    v[0]=A[0];
    for (long long i = 1; i < N; i++) {
        v[i]=v[i-1]+A[i];
    }
    w[K-1]=v[K-1];
    for (long long i = K; i < N; i++) {
        w[i]=v[i]-v[i-K];
    }
    for (long long i = 0; i < N-K; i++) {
        judge(w[K+i-1]<w[K+i])
    }
    return 0;
}


Measured memory_bytes: 8028
X,Y,A,B,C = map(int, input().split())
P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]

P.sort(reverse = True)
Q.sort(reverse = True)
R.sort(reverse = True)

PQ = P[:X] + Q[:Y]

PQ.sort()

for i in range(min(X+Y, C)):
    if PQ[i] < R[i]:
        PQ[i] = R[i]

print(sum(PQ))

Measured memory_bytes: 23340
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
ll from, to, cost;
bool operator<(const E &b) const { return cost < b.cost; }
bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
vector<string>split(string s, char c = ' ') {
	vector<string>vec;
	string h = "";
	for (int i = 0; i < s.size();) {
		int j = i;
		while (j < s.size() && s[j] != ' ') {
			h += s[j++];
		}
		if (h.size() > 0) vec.push_back(h);
		h = "";
		i = j + 1;
	}
	return vec;
}
template<typename T>
void print_vec(vector<T>a) {
	for (int i = 0; i < a.size(); i++) {
		cout << (i == 0 ? "" : " ") << a[i];
	}
	cout << endl;
}
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n;
ld a[3000];
ld dp[3000][3000];
//表がiまい出る確率
signed main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= i; j++) {
			dp[i][j] = dp[i - 1][j - 1] * a[i] + dp[i - 1][j] * (1 - a[i]);
		}
	}
	ld sum = 0;
	for (int i = n / 2 + 1; i <= n; i++) {
		sum += dp[n][i];
	}
	printf("%.20LF\n", sum);
}

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

int main(){
  std::vector<int> p;
  int n,m;
  cin >> n >> m;
  p.push_back(n); p.push_back(m);
  cin >> n >> m;
  p.push_back(n); p.push_back(m);
  cin >> n >> m;
  p.push_back(n); p.push_back(m);
  
  for(int i=1; i<5;i++){
    if(count(p.begin(),p.end(),i)>2){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X = INT()
m = 100
ans = 0
while m < X:
	m = m*101//100
	ans += 1
print(ans)


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

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

int main(){
  int n,m;
  cin >> n >> m;
  int a[m];
  for(int i=0;i<m;i++) cin >> a[i];
  int dp[n+1];
  dp[0]=0;
  for(int i=1;i<n+1;i++){
    int x=-1e9;
    for(int j=0;j<m;j++){
      if(i-use[a[j]]>=0){
       x=max(x,dp[i-use[a[j]]]+1);
      }
    }
    dp[i]=x;
  }
  sort(a,a+m);
  int nn=n;
  for(int i=0;i<dp[nn];i++){
    for(int j=m-1;j>=0;j--){
      if(dp[n-use[a[j]]]==dp[n]-1&&n-use[a[j]]>=0){
        cout << a[j];
        n-=use[a[j]];
        j=-1;
      }
    }
  }
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
x = [i for i in range(1,2000001)]
ans = 0
cnt = 0
if 1 not in a:
    print(-1)
    quit()
for i in range(n):
    if x[cnt] != a[i]:
        ans += 1
    else:
        cnt += 1
print(ans)


Measured memory_bytes: 92640
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define MAX(a,b) (a>b?a:b)
using namespace std;

int main(){
  int N, num;
  cin >> N;
  int cnt =0;
  rep(i, N){
    cin >> num;
    if(num%2==1) cnt++;
  }
  if(cnt%2==0) cout << "YES" << endl;
  else  cout << "NO" << endl;
  return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;

const int MOD = 1e9 + 7;

int sol, n, dp[2001];

int search (int cur) {
	if (cur == n) return 1;
	
	int& ans = dp[cur];

	if (ans != -1) return ans;
	else ans = 0;

	for (int sum = 3; sum + cur <= n; sum++) {
		ans = (ans + search(cur + sum)) % MOD;
	}

	return ans;
}

int main () {
	cin >> n;
	memset (dp, -1, sizeof(dp));
	sol = search (0);
	cout << sol << '\n';
}


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

int main() {
    int N, Y;
    cin >> N >> Y;
    int maxman = Y/10000;
    int maxgosen = Y/5000;

    for (int man = 0; man <= maxman; man++) {
        for (int gosen = 0; gosen <= maxgosen; gosen++) {
            int sen = N - gosen - man;
            if(sen<0) break;
            if (man * 10000 + gosen * 5000 + sen * 1000 == Y) {
                printf("%d %d %d\n", man, gosen, sen);
                return 0;
            }
        }
    }
    printf("-1 -1 -1\n");
}

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

const int mod = 1e9 + 7;
ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}
const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();

	int tmp[100001];
	tmp[0] = 1;
	rep1(i, N) tmp[i] = ll(tmp[i - 1]) * i % mod;
	ll fac = tmp[N - 1];
	ll ifac = modpow(tmp[N], mod - 2);
	for (int i = N; i > 0; i--) {
		tmp[i] = tmp[i - 1] * ifac % mod;
		ifac = ifac * i % mod;
	}

	int kei = 0;
	ll kotae = 0;
	int mae = getint();
	rep1(i, N - 1) {
		int tugi = getint();
		ll X = tugi - mae;
		kei = (kei + tmp[i]) % mod;
		kotae += kei * X % mod;
		mae = tugi;
	}

	printf("%lld\n", kotae % mod * fac % mod);

	Would you please return 0;
}

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

int main(){
    int h, w;
    cin >> h >> w;
    vector<vector<char>> c(h, vector<char> (w));
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            cin >> c.at(i).at(j);
        }
    }
    int count = 0;
    for(int i = 0;i < 2 * h;i++){
        for(int j = 0;j < w;j++){
            cout << c.at(count).at(j);
        }
        if(i % 2 == 1)count++;
        cout << endl;
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll
#define INF 1e16
#define mod 1000000007
int main(){
    ll d,G,a,b;
    cin>>d>>G;
    vector<P> v;
    rep(i,d){
        cin>>a>>b;
        v.push_back(P(b,a));
    }
    ll ans = INF;
    rep(i,(1<<d)){
        ll tmp1 = 0, tmp2 = 0;
        ll mx = -1;
        rep(j,d) {
            if((1<<j) & i) {
                tmp1 += v[j].se * 100 * (j+1) +v[j].fi;
                tmp2 += v[j].se;
            } else {
                mx = j;
            }
        } 
        // sort(all(tt));
        // cout<<tmp1<<" "<<tmp2<<endl;
        if(tmp1 >= G) {
            minch(ans,tmp2);
        } else {
            ll cnt = 0;
            // while(tmp1 < G) {
                P p = v[mx];
                // cout<<p.se<<endl;
                rep(j,p.se){
                    tmp1 += 100 * (mx+1); 
                    tmp2++;
                    if(tmp1 >= G) break;
                }
                // cnt++;
            // }
            if(tmp1 >= G) minch(ans,tmp2);
        }
        // cout<<tmp1<<" "<<tmp2<<endl;
        // cout<<ans<<endl;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

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

int abs(int a){
  if(a<0){
    return -a;
  }else{
    return a;
  }
}

int main(){
  int n,i,k,ans=0;
  scanf("%d",&n);
  scanf("%d",&k);
  int x[100];
  for(i=0;i<n;i++){
    scanf("%d",&x[i]);
  }
  for(i=0;i<n;i++){
    ans += min(x[i],abs(k-x[i]));
  }
  printf("%d\n",2*ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int h,n,a[1001],b[1001];
int dp[10005];
int main(){
    cin>>h>>n;
    rep(i,n) cin>>a[i]>>b[i];
    memset(dp,0x3f,sizeof(dp));
    dp[0]=0;
    rep(i,h){
        rep(j,n){
            dp[min(h,i+a[j])]=min(dp[min(h,i+a[j])],dp[i]+b[j]);
        }
    }
    cout<<dp[h]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (int)(a); v < (int)(b); ++v)
#define FORE(v, a, b) for(int v = (int)(a); v <= (int)(b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define RS resize
#define CLR clear
#define PB push_back
#define ALL(x) (x).begin(), (x).end()
using namespace std;

void split(string str, char chr, vector< string > *res){
	stringstream ss(str);
	string itm;
	while(getline(ss, itm, chr)){
		(*res).PB(itm);
	}
}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string str;
	vector< string > words;
	
	while(getline(cin, str), str != "END OF INPUT"){
		words.CLR();
		split(str, ' ', &words);
		REP(i, words.size()){
			cout << words[i].length();
		}
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1204
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
bool a[100];
int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	int ans=0;
	for(int i=0;i<n-1;i++){
		int t=0;
		memset(a,0,sizeof(a));
		for(int j=0;j<=i;j++) a[s[j]-'A']=1;
		for(int j=i+1;j<n;j++){
			if(a[s[j]-'A']){
				a[s[j]-'A']=0;
				t++;
			}
		}
		ans=max(ans,t);
	}
	cout<<ans;
	return 0;
}

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

#define ALL(v) (v).begin(),(v).end()

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;




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

/*　吾輩はやれば出来る子である。 
　　　　∩∩ 
　　　（´･ω･） 
　　 ＿|　⊃／(＿＿_ 
　／　└-(＿＿＿_／ 
　￣￣￣￣￣￣￣ 
　やる気はまだない 

　　 ⊂⌒／ヽ-、＿_ 
　／⊂_/＿＿＿＿ ／ 
　￣￣￣￣￣￣￣　　*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
ll n,k,ans=0;
const ll MOD = 1000000007;
void Main(){    
    cin>>n>>k;
    For(i,0,n){
        ll h;cin>>h;
        if(h>=k) ans++;
    }
    cout<<ans<<endl;
}
int main(){
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int s[55];
int main(){
  int a,m=0;
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>s[i];
    for(int j=0;j<i;j++)
      m+=s[j]*s[i];
    for(int j=i+1;j<a;j++)
      m+=s[j]*s[i];
  }
  cout<<m;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    int main(){
    int n;
    cin >> n;
    vector <pair<int,int> > a(n);
    int dummy;
    for (int i = 0; i < n; i++){
    cin >> dummy;
    a[i].first = dummy;
    a[i].second = i;
    }
    sort(a.begin(),a.end());
      
    for (int j = 0; j < n; j++){
    cout << a[j].second + 1 << " ";
    }
    return 0;  
    }

Measured memory_bytes: 1536
import Queue
import sys

class Proc:
    def __init__(self, name, time):
        self.time = time
        self.name = name

def main():
    array = map(lambda x: int(x), sys.stdin.readline().strip().split(" "))
    p_num = array[0]
    q_time = array[1]
    p_queue = Queue.Queue()
    for i in range(0, p_num):
        array = sys.stdin.readline().strip().split(" ")
        p_queue.put(Proc(array[0], int(array[1])))
    t = 0
    while not p_queue.empty():
        p = p_queue.get()
        if p.time > q_time:
            p.time = p.time - q_time
            p_queue.put(p)
            t += q_time
        else:
            t += p.time
            print p.name + " " + str(t)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 28896
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> pts(3);
    for (int i = 0; i < 3; i++)cin >> pts[i];

    string t;
    cin >> t;
    vector<int> machine(n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            if (t[i] == "rsp"[j])machine[i] = j;
        }
    }

    int ret = 0;
    for (int i = 0; i < k; i++) {
        int len = ((n - i) + k - 1) / k;
        vector<vector<int>> dp(len + 1, vector<int>(3));
        for (int j = 0; j < len; j++) {
            for (int prev = 0; prev < 3; prev++) {
                for (int now = 0; now < 3; now++) {
                    if (prev == now)continue;

                    int point = 0;
                    if ((now + 1) % 3 == machine[i + k * j])point += pts[now];
                    dp[j + 1][now] = max(dp[j + 1][now], dp[j][prev] + point);
                }
            }
        }
        ret += max({dp[len][0], dp[len][1], dp[len][2]});
    }

    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 6144
#include "bits/stdc++.h"
 
using namespace std;
 
typedef long long ll;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
    
 #define sz(x) (int)(x).size()
 #define mp make_pair
 #define pb push_back
 #define all(x) x.begin(), x.end()
 
 #define PI 3.14159265358979323846264338327950L
const int MOD = 1000000007;
 
int main() 
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    
    int d,t,s;cin>>d>>t>>s;

    int temp = s*t;

    if(temp >= d) cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 3648
#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(){
	double N;
	cin>>N;
	double ave=0;
	vector<int>a(N);
	rep(i,N){
		cin>>a.at(i);
		ave+=a.at(i);
	}
	ave=ave/N;
	double min=abs(a.at(0)-ave);
	//cout<<abs(a.at(0)-ave);
	//cout<<min;
	int minn=0;
	rep(i,N){
		if(abs(a.at(i)-ave)<min){
			min=abs(a.at(i)-ave);
			minn=i;
		}
	}
	cout<<minn<<endl;
return 0;}

/*compile
g++ code.cpp
./a.out
run*/

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

int main()
{
    string s;
    cin >> s;
    int count = 0, n = s.size();
    rep(i, n/2) {
        if(s[i] != s[n-i-1]) count++; 
    }
    cout << count << endl;
    return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        var x = int.Parse(ReadLine());

        if(400 <= x && x < 600)
            WriteLine(8);
        else if (600 <= x && x < 800)
            WriteLine(7);
        else if (800 <= x && x < 1000)
            WriteLine(6);
        else if (1000 <= x && x < 1200)
            WriteLine(5);
        else if (1200 <= x && x < 1400)
            WriteLine(4);
        else if (1400 <= x && x < 1600)
            WriteLine(3);
        else if (1600 <= x && x < 1800)
            WriteLine(2);
        else if (1800 <= x && x < 2000)
            WriteLine(1);
    }
}


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


/*
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <ctype.h>
*/
typedef struct  llnode
{
	int x;
	struct llnode *next;
}
slnode;


using namespace std;

typedef pair<int , int > pii;
typedef pair<long , long> pll;
typedef pair<pii , int > piii;
typedef pair<pll , long > plll;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector <pii> vii;
typedef vector<pll> vll;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned long long int ulli;
typedef long long int lli;
typedef double d;
typedef float f;
typedef string s;
typedef char ch;
typedef pair<int,ll> pill;

#define loop(n) for(int i = 0; i < (n); i++)
#define lp(x , s , e) for(int x = (s); x < (e); x++)
#define lpe(x , s , e) for(int x = (s); x <= (e); x++)
#define readline(s) getline(cin,s)
#define NumofDigits(n) ((int)log10(n)+1)
#define CountofNumber(array,n,x)  (upper_bound(array, array+n, x)-lower_bound(array, array+n, x))
#define F first
#define S second
#define EPS 1e-7
#define modulo ll (1e9 + 7)
const long double PI = 3.141592653589793238L;
#define MP make_pair
#define PB push_back
#define all(a) a.begin(),a.end()
#define clr(x , val) memset((x) , (val) , sizeof(x))
#define endl '\n'

ll power(ll a, ll b)
{
    ll res = 1;
    for(int i = 0; i<b; i++)
       res *= a;

    return res;
}
int findSingle(int ar[], int ar_size)
    {
        int res = ar[0];
        for (int i = 1; i < ar_size; i++)
            res = res ^ ar[i];
        return res;
    }
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
   int r;
   cin >> r;
   cout << 2 *PI * r;
    return 0;
}


Measured memory_bytes: 3784
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int main(){
    ll n,m; cin >> n >> m;
    ll ans;
    if(n <= 1 || m <= 1){
      	if(n == 1 && m == 1) ans = 1;
      	else ans = max(n,m) - 2;
    }else{ 
        ans = (n-2) * (m-2);
    }
    cout << ans << endl;
}

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

#define pb push_back
#define INF INT_MAX

void solution1(int n, vector<int>& heights);
void solution2(int n, vector<int>& heights);
void solution3(int n, vector<int>& heights);

int main(void){

	// taking input
	int n ;
	cin >> n;
	vector<int> heights(n);
	for(int i = 0;i < n;i++)
		cin >> heights[i];

	// sending inputs to functions
	// 
	solution1(n, heights);
	//
	// solution2(n, heights);
}


// iterative
void solution1(int n, vector<int>& heights){

	std::vector<int> dp(n);
	dp[0] = 0;
	dp[1] = abs(heights[1]-heights[0]);
	for(int i =2;i < n;i++){
		dp[i] = min(dp[i-1] + abs(heights[i]-heights[i-1]), dp[i-2] + abs(heights[i]-heights[i-2]));
	}
	cout << dp[n-1] << endl;
	return;
}

int helper(int n, std::vector<int>& heights, int x){

	if(x == 0)
		return 0;
	if(x == 1)
		return abs(heights[1] - heights[0]);
	return min(helper(n, heights, x-1)+abs(heights[x]-heights[x-1]), helper(n, heights, x-2)+abs(heights[x]-heights[x-2]));
}

// recursive
void solution2(int n, vector<int>& heights){

	int ans = helper(n, heights, n-1);
	cout << ans << endl;
	return;
}



void solution3(int n, vector<int>& heights){

}

Measured memory_bytes: 1024
import heapq

n = int(input())
a = list(map(int, input().split()))
    
count = 0
for i in range(1, n-1):
    # 小さい順で2番目の値が真ん中の値と一致しているかどうか
    sl = heapq.nsmallest(2, a[i-1:i+2])
    if sl[1] == a[i]:
        count += 1
    
print(count)

Measured memory_bytes: 3188
a=int(input())
if a==1:
    print(input())
else:
    b=[]
    k=l=0
    for i in range(a):
        x,y,h=map(int,input().split())
        b.append([x,y,h])
    for k in range(a):
        if b[k][2] != 0: break
    for i in range(101):
        for j in range(101):
            l=b[k][2]+abs(b[k][0]-i)+abs(b[k][1]-j)
            for I in range(a):
                if b[I][2]!=max(0,l-abs(i-b[I][0])-abs(j-b[I][1])):
                    break
                elif I==a-1:
                    print(str(i)+" "+str(j)+" "+str(l))
                    exit()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	int N; cin>>N;
	vi A(N);
	ll ans = 0;
	rp(i,0,N){
		cin>>A[i];
		int a = A[i];
		// ote(a);
		while(a%2==0){
			ans++;
			a/=2;
		}
		// ote(ans);//
	}

	ote(ans);
}


Measured memory_bytes: 256