akhauriyash/Code-Regression huggingface dataset:
import java.io.InputStream
import java.math.BigDecimal
import java.math.BigInteger

private val MOD = 1e9.toLong() + 7

fun main(args: Array<String>) = input.run {
    val n = nextInt()
    val a = nextInts(n)
    println(solve(a))
}

fun solve(a: IntArray): Int {
    val sum = a.sum()
    if (sum % 10 != 0) {
        return sum
    }
    val min = a.filter { it % 10 != 0 }.min() ?: return 0
    return sum - min
}

val input = FastScanner()

fun String.toBigInteger() = BigInteger(this)
fun String.toBigDecimal() = BigDecimal(this)

class FastScanner(private val input: InputStream = System.`in`) {
    private val sb = StringBuilder()
    private val buffer = ByteArray(4096)
    private var pos = 0
    private var size = 0

    fun nextString(): String? {
        var c = skipWhitespace()
        if (c < 0) return null

        return sb.run {
            setLength(0)

            do {
                append(c.toChar())
                c = read()
            } while (c > ' '.toInt())

            toString()
        }
    }

    fun nextLine(): String? {
        var c = read()
        if (c < 0) return null

        return sb.run {
            setLength(0)

            while (c >= 0 && c != '\n'.toInt()) {
                append(c.toChar())
                c = read()
            }

            toString()
        }
    }

    fun nextLong(): Long {
        var c = skipWhitespace()

        val sign = if (c == '-'.toInt()) {
            c = read()
            -1
        } else 1

        var ans = 0L

        while (c > ' '.toInt()) {
            ans = ans * 10 + c - '0'.toInt()
            c = read()
        }

        return sign * ans
    }

    fun nextInt() = nextLong().toInt()
    fun nextDouble() = nextString()?.toDouble() ?: 0.0
    fun nextBigInteger(): BigInteger = nextString()?.toBigInteger() ?: BigInteger.ZERO
    fun nextBigDecimal(): BigDecimal = nextString()?.toBigDecimal() ?: BigDecimal.ZERO

    fun nextStrings(n: Int) = Array<String>(n) { nextString() ?: "" }
    fun nextInts(n: Int) = IntArray(n) { nextInt() }
    fun nextLongs(n: Int) = LongArray(n) { nextLong() }
    fun nextDoubles(n: Int) = DoubleArray(n) { nextDouble() }
    fun nextBigIntegers(n: Int) = Array<BigInteger>(n) { nextBigInteger() }
    fun nextBigDecimals(n: Int) = Array<BigDecimal>(n) { nextBigDecimal() }

    fun nextStrings(n: Int, m: Int) = Array(n) { nextStrings(m) }
    fun nextInts(n: Int, m: Int) = Array(n) { nextInts(m) }
    fun nextLongs(n: Int, m: Int) = Array(n) { nextLongs(m) }
    fun nextDoubles(n: Int, m: Int) = Array(n) { nextDoubles(m) }
    fun nextBigIntegers(n: Int, m: Int) = Array(n) { nextBigIntegers(m) }
    fun nextBigDecimals(n: Int, m: Int) = Array(n) { nextBigDecimals(m) }

    private fun skipWhitespace(): Int {
        while (true) {
            val c = read()
            if (c > ' '.toInt() || c < 0) return c
        }
    }

    private fun read(): Int {
        while (pos >= size) {
            if (size < 0) return -1
            size = input.read(buffer, 0, buffer.size)
            pos = 0
        }
        return buffer[pos++].toInt()
    }
}


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

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

const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};


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

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

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

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

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

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

void solve(){
  vector<pair<double, pair<double, double>>> kakudo(2 * N);
  rep(i, N){
    kakudo[i].f = atan2(y[i], x[i]);
    kakudo[i].s.f = y[i];
    kakudo[i].s.s = x[i];
    kakudo[i + N] = kakudo[i];
    kakudo[i + N].f += M_PI * 2;
  }

  sort(kakudo.begin(), kakudo.end());
  double ans = 0;
  for(ll s = 0; s < N; s++){
    double Y = kakudo[s].s.f;
    double X = kakudo[s].s.s;
    ans = max(ans, d(Y, X));
    for(ll t = s + 1; t < s + N; t++){
      Y += kakudo[t].s.f;
      X += kakudo[t].s.s;
      ans = max(ans, d(Y, X));
    }
  }
  cout << fixed << setprecision(40) << ans << endl;
}

int main(){
  cin >> N;
  x.resize(N);
  y.resize(N);
  rep(i, N) cin >> y[i] >> x[i];
  solve();
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner fsc = new Scanner(System.in);
        int[][] a = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                a[i][j] = fsc.nextInt();
            }
        }
        int n = fsc.nextInt();
        for (int i = 0; i < n; i++) {
            int b = fsc.nextInt();
            for (int r = 0; r < 3; r++) {
                for (int c = 0; c < 3; c++) {
                    if (a[r][c] == b) {
                        a[r][c] = -1;
                    }
                }
            }
        }
        for(int i=0;i<3;i++){
            if(a[i][0]<0&&a[i][1]<0&&a[i][2]<0){
                System.out.println("Yes");
                return;
            }
            if(a[0][i]<0&&a[1][i]<0&&a[2][i]<0){
                System.out.println("Yes");
                return;
            }
        }
        if(a[0][0]<0&&a[1][1]<0&&a[2][2]<0){
            System.out.println("Yes");
            return;
        }
        if(a[0][2]<0&&a[1][1]<0&&a[2][0]<0){
            System.out.println("Yes");
            return;
        }
        System.out.println("No");
    }
}


Measured memory_bytes: 22612
from sys import stdin
from itertools import groupby
n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
li.sort()
lin = []
for key, value in groupby(li):
    lin.append((key,len(list(value))))
if len(lin) == 1 and lin[0][1] == n and lin[0][0] == 0:
    print("Yes")
elif n%3 != 0:
    print("No")
elif len(lin) == 2:
    lin.sort()
    if lin[0][1] == n//3:
        print("Yes")
    else:
        print("No")
elif len(lin) == 3:
    if lin[0][1] == lin[1][1] == lin[2][1] and lin[0][0]^lin[1][0]^lin[2][0] == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr const char* NO = "IMPOSSIBLE";

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

int main(int argc, char* argv[]) {
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);

  ll diff = abs(A + B);
  if (diff % 2 == 1) {
    cout << NO << endl;
    return 0;
  }

  cout << diff / 2 << endl;
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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;
}

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
int i,r;
int kazu[26];
char c;
for(i=0;i<26;i++){
kazu[i]=0;
}
while(1){
scanf("%c",&c);
if(c=='\n'){
scanf("%c",&c);
if('A'>c||c>'z')break;
}
if('A'<=c&&c<='Z'){c=c-'A'+'a';}
if('a'<=c&&c<='z'){
kazu[c-'a']+=1;
}
}
for(i=0;i<26;i++){
printf("%c : %d\n",'a'+i,kazu[i]);
}
return 0;
}

Measured memory_bytes: 540
//AOJ 0554
#include <stdio.h>
main()
{
        int i,t,sum;

        for(i=0,sum=0;i<4;i++)
        {
                scanf("%d",&t);
                sum += t;
        }
        printf("%d\n",sum/60);
        printf("%d\n",sum%60);

        return(0);
}

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

using namespace std;

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

    vector<string> S(n);
    for (int i = 0; i < n; i++) {
        cin >> S[i];
    }

    vector<vector<int>> num(26, vector<int>(n));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < S[i].size(); j++) {
            char c = S[i][j];
            num[c - 'a'][i]++;
        }
    }

    for (int i = 0; i < 26; i++) {
        int r = *min_element(num[i].begin(), num[i].end());
        for (int j = 0; j < r; j++) {
            cout << (char)('a' + i);
        }
    }

    cout << endl;
    return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> v(n+1), w(n+1);
	rep(i, n) cin >> v[i+1] >> w[i+1];
	int q;
	cin >> q;
	rep(_, q) {
		int s, l;
		cin >> s >> l;
		vector<vector<P>> items(2);
		for(; s; s /= 2) {
			items[items[0].size() < 9 ? 0 : 1].emplace_back(w[s], v[s]);
		}
		vector<vector<P>> d(2);
		rep(t, 2) {
			vector<P> d1{{0, 0}};
			for(auto p: items[t]) {
				vector<P> d2;
				for(auto q: d1) {
					d2.emplace_back(p.first + q.first, p.second + q.second);
				}
				vector<P> nd{{0, 0}};
				int i1 = 1, i2 = 0;
				while(i2 < d2.size()) {
					P p = i1 < d1.size() && d1[i1] < d2[i2] ? d1[i1++] : d2[i2++];
					if (nd.back().first == p.first) nd.back().second = p.second;
					else if (nd.back().second < p.second) nd.push_back(p);
				}
				d1 = move(nd);
			}
			d[t] = move(d1);
		}
		int ans = 0;
		int j = d[1].size() - 1;
		rep(i, d[0].size()) {
			while(j >= 0 && d[0][i].first + d[1][j].first > l) j--;
			if (j < 0) break;
			chmax(ans, d[0][i].second + d[1][j].second);
		}
		cout << ans << endl;
	}
}

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

int main() {
   	int n;
   	cin>>n;
   	string s;
   	cin>>s;
   	
   	int totr=0,curr=0;
   	for(int i=0;i<n;i++)
   	{
   	    if(s[i]=='R')
   	    totr++;
   	}
   	curr=totr;
   	int res=0;
   	for(int i=0;i<n;i++)
   	{   
   	    if(curr==0)
   	    break;
   	    else
   	    {
   	        if(s[i]=='W')
   	        {
   	            curr--;
   	            res++;
   	        }
   	        else if(s[i]=='R')
   	        curr--;
   	    }
   	}
   	cout<<res<<endl;
}

Measured memory_bytes: 3744
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

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

    LL count = 1LL << m;
    LL each_time = 1900LL * m + 100LL * (n - m);
    cout << each_time * count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << (long double)(w*h/2.0) << " " 
       << ((w%2==0 and w/2==x) and (h%2==0 and h/2==y) ?1 :0) << "\n";
}

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

#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 VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;

int main(){FIN

    ll n;cin>>n;
    string s;cin>>s;
    
    ll mx = 0; 
    FOR(i,1,n-1){
        ll i1 = 0, i2 = i;

        ll cnt=0;
        while(i2<n){
            if(s[i1] == s[i2]) cnt++;
            else { 
                mx = max(mx,cnt);
                mx = min(mx,ll(i));
                cnt = 0;
            }
            i1++; i2++;
        }
        mx = max(mx,cnt);
        mx = min(mx,ll(i));
    }
    cout<<mx<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
#include <algorithm> 
#include<map>
#include<string>
#include<unordered_map>
#include <set>
#include <unordered_set>
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long long n;
	cin >> n;
	if (n == 0) {
		cout << 1;
	}
	else {
		cout << 0;
	}
	return 0;
}


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

xor_left = [0]
for a in A:
    xor_left.append(xor_left[-1] ^ a)
xor_left.append(0)

xor_right = [0]
for a in A[::-1]:
    xor_right.append(xor_right[-1] ^ a)
xor_right.append(0)
xor_right = xor_right[::-1]

ans = []
for i in range(1, N + 1):
    ans.append(xor_left[i - 1] ^ xor_right[i + 1])
print(*ans, sep=' ')


Measured memory_bytes: 136972
#include<bits/stdc++.h> 
using namespace std;
long long n,ans;
int s;
int main()
{
    scanf("%lld",&n);
    for(int i=sqrt(n);i>0;--i) 
    {
		if(n%i==0)
		{
            ans=n/i;
            break;
        }
    }
    while(ans>0)
	{
        ++s;
        ans/=10;
    }
    printf("%d\n",s); 
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdlib>
#include<math.h>
using namespace std;
int main(void){
    long long N,X,mtr;
    int a[N],min=1000000000;
    cin >> N >> X;
    for(int i=0;i<N;i++){
        cin >> a[i];
        if(min>a[i]){
            min=a[i];
        }
        X-=a[i];
    }
    int ans=N+(int)X/min;
    printf("%d",ans);
    return 0;
    
}

Measured memory_bytes: 764
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=998244353;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	int n,i,j,wa=0;cin>>n;
	llint ans=1;
	llint dp[45301]={0};
	llint ep[45301]={0};
	dp[0]=1;ep[0]=1;
	for(i=0;i<n;i++){
		int x;cin>>x;wa+=x;ans*=3;ans%=mod;
		for(j=min(45000,i*300);j>=0;j--){dp[j+x]+=dp[j]*2;dp[j+x]%=mod;ep[j+x]+=ep[j];ep[j+x]%=mod;}
	}
	//cerr<<"wa="<<wa<<endl;
	for(j=0;j<=wa/2;j++){ans-=dp[j]*3;ans%=mod;}
	if(wa%2==0){ans+=ep[wa/2]*3;}
	ans+=mod;ans%=mod;cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#else
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
 public:
  void solve() {
    i64 a, b, n;
    cin >> a >> b >> n;
    if (n >= b - 1) {
      cout << a - (a + b - 1) / b << '\n';
    } else {
      cout << (a * n) / b - a * (n / b) << '\n';
    }
  }
} NSPACE;
int main() {
  FPEN;
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  NSPACE.solve();
}

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

namespace ConsoleApp26 {
    class Program {
        static void Main(string[] args) {
            //int N = int.Parse(Console.ReadLine());

            //var x = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            string C = Console.ReadLine();

            string[] letter = new string[26] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};

            int num = Array.IndexOf(letter, C);



            Console.WriteLine(letter[num + 1]);


        }
    }
}


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

using namespace std;
using ll = long long;
using P = pair<int, int>;
#define all(c) (c).begin(), (c).end()
const int INF = (1 << 30) - 1;
const ll LINF = (1L << 62) - 1;
const ll MOD = 1000000007;
template <class T> inline void chmin(T& a, T& x) { a = a < x ? a : x; }
template <class T> inline void chmax(T& a, T& x) { a = a > x ? a : x; }

int n;
vector<string> ans;

void make(int k, int cnt, string s) {
  if (k == n) {
    ans.push_back(s);
    return;
  } else {
    for (int i = 0; i < cnt; ++i) {
      char c = (int)'a' + i;
      string t = s;
      t.push_back(c);
      make(k + 1, cnt, t);
    }
    char c = (int)'a' + cnt;
    string t = s;
    t.push_back(c);
    make(k + 1, cnt + 1, t);
    return;
  }
}

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

  cin >> n;
  string s = "a";
  make(1, 1, s);
  sort(all(ans));
  for (string t : ans) {
    cout << t << endl;
  }
  return 0;
}


Measured memory_bytes: 7796
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int N;
	cin >> N;

	for (int i = 1; i <= N; i++) {
		int t; cin >> t;
		int x; cin >> x;
		int y; cin >> y;
		if (t < (x + y)) {
			cout << "No";
			return 0;
		}
		else if ((t - x - y) % 2 == 1) {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
}

Measured memory_bytes: 256
n , y= map(int, input().split())

for i in range(n + 1):
    for j in range(n + 1 - i):
            if  10000 * i + 5000 * j + 1000 * (n - i - j) == y:
                print(i, j, n - i - j)
                exit()
                    
print(-1, -1, -1)        

Measured memory_bytes: 3060
# frozen_string_literal: true

s = gets.chomp
t = gets.chomp

h = {}

0.upto(s.size - 1) do |i|
  c = s[i]
  if h[c]
    h[c].push i
  else
    h[c] = [i]
  end
end
cycle = 0
p = -1
0.upto(t.size - 1) do |i|
  c = t[i]
  if h[c].nil?
    puts '-1'
    exit
  else
    np = h[c].bsearch { |e| e > p }
    if np.nil?
      np = h[c][0]
      cycle += 1
    end
    p = np
  end
end

puts cycle * s.size + p + 1


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

int main() {
    int n;
    string s, t;
    cin >> n >> s >> t;

    int ans = 2 * n;
    rep(offset, n) {
        int len = n - offset;
        string subs = s.substr(offset, len);
        string subt = t.substr(0, len);
        if (subs == subt) {
            ans = len + 2 * offset;
            break;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
#ifdef LOCAL_TEST
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    double r, g;
    cin >> r >> g;
    cout << 2 * g - r << endl;
    return 0;
}

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

 
int main(){
  int n,m,s=0;
  cin >> n >> m;
  vector<int> a(m);
  for(int i=0; i<m; i++){
    cin >> a.at(i);
  }
  for(int i=0; i<m; i++){
    s+=a.at(i);
  }
  if(n-s>=0){
    cout << n-s << endl;
  }
  if(n-s<0){
    cout << "-1" << endl;
  }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    string temp;
    map <string,int> mp;
    for(int i=0;i<N;i++){
        cin>>temp;
        mp[temp]++;
    }
    cout<<mp.size()<<endl;
    
    return 0;
}


Measured memory_bytes: 19228
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	vector<vector<int> > G(n);
	vector<int> c(n), d(n);
	for(int i = 0; i < n - 1; ++i) {
		int u, v;
		cin >> u >> v;
		--u;
		--v;
		G[u].emplace_back(v);
		G[v].emplace_back(u);
		++d[u];
		++d[v];
	}
	for(int i = 0; i < n; ++i) {
		cin >> c[i];
	}
	set<pair<int, int> > s;
	for(int i = 0; i < n; ++i) {
		s.emplace(d[i], i);
	}
	sort(c.begin(), c.end());
	long long sum = 0;
	vector<int> ans(n);
	for(int i = 0; i < n; ++i) {
		auto o = *s.begin();
		int w = o.first, u = o.second;
		s.erase(s.begin());
		sum += 1LL * w * c[i];
		ans[u] = c[i];
		for(auto v : G[u]) {
			if(s.find({d[v], v}) != s.end()) {
				s.erase({d[v], v});
				--d[v];
				s.emplace(d[v], v);
			}
		}
	}
	cout << sum << '\n';
	for(auto u : ans) {
		cout << u << ' ';
	}
	cout << '\n';
	return 0;
}

Measured memory_bytes: 1536
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

// dp[i][j] := i番目の商品までを用いたときの，重さj以下における価値の最大
int dp[101][10001];


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int W; cin >> W;
    int w[n], v[n];
    rep(i, n) cin >> v[i] >> w[i];

    rep(i, n) {
        REP(j, 0, 10000) {
            dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
            if (j+w[i] <= 10000)
                dp[i+1][j+w[i]] = max(dp[i+1][j+w[i]], max(dp[i][j+w[i]], dp[i][j] + v[i]));
        }
    }
    //rep(j, n+1) rep(i, W+1) cout << "dp[" << j << "][" << i << "] = " << dp[j][i] << endl;
    cout << dp[n][W] << endl;


    return 0;
}



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

int main(){
    int n,d;
    cin >> n >> d;
    int kotae;
    kotae=(n-1)/(d*2+1);
    kotae++;
    cout << kotae << endl;

    return 0;
}

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

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

template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

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

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

int N;

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

    cin >> N;

    vector<int> ans(10010, 0);
    for(int x = 1; x <= 100; ++x) {
        for (int y = 1; y <= 100; ++y) {
            for (int z = 1; z <= 100; ++z) {
                int n = x * x + y * y + z * z + x * y + y * z + z * x;
                if(n <= 10000) {
                    ans[n]++;
                }
            }
        }
    }

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

    return 0;
}



Measured memory_bytes: 3732
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		new Main().run();
	}
	public void run(){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int count = 0;
		int a = 0;
		while(n > 1){
			if(n <= 3){
				count++;
				break;
			}
			a = (int)(0.5 + ((double)n/3.0));
			n = Math.max(a,n-(2*a));
			count++;
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 17236
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>
#include <cstring>

#define nl '\n'

using namespace std;

string n;
int x;

int main(){

    cin >> n;

    for(int i = 0; i < n.length(); i++){
        x = x + (n[i]-'0');
    }

    if(stoi(n, nullptr, 10) % x == 0){
        cout << "Yes";
        return 0;
    }

    cout << "No";
}

//g++ -std=c++14 comp.cpp -o b; ./b.exe
//g++ -std=c++14 comp.cpp && ./a.out

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){

  int a,b,c;
  int i;
  cin >>a>>b>>c;
  
  int x=0,x2=a;
  int cnt=0;
  int ans=c;
  while(1){
    if(cnt > 60){
      cout <<"-1"<<endl;
      break;
    }
    if(ans < x){
      ans+=60;
    }
    if(x <= ans && ans <= x2){
      cout <<ans<<endl;
      break;
    }else{
      x=x2+b;
      x2=x+a;
    }
    cnt++;
  }
  
  return 0;
}

Measured memory_bytes: 1164
#include <stdio.h>
#include <stdlib.h>

int po(int n)
{
    int a=n,m=0;
    while(n)
    {
        m=m*10+n%10;
        n/=10;
    }
    if(m==a)
        return 1;
    else
        return 0;
}
int main()
{
    int i,n,m,c;
    while(scanf("%d %d",&n,&m)==2)
    {
        for(i=n,c=0; i<=m; i++)
        {
            if(po(i))
                c++;
        }
        printf("%d\n",c);
    }
    return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define MOD ((int)(1e9) + 7)
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define filename "lynext"
#define freop freopen(filename ".cik","w",stdout);freopen(filename ".gir","r",stdin)
const long long int N = ((long long int)2e3) + 5;
const long long int M = ((long long int)1e3) + 5;
const long long int llinf = (long long int)1e18;
const int inf = INT_MAX;
typedef long long int lli;

lli n, x;
lli arr[N];
lli tut[N];
lli ans = llinf;

int main ()
{
	fast;
	//freop;
	cin >> n >> x;
	for (lli i = 1; i <= n; i++)
	{
		cin >> arr[i];
		tut[i] = llinf;
	}
	for (lli k = 0; k < n; k++)
	{
		for (lli i = 1; i <= n; i++)
		{
			lli ind = i - k;
			ind += n;
			ind %= n;
			ind++;
			tut[i] = min(tut[i], arr[ind]);
		}
		lli a = 0;
		for (lli i = 1; i <= n; i++)
		{
			a += tut[i];
		}
		ans = min(ans,a + (k * x));
	}
	cout << ans << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int main(){
  IOS();
  int n;
  cin>>n;
  if( n==1 ) return cout<<"Hello World"<<endl,0;
  int a,b;
  cin>>a>>b;
  cout<<a+b<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

signed main(){
	int n;
	scanf("%lld", &n);
	rep(i,n){
		int x, y, z, ans = 0, a[3] = {};
		rep(j,3)scanf("%lld", &a[j]);
		int mn = *min_element(a, a+3);
		ans += mn;
		rep(j,3)a[j] -= mn;
		mn = min(a[0]/2, a[1]);
		a[0] -= mn*2;a[1] -= mn;
		ans += mn;
		ans += a[0]/3;
		printf("%lld\n", ans);
		//printf("*%lld*\n", mn);
	}
	return 0;
}








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

int main(int argc, char const* argv[])
{
    int a, b;
    cin >> a >> b;
    if (a <= b) {
        for (int i = 0; i < b; i++) {
            cout << a;
        }
        cout << endl;
    } else {
        for (int i = 0; i < a; i++) {
            cout << b;
        }
        cout << endl;
    }
    return 0;
}


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

int main(void){
  char s[10];
  int i,j,count;
  scanf("%s",s);
  for(i=0;i<strlen(s);i++){
    count = 0;
    for(j=0;j<strlen(s);j++){
      if(s[i]==s[j]) count++;
    }
    if(count!=2){
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
int main() {
	int n;
	while (std::cin >> n, n) {
		int asum = 0, bsum = 0, a, b;
		for (int i = 0; i < n; i++) {
			std::cin >> a >> b;
			if (a > b)
				asum += a + b;
			else if(a < b)
				bsum += a + b;
			else {
				asum += a;
				bsum += b;
			}
		}
		std::cout << asum << " " << bsum << std::endl;
	}
	return 0;
}

Measured memory_bytes: 2996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  
  ll N;
  cin>>N;
  
  vector<ll>a(N);
  vector<ll>S(9);
  
  
  rep(i,N){
    cin>>a[i];
    
    if(a[i]<400){
      S[0]++;
    }
    else if(a[i]<800){
      S[1]++;
    }
    else if(a[i]<1200){
      S[2]++;
    }
    else if(a[i]<1600){
      S[3]++;
    }
    else if(a[i]<2000){
      S[4]++;
    }
    else if(a[i]<2400){
S[5]++;
    }
    else if(a[i]<2800){
      S[6]++;
    }
    else if(a[i]<3200){
      S[7]++;
    }
    else{
S[8]++;
    }    
  }
  ll sum=0;
rep(i,8){
  if(S[i]>0){
    sum++;
  }
}
  
  if(sum==0){
cout<<1<<" "<<S[8]<<endl;
  }

  else{
cout<<sum<<" "<<sum+S[8]<<endl;
  }
}

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

using namespace std;

constexpr int64_t MOD = 1000000007;

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

    bool is_one = true;
    vector<int64_t> A(N);
    for (int64_t i = 0; i < N; i++) {
        cin >> A[i];
        if (A[i] != i) {
            is_one = false;
        }
    }

    if (is_one) {
        cout << 3 << endl;
        return 0;
    }

    vector<int64_t> num(3, 0);
    int64_t ans = 1;
    for (int64_t i = 0; i < N; i++) {
        int64_t same_num = 0;
        for (int64_t j = 0; j < 3; j++) {
            if (num[j] == A[i]) {
                same_num++;
            }
        }
        (ans *= same_num) %= MOD;

        for (int64_t j = 0; j < 3; j++) {
            if (num[j] == A[i]) {
                num[j]++;
                break;
            }
        }
    }

    cout << ans % MOD << endl;
}

Measured memory_bytes: 1024
#include <cstdio>

int main()
{
    int W,H,x,y,r;
    scanf("%d",&W);
    scanf("%d",&H);
    scanf("%d",&x);
    scanf("%d",&y);
    scanf("%d",&r);
    if(x < r || y < r || x + r > W || y + r > H)
    {
        printf("No\n");
    }
    else
    {
        printf("Yes\n");
    }
    return 0;
}

Measured memory_bytes: 2688
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    string S;
    cin >> S;
    if (S == "Sunny") cout << "Cloudy" << endl;
    else if (S == "Cloudy") cout << "Rainy" << endl;
    else cout << "Sunny" <<endl;
    return 0;
}


Measured memory_bytes: 256
n,m = gets.split(" ").map(&:to_i)
matrix = Array.new(n).map{Array.new(m)}
vec = Array.new(m)
c = Array.new(n,0)

for i in 0..(n-1)
    matrix[i] = gets.split(" ").map(&:to_i)
end
for j in 0..(m-1)
    vec[j] = gets.to_i
end

for i in 0..(n-1)
    for j in 0..(m-1)
        c[i] += matrix[i][j] * vec[j]
    end
end

c.each do |ci|
    puts ci
end

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

using namespace std;
#define X first
#define Y second
#define pb push_back
typedef double db;
typedef long long ll;
typedef pair<int,int> P;
int a,b,cnt[5];

int main()
{
    for(int i=1;i<=3;i++)
    {
        scanf("%d%d",&a,&b);
        cnt[a]++;cnt[b]++;
    }
    for(int i=1;i<=4;i++)
        if(!cnt[i]||cnt[i]>2) return puts("NO"),0;
    puts("YES");
    return 0;
}

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

int main()
{
  int L;
  cin >> L;
  
  long double vol = 0;
  if( L % 3 == 0){
    vol = (long double)((L / 3) * (L / 3) * (L / 3));
  }else{
    vol = (long double)(((long double)L / 3.00000000000) * ((long double)L / 3.0000000000000) * ((long double)L / 3.00000000000)); 
  }
  
  cout << fixed;
  cout << setprecision(20);
  cout << (long double)vol << endl;
}

Measured memory_bytes: 3788
i = list(map(int, input().split()))
n,m,k = i[0], i[1], i[2]

A = list(map(int, input().split()))
B = list(map(int, input().split()))

a,b = [0],[0]

for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])

ans, j = 0,m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j]>k-a[i]:
        j -= 1
    ans = max(ans,i+j)
print(ans)

Measured memory_bytes: 47556
#include<iostream>
using namespace std;
 
int main(void)
{
  int w=0;
  while(1){
    cin >> w;
    if(w <= -1) break;
    else{
      if(w >= 0 && w < 10){
        w = 0;
      }
      else if(w >= 10 && w < 20){
        w -=10;
        w *= 125;
      }
      else if(w >= 20 && w < 30){
        w -=20;
        w *= 140;
        w +=1250;
      }
      else if(w >= 30 && w < 40){
        w -=30;
        w *= 160;
        w += 2650;
      }
      else if(w >= 40 && w <= 100){
        w -=40;
        w *= 160;
        w += 4250;
      }
      w+= 1150;
      cout << 4280-w << endl;
    }
 
  }
}
 
 

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

int main() {
int a, b;
  cin >> a >> b;
  if( !(a % 2 == 0) && !(b % 2 == 0) ){
    cout << "Odd" << endl;
  }
  else
  {
    cout << "Even";
  }
     
}


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

using namespace std;

int main(void) {
    int A;
    cin >> A;
    int B;
    cin >> B;

    if (B == 1) {
        cout << 0 << endl;
        return 0;
    }
    
    int cnt = 1;
    int now = A;
    while (now < B) {
        now += A - 1;
        cnt++;
    }

    cout << cnt << endl;
}


Measured memory_bytes: 256
def main():
    n, q = map(int, input().split())
    s = input()

    # 累積出現数を格納: 指定される番号が1始まりなのでズラして格納
    p = [0] * (n+1)
    for i in range(n):
        p[i+1] = p[i] + (1 if s[i:i+2] == "AC" else 0)

    for i in range(q):
        l, r = map(int, input().split())
        # 終端(=l-1)から始端-1(=r-1)の累積出現数を引いた数が指定区間内での出現回数
        print(p[r-1] - p[l-1])


if __name__ == '__main__':
    main()

Measured memory_bytes: 7748
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define print(n) cout << n << endl
#define YN(c) (c)?(print("YES")):(print("NO"))
#define Yn(c) (c)?(print("Yes")):(print("No"))
#define yn(c) (c)?(print("yes")):(print("no"))
#define in(v) int v; cin >> v
#define vint vector<int>
#define pb push_back
typedef long long int ll;

int main(){
  in(n);set<string> s;
  rep(i,n){
    string st;
    cin>>st;
    s.insert(st);
  }
  print(s.size());
  return 0;
}

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

int main() {
	int N;
	cin >> N;
	vector <long long> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	vector<int> BuySell(N, 0);
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			if (A[i] < A[j]) { //上がるなら売るな（買え）
				BuySell[i] = 1;
				break;
			}
			if (A[i] > A[j]) { //下がるかそのままなら売れ（次で買え）
				BuySell[i] = 0;
				break;
			}
		}
	}
	long long money = 1000, stock = 0;
	for (int i = 0; i < N; i++) {
		if (BuySell[i]) {
			long long buy = money / A[i];
			if (buy > 0) {
				stock += buy;
				money -= buy * A[i];
			}
		}
		else {
			money += stock * A[i];
			stock = 0;
		}
	}
	cout << money << endl;
}

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

int main() {
  int A , B  ;
  cin >> A >> B ; 
  
  if((A*B) % 2 == 0  ){
    cout << "No" << endl ; 
  }
  else{
   cout << "Yes" << endl ; 
  }
  
  
}


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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

template<typename T>
T vec_sum(V<T> v, T init_val=0){return accumulate(ALL(v),T(init_val));}

template<typename A>
void UNIQUE(vector< A > &a,int mode=0){
    if(mode==0){ sort(ALL(a),greater< A >());}else{ sort(ALL(a));}
    a.erase(unique(ALL(a)),a.en());
}

LL f(LL num, LL end_num, Vll &pool){
    if(num > 3234566667) return -1;
    pool.pb(num);
    LL s = end_num-1;
    LL e = end_num+1;
    if(s<0) s = 0;
    if(e>=10) e = 9;
    for(LL i = s; i<=e; i++){
        f(stoll(to_string(num)+to_string(i)),i,pool);
    }
}

int main(){
    LL K;
    cin>>K;
    Vll pool;
    REP(i,9){
        f(i+1,i+1,pool);
    }
    sort(ALL(pool));
    cout<<pool[K-1]<<endl;
    return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}

int main(){
    ll N;
    cin >> N;
    vector<ll> a(N);//,dp(1000000);
    rep(i,N){
        cin >> a[i];
    }
    ll b = ((N%2)?0:1);
    ll cnt = 0;
    rep(i,N){
        if(a[i]%2==0){
            cnt++;
        }
    }
    if(cnt != N){
        cout << "first" << endl;
    }else{
        cout << "second" << endl;
    }

}

Measured memory_bytes: 1024
time_list = [int(input()) for _ in range(5)]

new_list = []
for i in range(5):
    time = time_list[i]
    amari = 10 - int(str(time_list[i])[-1])
    if amari == 10:
        amari = 0
    new_list.append((time, amari))

new_list = sorted(new_list, key=lambda x: x[1])

total = 0
for i in range(4):
    total += new_list[i][0]
    total += new_list[i][1]

total += new_list[4][0]
print(total)


Measured memory_bytes: 9076
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int m = scanner.nextInt();

        final Pair[] pairs = new Pair[m];
        for (int i = 0; i < m; i++) {
            pairs[i] = new Pair(scanner.nextInt() - 1, scanner.nextInt());
        }

        if (n == 1) {
            for (int i = 0; i <= 9; i++) {
                if (isValid(i, pairs)) {
                    System.out.println(i);
                    return;
                }
            }
        } else if (n == 2) {
            for (int i = 10; i <= 99; i++) {
                if (isValid(i, pairs)) {
                    System.out.println(i);
                    return;
                }
            }
        } else {
            for (int i = 100; i <= 999; i++) {
                if (isValid(i, pairs)) {
                    System.out.println(i);
                    return;
                }
            }
        }
        System.out.println(-1);
    }

    private static boolean isValid(final int i, final Pair[] pairs) {
        final String str = String.valueOf(i);
        for (final Pair pair : pairs) {
            if (str.charAt(pair.s) - '0' != pair.c) {
                return false;
            }
        }

        return true;
    }

    static class Pair {
        int s;
        int c;

        Pair(final int s, final int c) {
            this.s = s;
            this.c = c;
        }
    }
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    int N, M, P; cin >> N >> M >> P;
    vector<Int> A(M), B(M), C(M);
    for (int i = 0; i < M; i++) {
        cin >> A[i] >> B[i] >> C[i];
        A[i]--, B[i]--;
        C[i] = P - C[i];
    }
    const Int INF = 1e18;
    vector<Int> dist(N, INF);
    dist[0] = 0;
    for (int i = 0; i < N-1; i++) {
        for (int j = 0; j < M; j++) {
            if (dist[A[j]] == INF) continue;
            dist[B[j]] = min(dist[B[j]], dist[A[j]] + C[j]);
        }
    }
    Int distN = dist[N-1];
    for (int i = 0; i < N-1; i++) {
        for (int j = 0; j < M; j++) {
            if (dist[A[j]] == INF) continue;
            dist[B[j]] = min(dist[B[j]], dist[A[j]] + C[j]);
        }
    }
    if (distN > dist[N-1]) {
        cout << -1 << endl;
    } else {
        cout << max(0LL, -dist[N-1]) << endl;
    }
    return 0;
}


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

int main() {
  int N, L;
  cin >> N >> L;
  string A[N];
  rep(i,N) cin >> A[i];
  sort(A, A + N);
  rep(i,N) cout << A[i];
  cout << endl;
}

Measured memory_bytes: 256