akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main() {
	char c;
	while (cin.get(c)) {
		if      (c == 'D') {
			c = 'A';
		}
		else if (c == 'E') {
			c = 'B';
		}
		else if (c == 'F') {
			c = 'C';
		}
		else if (c == 'G') {
			c = 'D';
		}
		else if (c == 'H') {
			c = 'E';
		}
		else if (c == 'I') {
			c = 'F';
		}
		else if (c == 'J') {
			c = 'G';
		}
		else if (c == 'K') {
			c = 'H';
		}
		else if (c == 'L') {
			c = 'I';
		}
		else if (c == 'M') {
			c = 'J';
		}
		else if (c == 'N') {
			c = 'K';
		}
		else if (c == 'O') {
			c = 'L';
		}
		else if (c == 'P') {
			c = 'M';
		}
		else if (c == 'Q') {
			c = 'N';
		}
		else if (c == 'R') {
			c = 'O';
		}
		else if (c == 'S') {
			c = 'P';
		}
		else if (c == 'T') {
			c = 'Q';
		}
		else if (c == 'U') {
			c = 'R';
		}
		else if (c == 'V') {
			c = 'S';
		}
		else if (c == 'W') {
			c = 'T';
		}
		else if (c == 'X') {
			c = 'U';
		}
		else if (c == 'Y') {
			c = 'V';
		}
		else if (c == 'Z') {
			c = 'W';
		}
		else if (c == 'A') {
			c = 'X';
		}
		else if (c == 'B') {
			c = 'Y';
		}
		else if (c == 'C') {
			c = 'Z';
		}
		cout.put(c);
	}
}

Measured memory_bytes: 3040
#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  
  if (((n % 10) == 7) ||
      (((n / 10) % 10) == 7) ||
      (((n / 100) % 10) == 7)) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
  return 0;
}

Measured memory_bytes: 3052
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

//ll dx[4] = {1, 0, -1, 0};
//ll dy[4] = {0, 1, 0, -1};

vector<ll> k[12];

int main() {
	IOS();
	ll n, k;
	cin >> n >> k;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll ans = -INF;
	for (int l = 0; l <= n; l++) {
		// l個とる
		vector<ll> left, suml(l + 1, 0);

		for (int i = 0; i < l; i++) {
			left.push_back(a[i]);
		}
		sort(left.begin(), left.end());
		for (int i = 0; i < l; i++) {
			suml[i + 1] = suml[i] + left[i];
			//cout << suml[i + 1] << " ";
		}
		//cout << endl;
		for (int r = 0; r <= n; r++) {
			// r個とる
			if (l + r > min(n, k)) break;
			vector<ll> right, sumr(r + 1, 0);
			for (int j = 0; j < r; j++) {
				right.push_back(a[n - j - 1]);
			}
			sort(right.begin(), right.end());
			for (int j = 0; j < r; j++) {
				sumr[j + 1] = sumr[j] + right[j];
			}

			ll unko = k - l - r; //ステる操作階数
			//ll tmp  = sumr[r] + suml[l];
			for (int l2 = 0; l2 <= unko; l2++) {
				for (int r2 = 0; r2 <= unko - l2; r2++) {
					if (l2 > l || r2 > r) continue;
					ll tmp = suml[l] - suml[l2] + sumr[r] - sumr[r2];
					ans	= max(ans, tmp);
					//cout << suml[l] << " " << suml[l2] << " " << tmp << endl;
				}
			}
			//cout << suml[l] << " " << sumr[r] << endl;
		}
	}
	dump(ans);
	return 0;
}

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

#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
using namespace std;

int main(){
	char a;	cin >> a;

	if( isupper(a) )	cout << "A" << endl;
	else				cout << "a" << endl;

	return 0;
}


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

using namespace std;

int main() {
	long long n, nine=1, eight=1,ten=1, MOD = 1000000007;
	cin >> n;
	for (int i = 0; i < n; i++) {
		nine *= 9;
		eight *= 8;
		ten *= 10;
		nine %= MOD;
		eight %= MOD;
		ten %= MOD;
	}

	nine *= 2;
	nine %= MOD;

	long long ans = ten - (nine - eight);
	ans %= MOD;
	if (ans < 0) {
		ans += MOD;
	}
	cout << ans << endl;


	return 0;
}


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vvs = vector<vs>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);

    ll n, d; std::cin >> n >> d;
    int ans = 0;
    d *= d;
    rep(i, n) {
        ll x, y; std::cin >> x >> y;
        ll di = x * x + y * y;
        ans += (di <= d);
    }
    std::cout << ans << "\n";
}


Measured memory_bytes: 3596
N, X = gets.split.map(&:to_i)
L = gets.split.map(&:to_i)

sum = Array.new(N+1) {0}

L.each_with_index do |l, i|
  sum[i+1] = sum[i] + l
end

# p sum

ans = 0
sum.each_with_index do |s, i|
  if s <= X
    ans += 1
  end
end

p ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1'000'000'007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

long long solve_25(long long N, long long P, string S){
    long long ans = 0;
    for(int i=0; i<N; i++){
        if(P == 2 && (S[i]-'0')%2==0) ans += i + 1;
        if(P == 5 && (S[i]-'0')%5==0) ans += i + 1;
    }
    return ans;
}

int main(){
    long long N, P;
    string S;
    cin >> N >> P >> S;

    if(P == 2 || P == 5){
        cout << solve_25(N, P, S) << endl;
        return 0;
    }
    long long ans = 0;
    vector<long long> cumsum(N+1);
    vector<long long> fac(N+1);
    fac[0] = 1;
    for(int i=1; i<=N; i++)
        fac[i] = (fac[i-1] * 10) % P;
    reverse(S.begin(), S.end());
    for(int i=0; i<N; i++)
        cumsum[i+1] = (cumsum[i] + fac[i]*(S[i] - '0')) % P;

    map<long long, long long> mp;
    for(int i=1; i<=N; i++)
        mp[cumsum[i]]++;

    for(int i=0; i<N; i++){
        ans += mp[cumsum[i]];
        mp[cumsum[i+1]]--;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin,(x).end()

int main(){
  int a,b,h;
  cin >> a >> b >> h;
  cout << ((a+b)*h)/2 << endl;
}

Measured memory_bytes: 3620
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n);
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end());
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end());
#define reverse(a)      reverse((a).begin(), (a).end());
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d);
#define outl(d)         std::cout<<(d)<<"\n";
#define Yes()           printf("Yes\n");
#define No()            printf("No\n");
#define YES()           printf("YES\n");
#define NO()            printf("NO\n");
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

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

void solve() {
  int a, b, c; cin >> a >> b >> c;
  
  outl(a + b + c - max(a, max(b, c)))
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12)

  solve();
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
   char s[4];
   int i,a=0;

   scanf("%s",s);
   
   for(i=0;i<3;i++){
      if(s[i]=='o')  a+=100;
   }

   printf("%d\n",a+700);

   return 0;
}


Measured memory_bytes: 128
import sys
from collections import deque
def input():
    return sys.stdin.readline()[:-1]
def main():
    N, M = map(int,input().split())
    G = [[] for _ in range(N+1)]
    for _ in range(M):
        a, b = map(int,input().split())
        G[a].append(b)
        G[b].append(a)
    ans = [-1]*(N+1)
    Q = deque()
    Q.append(1)
    while len(Q) > 0:
        ima = Q.popleft()
        for tsugi in G[ima]:
            if ans[tsugi] == -1:
                ans[tsugi] = ima
                Q.append(tsugi)
    print("Yes")
    for e in ans[2:]:
        print(e)
if __name__ == '__main__':
    main()


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	int N, Y;
	cin >> N >> Y;

	for (int x = 0; x <= N; x++) {
		for(int y = 0; y <= N - x; y++) {
			int z = N - x - y;
			if (10000 * x + 5000 * y + 1000 * z == Y) {
				cout << x << " " << y << " " << z << endl;
				return 0;
			}
		}
	}

	cout << "-1 -1 -1" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

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

  set<int> s;  // 行先がnな島のset
  for (int i = 0; i < m; i++) {
    if (b[i] == n - 1) {
      s.insert(a[i]);
    }
  }

  string ans = "IMPOSSIBLE";
  for (int i = 0; i < m; i++) {
    if (a[i] == 0) {
      if (s.find(b[i]) != s.end()) {
        ans = "POSSIBLE";
        break;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6528
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define REP(i,n)   for (int i = 0; i < (n); ++i)
#define SORT(a)    sort((a).begin(), (a).end());
#define UNIQ(a)    SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end());
#define FIND(a,x)  find((a).begin(), (a).end(), (x)) != (a).end()
#define REVERSE(a) reverse((a).begin(), (a).end());

using namespace std;
using ll = long long;
using P = pair<int,int>;

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

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

  double N; cin >> N;
  cout << ceil(N / 2) << endl;
}


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

#define all(x) (x).begin(),(x).end()
#define init() \
  ios::sync_with_stdio(false); \
  cin.tie(0)

#define MOD 1000000007

using namespace std;

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

#ifdef LOCAL

template<typename T>
void show(vector<T>& v) {
    cout << '[';
    for (const T& e : v) {
        cout << e << ',';
    }
    cout << ']' << endl;
}

#endif

template<typename M, typename N>
constexpr common_type_t<M, N> gcd(M a, N b) {
  return a == 0 ? b
    : b == 0 ? a
    : gcd(b, a % b);
}

template <typename M, typename N>
constexpr common_type_t<M, N> lcm(M a, N b) {
  return a * b / gcd(a, b);
}

template <long long MAX>
class CombinationCalculator {
  long long mod_;
  long long fac[MAX];
  long long finv[MAX];
  long long inv[MAX];

public:
  CombinationCalculator(long long mi = MOD): fac(), finv(), inv() {
    mod_ = mi;
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i - 1] * i % mod_;
      inv[i] = mod_ - inv[mod_ % i] * (mod_ / i) % mod_;
      finv[i] = finv[i - 1] * inv[i] % mod_;
    }
  }

  long long c(long long n, long long k) const {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod_) % mod_;
  }
};

template <long long MAX = 210000>
using CC = CombinationCalculator<MAX>;

template<typename T>
T modpow(T a, T n, T mod = MOD) {
    T res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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

template<typename T>
vector<T> read_n(const size_t n) {
    T dummy;
    vector<T> v(n);
    for (size_t i = 0; i < n; i++) {
        cin >> dummy;
        v[i] = dummy;
    }
    return v;
}

template<typename T>
vector<T> read_n() {
    size_t n;
    cin >> n;
    return read_n<T>(n);
}

int solve(int a, int b) {
    if (b <= 1) {
        return 0;
    } else {
        int sum = 1;
        int i = 0;
        while(1) {
            if (sum >= b) {
                return i;
            } else {
                i++;
                sum += a - 1;
            }
        }
    }
}

int main() {
  init();

  int a, b;
  cin >> a >> b;

  cout << solve(a, b) << endl;

  return 0;
}


Measured memory_bytes: 3604
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <utility>
#include <map>
using namespace std;


int main()
{
	int n;

	cin >> n;
	
	vector<pair<int, int>> a;

	for (int i = 0; i < n; i++) {
		int tmp;
		cin >> tmp;
		a.push_back(make_pair(tmp, i));
	}

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

	for (int i = 0; i < n; i++) {
		if(i == a[n - 1].second)
			cout << a[n - 2].first << endl;
		else
			cout << a[n - 1].first << endl;
	}

	return 0;

}

Measured memory_bytes: 3312
fun main(arg: Array<String>) {
    val N = nextInt()
    val A = listOfInt()
    val B = IntArray(3)
    A.forEach { a ->
        B[when (Integer.numberOfTrailingZeros(a)) {
            0 -> 0      //odd
            1 -> 1      //mod 2
            else -> 2   //mod 4
        }] += 1
    }
    val ans = if (B[1] == 0) B[0] <= B[2] + 1 else B[0] <= B[2]
    println(if (ans) "Yes" else "No")
}
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfInt(vararg deltas: Int) = listOfString().map { Integer.parseInt(it) }.mapIndexed { index, int -> int + deltas[index % deltas.size] }



Measured memory_bytes: 51904
import sys
n = int(input())
a = list(map(int, input().split()))
sys.setrecursionlimit(10 ** 5)


def cut(l):
    l.sort()
    nokori = [l[0]]
    for i in range(1, len(l)):
        b = l[i] % l[0]
        if b != 0:
            nokori.append(b)
    if len(nokori) != 1:
        return cut(nokori)
    return nokori[0]


print(cut(a))


Measured memory_bytes: 14252
#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 all(v) v.begin(), v.end()

bool same(vector<int> P,vector<int> R, int N) {
    for(int i=0;i<N;i++){
        if(P.at(i) != R.at(i)) return false;
    }
    return true;
}

int main() {
    int N;
    cin >> N;
    vector<int> P(N), Q(N);
    rep(i,N) cin >> P.at(i);
    rep(i,N) cin >> Q.at(i);
   
    vector<int> R(N);
    rep(i,N) R.at(i) = i+1;

    int a = 0;
    int b = 0;
    int cnt = 0;
    do{
        if(same(P,R,N)) a = cnt;
        if(same(Q,R,N)) b = cnt;
        cnt++;
    } while(next_permutation(all(R)));
 
    cout << abs(a-b) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
    int m, f, r, mf;
 
    while (1) {
        scanf("%d %d %d", &m, &f, &r);
        if (m < 0 && f < 0 && r < 0)
            break;
        mf = m + f;
        if (m < 0 || f < 0 || mf < 30)
            puts("F");
        else if (mf >= 80)
            puts("A");
        else if (mf >= 65)
            puts("B");
        else if (mf >= 50 || r >= 50)
            puts("C");
        else
            puts("D");
    }
    return 0;
}


Measured memory_bytes: 2108
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

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


int main() {
	int n, q;
	int64_t k;
	cin >> n >> k >> q;
	int A[100010];
	rep(i, q) cin >> A[i];
	int64_t P[100010];
	rep(i, n) P[i] = k - q;

	rep(i, q) {
		int a = A[i];
		a--;
		P[a]++;
	}
	rep(i, n) {
		if (P[i]>0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
string s;
int i;
bool cond = false;
int main()
{
    cin >> s;
    for(i=1;i<3;i++)
    {
        if(s[i]!=s[i-1])
            cond = true;
    }
    if(cond)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3628
def resolve():
    n = int(input())
    M = 10 ** 9 + 7
    pl = [0] * (n + 1)

    for i in range(2, n+1):
        x = i
        p = 2
        while x > 1:
            while x % p == 0:
                pl[p] += 1
                x //= p
            p += 1
    ans = 1
    for s in pl:
        ans *= (s+1)

    print(ans % M)

if __name__ == '__main__':
    resolve()

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        String line = scan.nextLine();
        int answer = Integer.parseInt(line);

        int count = 0;
        for (int i = 1; i < answer; i++) {
            count += (answer -1) / i;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 35804
#include <stdio.h>

int main()
{
    int x1;
    int x2;
    
    scanf("%d%d", &x1, &x2);
    
    if (x1 > x2)
    {
        printf("%d\n", x1 - x2);
    }
    else
    {
        printf("%d\n", x2 - x1);
    }
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  int a, b, c; cin >> a >> b >> c;
  if(a + b >= c) cout << "Yes";
  else cout << "No";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define MP make_pair
#define PB push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int sum(string s) {
	int ans = 0;
	rep(i, SZ(s)) {
		ans += s[i] - '0';
	}
	return ans;
}
int main() {
	VI ans;
	while (true) {
		string s;
		cin >> s;
		if (s == "0")break;
		ans.PB(sum(s));
	}
	for (auto i : ans) {
		cout << i << endl;
	}
}


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

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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    string s;
    cin >> s;

    char c = s.at(0); 
    int a, z;
    a = 'a';
    z = 'z';

    if(a<=c&&c<=z) cout << 'a' << endl;
    else cout << 'A' << endl;
    return 0;
}


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

using namespace std;

int main(){

  int n;
  scanf("%d", &n);

  set <int> s;
  int cn = 0;
  for(int i = 0; i < n; i++ ){
    int x;
    scanf("%d", &x );
    if( x < 3200 ) s.insert( x/400);
    else cn++;
  }


  printf("%d %d\n", max( 1, int(s.size()) ),  int(s.size()) + cn );
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.length();
  string ky = "keyence";
  int l = 0;
  for (; l < 7; l++) {
    if (s[l] != ky[l]) {
      break;
    }
  }
  int r = 0;
  for (; r < 7; r++) {
    if (s[n - 1 - r] != ky[6 - r]) {
      break;
    }
  }
  if (l + r >= 7) {
    cout << "YES" << '\n';
  } else {
    cout << "NO" << '\n';
  }
  return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (1LL << 55)
#define MOD (1000 * 1000 * 1000 + 7)
#define maxn 500111

typedef long long ll;
typedef long double ld;

vector<int> adj[maxn];
int col[maxn], num[4];
bool bipartite;

void DFS(int x, int p){
	col[x] = 3 - col[p];
	num[col[x]]++;
	for(int v : adj[x]){
		if(!col[v])
			DFS(v, x);
		else{
			if(col[v] == col[x])
				bipartite = 0;
		}
	}
}

int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	for(int i = 0; i < m; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		adj[a].pb(b);
		adj[b].pb(a);
	}

	col[0] = 1;
	bipartite = 1;
	DFS(1, 0);

	if(bipartite)
		printf("%lld\n", 1LL * num[1] * num[2] - m);

	if(!bipartite)
		printf("%lld\n", 1LL * n * (n - 1) / 2LL - m);

	return 0;
}

Measured memory_bytes: 16256
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int,int> pii;
typedef pair <db,db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline int gcd(int a,int b){if(a==0) return b;return gcd(b%a,a);}
inline int power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD=998244353;
const ll hell=1000000007;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

const int N=200005;

void solve()
{
    int a,b;
    cin>>a>>b;
    cout<<(a*b)<<endl;
    
    
}


int32_t main()
{
    IOS;
    //pre();
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        
        solve();
    }
    return 0;
}


Measured memory_bytes: 3656
#include <iostream>
using namespace std;
#define ll long long
#define MOD 1000000007

ll fact_mod(ll n) {
    if (n == 0) {
        return 1;
    } else {
        return (n * fact_mod(n - 1)) % MOD;
    }
}

int main() {
    ll n, m;
    ll temp, ans;
    cin >> n >> m;

    if (n == m) {
        temp = fact_mod(n);
        ans = (2 * temp * temp) % MOD;
    } else if (n == m + 1) {
        temp = fact_mod(m);
        ans = ((n * temp) % MOD) * temp % MOD;
    } else if (m == n + 1) {
        temp = fact_mod(n);
        ans = ((m * temp) % MOD) * temp % MOD;
    } else {
        ans = 0;
    }

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



Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;

int main(int argc, char *argv[]) {
  /*
  cin>>x;
  cout<<x<<endl;
  */
  int i,j,n,m,c=0;
  cin>>n>>m;
  for(i=0;i<2;i++){
    if(n>m){
      c+=n;
      n--;
    }else{
      c+=m;
      m--;
    }
  }
  cout<<c<<endl;
}


Measured memory_bytes: 256
/********************
Author : MIHIR ARORA
********************
*/
#include <iostream>
using namespace std;
#define fast cin.tie(NULL); cout.tie(NULL); 
#define input int n; scanf("%d",&n); int*arr = new int[n];  for(int i=0;i<n;i++) scanf("%d",&arr[i]);  
#define inputs int n; scanf("%d",&n); char str[n];   cin>>str;   
 
typedef long long int ll;
const int mod=1e9+7; 
ll add(ll a, ll b)
{
    return (a%mod+b%mod)%mod;
}
 
ll mul(ll a, ll b)
{
    return ((a%mod)*(b%mod))%mod;
}
 
ll sub(ll a, ll b)
{
    return ((a%mod) - (b%mod))%mod;
}
inline void solve()
{
 input; 
}
int main()
{ 
    fast; 
    int n; 
    int s; 
    cin>>n>>s;
    if(n<=s)
        cout<<"unsafe"; 
    else
        cout<<"safe"; 
    
}

Measured memory_bytes: 3636
#include <stdio.h>

int main(void)
{
  char s[10];
  scanf("%s", s);
  
  if (s[0] == 'S')
    if (s[1] == 'U')
      puts("7");
    else
      puts("1");
  if (s[0] == 'M')
    puts("6");
  if (s[0] == 'T')
    if (s[1] == 'U')
      puts("5");
    else
      puts("3");
  if (s[0] == 'W')
    puts("4");
  if (s[0] == 'F')
    puts("2");
  
  return 0;
}

Measured memory_bytes: 128
#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;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int ans=0;
  rep(i,n) {
    if(a[a[i]-1]==i+1) ans++;
  }
  cout <<  ans/2 << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  double ans=0;
  for(int i=1;i<=n;i++)
  {
    int now=i;
    double p=1.0/n;
    while(now<k)
    {
      now*=2;
      p/=2;
    }
    ans+=p;
  }
  printf("%.12f\n",ans);
  return 0;
}

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

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

	string s, t;

	cin >> s >> t;

	for (int i = 0; i < N; i++)
	{
		cout << s.at(i) << t.at(i);
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
#define pb push_back
const ll mod = 1e9+7;
const int N = 2e5+205;
vector<int>v[N];
bool vis[N];
int sz;
int ans;
void dfs(int x){
	vis[x] = true;
	sz++;
	ans = max(ans,sz);
	for(int y:v[x]){
		if(!vis[y])dfs(y);
	}
}
void solve(){
	int n,m; 
	cin>>n>>m; 
	for(int i=1;i<=m;i++){
		int x,y; 
		cin>>x>>y; 
		v[x].pb(y);
		v[y].pb(x);
	}
	ans = 1;
	for(int i=1;i<=n;i++){
		if(!vis[i]){
			sz = 0;
			dfs(i);
		}
	}
	cout<<ans<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 21044
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		coordinate[] crd=new coordinate[5];
		for(int i=0;i<5;i++){
			crd[i]=new coordinate();
		}
		while(sc.hasNextDouble()){
			crd[0].input(sc.nextDouble(),sc.nextDouble());
			crd[1].input(sc.nextDouble(),sc.nextDouble());
			crd[2].input(sc.nextDouble(),sc.nextDouble());
			crd[3].input((crd[0].x+crd[1].x+crd[2].x)/3,(crd[0].y+crd[1].y+crd[2].y)/3);
			crd[4].input(sc.nextDouble(),sc.nextDouble());
			
			if(intersection(crd[0],crd[1],crd[3],crd[4])&intersection(crd[1],crd[2],crd[4],crd[3])&&intersection(crd[2],crd[0],crd[4],crd[3])){
				System.out.println("YES");
			}else{
				System.out.println("NO");
			}
		}

	}
	public static boolean intersection(coordinate p1,coordinate p2,coordinate p3,coordinate p4){
		boolean judge=((p1.y-p2.y)*(p3.x-p1.x)-(p1.x-p2.x)*(p3.y-p1.y))*((p1.y-p2.y)*(p4.x-p1.x)-(p1.x-p2.x)*(p4.y-p1.y))>0;
		return judge;
	}
	public static class coordinate{
		double x,y;
		coordinate(double x,double y){
			this.x=x;
			this.y=y;
		}
		coordinate(){
			this.x=0;
			this.y=0;
		}

		public void input(double x,double y){
			this.x=x;
			this.y=y;
		}
	}
}

Measured memory_bytes: 31168
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef long long ll;
typedef long double ld;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define fi first
#define se second

template<class T> bool ckmin(T &a, const T &b) {return a > b ? a = b, 1 : 0;}
template<class T> bool ckmax(T &a, const T &b) {return a < b ? a = b, 1 : 0;}

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

    int n;
    cin >> n;
    vector<ll> xo, dod;
    xo.pb(0);
    dod.pb(0);
    for(int i = 0, num; i < n; ++i)
    {
        cin >> num;
        xo.pb(xo.back()^num);
        dod.pb(dod.back()+num);
    }


    int l = 1;
    ll ans = 0;

    for(int r = 1; r <= n; ++r)
    {
        while((xo[r]^xo[l-1]) != dod[r]-dod[l-1])
            ++l;
        ans += (r - l + 1) * 1LL;
    }
    cout << ans;
}


Measured memory_bytes: 6688
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static boolean hiekou = false;
	public static int intHiekou = 0;

	public static void main(String[] args) {
		// 標準入力
		Scanner sc = new Scanner(System.in);

		String line1 = sc.nextLine();
		List<String> lines1 = Arrays.asList(line1.split(" "));
		Integer N = Integer.parseInt(lines1.get(0));
		Integer M = Integer.parseInt(lines1.get(1));

		if (N + M >= 24) {
			System.out.println(N + M - 24);
		} else {
			System.out.println(N + M);
		}
	}

}

Measured memory_bytes: 21844
#include <cstdio>
#include <cmath>

#include <vector>
#include <queue>
#include <utility>

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define inc( i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec( i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

template<typename T> void swap(T & x, T & y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T & a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n;
double x[1002], y[1002], r[1002];


typedef std::pair<int, double> PC;

std::vector<PC> vec[1002];
double dist[1002];

double dijkstra(int s, int g) {
	inc(i, n + 2) { dist[i] = 4e9; }
	
	std::priority_queue<PC, std::vector<PC>, std::greater<PC>> p_que;
	dist[s] = 0;
	p_que.push(std::make_pair(s, dist[s]));
	
	while(! p_que.empty()) {
		PC pc = p_que.top(); p_que.pop();
		int p = pc.first;
		if(pc.second != dist[p]) { continue; }
		for(auto && e : vec[p]) {
			if(setmin(dist[e.first], dist[p] + e.second)) {
				p_que.push(std::make_pair(e.first, dist[e.first]));
			}
		}
	}
	
	return dist[g];
}

int main() {
	double xs, ys, xt, yt;
	scanf("%lf%lf%lf%lf%d", &xs, &ys, &xt, &yt, &n);
	inc(i, n) { scanf("%lf%lf%lf", &x[i], &y[i], &r[i]); }
	x[n] = xs;
	y[n] = ys;
	r[n] = 0.0;
	x[n + 1] = xt;
	y[n + 1] = yt;
	r[n + 1] = 0.0;
	
	inc(i, n + 2) {
	inc(j, n + 2) {
		double d = max(sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j])) - r[i] - r[j], 0.0);
		vec[i].push_back(std::make_pair(j, d));
	}
	}
	
	printf("%.12f\n", dijkstra(n, n + 1));
	
	return 0;
}


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

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

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

  int n;
  cin >> n;

  if (1 <= n && n < 1000) {
    cout << "ABC" << endl;
  } else {
    cout << "ABD" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
s = str(input())
n = len(s)

if n == 1:
    print(1)
    exit()

maxs = []
for i in range(n-1):
    if s[i] != s[i+1]:
        maxs.append(max(i+1, n-i-1))

if maxs != []:
    print(min(maxs))
else:
    print(n)

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

typedef long long ll;
const int MM = 1e9 + 7;
const int MAXN = 2e6 + 10;

int n, m;
int b[MAXN], c[MAXN];

int main(){
	cin>>n; 
	int cnt = 0;
	for(int i = 2; i <= n; i++){
		int flag = 1;
		for(int j = 2; j * j <= i; j++)
			if (i % j == 0){
				flag = 0;
				break;
			}
		if (flag){
			b[++cnt] = i;
			c[cnt] = 0;
		}
	}
	for(int i = 2; i <= n; i++){
		int x = i;
		for(int j = 1; j <= cnt && b[j] <= x && x != 1; j++){
			while(x % b[j] == 0){
				x /= b[j];
				c[j]++;
			}
		}
	}
	ll ans = 1;
	for(int i = 1; i <= cnt; i++)
		ans = (ans * (c[i] + 1)) % MM;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
bin_A=[bin(c) for c in A]
flags=[True]*N

count=0
for keta in range(60):
   count_0=0
   count_1=0
   for i in range(N):
      if flags[i]:
         if bin_A[i][-1*(keta+1)]=="b":
            count_0+=1
            flags[i]=False
         elif bin_A[i][-1*(keta+1)]=="0":
            count_0+=1
         else:
            count_1+=1
      elif flags[i]==False:
         count_0+=1
   count+=count_0*count_1*2**keta

print(count%(10**9+7))

Measured memory_bytes: 126852
N,L = map(int,input().split())
numlist = []
for i in range(N):
    numlist.append(L)
    L += 1

ideal = sum(numlist)
salist = []
for i in range(N):
    a = numlist.pop(i)
    suma = sum(numlist)
    salist.append(suma)
    numlist.insert(i,a)


anslist = []
lastans = 0
for i in range(len(salist)):
    if i == 0:
        sa = salist[i] - ideal
        anser = i
    else:
        if abs(salist[i] - ideal) < sa:
            sa = salist[i] - ideal
            anser = i

print(salist[anser])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;
const int MAX = 55;

ll dp[MAX][MAX*MAX*2];
int n, a;

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

  REP(i, 1, n){
    int x;
    cin >> x;
    x -= a;
    REP(j, 0, MAX*MAX*2){
      if(j-x >= 0) dp[i][j] += dp[i-1][j-x];
      dp[i][j] += dp[i-1][j];
    }
    dp[i][MAX*MAX+x]++;
  }

  cout << dp[n][MAX*MAX] << endl;

  return 0;
}


Measured memory_bytes: 2560
N=int(input())
L=sorted(list(map(int,input().split())))
ans=0
for i in range(N-2):
  for j in range(i+1,N-1):
    for k in range(j+1,N):
      a,b,c = L[i],L[j],L[k]
      if a!=b and a!=c and b!=c and a+b>c:
        ans+=1
print(ans)

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

int main() {
  int N;
  std::cin >> N;

  int ans = 0;

  int has_B_prefix = 0;
  int has_A_postfix = 0;
  int has_Both = 0;

  for (int i=0; i<N; i++) {
    std::string s;
    std::cin >> s;

    for (int j=1; j<s.size(); j++) {
      if (s[j-1] == 'A' && s[j] == 'B') ans++;
    }

    if (s.front() == 'B') {
      if (s.back() == 'A') {
        has_Both++;
      } else {
        has_B_prefix++;
      }
    } else {
      if (s.back() == 'A') {
        has_A_postfix++;
      }
    }
  }

  if (has_Both > 0) {
    ans += has_Both - 1;

    if (has_A_postfix > 0) {
      ans += 1;
      has_A_postfix--;
    }

    if (has_B_prefix) {
      ans += 1;
      has_B_prefix--;
    }
  }

  ans += std::min(has_A_postfix, has_B_prefix);

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
//#define DEBUG
#ifdef DEBUG
#define DEBUG_PRINT(fm, ...) do{std::printf("%s:%d(%s)", __FILE__, __LINE__, __func__);std::cout << "DEBUG PRINT ";std::printf(fm, __VA_ARGS__);}while(0)
#define DEBUG_VAL(a, b) do{std::printf("%s:%d(%s)", __FILE__, __LINE__, __func__);std::cout <<"DEBUG VAL " << a << ":" << b << endl;}while(0)
#else
#define DEBUG_PRINT(...)do{}while(0);
#define DEBUG_VAL(a, b)do{}while(0);
#endif

using namespace std;
using ll = long long;
using v1 = vector<int>;
using vl = vector<long long>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;
int main(){
    int n, x, t, f;
    cin >> n >> x >> t;
    if(n%x == 0){
        f = n/x;
    }else f = n/x + 1;
    cout << f*t << endl;
}

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

class C
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var v = Console.ReadLine().Split().Select(int.Parse).ToArray();

		var v0 = v.Where((x, i) => i % 2 == 0).GroupBy(x => x).Select(g => new { x = g.Key, c = g.Count() }).OrderByDescending(_ => _.c).ToArray();
		var v1 = v.Where((x, i) => i % 2 == 1).GroupBy(x => x).Select(g => new { x = g.Key, c = g.Count() }).OrderByDescending(_ => _.c).ToArray();
		if (v0[0].x == v1[0].x) Console.WriteLine(n - Math.Max(v0[0].c + (v1.Length > 1 ? v1[1].c : 0), (v0.Length > 1 ? v0[1].c : 0) + v1[0].c));
		else Console.WriteLine(n - v0[0].c - v1[0].c);
	}
}


Measured memory_bytes: 36012
#include <math.h>
#include <ctype.h>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)

int main(){
    int n;
    cin >> n;
    int A[n];
    REP(i, n) cin >> A[i];

    sort(A, A + n, greater<int>());
    int a = 0, b = 0;
    REP(i, n){
        if(i % 2 == 0) a += A[i];
        else b += A[i];
    }
    cout << a - b << endl; 


    return 0;
}

Measured memory_bytes: 256
package main

import (
  "fmt"
  "math"
)

func main() {
  var a, b float64
  fmt.Scan(&a, &b)

  x := (a + b) / 2
  fmt.Println(round(x))
}

func round(x float64) float64 {
  return math.Floor(x + .5)
}

Measured memory_bytes: 512
import bisect
from operator import itemgetter
import math
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()


N,X = IL()
L = IL()

tmp = 0
cnt = 1
for i in L:
  tmp += i
  if tmp <= X:
    cnt += 1

print(cnt)

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

int main(){
    int W,H,X,Y,r;
    cin >> W >> H >> X >> Y >> r;
    if(X+r>W||X-r<0||Y+r>H||Y-r<0){
        cout <<"No" <<endl;
    }
    else{
        cout <<"Yes"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3124
s = input()

ss = s.split(" ")

N = int(ss[0])
A = int(ss[1])
B = int(ss[2])


ans = 0
div = N //( A + B ) # A > 0
ans = div * A
ans += min( N % (A + B) , A)
# mod = N % ( A + B )


# if mod > A :
#   ans += A
# else :
#   ans += mod

print(ans)

Measured memory_bytes: 3060
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#define LL long long
using namespace std;

int H,W,K,MOD=1000000007;
int dp[105][10][3];
int dpc[3][10];

int M(LL m){
    return m%MOD;
}

LL dfs(int h,int k,int t){
    if(k<1||k>W)return 0;
    int& ans=dp[h][k][t];
    if(ans!=-1)return ans;

    int lk=k;
    if(t==1)lk=k-1;
    if(t==2)lk=k+1;

    LL ldfs=M(M(dfs(h-1,lk,0)+dfs(h-1,lk,1))+dfs(h-1,lk,2));
    ans=M(ldfs*dpc[t][k]);
    //printf("dfs[%d][%d][%d]=%d\n",h,k,t,ans);
    return ans;
}

int mc[15];

int c(int len){
    if(len<=0)return 1;
    int& ans=mc[len];
    if(ans)return ans;
    return ans=c(len-1)+c(len-2);
}

int c(int a,int b){
    return c(b-a);
}

int main(){
    scanf("%d%d%d",&H,&W,&K);

    memset(dp,-1,sizeof dp);
    memset(mc,0,sizeof mc);

    for(int i=1;i<=W;i++){
        dpc[0][i]=c(1,i-1)*c(i+1,W);
        dpc[1][i]=c(1,i-2)*c(i+1,W);
        dpc[2][i]=c(1,i-1)*c(i+2,W);
    }

    for(int t=0;t<=2;t++)
        for(int i=1;i<=W;i++)
            dp[0][i][t]=0;
    dp[0][1][0]=1;

    printf("%d",M(dfs(H,K,0)+dfs(H,K,1)+dfs(H,K,2)));
    return 0;
}



Measured memory_bytes: 256
//Created by Aminul on 8/22/2020.

import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        String str = in.next();
        int res = 0;
        for (char c : str.toCharArray()) {
            res = (res * 10 + (c - '0')) % 9;
        }
        pw.println(res == 0 ? "Yes" : "No");
        pw.close();
    }

    static void debug(Object... obj) {
        System.err.println(Arrays.deepToString(obj));
    }
}

Measured memory_bytes: 31796
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
void vout(vl V) {
	for (ll i = 0; i < (ll)V.size(); i++) cout << V[i] << " ";
	cout << endl;
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 0; ll z = 0, o = 1;
vl flag, color; vll path;
int main() {
	cin >> N >> M;
	if (N % 2 == 1) {
		ll left = N / 2;
		ll right = N / 2 + 1;
		if (N % 2 == 1) right++;
		for (i = 0; i < M; i++) {
			cout << left << " " << right << endl;
			left--; right++;
		}
	}
	else {
		ll left = (M+1)/2; ll right=left+1;
		for (i = 0; i < (M+1)/2; i++) {
			cout << left << " " << right << endl;
			left--; right++;
		}
		left = ((M+1)/2)*2  + M/2; right = left+2;
		for (i = 0; i < M / 2; i++) {
			cout << left << " " << right << endl;
			left--; right++;
		}
	}
}

Measured memory_bytes: 3656