akhauriyash/Code-Regression huggingface dataset:
n = int(input())

s = {}
for i in range(n):
    tmp, temp = input().split()
    if tmp not in s.keys():
        s[tmp] = [(i, int(temp))]
    else:
        s[tmp] += [(i, int(temp))]
    
    
s = sorted(s.items(), key=lambda x:x[0])

for i in s:
    a = sorted(i[1], key=lambda x:x[1], reverse=True)
    for j in a:
        print(j[0] + 1)
        

Measured memory_bytes: 3064
#include "vector"
#include "string"
#include "set"
#include "map"
#include "sstream"
#include "algorithm"
#include "cmath"
#include "cassert"
#include "iostream"
#include "numeric"
#include "fstream"
#include "queue"
#include <functional>
#include <climits>
#include <cstring>
#include <ctime>
#include <list>
#include <iomanip>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <complex>
#include <limits>
#include <random>
#include <array>

#define int64 long long int

const int64 M = 1e9 + 7;

void MultL(int64 &a, int64 b) {
    a = (a * b) % M;
}
void AddL(int64 &a, int64 b) {
    a = (a + (b + M)) % M;
}

int64 Mult(int64 a, int64 b) {
    return (a * b) % M;
}
int64 Add(int64 a, int64 b) {
    return (a + (b + M)) % M;
}

using namespace std;

vector<int64> fen;
int64 fen_sum(int r) {
    int64 result = 0;
    for (; r >= 0; r = (r & (r + 1)) - 1) {
        result += fen[r];
    }
    return result;
}
void fen_inc(int i, int64 delta) {
    for (; i < fen.size(); i = (i | (i + 1))) {
        fen[i] += delta;
    }
}
void fen_init(size_t n) {
    fen.assign(n, 0);
}
void fen_init(const vector<int64> &data) {
    fen_init(data.size());
    for (int i = 0; i < data.size(); i++) {
        fen_inc(i, data[i]);
    }
}

int64 gcd(int64 a, int64 b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    std::ios::sync_with_stdio(false);
    int64 n1, n2;
    cin >> n1 >> n2;
    int64 g = gcd(n1, n2);
    string str1, str2;
    cin >> str1 >> str2;
    n1 /= g;
    n2 /= g;
    swap(n1, n2);
    int64 p1 = 0;
    int64 p2 = 0;
    while (p1 < str1.size() && p2 < str2.size()) {
        if (p1 * n1 == p2 * n2 && str1[p1] != str2[p2]) {
            cout << -1 << endl;
            return 0;
        }
        if (p1 * n1 > p2 * n2) {
            ++p2;
        }
        else if (p1 * n1 == p2 * n2) {
            ++p1;
            ++p2;
        }
        else {
            ++p1;
        }
    }

    cout << n1 * n2 * g << endl;




    return 0;
}

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

using namespace std;
int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  string tmp;
  vector<string> v;
  cin >> n;
  cin >> tmp; //よみとばし
  for (int i = 0; i < n; ++i)  {
    cin >> tmp;
    v.push_back(tmp);
  }
  sort(v.begin(), v.end());

  for (std::vector<string>::iterator i = v.begin(); i != v.end(); ++i) {
    cout << *i;
  }

  cout << "\n";
  return 0;
}

Measured memory_bytes: 256
import 'dart:io';
 
void main(List<String> args) {
  List<int> x = stdin.readLineSync().split(" ").map((i) => int.parse(i)).toList();
  String N = stdin.readLineSync();
  String ans = "Yes";
  for(int i=0; i<x[0]+x[1]+1; ++i){
    if(i==x[0]){
    	if(N[i]!='-') ans = "No";
    }else{
    	if(N[i]=='-') ans = "No";
    }
  }
  print(ans);
}

Measured memory_bytes: 13164
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        k: usize
    }

    println!("{}", n - k + 1)
}

Measured memory_bytes: 4352
#include<stdio.h>
int RS(char *s){
	int i=0;
	while(1){
		if(s[i]==0)break;
		i++;
	}
	int k=1;
	for(int j=0;j<(i-1)/2;j++){
		if(s[j]!=s[i-j-1])k=0;
	}
	if(i>0&&k)return 1;
	return 0;
}
int RS2(char *s){
	int i=0;
	while(1){
		if(s[i]==0)break;
		i++;
	}
	i=(i-1)/2;
	int k=1;
	for(int j=0;j<i/2;j++){
		if(s[j]!=s[i-j-1])k=0;
	}
	if(i>0&&k)return 1;
	return 0;
}
int RS3(char *s){
	int i=0;
	while(1){
		if(s[i]==0)break;
		i++;
	}
	int k=1;
	for(int j=(i+3)/2-1;j<i/2;j++){
		if(s[j]!=s[i-(i+3)/2])k=0;;
	}
	if((i-(i+3)/2+1)>1&&k)return 1;
	return 0;
}
int main(){
	char s[100];
	scanf("%s",s);
	if(RS(s)&&RS2(s)/*&&RS3(s)*/)printf("Yes");
	else printf("No");
}

Measured memory_bytes: 128
import numpy as np

H, W = map(int, input().split(" "))

lines = np.asarray([list(input().replace("\n", "")) for h in range(H)])

h_indexs, w_indexs = map(set, np.where(lines == "#"))

outlines = lines[list(h_indexs), :][:, list(w_indexs)]
for outline in outlines:
    print("".join(outline))

Measured memory_bytes: 12880
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <stack>
#include <limits>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <numeric>
//#include <tuple>

constexpr long long mod = static_cast<long long>(1e9 + 7);

int main() {
    int N;
    std::cin >> N;
    bool ans = true;
    int t = 0;
    int x = 0;
    int y = 0;
    while(N--) {
        int u, i, j;
        std::cin >> u >> i >> j;
        int dist = std::abs(x - i) + std::abs(y - j);
        if(u - t < dist) ans = false;
        else {
            if((dist - u + t) % 2) ans = false;
        }
    }

    if(ans) std::cout << "Yes" << std::endl;
    else std::cout << "No" << std::endl;
    return 0;
}


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

int main(){ 
    string s;
    cin >> s;
    sort(s.begin(),s.end());
    int a = s.size();
    bool ans =true;
    for(int i=0;i<a-1;i++){
        if(s.at(i) == s.at(i+1)){
            ans = false;
            break;
        }
    }
    if(ans) cout << "yes" << endl;
    else cout << "no" << endl;
 }

Measured memory_bytes: 256
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int n,k;
		cin>>n>>k;
		ll int cnt=0;
		while(n!=0)
		{
			cnt++;
			n/=k;
		}
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    ll x, y, cnt = 0;
    cin >> x >> y;

    ll now = x;
    while (1) {
        if (now <= y) {
            now *= 2;
            cnt++;
        } else {
            break;
        }
    }

    cout << cnt << endl;
    

    return 0;
}

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

public class UnionFind
{
    private int[] data;
    public UnionFind(int size)
    {
        data = new int[size];
        for (int i = 0; i < size; i++) data[i] = -1;
    }
    public bool Unite(int x, int y)
    {
        x = Root(x);
        y = Root(y);
        if (x != y)
        {
            if (data[y] < data[x])
            {
                var tmp = y;
                y = x;
                x = tmp;
            }
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    public bool IsSameGroup(int x, int y) => Root(x) == Root(y);
    public int Root(int x) => data[x] < 0 ? x : data[x] = Root(data[x]);
    public int getMem(int x) => -data[Root(x)];
}


public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var h = int.Parse(line[0]);
        var w = int.Parse(line[1]);
        var map = new bool[h, w];
        var sno = new int[h, w];
        var p = 0;
        for (int i = 0; i < h; i++)
        {
            var s = Console.ReadLine().Trim();
            for (int j = 0; j < w; j++)
            {
                if (s[j] == '#') map[i, j] = true;
                sno[i, j] = p++;
            }
        }
        getAns(h, w, map, sno);
    }
    static void getAns2(int h, int w, bool[,] map, int[,] sno, UnionFind uf)
    {
        var d = new Dictionary<int, int>();
        for (int i = 0; i < h; i++)
            for (int j = 0; j < w; j++)
            {
                var p = uf.Root(sno[i, j]);
                if (!d.ContainsKey(p)) d[p] = 0;
                if (map[i, j]) d[p]++;
            }
        var ans = 0L;
        foreach (var x in d)
        {
            var t = uf.getMem(x.Key);
            ans += (long)x.Value * (t - x.Value);
        }
        Console.WriteLine(ans);
    }
    static void getAns(int h, int w, bool[,] map, int[,] sno)
    {
        var dx = new int[] { 0, 1 };
        var dy = new int[] { 1, 0 };
        var uf = new UnionFind(h * w);
        for (int i = 0; i < h; i++)
            for (int j = 0; j < w; j++)
                for (int k = 0; k < 2; k++)
                {
                    var nx = i + dx[k];
                    var ny = j + dy[k];
                    if (nx < h && ny < w &&
                      ((map[i, j] && !map[nx, ny]) | (!map[i, j] && map[nx, ny])))
                        uf.Unite(sno[i, j], sno[nx, ny]);
                }
        getAns2(h, w, map, sno, uf);
    }
}

Measured memory_bytes: 20320
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;

typedef long long ll;
const ll mod = 1e9+7;
char ch[505][505];
int vis[505][505];
int love[8][8]={{0,0,1},{0,0,-1},{1,0,0},{-1,0,0},{0,1,0},{0,-1,0}};
int h[8][8]={{0,1},{1,0},{-1,0},{0,-1}};
int n,m;
int a,b,c,d;
int main()
{
	int maxx=0,sum=0;
	char arr[12];
	scanf("%s",arr);	
	for(int i=0;i<3;i++)
	{
		if(arr[i]==arr[i+1]&&arr[i]=='R')
		{
			sum++;
		}
		else
		{
			if(sum>maxx)
			maxx=sum;
			sum=0;
		}
		
	}
	int flag=0;
	if(maxx==0)
	{
		for(int i=0;i<3;i++)
		{
			if(arr[i]=='R')
			{
				flag=1;
					printf("1\n");
					break;
		}
	
		}
		if(flag==0)
		printf("0\n");
	}
	
	else if(maxx==1)
	printf("%d\n",maxx+1);
	else
	printf("3\n");
} 
       

Measured memory_bytes: 3684
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

ll N,Q,x;
ll A[100010];


int main() {
    scanf("%lld%lld",&N,&Q);
    REP(i,N) scanf("%lld",&A[i]);
    REP(i,Q){
        scanf("%lld",&x);
        ll  sum = 0, ans = 0;
        int r = 0;
        REP(l,N){
            while(r < N && sum + A[r] <= x) sum += A[r++];
            ans += r - l;
            if(r==l) ++r;
            else sum -= A[l];
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 4016
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <cmath>
#include <climits>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  int res = 1;
  int odd = 1;
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
    res *= 3;
    if(a % 2 == 0)odd *= 2;
  }
  cout << res - odd << endl;
	return 0;
}


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

int main()
{
    int X, N;
    cin >> X >> N;
    set<int> P;
    int Pi;
    for(int i=0;i<N;i++){
        cin >> Pi;
        P.insert(Pi);
    }
    int res = -1;
    int b = 0;
    while(true){
        if(P.count(X-b) == 0){
            res = X-b;
            break;
        }
        if(P.count(X+b) == 0){
            res = X+b;
            break;
        }
        b++;
    }

    cout << res << endl;

    return 0;
}

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

const int N=3010;
const int mod=1000000007;
int n,m;
long long f[N][N][2];

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		f[0][i][0]=1;
	f[0][0][1]=1;
	for(int i=1;i<=m;i++)
		for(int j=0;j<=n;j++)
		{
			if(j<n)
			{
				f[i][j][1]+=f[i-1][j+1][1];
				if(!j)f[i][j][1]+=f[i-1][j+1][0];
				else f[i][j][0]+=f[i-1][j+1][0];					
			}	
			if(j>0)
			{
				f[i][j][1]+=f[i-1][j-1][1];
				f[i][j][0]+=f[i-1][j-1][0];
			}
			if(j>0)
			{
				f[i][j][1]+=f[i-1][j][1];
				if(j==1)f[i][j][1]+=f[i-1][j][0];
				else f[i][j][0]+=f[i-1][j][0];
			}
			if(j<n)
			{
				f[i][j][0]+=f[i-1][j][0];
				f[i][j][1]+=f[i-1][j][1];
			}
			f[i][j][0]%=mod,f[i][j][1]%=mod;
		}
	long long ans=0;
	for(int i=0;i<=n;i++)
		(ans+=f[m][i][1])%=mod;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 141568
def pred(t,x,y):
    return (t >= x + y and (y + x - t)%2 == 0)
result = True

t = 0
x = 0
y = 0

N = input()
for i in range(N):
    nt,nx,ny = map(int ,raw_input().split())
    if not pred(nt -t, abs(nx-x), abs(ny-y)):
        result = False
        break
    t, x, y =nt, nx, ny
print (['No','Yes'][result])


Measured memory_bytes: 5764
#include <stdio.h>

int main(){
  int n,k;
  int sunuke[100]={0};
  int now_k,i,j,tmp,count=0;
  
  scanf("%d %d",&n,&k);
  
  for(i=0;i<k;i++){
    scanf("%d",&now_k);
    
    for(j=0;j<now_k;j++){
      scanf("%d",&tmp);
      sunuke[tmp-1]++;
    }
  }
  
  for(i=0;i<n;i++){
    if(sunuke[i]==0){
      count++;
    }
  }
  printf("%d",count);
}

Measured memory_bytes: 1728
#include<stdio.h>

int main(void) {
	int dp[16][16];
	int a, b, n, x, y;
	int i,j;
	while (1) {
		scanf("%d %d", &a, &b);
		if (a == 0 && b == 0)break;

		scanf("%d", &n);

		for (i = 0; i < a; i++) {
			for (j = 0; j < b; j++)
				dp[i][j] = 0;
		}
		for (i = 0; i < b; i++)
			dp[0][i] = 1;

		for (i = 0; i < a; i++)
			dp[i][0] = 1;

		for (i = 0; i < n; i++) {
			scanf("%d %d", &x, &y);
			dp[x - 1][y - 1] = -1;
			if (x == 1)
				for (j = y - 1; j < b; j++) { dp[0][j] = 0; }
			if (y == 1)
				for (j = x - 1; j < a; j++) { dp[j][0] = 0; }
		}

		for (i = 1; i < a; i++) {
			for (j = 1; j < b; j++) {
				if (dp[i][j] == -1) { dp[i][j] = 0; }
			    else dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
			}
		}
		printf("%d\n", dp[a - 1][b - 1]);
	}
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 28;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

bool isPal(int k)
{
	int m = k;
	int rev = 0;

	while (m) {
		rev = rev * 10 + m % 10;
		m /= 10;
	}

	if (k == rev) return true;
	else return false;
}

int main()
{
	int a, b;
	cin >> a >> b;
	int ans = 0;

	for (int i = a;i <= b;i++) {
		if (isPal(i)) ans++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
// #pragma GCC optimize("O2")
typedef long long int ll;
typedef long double ld;
typedef map <ll,ll> mm;
typedef vector <ll> mv;
typedef pair <ll,ll> mp;
typedef set <ll> ms;
typedef multiset <ll> mms;
typedef queue <ll> mq;
typedef deque <ll> mdq;
typedef stack <ll> mst;
typedef priority_queue <ll> mpq;
typedef priority_queue <ll, vector<ll>, greater<ll> > mmh;
typedef complex<double> cd;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define flush cout.flush();
#define all(v) v.begin(),v.end()
#define deb(x) cout << #x << " " << x << endl;
#define ff first
#define ss second
#define pb(v) push_back(v)
#define lb(v) lower_bound(v)
#define ub(v) upper_bound(v)
#define cn continue
#define forl(i,n) for(ll i=0;i<n;i++)
#define forlr(i,n) for(ll i=n-1;i>=0;i--)
#define rev(s) reverse(s.begin(),s.end())
void swap(ll &a,ll &b) {
	ll tmp=a;
	a=b;
	b=tmp;
}
ll atoistring(string s) {
	stringstream lol(s);
	ll x;
	lol>>x;
	return x;
}
void pv(mv v) {
	forl(i,v.size()) cout<<v[i]<<" ";
	cout<<"\n";
}
void pa(ll *v, ll size) {
	forl(i,size) cout<<v[i]<<" ";
	cout<<"\n";
}
void removeDups(mv &v) {
	sort(all(v));
	mv::iterator it = unique(v.begin(), v.end());
	v.resize(distance(v.begin(), it));
}
inline ld kthRoot(ld n, ll k) {
	return pow(k, (1.0 / k) * (log(n) / log(k)));
}
ll power(ll x, ll y, ll p) {
	ll res=1;
	x=x%p;
	while(y>0) {
		if(y&1) res = (res*x)%p;
		y=y>>1;
		x=(x*x)%p;
	}
	return res;
}
void checkmod(ll &x, ll mod) {
	if(x>=mod) x%=mod;
}

ll mod = 1e9 + 7;

const ll facsize = 4000;
ll facs[facsize], facsinv[facsize];
void makeFacs(ll mod) {
	ll l = 1;
	facs[0] = facsinv[0] = 1;
	for(ll i=1;i<=facsize;i++) {
		l *= i;
		checkmod(l, mod);
		facs[i] = l;
		facsinv[i] = power(l, mod - 2, mod);
	}
}
ll nck(ll N,ll K,ll mod) {
	if(K == 0) return 1;
	if(N<K) return 0;
	return (((facs[N]*facsinv[N-K])%mod)*facsinv[K])%mod;
}

void thisIsMain() {
	ll n;
	cin>>n;
	makeFacs(mod);
	ll i = 1;
	ll ans = 0;
	// cout<<nck(4, 0, mod)<<" "<<nck(2, 1, mod)<<"\n";
	while(n >= 3 * i) {
		ans += nck(n - 2 * i - 1, i - 1, mod);
		if(ans >= mod) ans -= mod;
		i ++ ;
	}
	cout<<ans<<"\n";
}

int main(void)
{
	fastio
	ll t = 1;
	// cin>>t;
	while(t--) thisIsMain();
	return 0;
}

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

using namespace std;

int main()
{
  int N; cin >> N;
  vector<int> L(2*N);
  for (int i = 0; i < 2*N; i++) cin >> L[i];
  sort(L.begin(), L.end());
  int ans = 0;
  for (int i = 0; i < 2*N; i += 2) {
    ans += L[i];
  }
  cout << ans << endl;
  return 0;
}


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

int main()
{
  int N;
  cin >> N;
  string ans = "No";

  rep(i, 9)
  {
    int num = N / (i + 1);
    if (num * (i + 1) == N && 1 <= num && num <= 9)
    {
      ans = "Yes";
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <climits>
#include <numeric>
#include <queue>
#include <cmath>
#include <iomanip>
#include <array>
#include <string>
#include <stack>
#include <cassert>
#include <memory>
#include <random>
#include <fstream>
#include <cfloat>
#include <complex>
using namespace std;
int main() {
	int n; cin >> n;
	vector<long long int> price(n);
	for (auto& p : price) cin >> p;
	long long int money{ 1000 };
	long long int unit{ 0 };
	for (auto i = 0; i < n - 1; ++i) {
		if (price[i + 1] >= price[i]) {
			unit += money / price[i];
			money %= price[i];
		}
		else if (price[i + 1] < price[i]) {
			money += unit * price[i];
			unit = 0;
		}
	}
	money += unit * price.back();
	cout << money << endl;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  string zentai = "";

  for (int i = 0; i < H; i++) {
    string s;
    cin >> s;
    zentai += s;
  }

  for (int i = 0; i < H * W; i++){
    if (zentai.at(i) == '#') {
      cout << '#';
    } else if (zentai.at(i) == '.'){
      	int count = 0;
      	int x = i % W;
      	int y = i / W;

//////// xが0より大きくyも0より大きく、iの（左隣 + 1段上）が # だったら
//////// ↓
//////// iが一番左ではなく一番上でもなく、iの左上が # だったら

      	if (x - 1 >= 0 && y - 1 >= 0 && zentai.at(x - 1 + (y - 1) * W) == '#'){
        	count++;
      	}

//////// yが0より大きく、iの（1段上）が # だったら
//////// ↓
//////// iが一番上ではなく、iの上が # だったら

      	if (y - 1 >= 0 && zentai.at(x + (y - 1) * W) == '#'){
        	count++;
      	}

//////// xがW - 1より小さくyが0より大きく、iの（右隣 + 1段上）が # だったら
//////// ↓
//////// iが一番右ではなく一番上でもなく、iの右上が # だったら

      	if (x + 1 < W && y - 1 >= 0 && zentai.at(x + 1 + (y - 1) * W) == '#'){
        	count++;
      	}

//////// xが0より大きく、iの（左隣）が # だったら
//////// ↓
//////// iが一番左ではなく、iの左が # だったら

      	if (x - 1 >= 0 && zentai.at(x - 1 + y * W) == '#'){
        	count++;
      	}

//////// xがW - 1より小さく、iの（右隣）が # だったら
//////// ↓
//////// iが一番右ではなく、iの右が # だったら

      	if (x + 1 < W && zentai.at(x + 1 + y * W) == '#'){
        	count++;
      	}

//////// xが0より大きくyがH - 1より小さく、iの（左隣 + 1段下）が # だったら
//////// ↓
//////// iが一番左ではなく一番下でもなく、iの左下が # だったら

      	if (x - 1 >= 0 && y + 1 < H && zentai.at(x - 1 + (y + 1) * W) == '#'){
        	count++;
      	}

//////// yがH - 1より小さく、iの（1段下）が # だったら
//////// ↓
//////// iが一番下ではなく、iの下が # だったら

      	if (y + 1 < H && zentai.at(x + (y + 1) * W) == '#'){
        	count++;
      	}

//////// xがW - 1より小さくyがH - 1より小さく、iの（右隣 + 1段下）が # だったら
//////// ↓
//////// iが一番右ではなく一番下でもなく、iの右下が # だったら

      	if (x + 1 < W && y + 1 < H && zentai.at(x + 1 + (y + 1) * W) == '#'){
        	count++;
      	}

      cout << count;
    }

    if ((i + 1) % W == 0){
      cout << endl;
    }
  }
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

const ll INF = 1e9;
const long long INFL = 1LL<<60;

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

using P = pair<int, int>;

int main() {
  int h, w;
  cin >> h >> w;

  vector<string> a(h);
  rep(i, h) cin >> a[i];

  // 1. # の数は h + w - 1 であること
  int cnt = 0;
  rep(i, h) rep(j, w) if (a[i][j] == '#') cnt++;
  if (cnt != h + w - 1) {
    puts("Impossible");
    return 0;
  }

  queue<P> q;
  q.push({0, 0});

  while (!q.empty()) {
    P now = q.front(); q.pop();
    rep(i, 2) {
      int nh = now.first + dx[i];
      int nw = now.second + dy[i];
      if (h <= nh || w <= nw || a[nh][nw] != '#') continue;
      if (nh == h - 1 && nw == w - 1) {
        puts("Possible");
        return 0;
      }
      q.push({nh, nw});
    }
  }

  puts("Impossible");

  return 0;
}

Measured memory_bytes: 3628
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  ll A, B, C;
  cin >> A >> B >> C;
  bool res = false;
  FOR(i, 1, B) {
    if (A * i % B == C) {
      res = true;
    }
  }
  cout << (res ? "YES" : "NO") << endl;
  return 0;
}


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

using namespace std;

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

    vector<string> s(3);
    vector<int> idx(3, 0);
    int turn = 0;

    for (int i = 0; i < 3; ++i) cin >> s[i];

    while (true) {
        if (s[turn].size() == idx[turn]) {
            cout << (char)(turn + 'A') << endl;
            break;
        }

        turn = (int)(s[turn][idx[turn]++] - 'a');
    }

    return 0;
}


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

class Main {

    // Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
    public static void main(String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        String S;
        S = sc.next();
        solve(S);
    }

    static void solve(String S){
        String[] arr = {"Sunny", "Cloudy", "Rainy"};
        int index = Arrays.asList(arr).indexOf(S);
        if (index == 2) {
            index = 0;
        } else {
            index++;
        }
        System.out.println(arr[index]);

    }
}

Measured memory_bytes: 21844
unittest
{
	assert( [ "10" ].solve == 170 );		// 追加ケース
	
	assert( [ "4" ].solve == 23 );
	assert( [ "100" ].solve == 26879 );
	assert( [ "10000000" ].solve == 838627288460105 );
}



import std.conv;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	
	// 約数dごとに割り切れるkの個数を集計
	auto ans = 0L;
	foreach( d; 1L .. n + 1 )
	{
		for( auto k = d; k <= n; k += d )
		{
			ans += k;
		}
	}
	return ans;
}


Measured memory_bytes: 2720
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int diff(int a, int b) { return abs(a - b); }

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  int sum = 0;
  for (int i = 0; i < n; i++)
    sum += a[i];
  int id = 0;
  for (int i = 0; i < n; i++) {
    if (diff(a[id] * n, sum) > diff(a[i] * n, sum)) {
      id = i;
    }
  }
  cout << id << endl;
  return 0;
}


Measured memory_bytes: 256
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
mod util {
    use std::fmt::Debug;
    use std::io::{stdin, stdout, BufWriter, StdoutLock};
    use std::str::FromStr;
    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
    #[allow(dead_code)]
    pub fn chars() -> Vec<char> {
        line().chars().collect()
    }
    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
    #[allow(dead_code)]
    pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
        let out = stdout();
        let writer = BufWriter::new(out.lock());
        f(writer)
    }
}
#[allow(unused_macros)]
macro_rules ! get { ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ;; ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; ( $ t : ty ;; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ;; ) ) . collect ::< Vec < _ >> ( ) } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let (n, y) = get!(u64, u64);

    for i in 0..n + 1 {
        for j in 0..n - i + 1 {
            let k = n - i - j;
            if 10000 * i + 5000 * j + 1000 * k == y {
                println!("{} {} {}", i, j, k);
                return;
            }
        }
    }
    println!("-1 -1 -1");
}


Measured memory_bytes: 8572
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;


template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

// 繰り返し二乗法
ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	string S, T;
	std::cin >> S >> T;
	ll ans = 0;
	rep(i, 0, S.size()) {
		if (S[i] != T[i]) {
			ans++;
		}
	}
	std::cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3860
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] a = new int[n];
		for(int i=0; i<n; i++){
			a[i] = scn.nextInt();
		}
      	int[] b = new int[n+1];
      	for(int i=0; i<n; i++){
          b[a[i]] ++;
        }
      	long all = 0;
      	for (int i=1; i<n+1; i++) {
			if(b[i]>0){
				all += (long)b[i]*(b[i]-1)/2;
			}
		}
		for (int i=0; i<a.length; i++) {
			int x = a[i];
			System.out.println(all-(b[x]-1));
        }
	}
}


Measured memory_bytes: 62992
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <cstring>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n-1); i >= 0; i--)
#define pb push_back
#define f first
#define s second
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll max3(ll a, ll b, ll c){return max(a, max(b, c));};
ll min3(ll a, ll b, ll c){return min(a, min(b, c));};
ll max4(ll a, ll b, ll c, ll d){return max(max(a, b), min(c, d));};
ll min4(ll a, ll b, ll c, ll d){return min(min(a, b), min(c, d));};
ll max5(ll a, ll b, ll c, ll d, ll e){return max(max(a, b), max3(c, d, e));};
ll min5(ll a, ll b, ll c, ll d, ll e){return min(min(a, b), min3(c, d, e));};

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

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

ll kai_mod(ll x){
  if(x == 0) return 1;
  return x * kai_mod(x-1) % MOD;
}

/*
//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}
*/


int main(){
  ll N, M; cin >> N >> M;
  string S; cin >> S;
  set<pair<ll, ll>> substr;
  ll hash = S[0];
  ll l = 0, r = 0;
  ll base = 998244353;
  rep(i, M){
    string query; cin >> query;
    if(query == "L++"){
      hash = ((hash - S[l] * pow_mod(base, r-l)) % MOD + MOD) % MOD;
      l++;
    }else if(query == "L--"){
      hash = (hash + S[l-1] * pow_mod(base, r-l+1)) % MOD;
      l--;
    }else if(query == "R++"){
      hash = (hash * base + S[r+1]) % MOD;
      r++;
    }else{
      hash = (hash - S[r] + MOD) * inverse(base) % MOD;
      r--;
    }
    substr.insert({hash, r-l+1});
  }
  cout << substr.size() << endl;
}


Measured memory_bytes: 21912
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner scan=new Scanner(System.in);
    int A=scan.nextInt();
    int B=scan.nextInt();
    if(A>=10||B>=10){
      System.out.println("-1");
    }else{
      System.out.println(A*B);
    }
  }
}

Measured memory_bytes: 21972
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		solve(s);
		s.close();
	}

	public static void solve(Scanner s) {
		int n = s.nextInt();

		long ans = 0;

		for (int i = 0; i < n; i++) {
			ans += i + 1;
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 9428
gets.to_i.times do
  xa, ya, ra, xb, yb, rb = gets.chomp.split(/\s/).map(&:to_f)

  l = Math.sqrt((xa - xb)**2 + (ya - yb)**2)

  if l + rb < ra
    puts 2
  elsif l + ra < rb
    puts -2
  elsif l > ra + rb
    puts 0
  else
    puts 1
  end
end

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rrepn(i, n) for (int i = ((int)(n)); i > 0; --i)
#define SZ(x) ((int)(x).size())
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;
}
vector<pair<string, P>> vec;
// vector<vector<int>> data(3, vector<int>(4));

int main() {
    int D;
    cin >> D;
    vector<int> c(26);
    rep(i, 26) cin >> c[i];
    vector<vector<int>> s(D, vector<int>(26));
    rep(i, D) rep(j, 26) cin >> s[i][j];

    vector<int> t(D);
    // rep(i, D) {
    //     cin >> t[i];
    //     t[i]--;
    // }
    vector<int> last(26);
    int score = 0;
    rep(i, D) {
        int now = 0;
        rep(j, 26) {
            if (now < s[i][j]) {
                now = s[i][j];
                t[i] = j;
            }
        }

        score += s[i][t[i]];
        last[t[i]] = i + 1;
        int m = 0;
        rep(j, 26) m += c[j] * (i + 1 - last[j]);
        score -= m;
        // cout << score << endl;
    }
    rep(i, D) { cout << t[i] + 1 << endl; }
    return 0;
}


Measured memory_bytes: 3680
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2019-12-17 20:47:30
*/

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

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> L(M), R(M);
    for (int i = 0; i < M; i++)
        cin >> L[i] >> R[i];

    int l, r;
    l = *max_element(all(L));
    r = *min_element(all(R));

    int ans = 0;
    if (l <= r) ans = r - l + 1;

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                                      \
  cerr << __LINE__ << ": " << #x << " = {";                   \
  for (long long hoge = 0; (hoge) < (long long)(n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];                   \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A, B, C;
  cin >> A >> B >> C;
  cout << (min(A, B) <= C && C <= max(A, B) ? "Yes" : "No") << '\n';
  return 0;
}


Measured memory_bytes: 3576
#include<bits/stdc++.h>
#define int long long int
#define sci(n) scanf("%lld",&n)
#define pri(n) printf("%lld",n)
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fl2(i,a,b) for(int i=(a);i<(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define nl printf("\n")
#define spc printf(" ")
#define pii pair<int,int>
#define piii pair<pii,int>
#define mii map<int,int>
#define msi map<string,int>
#define mci map<char,int>
#define mss map<string,string>
using namespace std;
int arr[200000+10];

int32_t main()
{

//#ifdef ONPC
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
//#endif
    int n;
    sci(n);
    for(int i=1;i<=n;i++)
        sci(arr[i]);
    int cnt = 0,c = 0;
    int k = 1;
    for(int i=1;i<=n;i++)
    {
        if(arr[i]==k)
        {

            c = 1;
            cnt++;
            k++;
        }
    }
    if(c==0)
        printf("-1\n");
    else
    pri(n-cnt),nl;



    return 0;
}


Measured memory_bytes: 1792
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {

        int jouhousu = int.Parse(Console.ReadLine());
       int[,,] a = new int [4,3,10];
      
        for (int i = 0; i < jouhousu; i++)
        {
            int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();
         a[(s[0] - 1), s[1]-1, s[2]-1] += s[3];
        }
        for (int i = 0; i < 4; i++)
        {
            for (int k = 0; k < 3; k++)
            {
                for (int m = 0; m <10; m++)
                {
                    if (!(m == 9))
                    {
                        Console.Write(" "+a[i, k,m] 
                            );
                    }
                    else
                    {
                        Console.WriteLine(" "+a[i, k,m]);
                    }
                }
            }
            if (i < 3) { Console.WriteLine("####################"); }
        }
        Console.ReadLine();
    }
}

Measured memory_bytes: 9568
import java.util.Scanner;
public class Main {


    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int a, b;
      a = sc.nextInt();
      b = sc.nextInt();
      if(a<b){
      System.out.println("a < b"); }
      else if(a>b){
     System.out.println("a > b"); } 
              
    else {
              System.out.println("a == b");
}
     
}
    }
    


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

using ll = long long;
#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

#define INF 1e9

int N, u, v;
vector<vector<int>> graph;
vector<int> aoki_dist, taka_dist;
int ans = 0;
void dfs(int node){
  for(auto nx : graph[node]){
    if(aoki_dist[nx] != -1) continue;
    aoki_dist[nx] = aoki_dist[node] +1;
    dfs(nx);
  }
}

void solve(int node, int turn){
  bool flag = false;
  ans = max(ans, turn);
  for(auto nx : graph[node]){
    if(taka_dist[nx] != -1) continue;
    taka_dist[nx] = turn+1;
    if(aoki_dist[nx] == turn){
      ans = max(ans, turn);
    }
    else if(aoki_dist[nx] == turn + 1){
      ans = max(ans, turn+1);
    }
    else if(aoki_dist[nx] < turn){

    }
    else{
      flag = true;
      solve(nx, turn+1);
    }
  }
  for(auto nx : graph[node]){
    // if(turn+1 <= aoki_dist[nx]){
    //   int add = (aoki_dist[nx] - (turn+1))/2 * 2;
    //   ans = max(ans, turn+1+add);
    // }
    if(aoki_dist[nx] < aoki_dist[node]){
      ans = max(ans, turn + (aoki_dist[nx]-turn));
    }
    else{
      ans = max(ans, turn + aoki_dist[node]-turn);
    }
  }
}

int main(){
  cin >> N >> u >> v;
  u--, v--;
  graph.resize(N);
  REP(i, N-1){
    int a, b;
    cin >> a >> b;
    a--, b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  aoki_dist.resize(N, -1), taka_dist.resize(N, -1);
  aoki_dist[v] = 0;
  dfs(v);
  taka_dist[u] = 0;
  solve(u, 0);
  cout << ans << endl;
  return 0;
}


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

namespace ABC133
{
    class Program
    {
        static void Main(string[] args)
        {
            var nab = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var n = nab[0];
            var a = nab[1];
            var b = nab[2];
            var result = Math.Min(n * a, b);
            Console.WriteLine(result);
        }
    }
}


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

int main() {
  int N;
  cin >> N;
  
  int G, W, Y, P;
  G = W = Y = P = 0;

  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    if ( s == "G" ) {
      G = 1;
    } else if ( s == "W" ) {
      W = 1;
    } else if ( s == "Y" ) {
      Y = 1;
    } else if ( s == "P" ) {
      P = 1;
    }
  }
  if (G == 1 && W == 1 && Y == 1 && P == 1) { 
    cout << "Four" << endl;
  } else {
    cout << "Three" << endl;
  }
}


Measured memory_bytes: 256
def select2( val ):
  return( val*(val-1) // 2 ) 

N = int(input())
elms = input().split(" ")


ielms = []
for elm in elms:
  ielms.append( int(elm ))



test_dict = {}

for ielm in ielms:
  if( ielm in test_dict.keys() ):
    test_dict[ielm] += 1
  else:
    test_dict[ielm] = 1

total = 0
for dkey in test_dict.keys():      
  total += select2( test_dict[dkey] )
      
for ielm in ielms:
  print(total - select2( test_dict[ielm] ) + select2( test_dict[ielm]-1 ))

Measured memory_bytes: 34980
#include <iostream>
#include <string>

using namespace std;

int main(void){
	string str;
	do{
		cin >> str;
	}while (str.length() > 20);
	for (int i = (str.length()-1); i>=0; --i){
		cout << str[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1172