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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr ll mod = static_cast<ll>(1e9 + 7);

std::string s;
int x, y;
bool dpX[16005][16005];
bool dpY[16005][16005];
int main() {
	std::cin >> s;
	std::cin >> x >> y;

	s += 'T';

	std::vector<int> xy[2];
	int sum = 0;
	int turn = 0;
	for (int i = 0, end = s.size(); i < end; ++i) {
		if (s[i] == 'T') {
			xy[turn].emplace_back(sum);
			turn = (turn + 1) % 2;
			sum = 0;
		}
		else {
			++sum;
		}
	}

	dpX[1][xy[0][0] + 8000] = true;
	for (int i = 1, end = xy[0].size(); i < end; ++i)
		for (int j = 0; j <= 16000; ++j) {
			auto val = xy[0][i];
			bool b1 = j - val >= 0 && dpX[i][j - val];
			bool b2 = j + val <= 16000 && dpX[i][j + val];
			dpX[i + 1][j] = b1 || b2;
		}

	dpY[0][8000] = true;
	for (int i = 0, end = xy[1].size(); i < end; ++i)
		for (int j = 0; j <= 16000; ++j) {
			auto val = xy[1][i];
			bool b1 = j - val >= 0 && dpY[i][j - val];
			bool b2 = j + val <= 16000 && dpY[i][j + val];
			dpY[i + 1][j] = b1 || b2;
		}

	if (dpX[xy[0].size()][x + 8000] && dpY[xy[1].size()][y + 8000])
		std::cout << "Yes" << std::endl;
	else
		std::cout << "No" << std::endl;

	return 0;
}


Measured memory_bytes: 127232
n=int(input())
for x in range(1,n+1):
      i =x
      if(i%3==0):
          print(" {}".format(x),end="")
      else:
          while(i!=0):
             if(i%10==3):
                print(" {}".format(x),end="")
                break
             i=i//10
print()


Measured memory_bytes: 5872
#include<iostream>
#include<bits/stdc++.h>
#include<map>
//repetition
//----------
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n) FOR(i,0,n)
//----------

typedef long long ll;
using namespace std;

int main(){
  int n;
  cin>>n;
  vector<pair<int,int>> v;
  REP(i,n){
    int temp;
    cin>>temp;
    v.push_back(make_pair(temp,i));
  }
  sort(v.begin(),v.end());
  // REP(i,n){
  //   cout<<v[i].first<<endl;
  // }

  REP(i,n){
    int ans=0;
    if(v[n-1].second==i){
      ans=v[n-2].first;
    }else{
      ans=v[n-1].first;
    }
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 3312
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    ll N;
    cin >> N;
    for (ll a = 1; a <= 3500; a++) {
        for (ll b = 1; b <= 3500; b++) {
            ll n = N * a * b;
            ll d = 4 * a * b - N * (a + b);
            if (d == 0) continue;
            if ((n % d) == 0) {
                ll c = n / d;
                if (1 <= c && c <= 3500) {
                    cout << a << ' ' << b << ' ' << c << '\n';
                    return 0;
                }
            }
        }
    }
}


Measured memory_bytes: 3632
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int d = sc.nextInt();
        int x = sc.nextInt();

        for (int i = 0; i < 10; i++)
        {
            x = r * x - d;
            System.out.println(x);
        }
    }
}


Measured memory_bytes: 21844
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int i,five=0,seven=0;
    vector<int>v(3);
    for(i=0;i<3;i++){
        cin>>v[i];
        if(v[i]==5)
        five++;
        else if(v[i]==7)
        seven++;
    }
    if(five==2&&seven==1)
    cout<<"YES";
    else
    cout<<"NO";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3620
t[9999][9999],j;main(p,W,a,b,c){for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,t[0][W],j)){for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);j=c--)for(j=0;j<=W;j++)t[c-1][j]=j<a?t[c][j]:fmax(t[c][j],(t[c][j-a]+b));for(;t[0][++j]!=t[0][W];);}} 

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

int main() {
    LL n, k;
    cin >> n >> k;

    LL x = n/k;
    LL ans = x*x*x;

    if (k % 2 == 0) {
        LL y = (n+k/2)/k;
        ans += y*y*y;
    }

    cout << ans << endl;


    return 0;
}


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

public class P
{
    public int x { get; set; }
    public int y { get; set; }
    public int d { get; set; }
    public string via { get; set; }
    public int count { get; set; }
}

public class hello
{
    public static Dictionary<char, int> d0;
    public static Dictionary<int, string> d1;
    public static char[,] map;
    public static int h, w;
    public static int[] dx, dy;

    public static void Main()
    {
        d0 = new Dictionary<char, int>() { { 'R', 0 }, { 'D', 1 }, { 'L', 2 }, { 'U', 3 } };
        d1 = new Dictionary<int, string>() { { 0, "R" }, { 1, "D" }, { 2, "L" }, { 3, "U" } };
        dx = new int[] { 0, 1, 0, -1 };
        dy = new int[] { 1, 0, -1, 0 };
        string[] line = Console.ReadLine().Trim().Split(' ');
        h = int.Parse(line[0]);
        w = int.Parse(line[1]);
        map = new char[h, w];
        var sx = 0; var sy = 0; var sd = -1;
        var Lc = 0;
        for (int i = 0; i < h; i++)
        {
            var s = Console.ReadLine().Trim();
            for (int j = 0; j < w; j++)
            {
                if (s[j] != 'o' && s[j] != '.')
                {
                    sx = i;
                    sy = j;
                    sd = d0[s[j]];
                    map[i, j] = '.';
                }
                else
                {
                    map[i, j] = s[j];
                    if (s[j] == 'o') Lc++;
                }
            }
        }
        goDfs(sx, sy, sd, Lc, "");
    }
    static void goDfs(int x, int y, int d, int Lc, string via)
    {
        if (Lc == 0) { Console.WriteLine(via); return; }
        var tw = getLeaf(x, y, d);
        if (tw != -1)
        {
            map[x, y] = '.';
            if (d == 0 | d == 2) goDfs(x, tw, d, Lc - 1, via + d1[d]);
            else goDfs(tw, y, d, Lc - 1, via + d1[d]);
            map[x, y] = 'o';
        }
        var td2 = d + 1;
        if (td2 > 3) td2 -= 4;
        tw = getLeaf(x, y, td2);
        if (tw != -1)
        {
            map[x, y] = '.';
            if (td2 == 0 | td2 == 2) goDfs(x, tw, td2, Lc - 1, via + d1[td2]);
            else goDfs(tw, y, td2, Lc - 1, via + d1[td2]);
            map[x, y] = 'o';
        }
        var td3 = d - 1;
        if (td3 < 0) td3 += 4;
        tw = getLeaf(x, y, td3);
        if (tw != -1)
        {
            map[x, y] = '.';
            if (td3 == 0 | td3 == 2) goDfs(x, tw, td3, Lc - 1, via + d1[td3]);
            else goDfs(tw, y, td3, Lc - 1, via + d1[td3]);
            map[x, y] = 'o';
        }
    }
    static int getLeaf(int x, int y, int d)
    {
        while (true)
        {
            var nx = x + dx[d];
            var ny = y + dy[d];
            if (nx < 0 | nx >= h | ny < 0 | ny >= w) return -1;
            if (map[nx, ny] == 'o')
            {
                if (d == 0 | d == 2) return ny;
                else return nx;
            }
            x = nx;
            y = ny;
        }
    }
}



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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    string s; cin >> s;
    ll k; cin >> k;
    rep(i, s.size()) {
        if(s[i] != 'a' && k >= 'z'-s[i]+1) {
            k -= 'z'-s[i]+1;
            s[i] = 'a';
        }
    }
    if(k != 0) {
        s[s.size()-1] = 'a' + (s[s.size()-1]-'a'+k)%26;
    }
    cout << s << endl;
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 3716
'''     ░░█ ▄▀█ █   █▀ █░█ █▀█ █▀▀ █▀▀   █▀█ ▄▀█ █▀▄▀█  
        █▄█ █▀█ █   ▄█ █▀█ █▀▄ ██▄ ██▄   █▀▄ █▀█ █░▀░█     '''


# [temp1.py] => [29-07-2020 @ 10:25:10] 
# Author & Template by : Udit "luctivud" Gupta
# https://www.linkedin.com/in/udit-gupta-1b7863135/


import math;   from collections import *
import sys;    from functools import reduce
import time;   from itertools import groupby

# sys.setrecursionlimit(10**6)

def input()         : return sys.stdin.readline()
def get_ints()      : return map(int, input().strip().split())
def get_list()      : return list(get_ints())
def get_string()    : return list(input().strip().split())
def printxsp(*args) : return print(*args, end="")
def printsp(*args)  : return print(*args, end=" ")


DIRECTIONS = [(+0, +1), (+0, -1), (+1, +0), (+1, -1)] 
NEIGHBOURS = [(-1, -1), (-1, +0), (-1, +1), (+0, -1),\
              (+1, +1), (+1, +0), (+1, -1), (+0, +1)]


CAPS_ALPHABETS = {chr(i+ord('A')) : i for i in range(26)}
SMOL_ALPHABETS = {chr(i+ord('a')) : i for i in range(26)}
INF = float('inf')


# Custom input output is now piped through terminal commands.
# for _test_ in range(int(input())): 
s = input()
ans = temp = 0
target = "ATGC"
for i in s:
	if i in target:
		temp += 1
		ans = max(temp, ans)
	else:
		temp = 0
print(max(ans, temp))



# print("Time Elapsed: {}".format(float(S34p-S34t)))


Measured memory_bytes: 9388
import itertools
n = int(input())
f = [list(map(int,input().split())) for _ in range(n)]
p = [list(map(int,input().split())) for _ in range(n)]

a = list(range(10))
cnt = 0
total = 0
total_p = []
for i in range(1,11):
    c = list(itertools.combinations(a,i))
    
    for tap in c:
        for j in range(n):
            for num in tap:
                if f[j][num] == 1:
                    cnt += 1
                    
            total += p[j][cnt]
            cnt = 0
        
        total_p.append(total)
        total = 0

print(max(total_p))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAXN = 2e5+7;
//const int MAXN = 1e3+7;

int X[MAXN], Y[MAXN];
int idX[MAXN];

int p[MAXN], q[MAXN];
int bam[MAXN], dan[MAXN];
int n;

int durotto(int i, int j) {
    i = idX[i];
    j = idX[j];
    return abs(X[i]-X[j])+abs(Y[i]-Y[j]);
}

int counter;
map< int , LL >dp[2][MAXN];
LL solve(int l, int r, bool side, int mn, int mx) {
    auto it = dp[side][l].find(r);
    if (it != dp[side][l].end()) return it->second;

    vector< LL >options;
    if (l > 1 && (p[l-1]==mn-1||p[l-1]==mx+1)) {
        LL tmp = solve(bam[l-1], r, false, min(mn, p[bam[l-1]]), max(mx, p[bam[l-1]]));
        tmp += (side ? durotto(bam[l-1], r) : durotto(bam[l-1], l));
        options.push_back(tmp);
    }
    if (r < n && (p[r+1]==mn-1||p[r+1]==mx+1)) {
        LL tmp = solve(l, dan[r+1], true, min(mn, p[dan[r+1]]), max(mx, p[dan[r+1]]));
        tmp += (side ? durotto(r, dan[r+1]) : durotto(l, dan[r+1]));
        options.push_back(tmp);
    }
    LL ans = l-r;
    if (options.size() >= 1) {
        ans = options.front();
        if (options.size() >= 2) {
            ans = min(ans, options[1]);
        }
    }
    counter++;
    return dp[side][l][r] = ans;
}

LL ans[MAXN];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> n;

    vector< int >idY(n, 0);
    for (int i = 1; i <= n; i++) {
        cin >> X[i] >> Y[i];
        idX[i] = i;
        idY[i-1] = i;
    }

    sort(idX+1, idX+n+1, [&](int i, int j) {
        return X[i] < X[j];
    });
    sort(idY.begin(), idY.end(), [&](int i, int j) {
        return Y[i] < Y[j];
    });
    for (int i = 0; i < n; i++) {
        q[idY[i]] = i+1;
    }
    for (int i = 1; i <= n; i++) {
        p[i] = q[idX[i]];
    }

    bam[1] = 1;
    for (int i = 2; i <= n; i++) {
        bam[i] = i;
        if (abs(p[i]-p[i-1])==1) bam[i] = bam[i-1];
    }
    dan[n] = n;
    for (int i = n-1; i > 0; i--) {
        dan[i] = i;
        if (abs(p[i]-p[i+1])==1) dan[i] = dan[i+1];
    }

    for (int i = 1; i <= n; i++) {
        ans[idX[i]] = solve(i, i, false, p[i], p[i]);
    }

//    cout << "counter: " << counter << endl;
    for (int i = 1; i <= n; i++) {
        cout << ans[i] << "\n";
    }

    return 0;
}


Measured memory_bytes: 81944
def geti; gets.to_i end
def getis; gets.split.map &:to_i end
def getin n;  n.times.map{geti}  end
def getisn n; n.times.map{getis} end
YES = "YES"; NO = "NO"; Yes = "Yes"; No = "No";


puts (gets.sub(?\s,'').to_i**0.5)%1==0? "Yes" : "No"
__END__

a,b=getis
puts a*b%2==0? "Even" : "Odd"


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

ll a[112345];
int main(){
	int n; scanf("%d", &n);
	REP(i, n) scanf("%lld", a+i);
	sort(a, a+n);
	ll ans = 1;
	REP(i, n){
		if(a[i] > 1'000'000'000'000'000'000LL / ans){
			ans = -1;
			break;
		}
		ans *= a[i];
		if(ans == 0) break;
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 4604
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    //String blank = sc.nextLine();
    String t = sc.nextLine();
    String s1 = s;
    String s2 = null;
    boolean flag = false;

    for(int i = 0; i < s.length(); i++){
      s2 = s1.charAt(s1.length()-1) + s1.substring(0, s1.length()-1);
      if(s2.equals(t)){flag = true; break;}
      s1 = s2;
      s2 = null;
    }

    if(flag == true){System.out.println("Yes");}
    else{System.out.println("No");}

  }
}


Measured memory_bytes: 21460
#include <stdio.h>

int main(){

    int i,j,data[10000];
     i=1;
    
    while(1){
	  
	  scanf("%d",&data[i]);
      if (data[i]==0) break;
      ++i;
    }	  
     
       for (j=1;j<i;++j){
	 	printf("Case %d: %d\n",j,data[j]);
	  }
		
	return 0;
}

Measured memory_bytes: 636
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
#include<functional>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265358979

using namespace std;
typedef pair<int, int> P;

int main(void) {
	long long int n;
	long long int a, b, c;
	long long int count = 0;
	long long int p = 0;
	long long int h[100001];
	long long int low, middle, high;

	cin >> n;
	cin >> a >> b;

	c = a - b;
	low = 0;
	high = 1e9;

	FOR(i, 1, n) {
		cin >> h[i];
	}

	while (low +1< high) {
		count = 0;
		middle = (low + high) / 2;

		FOR(t, 1, n) {
			p = h[t] - middle*b;
			if (p > 0) {
				if (p % c == 0) {
					count += p / c;
				}
				else {
					count += (p / c) + 1;
				}
			}
		}

		//cout << count << endl;
		//cout << low << " " << middle << " " << high << endl;

		if (count <= middle) {
			high = middle;
		}
		else {
			low = middle;
		}
	}
	
	cout << high << endl;

	return 0;
}

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

int main() 
{
    int n;
    string s;
    cin >> n >> s;
    
    if (n % 2 == 1) {
        cout << "No" << endl;
        return 0;
    }
    int mid = n/2;
    if (s.substr(0,mid) == s.substr(mid,mid)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
num_contest = [0, 0, 0]
for p in P:
    if p <= A:
        num_contest[0] += 1
    elif p <= B:
        num_contest[1] += 1
    else:
        num_contest[2] += 1
print(min(num_contest))

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int x = a+b;
		int y = a-b;
		int z = a*b;
		int max = x;

		if (max < y) {
			max = y;
		}

		if (max < z) {
			max = z;
		}

		System.out.println(max);

		scan.close();

	}

}


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

using ll = long long;
// #define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))

bool IsPrime(int);

/***** MAIN *****/
signed main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  if(n % 2 != 0) {
    cout << "No\n";
    return 0;
  }
  REP(i, n/2) {
    if(s[i] != s[i+(n/2)]) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes";
  cout << "\n";
  return 0;
}
/***** MAIN *****/

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

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#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 mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>m;
  if(n*m%2==1) cout<<"Odd"<<endl;
  else cout<<"Even"<<endl;

}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 896
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
from bisect import bisect_left
from collections import defaultdict
import sys
def main(S, T):
    D = defaultdict(list)
    for i, s in enumerate(S):
        D[s].append(i + 1)
    cycle = 0
    idx = 0
    N = len(S)
    for t in T:
        if not D[t]:
            return -1
        i = bisect_left(D[t], idx + 1)
        if i >= len(D[t]):
            cycle += 1
            idx = D[t][0]
        else:
            idx = D[t][i]
    return cycle * N + idx

if __name__ == '__main__':
    input = sys.stdin.readline
    s = input().rstrip()
    t = input().rstrip()
    ans = main(s, t)
    print(ans)


Measured memory_bytes: 78560
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
typedef double lld;
#define mod 1000000007
#define mod2 998244353
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)
#define pb push_back
#define F first
#define S second
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
template <typename T, typename U>ostream &operator<<(ostream &out, const pair<T, U> &p){out << "(" << p.first << ", " << p.second << ")";return out;}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>void print(const ContainerType<ValueType, Args...> &c){for (const auto &v : c)cout << v << ' ';cout << '\n';} void print(){cout<<'\n';}
template <typename T, typename... Args>void print(T a, Args... args){cout << a << " ";print(args...);}
lli llipower(lli x, lli y, lli p = LLONG_MAX){lli res = 1;x = x % p;while (y > 0){if (y & 1)res = (res * x) % p;y = y >> 1;x = (x * x) % p;}return res;}

//8====================================D
int main(){
   lli n;
   cin>>n;
   lli ans=0;
   for(lli i=1;i<=n;i++){
       lli x=((i)*(n/i)*(1+(n/i)))/2;
       ans+=x;
   }
   cout<<ans<<endl;
}

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

int main()
{
  char a,c,t,g;
  a = 'A';
  c = 'C';
  t = 'T';
  g = 'G';

  char enter;
  cin >> enter;

  if(enter == 'A') cout << 'T' << endl;
  if(enter == 'T') cout << 'A' << endl;
  if(enter == 'C') cout << 'G' << endl;
  if(enter == 'G') cout << 'C' << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 200001
using namespace std;
int n,a[N];
long long ans;
int main(void){
	int i,maxx,x;scanf("%d",&n);
	for(i=1;i<=n;++i){
		scanf("%d",&x);
		if(i==1){maxx=x;continue;
		} 
		if(x>maxx)maxx=x;
		else ans+=maxx-x;
	}printf("%lld\n",ans);
	
	return 0;
}


Measured memory_bytes: 3836
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n;
    cin >> n;
    vector<pii> a;
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        a.pb(mp(x, i+1));
    }
    sort(all(a));
    for(int i = 0; i < n; i++) cout << a[i].s << " ";
}

Measured memory_bytes: 1780
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
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; }

int main(void){

    int X, Y;
    cin >> X >> Y;
    int ans=0;

    if(X <= 3) ans += (4-X)*100000;
    if(Y <= 3) ans += (4-Y)*100000;

    if(X == 1 && Y == 1) ans += 400000;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int h,m,s;
	int in[3],out[3],work[3];
	int i;
	
	for(i=0;i<3;i++){
		scanf("%d%d%d",&h,&m,&s);
		in[i]=h*60*60+m*60+s;
		
		scanf("%d%d%d",&h,&m,&s);
		out[i]=h*60*60+m*60+s;
		
		work[i]=out[i]-in[i];
	}
	for(i=0,h=0,m=0,s=0 ; i<3 ; i++,h=0,m=0,s=0){
		for(;work[i]!=0;){
			if(work[i]>=3600){
				work[i]-=3600;
				h++;
			}
			else if(work[i]>=60){
				work[i]-=60;
				m++;
			}
			else {
				s=work[i];
				work[i]-=s;
			}
		}
		printf("%d %d %d\n",h,m,s);
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void)
{
 int v,i,j,count=0,min,A[100],N;

 scanf("%d",&N);

 for(i=0;i<N;i++){
  scanf("%d",&A[i]);
 }

 for(i=0;i<N;i++){
  min=i;
  for(j=i;j<N;j++){
    if(A[j]<A[min]){
      min=j;
    }
  }
 if(i!=min){
   v=A[i];
   A[i]=A[min];
   A[min]=v;
   count++;
  }
 }

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

 return 0;

}

Measured memory_bytes: 1800
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define all(v) v.begin(),v.end()
#define pb push_back
#define rep(p,a,b) for(ll p=a ; p<b ; p++)
#define F first
#define S second
using namespace std;


int main()
{
    ll t,i,j,k,ans,n,x;

    //cin>>t;
    t=1;
    while(t--)
    {
        string s1="ABC",s;
        cin>>n>>s;
        s = s1+"#"+s;
        n = (ll)s.length();

        //cout<<s<<"\n";

        vector<ll> pi(n);
        ans=0;
        rep(p,1,n)
        {
            j = pi[p-1];
            //cout<<j<<"1\n";
            while(j>0 && s[j]!=s[p]){j = pi[j-1];}
            if(s[j]==s[p])j++;
            pi[p] = j;

            //cout<<pi[p]<<" ";
            if(pi[p]==3)ans++;
        }

        cout<<ans;
    }
    return 0;
}



Measured memory_bytes: 3544
#include<bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
 
#define ulli unsigned long long int
 
#define Pi 3.14159265358979323846264338327950288419716939937510
 
int main(){
   
    ios :: sync_with_stdio(false);
   
    //ifstream cin; ofstream cout; cin.open("input.txt"); cout.open("output.txt");
    
    int A[3][3];
    
    for(int i=0; i<3; i++){
    	
    	for(int j=0; j<3; j++){
    		
    		cin>>A[i][j];
		}
	}
	
	int n;
	
	cin>>n;
	
	while(n--){
		
		int b;
		
		cin>>b;
		
		for(int i=0; i<3; i++){
    	
    		for(int j=0; j<3; j++){
    			
    			if(A[i][j] == b){
    				
    				A[i][j] = 0;
				}
			}
		}
	}
	
    if(A[0][0] == 0 and A[0][1] == 0 and A[0][2] == 0){
    	
    	cout<<"Yes";
	}
	
    else if(A[1][0] == 0 and A[1][1] == 0 and A[1][2] == 0){
    	
    	cout<<"Yes";
	}
	
    else if(A[2][0] == 0 and A[2][1] == 0 and A[2][2] == 0){
    	
    	cout<<"Yes";
	}
	
    else if(A[0][0] == 0 and A[1][0] == 0 and A[2][0] == 0){
    	
    	cout<<"Yes";
	}
	
    else if(A[0][1] == 0 and A[1][1] == 0 and A[2][1] == 0){
    	
    	cout<<"Yes";
	}
	
    else if(A[0][2] == 0 and A[1][2] == 0 and A[2][2] == 0){
    	
    	cout<<"Yes";
	}
	
    else if(A[0][0] == 0 and A[1][1] == 0 and A[2][2] == 0){
    	
    	cout<<"Yes";
	}
	
    else if(A[2][0] == 0 and A[1][1] == 0 and A[0][2] == 0){
    	
    	cout<<"Yes";
	}
	
	else{
		
		cout<<"No";
	}
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int a,b; /* 数の箱*/
    char c, p; /* 文字の箱*/
    do{
        scanf("%d ",&a);
        scanf("%c",&c);/*文字は %c */
        scanf(" %d",&b);
        switch(c){ /* p128 */
        case '-':
            printf("%d\n",a-b);
            break;
        case '+':
            printf("%d\n",a+b);
            break;
        case '*':
            printf("%d\n",a*b);
            break;
        case '/':
            printf("%d\n",a/b);
            break;
        case '%':
            printf("%d\n",a%b);
            break;
        default: /*どれにも当てはまらない場合*/
            break;
        }
    }while(c!='?'); /*cが'？'になるまで繰り返す*/
    return 0;
}


Measured memory_bytes: 2748
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

AA = []
a = 0
for i in range(N):
	a += A[i]
	AA.append(a % M)
AA.append(0)
AA = sorted(AA)

L = []
x = AA[0]
c = 1
for i in range(1, N + 1):
	if AA[i] == x:
		c += 1
	else:
		L.append(c)
		c = 1
	x = AA[i]
L.append(c)

s = 0
for i in L:
	s += int(i * (i - 1) / 2)

print(s)

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b + c || b == a + c || c == a + b) {
        printf("Yes\n");
        return 0;
    }
    printf("No\n");
    return 0;
}


Measured memory_bytes: 256
import sys


def solve(n, k, aaa):
    MOD = 10 ** 9 + 7

    if n == k:
        ans = 1
        for a in aaa:
            ans = ans * a % MOD
        return ans

    pos = []  # Strictly, Non-neg
    neg = []
    for a in aaa:
        if a >= 0:
            pos.append(a)
        elif a < 0:
            neg.append(a)

    if len(pos) == 0:
        if k % 2 == 1:
            neg.sort(reverse=True)
        else:
            neg.sort()
        ans = 1
        for a in neg[:k]:
            ans = ans * a % MOD
        return ans

    pos.sort()
    neg.sort(reverse=True)
    ans = 1
    r = k

    if r % 2 == 1:
        ans = ans * pos.pop() % MOD
        r -= 1

    while r > 0:
        if len(pos) <= 1:
            ans = ans * neg.pop() * neg.pop() % MOD
        elif len(neg) <= 1:
            ans = ans * pos.pop() * pos.pop() % MOD
        else:
            pm = pos[-1] * pos[-2]
            nm = neg[-1] * neg[-2]
            if pm > nm:
                ans = ans * pos.pop() * pos.pop() % MOD
            else:
                ans = ans * neg.pop() * neg.pop() % MOD
        r -= 2

    return ans


n, k, *aaa = map(int, sys.stdin.buffer.read().split())
print(solve(n, k, aaa))


Measured memory_bytes: 27916
#define _CRT_SECURE_NO_WARNINGS
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <array>
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <utility>
#include <assert.h>
#include <regex>
#include <numeric>
#include <functional>
#include <iomanip>
using namespace std;

typedef unsigned long long ull;
typedef signed long long ll;
#define INF (1LL << 48)

struct PT { ll x; ll y; };
string to_s(ull x) { return to_string(x); }
string to_s(ll x) { return to_string(x); }
ll to_ll(const string& x) { return stoll(x); }
ull to_ull(const string& x) { return stoull(x); }




int main(int argc, char* argv[])
{
	cout << std::fixed << std::setprecision(10);

	for (;;) {
		string S;

		cin >> S;
		if (cin.fail()) break;

		char last = 0;
		bool bad = false;
		for (auto c : S) {
			if (c == last) bad = true;
			last = c;
		}

		cout << (bad ? "Bad" : "Good") << endl;
	}

	return 0;
}


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

using namespace std;

int main() {
	long long A;//<<10^15
	double B;//<10
	cin >> A >> B;
	long long C = 100 * B + 0.5;//10^3
	long long nAns = (long long)(A* C);//10^18
	nAns /= 100;//10^16
	//std::cout << nAns << endl; 
	printf("%llu\n", nAns);
	return 0;
}

Measured memory_bytes: 3732
def dfs(i, a, b, c):
    if i == N:
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a, b, c) > 0 else float('inf')
    mx = dfs(i+1, a, b, c)
    ma = dfs(i+1, a+l[i], b, c) + 10
    mb = dfs(i+1, a, b+l[i], c) + 10
    mc = dfs(i+1, a, b, c+l[i]) + 10
    return min(mx, ma, mb, mc)


N, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(N)]
print(dfs(0, 0, 0, 0))


Measured memory_bytes: 3188
N=int(input())
D=list(map(int,input().split()))

isOK=True
if D[0]!=0:
    isOK=False

for i in range(1,N):
    if D[i]==0:
        isOK=False
        break

cnt=[0]*(max(D)+1)
MOD=998244353
for i in range(N):
    cnt[D[i]]+=1

ans=1
for i in range(len(cnt)-1):
    
    for r in range(cnt[i+1]):
        ans=ans*cnt[i]%MOD
if isOK:
    print(ans)
else:
    print(0)

Measured memory_bytes: 20796
using System;

class Program
{
    public static void Main()
    {
        string w = Console.ReadLine();
        int cnt = 0;
        while (true)
        {
            string[] t = Console.ReadLine().Split(' ');
            if (t[0] == "END_OF_TEXT") break;
            foreach (var s in t) if (string.Compare(s, w, true) == 0) ++cnt;
        }
        Console.WriteLine(cnt);
    }
}


Measured memory_bytes: 18716
// A - 和風いろはちゃんイージー / Iroha and Haiku (ABC Edition)

#include <stdio.h>

int main(void) {
  int n[3], n5 = 0, n7 = 0;
  scanf("%d %d %d", &n[0], &n[1], &n[2]);
  for (int i = 0; i < 3; i++) {
    if (n[i] == 5) {
      n5++;
    } else if (n[i] == 7) {
      n7++;
    }
  }
  if((n5 == 2) && (n7 == 1)){
    printf("YES\n");
  }else{
    printf("NO\n");
  }
  //printf("%d %d ",n5,n7);
  return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define MAX_V 300001
#define INF 1000000000
#define mod 1000000007
using namespace std;

struct edge{int to;long cost;};
typedef pair<int,int> P;

int V;
vector<edge> G[MAX_V];
int d[MAX_V];
int dd[MAX_V];
void dijkstra(int s){
    priority_queue<P,vector<P>,greater<P> > que;
    fill(d,d+V+1,INF);
    d[s]=0;
    que.push(P(0,s));
    while(!que.empty()){
        P p=que.top(); que.pop();
        int v=p.second;
        if(d[v]<p.first) continue;
        for(int i=0;i<G[v].size();i++){
            edge e=G[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }
}

int main(){
    int n,m,v,u,s,t,ans=INF;
    scanf("%d %d",&n,&m);
    V=300000;
    for(int i=0;i<m;i++){
        scanf("%d %d",&u,&v);
        edge e;
        e.cost=1;
        e.to=v+100000;
        G[u].push_back(e);
        e.to=v+200000;
        G[u+100000].push_back(e);
        e.to=v;
        G[u+200000].push_back(e);
    }
    scanf("%d %d",&s,&t);
    dijkstra(s);
    for(int i=0;i<=n;i++){

    }
    if(d[t]<INF){
        printf("%d\n",d[t]/3);
    }
    else{
        printf("-1\n");
    }
}

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main(int argc, char const *argv[]) {
	int n;
	std::cin >> n;
	std::vector<string> str(n),cpy_str;
	for (size_t i = 0; i < n; i++) {
		std::cin >> str[i];
	}
	cpy_str = str;
	sort(cpy_str.begin(), cpy_str.end());

	for (size_t i = 1; i < str.size(); i++) {
		if (str[i-1][str[i-1].size()-1] != str[i][0]) {
			std::cout << "No" << '\n';
			return 0;
		}
	}

	for (size_t i = 1; i < cpy_str.size(); i++) {
		if (cpy_str[i-1] == cpy_str[i]) {
			std::cout << "No" << '\n';
			return 0;
		}
	}

	std::cout << "Yes" << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
  unsigned H, W, d;
  std::cin >> H >> W >> d;
  if (d % 2 == 1) {
    for (unsigned i = 0; i < H; ++i) {
      for (unsigned j = 0; j < W; ++j) {
        if ((i + j) % 2) { std::cout << "R"; }
        else { std::cout << "G"; }
      }
      std::cout << std::endl;
    }
  } else {
    std::string s = "RGBY";
    for (unsigned i = 0; i < H; ++i) {
      for (unsigned j = 0; j < W; ++j) {
        unsigned x = ((i + j) / d) % 2;
        unsigned y = ((i - j + W) / d) % 2;
        std::cout << s[x * 2 + y];
      }
      std::cout << std::endl;
    }
  }
  return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(&x[0], val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define e1 first
#define e2 second
#define newline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};

VI a;

int main()
{
    int n, k;
    cin>>n>>k;
    a.resize(n);

    REP(i,n) {
        cin>>a[i];
    }

    REP(i,k) {
        VI sum(n+1);
        REP(j,n) {
            //cout<<max((int)j-a[j], 0)<<" "<<min((int)j+a[j]+1, n)<<endl;
            sum[max((int)j-a[j], 0)]++;
            sum[min((int)j+a[j]+1, n)]--;
        }

        a[0] = sum[0];
        REP(j,n-1) {
            a[j+1] = a[j] + sum[j+1];
        }

        if (a[0] == n && a[n-1] == n) {
            break;
        }
    }

    REP(i,n) {
        cout<<a[i];
        if (i != n-1) cout<<" ";
    }
    newline;


    return 0;
}


Measured memory_bytes: 4840
from bisect import bisect_right
N = int(input())
L = sorted(list(map(int, input().split())))
L = [(l, i) for i, l in enumerate(L)]

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        l1_value, l1_index = L[i]
        l2_value, l2_index = L[j]
        ans += max(0, (bisect_right(L, (l1_value + l2_value, l2_index))) - j - 1)

print(ans)


Measured memory_bytes: 48308
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	int a,b,c;
	while(scanf("%d%d%d",&a,&b,&c)!=EOF)
	{
		if(a==b+c||b==a+c||c==a+b)
		printf("Yes\n");
		else
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi = 3.141592654;
void solve()
{
   ll n,cnt=0;
   cin>>n;
   for(ll i=2;n != 1;i*=2)
   {
       n=n/2;
       //cout<<n<<endl;
       cnt+=i;
   }
   cout<<++cnt<<endl;

}

int main()
{

    //freopen("Input.txt","r",stdin);
    ios_base :: sync_with_stdio(false);
    ll t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using V = vector<int>;
#define rep2(i, m, n) for (int i = (m); i < (n); ++i)
#define rep(i, n) rep2(i, 0, n)
#define all(a) (a).begin(), (a).end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }


int main() {
  int n, q; cin >> n >> q;
  V c(n); cin >> c;
  rep(i, n) --c[i];
  int B = sqrt(2*q); // number of buckets

  // input and sort queries
  using Query = array<int, 3>;
  vector<Query> query(q);
  rep(i, q) {
    int l, r; cin >> l >> r;
    --l;
    query[i] = {l, r, i};
  }
  sort(all(query), [&] (const Query &a, const Query &b) {
    if (a[0] / B != b[0] / B) return a[0] < b[0];
    else if (a[0] / B % 2 == 0) return a[1] < b[1];
    else return a[1] > b[1];
  });

  // edit here
  int sum = 0;
  int l = 0, r = 0;
  V cnt(n), ans(q);

  auto add = [&] (int i) {
    if (cnt[c[i]] == 0) ++sum;
    ++cnt[c[i]];
  };
  auto del = [&] (int i) {
    --cnt[c[i]];
    if (cnt[c[i]] == 0) --sum;
  };
  // 

  // O(n \sqrt{q})
  for(const auto [li, ri, i] : query) {
    while (li < l) add(--l);
    while (ri < r) del(--r);
    while (r < ri) add(r++);
    while (l < li) del(l++);
    ans[i] = sum;
  }

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


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

const string YES = "Yes";
const string NO = "No";

void solve(long long a, long long b, long long c, long long d){
    if ((abs(a - b) <= d && abs(b - c) <= d) || abs(a - c) <= d) cout << YES << '\n';
    else cout << NO << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    long long c;
    scanf("%lld",&c);
    long long d;
    scanf("%lld",&d);
    solve(a, b, c, d);
    return 0;
}


Measured memory_bytes: 256
def xgcd(a, b)
  y = 0; q=v=w=x = 1
  while b > 0
    v -= q*x; w -= q*y
    q,a = a.divmod b
    a,x,y,b,v,w = b,v,w,a,x,y
  end
  [a,x,y]
end
N,A,B = gets.split.map &:to_i
n,s,P = 1,2,10**9+7
30.times {|i| n*=s and n%=P if N[i]>0; s*=s; s%=P}
a,b = [A,B].map{|r| N < r+r ? N-r : r}.sort
s=t=u = 1
F =->(x,y){ x.upto(y){|i| t*=N+1-i; u*=i; t%=P; u%=P}; s += t*xgcd(u,P)[1]%P }
F[1,a]; F[a+1,b]
p (n<s ? P+n-s : n-s) % P

Measured memory_bytes: 1788
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f,g,h,i;
int main(){
    cin>>a>>b>>e; 
    c=3*e-a-b; 
    h=2*e-b;
    f=2*a-h;
    i=3*e-c-f;
    d=2*e-f;
    g=3*e-h-i;
    cout<<a<<" "<<b<<" "<<c<<endl<<d<<" "<<e<<" "<<f<<" "<<endl<<g<<" "<<h<<" "<<i<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
from collections import Counter

N = int(input())
s = Counter(list(map(int, sys.stdin.readline().rsplit())))

# すべて同じ値かつ0である
if len(s) == 1 and 0 in s:
    print("Yes")
# 2種類の値かつ(a, a, 0)という組み合わせ(aは任意)
elif len(s) == 2 and s[0] == N // 3:
    print("Yes")
# すべて異なる値
elif len(s) == 3:
    res = 0
    num = set()
    # 3種類のXORを計算(res), それぞれの数をpush
    for k, v in s.items():
        res ^= k
        num.add(v)
    # res = a1 ^ a2 ^ a3 = 0 かつそれぞれの数が同じ(= 3 // N) -> Yes
    if not res and len(num) == 1:
        print("Yes")
    else:
        print("No")
# 3種類より多い場合は成立しない
else:
    print("No")


Measured memory_bytes: 14468
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, N);
  vi t(N), x(N), y(N);
  rep(i, 0, N) {
    in(t[i], x[i], y[i]);
  }
  int nt = 0, nx = 0, ny = 0;
  rep(i, 0, N) {
    int d = abs(nx - x[i]) + abs(ny - y[i]);
    int dt = t[i] - nt;
    if (d > dt || (dt - d) % 2) {
      print("No");
      return;
    }
    nx = x[i];
    ny = y[i];
    nt = t[i];
  }
  print("Yes");
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using namespace std;

signed main(){
    string s;
    cin>>s;
    string w="WA";
    if(s[0]!='A')cout<<w<<endl;
    else{
        int c=0;
        Rep(i,1,s.length()){
            if(i>1&&i<s.length()-1&&s[i]=='C')c++;
            else if('A'<=s[i]&&s[i]<='Z'){
                cout<<w<<endl;
                return 0;
            }
        }
    cout<<((c==1)?"AC":w)<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void){
    string s;
    cin >> s;
    int cnt[3] = {0};
    for (int i = 0; i < s.length(); i++)
    {
        if(s[i] == 'a'){
            cnt[0]++;
        }else if(s[i] == 'b'){
            cnt[1]++;
        }else if(s[i] == 'c'){
            cnt[2]++;
        }
    }
    
    if(cnt[0] == 1 && cnt[1] == 1 && cnt[2] == 1){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

Measured memory_bytes: 256
w = sorted(list(input()))
isBeautiful = 'Yes'
stringMap = {}

for string in w:
    if string in stringMap:
        stringMap[string] += 1
    else:
        stringMap[string] = 1

for string in stringMap:
    if stringMap[string]%2 != 0:
        isBeautiful = 'No'
        break

print(isBeautiful)

Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;

int main() {
	int n,m=1;
	int push = -1;
	cin >> n;

	vector<int> btn(n+1, 0);
	for (int i = 0; i < n; i++) cin >> btn.at(i+1);
	for (int i = 0; i < n; i++)
	{
		m = btn.at(m);
		if (m == 2)
		{
			push = i + 1;
			break;
		}
	}
		cout << push << endl;

}

Measured memory_bytes: 3796