akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>
#include <locale>
#include <random>
#include <type_traits>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

using LL = long long;

//~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~

int main() {

    int N;
    cin >> N;


    int ans = 0;

    for (int i = 1; i <= N; i++) {
        if (i % 2 == 1) {
            int count = 0;
            for (int j = 1; j <= i; j++) {
                if(i % j == 0){
                    count++;
                }
            }
            if(count == 8){
                ans++;
            }
        }
    }

    cout << ans << endl;

}

































Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;


void main() {
    char x, y;
    scan(x, y);

    char ans;

    if (x < y) {
        ans = '<';
    }
    else if (x > y) {
        ans = '>';
    }
    else {
        ans = '=';
    }

    writeln(ans);
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



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

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.Exception;
import java.lang.Integer;
import java.lang.System;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] a){
        try {
            BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
            int n = Integer.parseInt(r.readLine());
            StringTokenizer st;

            int side[] = new int[3];
            for(int i = 0; i < n; i++) {
                st = new StringTokenizer(r.readLine());
                for(int j = 0; j < 3; j++) {
                    side[j] = Integer.parseInt(st.nextToken());
                }
                Arrays.sort(side);
                if((side[0]*side[0] + side[1]*side[1]) == side[2]*side[2]) {
                    System.out.println("YES");
                } else {
                    System.out.println("NO");
                }
            }
        } catch (Exception ex) {
            System.exit(0);
        }
    }
}

Measured memory_bytes: 18432
n,t = gets.split.map(&:to_i)
a =[]
b = []
for i in 0..n - 1
a[i] = gets.split.map(&:to_i)
if a[i][1] <= t
    b << a[i][0]
end
end
if b == []
    puts "TLE"
else
    puts b.sort[0]
end

Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //ATTENTION: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/
int a,b,c;
/**********************************/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b >> c;

    cout << min(a+b,min(a+c,b+c)) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,c;
  cin>>n>>c;
  vvll ta(c,vll(100001));
  rep(i,n){
    ll s,t,h;
    cin>>s>>t>>h;
    h--;
    for(int i=s;i<=t;i++){
      ta[h][i]++;
    }
  }
  ll ans=0;
  for(int i=0;i<100001;i++){
    ll cu=0;
    rep(j,c){
      if(ta[j][i]) cu++;
    }
    ans=max(ans,cu);
  }
  COUT(ans);
}


Measured memory_bytes: 24576
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
#define min(x,y) (x < y ? x : y)
#define max(x,y) (x < y ? y : x)
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

vector<vector<ll>> make_next(const string& S) {
  const ll n = S.size();
  vector<vector<ll>> res(n+1, vector<ll>(26, n+1));
  rep(i, n) {
    res[i][S[i]-'a'] = i+1;
  }
  rrep(i, n) rep(j, 26) {
    chmin(res[i][j], res[i+1][j]);
  }
  return res;
}

void solve() {
  string S, T; cin >> S >> T;
  const ll n = S.size(), m = T.size();
  vector<vector<ll>> sn = make_next(S), tn = make_next(T);
  vector<vector<bool>> m1(n+1, vector<bool>(m+1, false));
  vector<vector<ll>> m2(n+1, vector<ll>(m+1));
  function<ll(ll, ll)> dp = [&](ll i, ll j) {
    if (m1[i][j]) return m2[i][j];
    ll res = 0;
    rep(c, 26) {
      assert(sn[i][c] > i && tn[j][c] > j);
      if (sn[i][c] <= n && tn[j][c] <= m) {
        chmax(res, dp(sn[i][c], tn[j][c])+1);
      }
    }
    return m1[i][j] = true, m2[i][j] = res;
  };
  ll len = dp(0, 0), i = 0, j = 0;
  string ans = "";
  while (len > 0) {
    rep(c, 26) {
      if (sn[i][c] <= n && tn[j][c] <= m && dp(sn[i][c], tn[j][c]) == len-1) {
        --len;
        i = sn[i][c];
        j = tn[j][c];
        ans += char('a'+c);
        break;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 73856
import scala.io.StdIn.{readInt, readLine}
object Main {
    def main(args: Array[String]): Unit = {
        val len = readInt
        val arr = new Array[Card](len).map { a => 
            val line = readLine.split(" ")
            Card(line(0), line(1).toInt)
        }
        val arr2 = new Array[Card](len)
        arr.copyToArray(arr2)
        quickSort(arr)
        mergeSort(arr2)
        val q = arr.mkString("\n")
        val m = arr2.mkString("\n")
        if (q == m) println("Stable") else println("Not stable")
        println(q)
    }
    def quickSort(arr: Array[Card]): Unit = {
        def go(left: Int, right: Int): Unit = {
            if (left < right) {
                val (pivot, oneKind) = partition(arr, left, right)
                if (!oneKind) {
                    go(left, pivot - 1)
                    go(pivot + 1, right)
                }
            }
        }
        go(0, arr.length - 1)
    }
    def partition(arr: Array[Card], left: Int, right: Int): (Int, Boolean) = {
        val pivot = arr(right)
        def go(sep: Int, seek: Int, oneKind: Boolean): (Int, Boolean) = seek match {
            case s if s <= right => arr(seek) match {
                case e if e > pivot => go(sep, seek + 1, false)
                case e if e < pivot => {
                    swap(arr, sep + 1, seek)
                    go(sep + 1, seek + 1, false)
                }
                case e => {
                    swap(arr, sep + 1, seek)
                    go(sep + 1, seek + 1, oneKind)
                }
            }
            case s => (sep, oneKind)
        }
        go(left - 1, left, true)
    }
    def mergeSort(arr: Array[Card]): Unit = {
        def go(left: Int, right: Int): Unit = {
            if (left < right) {
                val mid = (left + right) / 2
                go(left, mid)
                go(mid + 1, right)
                merge(left, mid, right)
            }
        }
        def merge(left: Int, mid: Int, right: Int): Unit = {
            val tmp = arr.slice(left, mid + 1)
            var leftPtr = 0
            var rightPtr = mid + 1
            for (i <- (left to right)) {
                if (leftPtr >= tmp.length) {
                    rightPtr += 1
                } else if (rightPtr > right || tmp(leftPtr) <= arr(rightPtr)) {
                    arr(i) = tmp(leftPtr)
                    leftPtr += 1
                } else {
                    arr(i) = arr(rightPtr)
                    rightPtr += 1
                }
            }
        }
        go(0, arr.length - 1)
    } 

    def swap(arr: Array[Card], a: Int, b: Int): Unit = {
        val tmp = arr(a)
        arr(a) = arr(b)
        arr(b) = tmp
    }
}
case class Card(symbol: String, num: Int) {
    override def toString(): String = symbol + " " + num
    def <(a: Card): Boolean = this.num < a.num
    def <=(a: Card): Boolean = this.num <= a.num
    def >(a: Card): Boolean =  this.num > a.num
    def >=(a: Card): Boolean =  this.num >= a.num
}


Measured memory_bytes: 161092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);
static const int MAX = 101;
int main(){
    int n; sc(n)
    vector<int> x(n), y(n), h(n);
    for (int i = 0; i < n; i++){
        sc(x[i]) sc(y[i]) sc(h[i])
    }
    int H, tmp;
    bool check;
    for (int i = 0; i < MAX; i++){
        for (int j = 0; j < MAX; j++){
            check = true; H = 0;
            for (int k = 0; k < n; k++){
                if (h[k] != 0) H = h[k] + abs(i - x[k]) + abs(j - y[k]);
            }
            for (int k = 0; k < n; k++){
                tmp = h[k] + abs(i - x[k]) + abs(j - y[k]);
                if (h[k] == 0 && tmp < H) check = false;
                if (h[k] != 0 && tmp != H) check = false;
                if (!check) break;
            }
            if (H != 0 && check){
                cout << i << " " << j << " " << H << endl;
                break;
            }
        }
        if (H != 0 && check) break;
    }
    return 0;
}

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

namespace AtCoder
{
	public class ABC
	{
		static public void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
			Solve(args);
			Console.Out.Flush();
		}

		const int mod = 1000000007;  // 10^9+7
		static int Mod(long x, int m) { return (int)((x % m + m) % m); }
		static long Mod(long x, long m) { return (x % m + m) % m; }

		static public void Solve(string[] args)
		{
			//string s = Console.ReadLine();
			//int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();

			int n = int.Parse(Console.ReadLine());
			int[] a = Console.ReadLine().Split().Select(int.Parse).OrderBy(p => p).ToArray();

			int[] list = new int[1000001];
			for (int i = 0; i < n; i++) {
				list[a[i]]++;
			}

			//System.Diagnostics.Debug.WriteLine(string.Join(" ", list));
			for (int i = 1; i < list.Length; i++) {
				if (list[i] > 0) {
					int j = i * 2;
					while (j < list.Length) {
						list[j] = -1;
						j += i;
					}
				}
			}

			//System.Diagnostics.Debug.WriteLine(string.Join(" ", list));
			int ans = 0;
			for (int i = 1; i < list.Length; i++) {
				if (list[i] == 1) {
					ans++;
				}
			}
			Console.WriteLine(ans);

		}
	}
}


Measured memory_bytes: 49624
#include<bits/stdc++.h>
using namespace std;
int n,f[100005][3];
int main()
{
	scanf("%d",&n);
	scanf("%d%d%d",&f[1][0],&f[1][1],&f[1][2]);
	for(int i=2;i<=n;i++)
	{
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		f[i][0]=max(f[i-1][1],f[i-1][2])+a;
		f[i][1]=max(f[i-1][0],f[i-1][2])+b;
		f[i][2]=max(f[i-1][0],f[i-1][1])+c;
	}
	printf("%d",max(max(f[n][0],f[n][1]),f[n][2]));
}


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

namespace AOZ
{
	class MainClass
	{
		static void Main(string[] args)
		{
			var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			if (input.Count() != 3)
				return;
			if (input[0] < input[1] && input[1] < input[2]) { Console.WriteLine("Yes"); return; }
			else { Console.WriteLine("No"); return; }
		}
	}
}



Measured memory_bytes: 18340
import sys
input = sys.stdin.readline
H, W = map(int, input().split())

ans = 10**10
S = [0,0,0]
for h in range(H) :
    S[0] = h*W
    S[1] = (H-h)*(W//2)
    S[2] = (H-h)*((W+1)//2)
    ans = min(ans, max(S)-min(S))

for h in range(H) :
    S[0] = h*W
    S[1] = ((H-h)//2)*W
    S[2] = ((H-h+1)//2)*W
    ans = min(ans, max(S)-min(S))

for w in range(W) :
    S[0] = w*H
    S[1] = (W-w)*(H//2)
    S[2] = (W-w)*((H+1)//2)
    ans = min(ans, max(S)-min(S))

for w in range(W) :
    S[0] = w*H
    S[1] = ((W-w)//2)*H
    S[2] = ((W-w+1)//2)*H
    ans = min(ans, max(S)-min(S))

print(ans)


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

typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++) // no semicoron
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>0;i--)
#define FORD(i,a,b) for(ll i=(a);i>(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく

using namespace std;

int main(){
    string S;
    cin >> S;
    ll N = S.length();

    //cout << "N: " << N << endl;

    //string revS = reverse(ALL(S));

    string revS;

    bool judge = false;

    FOR(i, 0, N/4 + 1){
        //cout << i << endl;
        if(S[i] == S[N-1-i]){
            //cout << "pass1" << endl;
            if(S[i] == S[(N-1)/2 - 1 - i]){
                //cout << "pass2" << endl;
                if(S[(N+3)/2 - 1 + i] == S[N-1 - i]){
                    //cout << "pass3" << endl;
                    if(i == N/4) judge = true;
                }else break;
            }else break;
            
        }else break;
        //if
        
    }
    if(judge) cout << "Yes" << endl;
    else cout << "No" << endl;

}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define forabr(i, a, b) for(int i = int(b)-1; i >= int(a); i--)
#define all(X) X.begin(), X.end()

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

const ll MOD = 1e9 + 7;
const int N = 1e6 + 1;
ll f[N], r[N];

ll bp(ll a, ll n) {
    ll res = 1;
    while (n) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}


ll inv(ll x) {
    return bp(x, MOD - 2);
}

void precalc() {
    f[0] = 1;
    forab(i, 1, N) f[i] = (i * 1ll * f[i - 1]) % MOD;
    r[N - 1] = inv(f[N - 1]);
    for (int i = N - 1; i >= 1; i--) r[i - 1] = (r[i] * 1ll * i) % MOD;
    r[0] = 1;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(20);
    precalc();
    int x, y;
    cin >> x >> y;
    ll ans = 0;
    forn(t, x + 1) {
        if (x - t < 0 || y - 2 * t < 0) break;
        if ((x - t) % 2 != 0 || (x - t) / 2 != y - 2 * t) continue;
        int s = y - 2 * t;
        ll cur = (r[s] * r[t]) % MOD;
        cur = (cur * f[s + t]) % MOD;
        ans = (ans + cur) % MOD;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 15872
n = int(input())
s = input()
t = list(s)

s1 = []
s2 = []

for i in range(n):
  s1.append([])
  s2.append([])

for i in range(n):
  for j in range(n):
    if j < i:
      s1[i].append(t[j])
    else:
      s2[i].append(t[j])

count = 0
com = []
slv = []
      
for i in range(n):
  for j in range(i):
    if s1[i][j] in s2[i] and s1[i][j] not in com:
      count += 1
      com.append(s1[i][j])
  slv.append(count)
  count = 0
  com = []
  
print(max(slv))
      
    


Measured memory_bytes: 3064
N, W, H = map(int, input().split())
row, col = [0] * (H + 1), [0] * (W + 1)
for _ in range(N):
    x, y, w = map(int, input().split())
    row[max(0, y - w)] += 1
    row[min(H, y + w)] -= 1
    col[max(0, x - w)] += 1
    col[min(W, x + w)] -= 1
for i in range(H):
    row[i + 1] += row[i]
    if not row[i]:
        break
else:
    print("Yes")
    quit()
for i in range(W):
    col[i + 1] += col[i]
    if not col[i]:
        break
else:
    print("Yes")
    quit()
print("No")

Measured memory_bytes: 15168
#include <iostream>
#include <vector>
#include <utility>
using namespace std;

int d[110][110] = {};
int n, m, inf = 1e9 + 7, a[1010], b[1010], c[1010], ans;
bool used[1010];

void warshall_floyd(int n)
{
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            for (int k = 0; k < n; k++)
            {
                d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
            }
        }
    }
}

int main()
{
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            d[i][j] = (i == j ? 0 : inf);
        }
    }
    for (int i = 0; i < m; i++)
    {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--, b[i]--;
        d[a[i]][b[i]] = c[i];
        d[b[i]][a[i]] = c[i];
    }
    warshall_floyd(n);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (i == j)
                continue;
            for (int k = 0; k < m; k++)
            {
                if (d[i][a[k]] + c[k] + d[b[k]][j] == d[i][j] || d[i][b[k]] + c[k] + d[a[k]][j] == d[i][j])
                    used[k] = true;
            }
        }
    }
    for (int i = 0; i < m; i++)
        ans += !used[i];
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

signed main() {
	string s;
	cin >> s;
	string s2(s);
	reverse(ALL(s2));

	int ans = 0;
	REP(i, s.size()) {
		if (s[i] != s2[i]) {
			ans++;
		}
	}
	col(ans/2 + ans%2);
	return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
const ull MOD = 1000000007;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
ll digitPoor(ll n)
{
    assert(INT_MAX == 2147483647);
    assert(n >= 0);

    if (n < 10)         return 1;
    if (n < 100)        return 2;
    if (n < 1000)       return 3;
    if (n < 10000)      return 4;
    if (n < 100000)     return 5;
    if (n < 1000000)    return 6;
    if (n < 10000000)   return 7;
    if (n < 100000000)  return 8;
    if (n < 1000000000) return 9;
    return 10;
}
struct p{
  ll x;
  bool b;
};
int main(){
    ll N;
    cin>>N;
    unordered_map<string,ll> m;
    m["AC"]=0;
    m["WA"]=0;
    m["TLE"]=0;
    m["RE"]=0;
    REP(i,N){
        string t;
        cin >> t;
        m[t]++;
    }
    
    cout<<"AC"<<" x "<<m["AC"]<<endl;
    cout<<"WA"<<" x "<<m["WA"]<<endl;
    cout<<"TLE"<<" x "<<m["TLE"]<<endl;
    cout<<"RE"<<" x "<<m["RE"]<<endl;
    
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  int X[M];
  for (int i{}; i < M; ++i) {
    cin >> X[i];
  }
  sort(X, X+M);
  int D[M-1];
  for (int i{}; i < M-1; ++i) {
    D[i] = X[i+1] - X[i];
  }
  sort(D, D+M-1, greater<int>());

  long ans{};
  for (int i{N-1}; i < M-1; ++i) {
    ans += D[i];
  }

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


Measured memory_bytes: 1024
/*
NAME:
 ___   _      _   ___  
/ __| /_\    /_\ |   \ 
\__ \/ _ \  / _ \| |) |
|___/_/ \_\/_/ \_\___/ 

lang: 
  ___   _      _   
 / __)_| |_  _| |_ 
( (__(_   _)(_   _)
 \___) |_|    |_|  

*/
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>
 
using namespace std;
 
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()

typedef long long ll;
typedef long l;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<l> vl;
typedef vector<ll> vll;

const int INF = 1 << 29;
const int MOD = 1e9 + 7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }
 
void solve(){
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	if(a==0) cout<<1<<endl;
	if(b==0) cout<<2<<endl;
	if(c==0) cout<<3<<endl;
	if(d==0) cout<<4<<endl;
	if(e==0) cout<<5<<endl;
}

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

	solve();

	return 0;
}

Measured memory_bytes: 3168
def splitter(type,input):
    return list(map(lambda x:type(x),input.split()))

s1 = splitter(int,input())
N = s1[0]
K = s1[1]
Q = s1[2]

ar = [0] * N
for i in range(Q):
    ar[int(input())-1] += 1
for j in range(N):
    if K-Q+ar[j] <= 0:
        print("No")
    else:
        print("Yes")



Measured memory_bytes: 4680
a,b,c,x,y = (int(i) for i in input().split())
if a+b > c*2:
  if x > y:
    print(c*min(x,y)*2 + (x-y) * min(a, c*2))
  else:
    print(c*min(x,y)*2 + (y-x) * min(b, c*2))
else:
  print(a*x + b*y)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
ll MOD = 1e9 + 7;

int main() {
	vector<int>x(2), y(2);
	rep(i,2) {
		cin >> x[i] >> y[i];
	}
	int a = x[1] - (y[1] - y[0]);
	int b = y[1] + (x[1] - x[0]);
	int c = x[0] - (y[1] - y[0]);
	int d = y[0] + (x[1] - x[0]);
	printf("%d %d %d %d\n", a, b, c, d);
}

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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var K = int.Parse(Console.ReadLine());
            Console.WriteLine(new int[] { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 }[K - 1]);
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
#include<memory>
using namespace std;
using ll=long long;

int main(){
    int m,d;
    cin>>m>>d;
    int res=0;
    for(int i=1;i<=m;i++){
        for(int j=1;j<=d;j++){
            int d1=j%10;
            int d10=j/10;
            if(d1>=2 && d10>=2 && d1*d10==i){
                res++;
            }
        }
    }
    cout<<res<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>

#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)

typedef long long int lli;

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<lli> v(N);
    vector<lli> pos(N);
    set<int> s;
    REP (i, 0, N) {
        cin >> v[i];
        pos[v[i] - 1] = i + 1;
    }
    lli ans = 0;
    for (int i = 0; i < N; i++) {
        int p = pos[i];
        auto pre = s.lower_bound(p);
        auto post = pre;
        lli vpre = 0;
        if (pre != s.begin()) {
            pre--;
            vpre = *pre;
        }
        lli vpost = N + 1;
        if (post != s.end()) vpost = *post;
        ans += ((vpost - p) * (p - vpre) * (i + 1));
        s.insert(p);
    }
    cout << ans << endl;
    return 0;
}


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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 998244353;
const ll INF = (ll)1e15;

struct Combination
{
    void init(ll n)
    {
        mNumTbl.resize(n + 1);
        mInverseNumTbl.resize(n + 1);
        mNumTbl[0] = 1;
        mInverseNumTbl[0] = 1;
        FOR(i, n + 1, 1)
        {
            mNumTbl[i] = (mNumTbl[i - 1] * i) % MOD;
        }
        FOR(i, n + 1, 1)
        {
            mInverseNumTbl[i] = modpow(mNumTbl[i]);
        }
    }

    ll get(ll n, ll r)
    {
        if (n < r || n < 0)
            return 0;
        return (((mNumTbl[n] * mInverseNumTbl[r]) % MOD) * mInverseNumTbl[n - r]) % MOD;
    }

    //! バイナリ方で累乗を計算
    ll modpow(ll n)
    {
        ll s = 1, p = n;
        for (ll i = 0; (1LL << i) <= MOD - 2; ++i, p = (p * p) % MOD)
        {
            if (((MOD - 2) & (1 << i)) == 0)
                continue;
            s *= p;
            s %= MOD;
        }
        return s;
    }

    vector<ll> mInverseNumTbl;
    vector<ll> mNumTbl;
};

int main()
{
    ll N, A, B, K;
    cin >> N >> A >> B >> K;
    ll ans = 0;
    Combination cmb;
    cmb.init(N + 5);
    REP(i, N + 1)
    {
        ll a = A * i;
        ll t = K - a;
        if (t < 0)
            break;
        if (t % B != 0)
            continue;
        ll j = t / B;
        if (j > N)
            continue;
        ans += (cmb.get(N, i) * cmb.get(N, j)) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	int n;
	cin >> n;
	int c = 0;
	bool ok = false;
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		if (x == y) {
			c++;
		}
		else {
			c = 0;
		}
		if (c == 3) {
			ok = true;
		}
	}
	if(ok) 
		cout << "Yes";
	else
		cout << "No";
}

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

using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  if((a+b)%3==0){
    cout << "Possible" << endl;
  }
  else if(a%3==0||b%3==0){
    cout << "Possible" << endl;
  }
  else{
    cout << "Impossible" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int main(){
  int N;
  while(cin >> N && N){
    const int H = 5010;
    const int W = 5;
    bool block[H][W] = {};
    int height[W] = {};
    int n_h = 0;
    REP(iter, N){
      int d, l, bx;
      cin >> d >> l >> bx;
      bx --;
      if(d == 1){
        // yoko
        int h = 0;
        for(int x = bx; x < bx + l; x++) h = max(h, height[x]);
        for(int x = bx; x < bx + l; x++) block[h][x] = true;
        bool line = true;
        for(int x = 0; x < W; x++) if(!block[h][x]) line = false;
        if(line){
          for(int x = 0; x < W; x++) block[h][x] = false;
        }
      }else if(d == 2){
        // tate
        for(int y = height[bx]; y < height[bx] + l; y++)
          block[y][bx] = true;
        for(int y = height[bx]; y < height[bx] + l; y++){
          bool line = true;
          for(int x = 0; x < W; x++) if(!block[y][x]) line = false;
          if(!line) continue;
          for(int x = 0; x < W; x++) block[y][x] = false;
        }
      }
      bool new_block[H][W] = {};
      int new_height[W] = {};
      int new_nh = 0;
      int curr = 0;
      /*
      for(int y = n_h + 5; y >= 0; y--){
        debug(block[y], block[y] + 5);
      }
      cout << endl;
      */
      for(int y = 0; y < n_h + 5; y++){
        bool clear = true;
        for(int x = 0; x < W; x++) if(block[y][x]) clear = false;
        if(clear) continue;
        for(int x = 0; x < W; x++)if(block[y][x]){
          new_block[curr][x] = true;
          new_height[x] = curr + 1;
        }
        new_nh = ++curr;
      }
      memcpy(block, new_block, sizeof(block));
      memcpy(height, new_height, sizeof(height));
      n_h = new_nh;
    }
    int ans = 0;
    REP(y, H)REP(x, W) ans += block[y][x];
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

char upper(char c){
	return c-0x20;
}

char lower(char c){
	return c+0x20;
}

void unique_vector(vector<int>& v){
	sort(all(v));
	v.erase(unique(all(v)), v.end());
}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    int n;cin >> n;
    vector<int> v(3*n);
    rep(i,3*n)cin>>v[i];
    sort(all(v));
    ll ans = 0;
    rep(i,n){
        ans += v[n + i*2];
    }
    cout << ans << endl;
}



Measured memory_bytes: 1536
Ope = [:+, :-, :*]
def tos(fo, op, la)
  return "(#{fo} #{op} #{la})"
end
while (arg = gets.split(" ").map(&:to_i)) != [0,0,0,0]
  result = []
  arg.permutation(4){|a, b, c, d|
    for i in Ope
      for j in Ope
        for k in Ope
          if a.send(i, b.send(j, c.send(k, d))) == 10
            result << tos(a, i, tos(b, j, tos(c, k, d)))
          end
          if a.send(i, b).send(j, c.send(k, d)) == 10
            result << tos(tos(a, i, b), j, tos(c, k, d))
          end
          if a.send(i, b.send(j, c)).send(k, d) == 10
            result << tos(tos(a, i, tos(b, j, c)), k, d)
          end
        end
      end
    end
  }
  if result.length != 0
    puts result[0]
  else
    puts 0
  end
end

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

int main(){
    string s,t;
    cin>>s>>t;
    if(s==t){
        cout<<"No"<<endl;
        return 0;
    }
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    reverse(t.begin(),t.end());
    vector<string>u(2);
    u[0]=s;
    u[1]=t;
    sort(u.begin(),u.end());
    if(u[0]==s)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

int main() {
  long long N, A, B;
  cin >> N;

  for (long long i = 1LL; i * i <= N; ++i) if (N % i == 0) A = i;

  int count = 0;
  B = N / A;
  while (B > 0) {
    B /= 10;
    count++;
  }
  cout << count << endl;
}


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

int main() {
  char C ;
  cin >> C;
 string S = "abcdefghijklmnopqrstuvwxyz";
  
  for ( int i = 0; i < 26; i++){
    if ( S.at(i) == C ) {
      cout << S.at(i + 1 ) << endl;
    }
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  int zero = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    zero += (a[i] == 0);
  }
  if (zero) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = 1;
  for (int i = 0; i < n; ++i) {
    ll tmp = 1e18;
    if (tmp / ans < a[i]) {
      cout << -1 << endl;
      return 0;
    }
    ans = ans * a[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3996
#include "bits/stdc++.h"
using namespace std;
int main(){
    int sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    const int dx=tx-sx,dy=ty-sy;
    cout << string(dy,'U')<<string(dx,'R')
    <<string(dy,'D')<<string(dx,'L')
    <<'L'<<string(dy+1,'U')<<string(dx+1,'R')<<'D'
    <<'R'<<string(dy+1,'D')<<string(dx+1,'L')<<'U'
    <<endl;
}


Measured memory_bytes: 3580
#include <cstdio>

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

    int ans = 0;
    for (int i = 0; i < N; i++) {
        int l, r;
        scanf(" %d %d", &l, &r);
        ans += r - l + 1;
    }
    printf("%d\n", ans);
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int sum = 0;
  for (int i = 0; i < n; i ++) {
    cin >> a.at(i);
    sum += a.at(i);
  }

  sort(a.begin(), a.end());
  int x = a.at(n - 1);
  sum -= x;
  string ans = "Yes";
  if (x >= sum) ans = "No";

  cout << ans << endl;
}


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

int table[10001][1261];

int main(){
  int N, M, r, q, t, s, n, m,ts,te;

  while(cin >> N >> M, N && M){
    cin >> r;
    for(int i= 0; i < 10001; i++){
      for(int j = 0; j < 1261; j++){
	table[i][j] = 0;
      }
    }
    
    for(int i = 0; i < r; i++){
      cin >> t >> n >> m >> s;
      if(s) table[m][t]++;
      else  table[m][t]--;
    }
    for(int i = 1; i <= M; i++){
      for(int j = 540; j <= 1260; j++){
	table[i][j] += table[i][j-1];
      }
    }
 
    for(int i = 1; i <= M; i++){
      for(int j = 540; j <= 1260; j++){
	//if(i == 1)cout << table[i][j] << endl;
	if(table[i][j] > 1) table[i][j] = 1;
	table[i][j] += table[i][j-1];
      }
    }
    cin >> q;
    for(int i = 0; i < q; i++){
      cin >> ts >> te >> m;
      cout << table[m][te-1] - table[m][ts-1] << endl;
    }
    /*for(int i = 540; i < 1260; i++) {cout << i << " " << table[1][i];
    if(i == te || i == ts) cout << "ttt";
    cout << endl;}
    */
  }
}
    

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

namespace abc168_a
{
    class Program
    {
        static void Main(string[] args)
        {
           int input= int.Parse(Console.ReadLine());
            int n = input % 10;

            if(n==3)
            {
                Console.WriteLine("bon");
            }
            else if(n==0 ||n==1 ||n==6 ||n==8)
            {
                Console.WriteLine("pon");
            }
            else
            {
                Console.WriteLine("hon");
            }
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 27480
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

const ll MM = 1000000000000000000;
int main(){
  int n; cin>>n;
  vector<ll> lst(n);
  rep(i,n){
    cin>>lst[i];
    if(lst[i]==0){
      cout<<"0"<<endl;
      return 0;
    }
  }
  ll prod=lst[0];
  REP(i,1,n){
    if(lst[i] > MM / prod){
      cout<<"-1"<<endl;
      return 0;
    }else{
      prod*=lst[i];
    }
  }
  cout<<prod<<endl;
}

Measured memory_bytes: 3992
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>
#include<functional>
using namespace std;

#define ll long long
#define MOD 1000000007
#define INF (1<<30)

vector<ll> getDivisor(ll n) {
	vector<ll> v;
	for (ll i = 1; i * i <= n;i++) {
		if (n % i == 0) {
			v.push_back(i);
			if (i != n / i) {
				v.push_back(n / i);
			}
		}
	}
	sort(v.begin(), v.end());
	return v;
}

ll GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	ll N; cin >> N;
	vector<ll> v = getDivisor(N);

	ll minv = INF;
	for (auto x : v) {
		ll A = x, B = N / x;
		minv = min(minv, max(GetDigit(A),GetDigit(B)));
	}
	cout << minv << endl;
}

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

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int main() {
    int N;
    cin>>N;
    string ans = "";
    int digit = 1;
    while(N != 0){
        int r = N%2;
        if(r < 0) r += 2;
        N = (N-r)/(-2);
        ans += (char)('0'+r);        
    }
    reverse(ans.begin(), ans.end());
    if(ans == "") ans = "0";
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#define N 105
using namespace std;

short line[N][N],list[N][N],ans[N][N][N][N],n,m,op,sx,sy;
char s[N][N];

int main()
{
    cin>>n>>m;
    for (short i=1;i<=n;i++) scanf("%s",s[i]+1);
    for (short i=1;i<=n;i++) for (short j=1;j<=m;j++)
    {
        line[i][j]=line[i][j-1]+(s[i][j]=='o');
        list[i][j]=list[i-1][j]+(s[i][j]=='o');
        if (s[i][j]=='E') sx=i,sy=j;
    }
    for (short i=sx;i;i--)
 for (short j=sy;j;j--) 
        for (short k=sx;k<=n;k++)
 for (short p=sy;p<=m;p++)
    {
        if (1<i && k+1<sx+i) op=max(op,ans[i-1][j][k][p]=max((int)ans[i-1][j][k][p],ans[i][j][k][p]+line[i-1][min((int)p,m-sy+j)]-line[i-1][max(j-1,p-sy)]));
        if (k<n && sx+k<n+i) op=max(op,ans[i][j][k+1][p]=max((int)ans[i][j][k+1][p],ans[i][j][k][p]+line[k+1][min((int)p,m-sy+j)]-line[k+1][max(j-1,p-sy)]));
        if (1<j && p+1<sy+j) op=max(op,ans[i][j-1][k][p]=max((int)ans[i][j-1][k][p],ans[i][j][k][p]+list[min((int)k,n-sx+i)][j-1]-list[max(i-1,k-sx)][j-1]));
        if (p<m && sy+p<m+j) op=max(op,ans[i][j][k][p+1]=max((int)ans[i][j][k][p+1],ans[i][j][k][p]+list[min((int)k,n-sx+i)][p+1]-list[max(i-1,k-sx)][p+1]));
    }
    cout<<op;
}

Measured memory_bytes: 227584
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int H,W;
vector<vector<int>> C;
void input(){
    fast_io();
    cin >> H >> W;
    C.assign(10,vector<int>(10,0));
    for (int i = 0; i < 10; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            cin >> C[i][j];
        }
    }
    
}

int solve(){
    for (int k = 0; k < 10; k++)
    {
        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                C[i][j] = min(C[i][j],C[i][k]+C[k][j]);
            }
        }
    }
    DBG(C)
    int ans = 0;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            int a; cin >> a;
            if(a!=-1) ans += C[a][1];
        }
    }
    cout << ans << endl;
    
    return 0;
}   

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

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		HashMap<Integer,Boolean> map = new HashMap<Integer,Boolean>();
		for(int i=0;i<n;i++){
			int a = scanner.nextInt();
			if(map.containsKey(a)){
				map.put(a, !map.get(a));
			}else{
				map.put(a, true);
			}
		}
		int count = 0;
		for(Integer key : map.keySet()){
			if(map.get(key)){
				count++;
			}
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 61456