akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		int K = int.Parse(str[1]);
		string[] str2 = Console.ReadLine().Split();
		int[]C = new int[N];
		for(var i=0;i<N;i++){
			C[i] = int.Parse(str2[i]);
		}
		int ct = 0;
		int act = 0;
		int[]E = new int[N];
		for(var i=1;i<K;i++){
			if(C[i]<C[i-1]){
				ct++;
			}
		}
		if(ct==0){
			act++;
			E[K-1] = 1;
		}
		for(var i=K;i<N;i++){
			if(C[i]<C[i-1]){
				ct++;
			}
			if(C[i-K+1]<C[i-1-K+1]){
				ct--;
			}
			if(ct==0){
				act++;
				E[i] = 1;
			}
		}
		int ans = N-K+1;
		if(act>=1){
			ans -= act-1;
        }
		var pq = new PriorityQueue<int>((x,y)=>y-x);
		var pq2 = new PriorityQueue<int>();
		for(var i=0;i<K;i++){
			pq.Enqueue(C[i]);
			pq2.Enqueue(C[i]);
		}
		int act2 = 0;
		int[]D = new int[N];
		for(var i=K;i<N;i++){
			while(true){
				if(D[pq2.heap[0]]==1){
                  	int a1 = pq2.Dequeue();
                } else {
                  	break;
                }
            }
			while(true){
				if(D[pq.heap[0]]==1){
					int a1 = pq.Dequeue();
                } else {
                  	break;
                }
            }
			if(C[i]>pq.heap[0]){
				if(C[i-K]==pq2.heap[0]){
					if(E[i]==0){
						act2++;
					}
                }
            }
			pq.Enqueue(C[i]);
			pq2.Enqueue(C[i]);
			D[C[i-K]] = 1;
		}
		ans -= act2;
		Console.WriteLine(ans);
	}
}

class PriorityQueue<T>
{
    public List<T> heap;
    private readonly Comparison<T> compare;
    public int size;
    public PriorityQueue() : this(Comparer<T>.Default) {} 
    public PriorityQueue(IComparer<T> comparer) : this(16, comparer.Compare) { }
    public PriorityQueue(Comparison<T> comparison) : this(16, comparison) { }
    public PriorityQueue(int capacity, Comparison<T> comparison)
    {
        this.heap = new List<T>(capacity);
        this.compare = comparison;
    }
    public void Enqueue(T item)
    {
        this.heap.Add(item);
        var i = size++;
        while (i > 0)
        {
            var p = (i - 1) >> 1;
            if (compare(this.heap[p], item) <= 0)
                break;
            this.heap[i] = heap[p];
            i = p;
        }
        this.heap[i] = item;

    }
    public T Dequeue()
    {
        var ret = this.heap[0];
        var x = this.heap[--size];
        var i = 0;
        while ((i << 1) + 1 < size)
        {
            var a = (i << 1) + 1;
            var b = (i << 1) + 2;
            if (b < size && compare(heap[b], heap[a]) < 0) a = b;
            if (compare(heap[a], x) >= 0)
                break;
            heap[i] = heap[a];
            i = a;
        }
        heap[i] = x;
        heap.RemoveAt(size);
        return ret;
    }
    public T Peek() { return heap[0]; }
    public int Count { get { return size; } }
    public bool Any() { return size > 0; }
}

Measured memory_bytes: 34592
#include<stdio.h>
int main(void){
    char c;
    int f=0;
    while(scanf("%c",&c)!=EOF){
        if(c=='Y'){
            f=1;
        }
    }
    if(f==1){
        printf("Four\n");
    }else{
        printf("Three\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;

const int MAX_E = 1e5 + 10;
const int MAX_V = 1e5 + 10;
const long long INF = 1e18;
struct edge{ int to, cost; };
typedef pair<int, int> P;
vector<edge> G[MAX_V + 10];
long long d[MAX_V + 10];
int V, E;

void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P>> que;
    for (int i = 1; i <= V; ++i) d[i] = INF;
    d[s] = 0;
    que.push(P(0,s));

    while(!que.empty()){
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (int i = 0; i < G[v].size(); ++i){
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}


int main(){

    cin >> V;
    E = V-1;
    for (int i = 0; i < E; ++i){
        int a, b, c;
        cin >> a >> b >> c;
        G[a].push_back(edge{b,c});
        G[b].push_back(edge{a,c});
    }

    int s = 1;
    dijkstra(s);

    for (int i = 1; i <= V; i++){
		cout << d[i] % 2 << endl;    		
    }
    return 0;
}

Measured memory_bytes: 7168
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int p=sc.nextInt();
    int q=sc.nextInt();
    int r=sc.nextInt();
    int x,y,z;
    x=p+q;
    y=q+r;
    z=r+p;
    if(x<=y&&x<=z){
      System.out.println(x);
    }
    if(y<=x&&y<=z&&x!=y){
      System.out.println(y);
    }
    if(z<=x&&z<=y&&z!=x&&z!=y){
      System.out.println(z);
    }
  }
}


Measured memory_bytes: 23252
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		long d = sc.nextLong();
		long e = sc.nextLong();

		long min = Math.min(Math.min(a, b), Math.min(c, Math.min(d, e)));

		if (n <= min) {
			System.out.println(5);
		} else {
			System.out.println((long)Math.ceil((double)n / min) + 4);
		}


		sc.close();

	}

}

Measured memory_bytes: 35676
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>

#define author int
#define sph_mp main() 
#define fr(i, a, b) for((i) = (a) ; (i) < (b) ; (i)++)
#define frr(i, a, b) for((i) = (a) ; (i) >= (b) ; (i)--)

typedef long long ll;
typedef unsigned long long ull;
int i, j, k, m;

int a, b;

author sph_mp {
//	freopen("input.in", "r", stdin);
	scanf("%d %d", &a, &b);
	if(a <= 8 && b <= 8) printf("Yay!");
	else printf(":(");
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

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

        for(int i = 0; i <= n; i++) {
        	for(int j = 0; j <= m; j++) {
        		if(k == i * (m - j) + j * (n - i)) {
        			System.out.println("Yes");
        			return;
        		}
        	}
        }

        System.out.println("No");
    }
}


Measured memory_bytes: 21844
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = l[0], M = l[1];
            
            var uf = new UnionFind(N+1);
            for (var i = 0; i < M; i++) {
               var t = Console.ReadLine().Split().Select(int.Parse).ToArray();
               uf.Union(t[0], t[1]);
            }
            
            var ans = 0;
            foreach (var i in Enumerable.Range(1, N)) {
                if (i == uf.Find(i)) ans++;
            }
            
            Console.WriteLine(ans);
        }
    }

    class UnionFind
    {
        public int[] Parents { get; set; }
        public UnionFind(int n)
            {
            this.Parents = new int[n];
            for (int i = 0; i < n; i++)
            {
                this.Parents[i] = -1;
            }
        }

        public int Find(int x)
        {
            if (this.Parents[x] < 0) return x;
            this.Parents[x] = Find(this.Parents[x]);
            return this.Parents[x];
    }

        public int Size(int x)
        {
            return -this.Parents[this.Find(x)];
        }

        public bool Same(int x, int y)
        {
            return this.Find(x) == this.Find(y);
        }

        public bool Union(int x, int y)
        {
            x = this.Find(x);
            y = this.Find(y);
            if (x == y) return false;

            if (this.Size(x) < this.Size(y))
            {
                var tmp = x;
                x = y;
                y = tmp;
            }
            this.Parents[x] += this.Parents[y];
            this.Parents[y] = x;
            return true;
        }
    }
}


Measured memory_bytes: 17632
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
A = list(map(int, input().split()))
B = sorted(list(map(int, input().split())))

from bisect import bisect_left, bisect_right
from copy import copy

ans = 0
for k in range(38):
    mod = 2**(k+1)
    T = 2**k
    A_sub = [ [], [] ]
    B_sub = [ [], [] ]
    for a in A:
        A_sub[ (a & (1<<k))>>k].append(a)
    for b in B:
        B_sub[ (b & (1<<k))>>k].append(b)

    A = sum(A_sub, [])
    B = sum(B_sub, [])

    itr = [N]*4
    count = 0
    mask = 2**(k+1)-1
    amask = [ai & mask for ai in A]
    bmask = [bi & mask for bi in B]
    for ai in amask:
        border = [
                T - ai,
                2*T - ai,
                3*T - ai,
                4*T - ai]
        for i in range(4):
            while 0 < itr[i]  and border[i] <= bmask[itr[i]-1]:
                itr[i] -= 1
        count += (itr[1] - itr[0]) + (itr[3]) - (itr[2])


    # Bcopy = list(map(lambda x: x%mod, B))

    # count = 0
    # for a in A:
    #     a = a % mod
    #     i1 = bisect_left(Bcopy, T-a)
    #     i2 = bisect_right(Bcopy, 2*T-a-1 )
    #     i3, i4 = bisect_left(Bcopy, 3*T-a), \
    #              bisect_right(Bcopy, 4*T-a-1)
    #     count += i2 - i1 + i4 - i3
    #     # print("T: {}, a: {} , i1,i2,i3,i4: {}, Bcopycopy: {}, T-a: {}, 2*T-a: {}".format(T,a, [i1,i2,i3,i4], Bcopy,
    #     #          T-a, 2*T-a))
    if not count % 2 == 0:
        ans |= 1<<k
print(ans)
        


Measured memory_bytes: 145108
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()

#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
#define MAX_N (100001)
typedef long long ll;

using namespace std;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s; cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
	else cout << "No" << endl;

}

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

if x == 0:
    print(sum(A))
    exit()

count = 0
for i in range(N - 1):
    d = A[i] + A[i + 1] - x
    if d <= 0:
        continue
    if A[i + 1] >= d:
        A[i + 1] -= d
        count += d
    else:
        count += d
        A[i] = d - A[i + 1]
        A[i + 1] = 0


print(count)


Measured memory_bytes: 20000
#include <iostream>
#include <algorithm>

using namespace std;

int n, q;
int s[1000010];
int t;
int sum = 0;

int binary(int t)
{
    int right = n;
    int left = 0;
    while(left < right)
    {
        int mid = (left + right) / 2;

        if(s[mid] == t)
            return 1;
        else if (t < s[mid])
            right = mid;
        else 
            left = mid + 1;
    }

    return 0;

}

int main()
{
    cin >> n;   
    for(int i = 0; i < n; i++)
        cin >> s[i];
    
    cin >> q;
    for(int i = 0; i < q; i++)
    {
        cin >> t;
        sum += binary(t);
    }

    cout << sum << endl;

    return 0;
}

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl

ll N, P;

int main() {
	ll a = 1;
	cin >> N >> P;
	if (N == 1) {
		cout << P << endl;
		return 0;
	}

	for (ll i = 2; i * i <= P; ++i) {
		if (P % i == 0) {
			int c = 0;
			while (P % i == 0) {
				P /= i;
				++c;
			}
			c /= N;
			rep(tt, c) {
				a = a * i;
			}
		}
	}
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> v(N);
    for(int i = 0;i < N;i++) cin >> v[i];
    int sum = accumulate(v.begin(),v.end(),0);
    int ssum = 0;
    int mindif = 1 << 10;
    for(int i = 0;i < N;i++)
    {
        ssum += v[i];
        mindif = min(mindif,abs(ssum - (sum - ssum)));
    }
    cout << mindif << '\n';
}

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

using namespace std;

int N, C, D[ 31 ][ 31 ], c[ 501 ][ 501 ], wrongness[ 3 ][ 31 ]; bitset< 31 > selected; 

int min_wrongness( int i = 0, int k = 0 )
{
    int l = i + 1, min_value = INT_MAX; 
    
    for( int c = 1; c <= C; c++ )
        if ( !selected[ c ] )
        {
            int m = k + wrongness[ i ][ c ];

            if ( l < 3 )
                selected.set( c ), m = min_wrongness( l, m ), selected.reset( c );
                
            min_value = min( min_value, m );
        }
            
    return min_value;
}

struct c_count_t: map< int, int > 
{
    int wrongness( int color ) const 
    {
        int total = 0;
        
        for( auto p: *this )
            total += p.second * D[ p.first ][ color ];
        
        return total; 
    }
    
} c_count[ 3 ];

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

    cin >> N >> C; int color; 

    for( int i = 1; i <= C; i++ )
        for( int j = 1; j <= C; j++ )
            cin >> D[ i ][ j ];
    
    for( int i = 1; i <= N; i++ )
        for( int color, j = 1; j <= N; j++ )
            cin >> color, c_count[ ( i + j ) % 3 ][ c[ i ][ j ] = color ]++;

    for( int i = 0; i < 3; i++ )
        for( int color = 1; color <= C; color++ )
            wrongness[ i ][ color ] = c_count[ i ].wrongness( color );
    
    cout << min_wrongness();
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a + b > c + d) {
    cout << "Left" << endl;
  }
  else if (a + b == c + d) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
  return 0;
}

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

int main()
{
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
    #endif

    	int r;
    	cin>>r;
    	cout<<2*M_PI*r<<endl;
}

Measured memory_bytes: 3796
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        try (CustomReader in = new CustomReader()) {
            new Main().execute(in);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void execute(CustomReader in) throws IOException {
        Scanner sc = new Scanner(in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        if (A < 6) {
            System.out.println(0);

        }else if (6<=A && A<=12){
            System.out.println(B / 2);
        }else{
            System.out.println(B);
        }

    }

    static class CustomReader extends BufferedReader {

        public CustomReader() throws IOException {
            super(new InputStreamReader(System.in));
        }

        public int[] readLineAsIntArray() throws IOException {
            String[] strArray = this.readLine().split(" ");
            int[] intArray = new int[strArray.length];
            for (int i = 0, n = strArray.length; i < n; i++) {
                intArray[i] = Integer.parseInt(strArray[i]);
            }
            return intArray;
        }

        public int[][] readAsIntMatrix(int rows, int columns) throws IOException {
            int[][] matrix = new int[rows][columns];
            for (int i = 0; i < rows; i++) {
                String[] r = this.readLine().split(" ");
                for (int j = 0; j < columns; j++) {
                    matrix[i][j] = Integer.parseInt(r[j]);
                }
            }
            return matrix;
        }

    }
}

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

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto A = RD-1;
	auto B = RD;
	auto C = RD;
	auto D = RD;

	auto cnt1 = B / C;
	auto cnt2 = B / D;
	auto cnt3 = B / lcm(C, D);
	auto cnt4 = A / C;
	auto cnt5 = A / D;
	auto cnt6 = A / lcm(C, D);
	auto ans = B - (cnt1 + cnt2) + cnt3;
	ans -= A - (cnt4 + cnt5) + cnt6;

	writeln(ans);
	stdout.flush();
	debug readln();
}

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

int amx[10001],amn[10001];
int main(){
    int n,m;
    while(cin>>n>>m,n|m){
        memset(amx,0,sizeof(amx));
        memset(amn,0,sizeof(amn));
        int s,k,c;
        rep(i,m){
            cin>>s>>k;
            rep(j,k){
                cin>>c;
                --c;
                if(k==1) amx[c]+=s,amn[c]+=s;
                else amx[c]+=s;
            }
        }
        int mx=0,mn=1000100010,ans=0;
        rep(i,n){
            ans=max(ans,amx[i]-mn);
            ans=max(ans,-amn[i]+mx);
            mx=max(mx,amx[i]);
            mn=min(mn,amn[i]);
        }
        cout<<ans+1<<endl;
    }
    return 0;
}


Measured memory_bytes: 3164
import sys
input = sys.stdin.readline

N, X, = map(int, input().split())
L = [int(v) for v in input().split()]

t = 0
c = 0
for v in L:
    if t <= X:
        c += 1
        
    t += v
    
if t <= X:
    c += 1
    
print(c)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

bool isprime(ll n) {
  if (n <= 1) return false;
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) {
      return false;
    }
  }
  return true;
}

template<class T>
struct CumulativeSum {
  vector<T> v;

  CumulativeSum(size_t n) : v(n+1) {};
  CumulativeSum(vector<T> v_) : v(v_) {
    v.push_back(T());
  };

  void add(size_t i, T x) {
    v[i] += x;
  }

  // O(N)
  void build() {
    for (size_t i = v.size()-1; i > 0; i--)
      v[i-1] += v[i];
  }

  // O(1) sum [l, r]
  T sum(size_t l, size_t r) const {
    return v[l]-v[r+1];
  }

  // O(1) sum [0, r]
  T sum(size_t r) const {
    return sum(0, r);
  }
};

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

  ll q;
  cin >> q;
  vl l(q), r(q);
  rep(i, q) {
    cin >> l[i] >> r[i];
  }

  constexpr ll n = 1e5+1;
  CumulativeSum<int> cs(n);
  rep(i, n) {
    if (isprime(i) && isprime((i+1)/2)) cs.add(i, 1);
  }

  cs.build();
  rep(i, q) {
    cout << cs.sum(l[i], r[i]) << endl;
  }
}


Measured memory_bytes: 2560
def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a
def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod
def cmb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod
def main():
    x,y=sorted(map(int,input().split()))
    if (x+y)%3!=0:
        print(0)
        return
    if y>2*x:
        print(0)
        return
    m=(x+y)//3
    a,b=x-m,y-m
    print(cmb(a+b, a,10**9+7))
    
main()

Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
 int i,j,n,taro_p=0,hana_p=0;
 char taro[101], hana[101]; scanf("%d", &n);
 for(i=0;i<n;i++){ scanf("%s %s", taro, hana);
 for(j=0;;j++){ if(taro[j] > hana[j]){ taro_p += 3; break; 
     
 }
 else if(taro[j] < hana[j]){ hana_p += 3; break;
 }
 else if(taro[j] + hana[j] == 0){ hana_p++; taro_p++; break; } } } 
 printf("%d %d\n", taro_p , hana_p); 
 return 0;
}



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

int main()
{
  int x, ans = 1;
  cin >> x;

  for (int i = 1; i <= x; i++)
  {
    for (int j = 2; j <= x; j++)
    {
      if (x < pow(i, j))
      {
        break;
      }
      ans = max(ans, (int)pow(i, j));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 4016
# coding : utf-8

S = input()

if(S == "SUN"):
    print(7)
elif(S == "MON"):
    print(6)
elif(S == "TUE"):
    print(5)
elif(S == "WED"):
    print(4)
elif(S == "THU"):
    print(3)
elif(S == "FRI"):
    print(2)
elif(S == "SAT"):
    print(1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long

using namespace std;

const int O = 1e6 + 5;

int n, x, y, h[O], m;

vector <int> a[O];

main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; ++ i) cin >> h[i];
    for (int i = 1; i <= m; ++ i){
        cin >> x >> y;
        a[x].push_back(y);
        a[y].push_back(x);
    }
    int Ans = 0;
    for (int i = 1; i <= n; ++ i){
        bool flag = true;
        for (auto j : a[i])
            if (h[i] <= h[j]) flag = false;
        if (flag) ++ Ans;
    }
    cout << Ans;
}

Measured memory_bytes: 31280
n,a,b = map(int,input().split())


c = max(a,b)
mod = 10**9+7
 
fact = [1,n]
finv = [1,1]
inv = [0,1]
 
for i in range(2,c+1):
    fact.append((fact[-1]*(n+1-i))%mod)
    inv.append((inv[mod%i]*(mod-mod//i))%mod)
    finv.append((finv[-1]*inv[-1])%mod)
 
def nCr(n,r,mod):
      
    return fact[r]*finv[r]%mod

def pow_k(x, n,mod):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
            K %= mod
        x *= x
        x %= mod
        n //= 2

    return K * x % mod
ans = pow_k(2,n,mod)-1-nCr(n,a,mod)-nCr(n,b,mod)

print(ans%mod)

Measured memory_bytes: 26816
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll l,r,d;
	cin>>l>>r>>d;
	ll c=0;
	for(ll i=l;i<=r;i++) {
		if(i%d==0) c++;
	}
	cout<<c;
	
	
}

Measured memory_bytes: 3580
#include <iostream>
#include <vector>
#include <cmath>

std::vector<long long> divisors(long long n) {
	std::vector<long long> ret(1, 1);
	long long m = sqrt(n);
	for (long long i = 2; i <= m; i++) {
		if (n % i == 0) ret.push_back(i);
	}
	if (m == sqrt(n)) {
		for (long long i = ret.size() - 2; i >= 0; i--) {
			ret.push_back(n / ret[i]);
		}
	} else {
		for (long long i = ret.size() - 1; i >= 0; i--) {
			ret.push_back(n / ret[i]);
		}
	}
	return ret;
}

std::vector<long long> common_divisors(long long a, long long b) {
    if (a > b) std::swap(a, b);
    std::vector<long long> v = divisors(a);
    std::vector<long long> ret(1, 1);
    for (long long i = 1; i < v.size(); i++) {
        if (b % v[i] == 0) ret.push_back(v[i]);
    }
    return ret;
}

bool is_prime(long long n) {
    if (n == 1) return false;
    if (n == 2) return true;
    if (n % 2 == 0) return false;
	long long m = sqrt(n);
    for (long long i = 3; i <= m; i += 2) {
        if (n % i == 0) return false;
    }
    return true;
}

int main() {
    long long a, b;
    std::cin >> a >> b;
    std::vector<long long> v = common_divisors(a, b);
    long long ans = 1;
    for (auto i : v) {
        if (is_prime(i)) ans++;
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 3644
use std::cmp::*;
use std::io::*; //Not mine.
use std::str::FromStr;
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main() {
    let n: usize = read();
    let h: Vec<i64> = (0..n).map(|_| read()).collect();
    let mut ans_list: Vec<i64> = vec![1145141919810; n];
    ans_list[0] = 0;
    for i in 1..n {
        ans_list[i] = min(ans_list[i], (h[i] - h[i - 1]).abs() + ans_list[i - 1]);
        if i >= 2 {
            ans_list[i] = min(ans_list[i], (h[i] - h[i - 2]).abs() + ans_list[i - 2]);
        }
    }
    println!("{}", ans_list[n - 1]);
}


Measured memory_bytes: 3576
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return read.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtype!real;
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //
void solve(){
	int n = rint;
	int[] as = rint(n).map!(x => x - 1).array;
	long[] bs = rlong(n);
	long[] cs =rlong(n - 1);
	
	long ans;
	foreach(i; 0 .. n){
		ans += bs[as[i]];
		if(i < n - 1 && as[i + 1] == as[i] + 1) ans += cs[as[i]];
		log("i:", i, "ans:", ans);
	}
	
	ans.writeln;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,c;
	cin>>a>>b>>c;
	long long ans=0;
	ans+=(a/(b+c))*b;
	if(a%(b+c)<b)ans+=a%(b+c);
	else ans+=b;
	cout<<ans;
}

Measured memory_bytes: 256
import sys
def sieve(m):
    N=range(1,m+2,2)
    r=int(m**.5)
    h=len(N)
    N[0]=0
    for i in range(h):
        x=N[i]
        if x>r: break
        if x and i+x<h: N[i+x:h:x]=[0]*((h-1-i-x)/x+1)
    return N
def f0056(n):
    x=0
    if n<4:x=0
    elif n==4:x=1
    elif n%2==1:
        if S[n/2-1]: x=1
    else:
        a=n/2
        for e in PRIMES:
            if e>a: break
            if S[(n-e)/2]: x+=1
    return x

S=sieve(50000)
PRIMES=filter(None,S)
for n in sys.stdin:
    n=int(n)
    if n==0: break
    print f0056(n)

Measured memory_bytes: 5824
import sys
n,m,x= map(int, sys.stdin.readline().rstrip("\n").split())
lines = [ [int(s) for s in line.split()] for line in sys.stdin ]
price = -1
skill = {}
for i in range(2**n-1):
    i = format(i+1, 'b').zfill(n)
    price_ = 0
    for j in range (m):
        skill[j] = 0
    for k in range(n):
        if i[k] == '1':
            price_  += lines[k][0]
            for j in range(m):
                skill[j] = skill[j] + lines[k][j+1]
    for j in range(m):
        if skill[j] < x:
            break
    else:
        if price == -1:
            price = price_
        else:
            price = min(price, price_)
print(price)

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3

#define MAX_N 1000

bool valid(int ni,int nj){ return ni>=0&&ni<8&&nj>=0&&nj<8; }

char board[10][10];

int di[]={-1,-1,-1,0,0,1,1,1};
int dj[]={-1,0,1,-1,1,-1,0,1};

void dfs(bool turn,bool pass){
	if(!turn){//mami
		int cnt=0,ii,jj;
		for(int i=7;i>=0;i--)for(int j=7;j>=0;j--){
			if(board[i][j]!='.')continue;
			int ncnt=0;
			rep(d,8){
				int ni=i+di[d],nj=j+dj[d],sum=0;
				while(valid(ni,nj)&&board[ni][nj]=='x'){
					ni+=di[d],nj+=dj[d];
					sum++;
				}
				if(valid(ni,nj)&&board[ni][nj]=='o'){
					ncnt+=sum;
				}
			}
			if(cnt<=ncnt){
				cnt=ncnt;
				ii=i; jj=j;
			}
		}
		if(cnt==0){
			if(pass)return;
			else{
				dfs(true,true);
				return;
			}
		}
		board[ii][jj]='o';
		rep(d,8){
			int ni=ii+di[d],nj=jj+dj[d];
			while(valid(ni,nj)&&board[ni][nj]=='x'){
				ni+=di[d],nj+=dj[d];
			}
			if(valid(ni,nj)&&board[ni][nj]=='o'){
				int nni=ii+di[d],nnj=jj+dj[d];
				while(valid(nni,nnj)&&board[nni][nnj]=='x'){
					board[nni][nnj]='o';
					nni+=di[d],nnj+=dj[d];
				}
			}
		}
		//rep(i,8)cout<<board[i]<<endl;
		//cout<<endl;
		dfs(true,false);
	}else{
		int cnt=0,ii,jj;
		rep(i,8)rep(j,8){
			if(board[i][j]!='.')continue;
			int ncnt=0;
			rep(d,8){
				int ni=i+di[d],nj=j+dj[d],sum=0;
				while(valid(ni,nj)&&board[ni][nj]=='o'){
					ni+=di[d],nj+=dj[d];
					sum++;
				}
				if(valid(ni,nj)&&board[ni][nj]=='x'){
					ncnt+=sum;
				}
			}
			if(cnt<=ncnt){
				cnt=ncnt;
				ii=i; jj=j;
			}
		}
		if(cnt==0){
			if(pass)return;
			else{
				dfs(false,true);
				return;
			}
		}
		board[ii][jj]='x';
		rep(d,8){
			int ni=ii+di[d],nj=jj+dj[d];
			while(valid(ni,nj)&&board[ni][nj]=='o'){
				ni+=di[d],nj+=dj[d];
			}
			if(valid(ni,nj)&&board[ni][nj]=='x'){
				int nni=ii+di[d],nnj=jj+dj[d];
				while(valid(nni,nnj)&&board[nni][nnj]=='o'){
					board[nni][nnj]='x';
					nni+=di[d],nnj+=dj[d];
				}
			}
		}
		//rep(i,8)cout<<board[i]<<endl;
		//cout<<endl;
		dfs(false,false);
	}
}

int main(){
	cin.sync_with_stdio(false);
	rep(i,8)cin>>board[i];
	dfs(false,false);
	rep(i,8)cout<<board[i]<<endl;
	return 0;
}

Measured memory_bytes: 3184
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B, C, D, E);

// ===

fn main() {
    let n: usize = read();
    let a: Vec<i32> = readnc();
    let mut x: Vec<(i32, usize)> = vec![];
    for i in 0..n {
        x.push((a[i], i));
    }
    x.sort();

    let mut ans = vec![0; n];

    let center_left = x[n/2-1].0;
    let center_right = x[n/2].0;
    for i in 0..n {
        let (_, idx) = x[i];
        if i < n/2 {
            ans[idx] = center_right;
        } else {
            ans[idx] = center_left;
        }
    }
    for i in 0..n {
        println!("{}", ans[i]);
    }
}


Measured memory_bytes: 12136
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
typedef pair<ll,ll> P;
#define N 100010
#define M 200010
int n,m;
 
vector<P> v[N];
P dis[N];
priority_queue<P,vector<P>,greater<P> >Q;
void Dijkstra(){
  lol(i,n)dis[i].first=(ll)mod*(ll)mod,dis[i].second=i;
  Q.push(make_pair(0,0));
  while(!Q.empty()){
    ll cost=Q.top().first;
    ll now=Q.top().second;
    Q.pop();
    if(dis[now].first<=cost)continue;
    dis[now].first=cost;
    lol(i,v[now].size()){
      ll to=v[now][i].first;
      ll pcos=v[now][i].second;
      Q.push(make_pair(pcos+cost,to));
    }
  }
}
 
queue<ll> lis[N];
ll nyuz[M],cos[M];
 
int main(){
  cin>>n>>m;
  ll c;cin>>c;
  lol(i,m){
    ll a,b,d;cin>>a>>b>>d;
    a--,b--;cos[i]=d;
    v[a].push_back(make_pair(b,d));
    v[b].push_back(make_pair(a,d));
    lis[a].push(i);
    lis[b].push(i);
    nyuz[i]=2;
  }
  Dijkstra();
  sort(dis,dis+n);
  ll ans=(ll)mod*(ll)mod,cnt=0;
  lol(i,m)cnt+=cos[i];
  lol(i,n){
    ll cost=dis[i].first;
    ll now=dis[i].second;
    while(!lis[now].empty()){
      ll edge=lis[now].front();
      lis[now].pop();
      nyuz[edge]--;
      if(nyuz[edge]==0){
	cnt-=cos[edge];
      }
    }
    ans=min(ans,cnt+c*cost);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 91588
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        Float[] a = new Float[N];
        for (int i = 0; i < N; i++)
            a[i] = (float) sc.nextInt();
        float sum = 0.0f;

        Arrays.sort(a, Comparator.reverseOrder());

        for (int i = 0; i < N; i++) {
            sum += a[i] / Math.pow(2, i);
        }

        sum += a[N - 1] / Math.pow(2, N-1);

        System.out.println(sum / 2);
    }
}

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

void solve(int n, string a, string b){
    string c;
    for(int i=0; i<n; i++){
        c.push_back(a[i]);
        c.push_back(b[i]);
    }
    cout << c << endl;
}

int main(){
    int n;
    string a, b;
    cin >> n ;
    cin >> a >> b;
    solve(n, a, b);
} 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
#include <set>
#include <cmath>
#include <bitset>
#include <queue>
#define enter putchar('\n')
#define space putchar(' ')
//#define ivorysi
#define pb push_back
#define mo 974711
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define MAXN 200005
#define eps 1e-12
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 - '0' + c;
	c = getchar();
    }
    res = res * f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) out(x / 10);
    putchar('0' + x % 10);
}
struct Bignum {
    vector<int> v;
    int sum;
    Bignum operator = (string s) {
	v.clear();
	sum = 0;
	for(int i = s.length() - 1 ; i >= 0 ; --i) {
	    v.pb(s[i] - '0');
	    sum += s[i] - '0';
	}
	return *this;
    }
    friend Bignum operator * (const Bignum &a,const int b) {
	int s = a.v.size();
	Bignum c;c.v.clear();
	for(int i = 0 ; i <= s ; ++i) c.v.pb(0);
	int g = 0;
	for(int i = 0 ; i < s ; ++i) {
	    int x = a.v[i] * b + g;
	    c.v[i] = x % 10;
	    g = x / 10;
	}
	if(g) c.v[s] = g;
	for(int i = s ; i > 0 ; --i) {
	    if(c.v[i] == 0) c.v.pop_back();
	    else break;
	}
	c.sum = 0;s = c.v.size();
	for(int i = 0 ; i < s ; ++i) c.sum += c.v[i];
	return c;
    }
}A;
string s;
void Solve() {
    cin>>s;
    A = s;
    A = A * 9;
    int ans = 0;
    while(1) {
	int s = A.v.size();
	int g = 9;
	for(int i = 0 ; i < s ; ++i) {
	    if(!g) break;
	    A.sum -= A.v[i];
	    int x = A.v[i] + g;
	    A.v[i] = x % 10;
	    A.sum += A.v[i];
	    g = x / 10;
	}
	if(g) A.v.pb(g),A.sum += g;
	++ans;
	if(ans * 9 >= A.sum) break;
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


Measured memory_bytes: 6768
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define RFOR(i,a,b) for(long long i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;
 
int main() {
	int N,S[110]={};
	cin >> N;
	string s;
  	cin >> s;
	REP(i,s.length()){
		if(s[i]=='(') S[i]=1;
		else S[i]=-1;
	}
	int mina=S[0];
	REP(i,N-1){
		S[i+1]+=S[i];
		mina=min(S[i+1],mina);
	}
  	if(mina<0) S[N-1]+=-mina;
	while(mina<0){
		mina++;
		cout<<"(";
	}
	cout<< s;
	while(S[N-1]>0){
		S[N-1]--;
		cout<<")";
	}
	cout << endl;
	
	return 0;
}

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

int main() {
	string s;
	cin >> s;
	set<char>p;
	for (int i = 0; i < s.length(); i++) {
		p.insert(s[i]);
	}
	if (p.size() == s.length()) {
		cout << "yes" << endl;
	} else {
		cout << "no" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N; cin >> N;
  long long A, ans = 1;
  bool able = true;
  for(int i = 0; i < N; i++){
    cin >> A;
    if(A == 0){
      ans = 0; able = true;
      break;
    } else if(((long long)(1000000000000000000 / A) + 1) <= ans) able = false;
    else ans *= A;
  }
  if(able) cout << ans;
  else cout << "-1";
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  for(int i=0; i<N; i++){
    string s;
    cin >> s;
    if(s=="Y"){
      cout << "Four";
      break;
    }
    else if(i==N-1){
      cout << "Three";
    }
  }
}


Measured memory_bytes: 256
use proconio::input;
use std::collections::BTreeMap;

const MOD: usize = 998_244_353;

fn main() {
    input! {
        n: usize,
        dd: [usize; n],
    }

    if dd[0] != 0 {
        println!("0");
        return;
    }

    let mut map = BTreeMap::new();
    for d in dd {
        *map.entry(d).or_insert(0) += 1;
    }

    let mut ans = 1;
    let mut prev = 1;
    let mut index = 0;
    for (key, value) in map.into_iter() {
        if key == 0 {
            if value != 1 {
                println!("0");
                return;
            }
            index += 1;
            continue;
        }
        if key != index {
            println!("0");
            return;
        }

        for _ in 0..value {
            ans *= prev;
            ans %= MOD;
        }
        index += 1;
        prev = value;
    }

    println!("{}", ans);
}


Measured memory_bytes: 6120
// ABC164
// a.cs

using System;

class A
{
    public static void Main()
    {
        int sheep;
        int wolf;

        string []str = Console.ReadLine().Split(' ');
        sheep = int.Parse(str[0]);
        wolf = int.Parse(str[1]);

        if (sheep > wolf)
        {
            Console.WriteLine("safe");
        }
        else
        {
            Console.WriteLine("unsafe");
        }
    }
}

Measured memory_bytes: 27536
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define d  long double
//#define d long double
#define pii pair<int,int>
#define pb push_back
#define N 200003
#define inf (int)1e18
#define haha ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int mod=1e9+7;
int c[10001];
 
 
signed main()
{
    haha
    int n,m;
    cin>>n>>m;
    if(m<n)
    {
        for(int i=0;i<n;i++)
        cout<<m;
        return 0;
    }
     
        for(int i=0;i<m;i++)
        cout<<n;
    
    
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long inf = 100000000000000;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int nCr(int n, int r) {
	int ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
bool is_even(ll x) { return x % 2 == 0 ? 1 : 0; }
bool is_odd(ll x) { return x % 2 == 1 ? 1 : 0; }
int main() {
	char s;
	cin >> s;
	char ans = s + 1;
	cout << ans;
	return(0);
}

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

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

const int MAX = 101;
int h, w;
char f[MAX][MAX];

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

void dfs(int y, int x, char c) {
    f[y][x] = '.';
    rep(i, 4) {
        int nx = x+dx[i], ny = y+dy[i];
        if (0 <= nx && nx < w && 0 <= ny && ny < h && f[ny][nx] == c) {
            dfs(ny, nx, c);
        }
    }
}

int main() {
    while (cin >> h >> w, (h||w)) {
        rep(y, h) rep(x, w) cin >> f[y][x];
        int c = 0;
        rep(y, h) rep(x, w) {
            if (f[y][x] != '.') {
                c++;
                dfs(y, x, f[y][x]);
            }
        }
        cout << c << endl;
    }
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int x, y;
  cin >> x >> y;
  cout << x + y / 2;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=(b);++i)
#define mem(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define pi pair<int, int>
#define mk make_pair
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int a[200],len;
int main()
{int k;
   cin>>k;
   if(k<=12){
      cout<<k;
      return 0;
   }
   priority_queue<ll,vector<ll>,greater<ll>> pq;
   for(int i=1;i<=9;i++)
   pq.push(i);

   int cnt=0;
   ll ans;
   while(true){
      ll num=pq.top();
      pq.pop();
      cnt++;

      if(cnt==k){
         ans=num;
         break;
      }

      int ld=num%10;
      ll num1=num*10+ld;
      pq.push(num1);

      if(ld!=0){
         num1=num*10+ld-1;
         pq.push(num1);
      }
      if(ld!=9){
         num1=num*10+ld+1;
         pq.push(num1);
      }
   }
   cout<<ans;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    string s,t;
    cin>>s>>t;
    int n1=s.size(),n2=t.size();
    for(int i=n1-n2; i>=0; --i){
        bool ok=true;
        for(int j=0; j<n2; ++j){
            if(s[i+j]!=t[j]&&s[i+j]!='?')ok=false;
        }
        if(ok==true){
            for(int j=0; j<n2; ++j){
                s[i+j]=t[j];
            }
            rep(i,n1){
                if(s[i]=='?')s[i]='a';
            }
            cout<<s<<endl;
            return 0;
        }
    }
    cout<<"UNRESTORABLE"<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <time.h>
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <memory.h>
#include <cstdlib>
#include <queue>
#include <iomanip>
#define P pair<int, int>
#define LL long long
#define LD long double
#define PLL pair<LL, LL>
#define mset(a, b) memset(a, b, sizeof(a))
#define PI acos(-1.0)
#define random(x) rand() % x
using namespace std;
const int inf = 0x3f3f3f3f;
const LL __64inf = 0x3f3f3f3f3f3f3f3f;
const int MAX = 1e5 + 5;
const int Mod = 1e9 + 7;

int cnt[MAX][2];
int main()
{
    string s;
    cin >> s;
    cnt[0][1] = 1-s[0]+'0';
    cnt[0][0] = s[0] - '0';
    int col1 = 1, col2 = 0;
    for(int i = 1; i < s.size(); i++)
    {
        col1 ^= 1;
        col2 ^= 1;
        cnt[i][1] = cnt[i-1][1] + (col1 ^ (s[i]-'0'));
        cnt[i][0] = cnt[i-1][0] + (col2 ^ (s[i]-'0'));
    }
    cout << min(cnt[s.size()-1][0], cnt[s.size()-1][1]) << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<string> w(n);
  for (int i = 0; i < n; i++)
    cin >> w.at(i);
  string j = "Yes";
  
  for (int i = 0; i < n - 1; i++) {
    if (w.at(i).at(w.at(i).size() - 1) != w.at(i + 1).at(0)) {
      j = "No";
      break;
    }
  }
  
  sort(w.begin(),w.end());
  
  if (j == "Yes") {
    for (int i = 0; i < n - 1; i++) {
      if (w.at(i) == w.at(i + 1)) {
        j = "No";
        break;
      }  
    }
  }
  
  cout << j << endl;
}


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

using namespace std;

const long long MOD = (long long)1e9 + 7;
long long dp[1010][1010];

int main(){
    int h, w;
    cin >> h >> w;
    vector<string> a(h);
    for(int i = 0; i < h; i++){
        cin >> a[i];
    }
    dp[0][0] = 1;
    for(int i = 1; i < h; i++){
        if(a[i][0] == '.') dp[i][0] = dp[i - 1][0];
    }
    for(int i = 1; i < w; i++){
        if(a[0][i] == '.') dp[0][i] = dp[0][i - 1];
    }
    for(int i = 1; i < h; i++){
        for(int j = 1; j < w; j++){
            if(a[i][j] == '.'){
                dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
                dp[i][j] %= MOD;
            }
        }
    }
    cout << dp[h - 1][w - 1] << endl;
    return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  vector<P> cb;
  rep(i, m) {
    int b, c;
    cin >> b >> c;
    cb.push_back({ c, b });
  }

  sort(a.begin(), a.end());
  sort(cb.begin(), cb.end(), greater<P>());

  int i = 0;
  int cb_i = 0;
  while(i < n) {
    // printf("%d: %d, %d\n", i, a[i], cb[cb_i].first);
    if(a[i] < cb[cb_i].first) {
      a[i] = cb[cb_i].first;
      cb[cb_i].second -= 1;
      if(cb[cb_i].second == 0) {
        cb_i += 1;
      }
      i++;
    } else {
      // もうCよりも大きな値しか持っていないので終了
      break;
    }
    if(cb_i == m) {
      break;
    }
  }

  ll sum = 0;
  for(auto v : a) sum += v;
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 2168
#include <stdio.h>
//a atac taka
//b forca taka
//atac aoki
//forca aoki
int main(){
    int a,b,c,d;
    int saude1,saude2;


    scanf("%d %d %d %d",&a,&b,&c,&d);

    while(a>0 && c>0){
        c = c - b; //tirando vida do aoki
        a = a - d; //tirando vida do taka
    }
    
    if(c<=0){
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    return 0;
}



Measured memory_bytes: 1644
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7


def main():
    s = input()
    d = collections.defaultdict(int)
    for c in s:
        d[c] += 1
    for c in d.values():
        if c % 2 == 1:
            return 'No'
    return 'Yes'



print(main())


Measured memory_bytes: 5404
#include<stdio.h>
#include<math.h>

int main( void ){
  double n,a,b,c,d,e;
  double bottom[6];
  double neck=0;
  double time=0;
  int i;
  scanf("%lf%lf%lf%lf%lf%lf", &n,&a,&b,&c,&d,&e);
  bottom[0] = n / a;
  bottom[1] = n / b;
  bottom[2] = n / c;
  bottom[3] = n / d;
  bottom[4] = n / e;
  for(i=0;i<5;i++){
    if(neck<bottom[i]){
      neck = bottom[i];
    }
  }
  neck = ceil(neck);
  time = neck + 4;
  printf("%.0lf\n", time);
  return 0;
}

Measured memory_bytes: 256