akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll	    long long
#define vi      vector <int>
#define vii     vector <pair<int,int>>
#define ii      pair<int,int>
#define loop(n)	for(int i=0;i<n;i++)
const ll mod=1e9+7;
bool is_prime(int n)
{
    if(n==2)
        return true;
    if(n%2==0||n<2)
        return false;
    for(int i=3; i<=sqrt(n); i+=2)
    {
        if(n%i==0)
            return false;
    }
    return true;
}
long long power(ll n, ll k){
    if(k==0) return 1;
    ll sq=(power(n,k/2))%mod;
    sq=(sq*sq)%mod;
    if(k%2==1)
        sq=(sq*n)%mod;
    return sq%mod;
}
long long gcd(long long a,long long b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
// lcm = (a*b)/gcd(a,b)
//freopen("input.txt" ,"r",stdin );
//freopen("output.txt","w",stdout);
int memo[3005][3005];
string a,b;
int x,y;
int fun(int i,int j)
{
	if(i==a.size()||j==b.size())
        return 0;
    int &ret=memo[i][j];
    if(~ret)
        return ret;
    if(a[i]==b[j])return ret=1+fun(i+1,j+1);
    else
    {
        return ret=max(fun(i,j+1),fun(i+1,j));
    }
}
void build(int i,int j)
{
    if(i==a.size()||j==b.size())
        return ;
    int optimal=fun(i,j);
    if(a[i]==b[j])
    {
        cout<<a[i];
        build(i+1,j+1);
    }
    else
    {
        int ch1=fun(i+1,j);
        if(ch1==optimal)return build(i+1,j);
        else return build(i,j+1);
    }
}
void fast();
int main()
{
    fast();
    cin>>a>>b;
    memset(memo,-1,sizeof memo);
    fun(0,0);
    build(0,0);
}
void fast(){
std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
/*

*/


Measured memory_bytes: 35968
#include <bits/stdc++.h>
typedef long long ll;
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++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,ll>
const ll MOD=998244353;
const int INF=1e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false);

    ll a;
    cin >> a;
    cout << 3*a*a << endl;

    return 0; 
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Y cout << "YES\n"
#define N cout << "NO\n"
#define REP(i, a, b) for (int i = a; i <= b; i++)
#define R(i,n) for(int i = 0 ; i < n ; i++)
#define RE(i, a, b) for (int i = a; i >= b; i--)

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

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

public static partial class Program
{
    public static void Main()
    {
        var pqr = CRL().ArrayInts();
        CWL(pqr.Sort().Take(2).Sum());
    }
}

public static partial class Program
{
    //テンプレここから
    public static int Sigma(int n, int next = 1, int val = 0) => next > n ? val : Sigma(n, next + 1, val + next);
    public static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);
    public static int GCD(int a, int b) => b == 0 ? a : GCD(b, a % b);
    public static long LCM(long a, long b) => a * b / GCD(a, b);
    public static int LCM(int a, int b) => a * b / GCD(a, b);
    public static string CRL() => Console.ReadLine();
    public static void CWL(object obj) => Console.WriteLine(obj);
    public static int ToInt(this double d) => (int) d;
    public static long ToLong(this double d) => (long) d;
    public static int ToInt(this string str) => int.Parse(str);
    public static long ToLong(this string str) => long.Parse(str);
    public static long[] ToLong(this IEnumerable<string> strs) => strs.Select(x => x.ToLong()).ToArray();
    public static int[] ToInt(this IEnumerable<string> strs) => strs.Select(x => x.ToInt()).ToArray();
    public static long[] ArrayLongs(this string str, char opr = ' ') => str.Split(opr).ToLong();
    public static int[] ArrayInts(this string str, char opr = ' ') => str.Split(opr).ToInt();
    public static long Diff(long a, long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static int Diff(int a, int b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static long Sign(this long i) => Math.Sign(i);
    public static bool IsEven(this long i) => i % 2 == 0;
    public static bool IsEven(this int i) => i % 2 == 0;
    public static readonly int[] Dx = new[] {0, -1, 0, 1};
    public static readonly int[] Dy = new[] {-1, 0, 1, 0};
    public const int Mod = 1000000007;
    public static string alphabet = "abcdefghijklmnopqrstuvwxyz";
    public static long ToLong(this char c) => c.ToString().ToLong();
    public static int ToInt(this char c) => c.ToString().ToInt();
    public static long[] Sort(this long[] array) => array.OrderBy(x => x).ToArray();
    public static int[] Sort(this int[] array) => array.OrderBy(x => x).ToArray();
    public static long[] DSort(this long[] array) => array.OrderByDescending(x => x).ToArray();
    public static int[] DSort(this int[] array) => array.OrderByDescending(x => x).ToArray();
    public static string Join(this IEnumerable<string> array, string sep = "") => string.Join(sep, array);
    public static string Join(this IEnumerable<char> array, string sep = "") => string.Join(sep, array);

    public static string JoinToStr(this IEnumerable<int> array, string sep = "")
        => array.Select(x => x.ToString()).Join(sep);

    //テンプレここまで
}

Measured memory_bytes: 13524
#![allow(unused_imports)]
use proconio::{input, fastout};
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
    k: usize
    }
    let dk = if k % 7 == 0 {
        k / 7
    } else {
        k
    };
    if gcd(&dk, &10) != 1 {
        println!("-1");
        return
    }
    let mut s = 1 % dk;
    for i in 1.. {
        if s == 0 {
            println!("{}", i);
            return
        }
        s = (10 % dk * s + 1 % dk) % dk;
    }
}

// O(log(N))
fn gcd(a: &usize, b: &usize) -> usize {
    let (mut x, mut y) = if a < b { (*b, *a) } else { (*a, *b) };
    let mut r = x % y;
    while r != 0 {
        x = y;
        y = r;
        r = x % y;
    }
    y
}


Measured memory_bytes: 2176
#include <stdio.h>

int f[100];

int main(){
  int n, i;
  f[0] = f[1] = 1;
  scanf("%d", &n);
  for(i = 2; i <= n; ++i) f[i] = f[i - 1] + f[i - 2];
  printf("%d\n", f[n]);
  return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
static const long long MOD = 1000000000+7;

int main() {
  string s,t;
  cin >> s >> t;
  for (int i=0; i<s.size(); i++) {
    if (s.at(i) != t.at(i)) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
	
using namespace std;
	
#define endl "\n"
#define ll long long
#define vi vector <int >
#define vii vectir < pii >
#define vll vector <ll >
#define pii pair <int, int>
#define pdd pair< double, double>
#define piii pair < pii, int > 
#define pll pair<ll, ll >
#define umap unordered_map
#define pb push_back
#define pq priority_queue
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define rep(i,b,c) for(int i = (int)b; i < (int)c; i++)
#define a first
#define b second

int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	ll n;
	cin >> n;
	if(n%2){
		cout << 0 << endl;
		return 0;
	}
	n/=2;
	ll ans = 0;
	for(ll i = 5; i <= n; i*=5){
		ans += n/i;
	}
	cout << ans<< endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int N, M, x[100000], y[100000], n[100000], red[100000], cnt=0;
  cin >> N >> M;
  for(int i=0; i<M; i++){
    cin >> x[i] >> y[i];
  }

  for(int i=0; i<N; i++){
    n[i] = 1;
    red[i] = false;
  }
  red[0] = true;

  for(int i =0; i<M; i++){
    if(red[x[i]-1]) red[y[i]-1]=true;
    n[x[i]-1]--;
    n[y[i]-1]++;
    if(n[x[i]-1]==0) red[x[i]-1]=false;
  }

  for(int i=0; i<N; i++){
    if(red[i]) cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 5116
w = [int(i) for i in input().split()]
N = w[0]
M = w[1]
A = {tuple([int(j) for j in input().split()]) for i in range(M)}

A_ = sorted(A, key=lambda x: x[1])
bridge = 0
c = 0
for i in A_:
    if i[0] > bridge:
        bridge = i[1]-1
        c += 1
print(c)

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  map<int,int> count;
  for(int i=0; i<N; i++){
    cin >> A.at(i);
    count[A.at(i)]++;
  }
  int ans = 0;
  for(auto &d : count){
    if(d.second%2!=0){
      ans++;
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 8084
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        int N = cin.nextint;
        int M = cin.nextint;
        var A = cin.scanint.Select(i => i % M).ToArray();
        var B = new int[N + 1];//累積和
        var K = new Dictionary<int, int>();
        var J = new bool[N + 1];
        long cnt = 0;

        K[0] = 0;
        long ans = 0;
        for (int i = 1; i <= N; i++)
        {
            B[i] = (B[i - 1] + A[i - 1]) % M;
            if (K.ContainsKey(B[i]))
            {
                K[B[i]]++;
            }
            else
            {
                K[B[i]] = 0;
            }
        }
        foreach (var v in K.Values)
        {
            ans += (long)(v + 1) * v / 2;
        }

        WriteLine(ans);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 21728
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<sstream>
#include<stack>
#include<string>
#include<unordered_set>
#include<vector>

#define ll long long
#define P pair<int,int>
#define FOR(i,N) for(int i=0;i<(int)N;i++)
#define FORIN(i,a,b) for(int i=a;i<(int)b;i++)
#define ALL(x) (x).begin(),(x).end()
#define LAST(x) (x)[(x).size()-1]
#define GI(name) int (name);scanf("%d",&(name))
#define GI2(name1,name2) int (name1),(name2);scanf("%d %d",&(name1),&(name2))
#define GI3(name1,name2,name3) int (name1),(name2),(name3);scanf("%d %d %d",&(name1),&(name2),&(name3))
#define GVI(name,size) vector<int> (name)(size);FOR(i,(size))scanf("%d",&(name)[i])

using namespace std;

string to_hex(int x){
    stringstream ss;
    ss<<hex<<x;
    return ss.str();
}

inline int get_int(){
    int ret;
    scanf("%d",&ret);
    return ret;
}

inline vector<int> get_ints(int n){
    vector<int> ret(n);
    FOR(i,n){
        scanf("%d",&ret[i]);
    }
    return ret;
}

inline string get_str(){
    string ret;
    cin>>ret;
    return ret;
}

bool is_prime(int n){
    int s=sqrt(n)+1;
    for(int i=2;i<=s;++i){
        if(n%i==0){
            return 0;
        }
    }
    return 1;
}

vector<P> prime_division(int n){
    vector<P> ret;
    int s=sqrt(n)+1;
    int c=0;
    for(int i=2;i<=s;++i){
        if(n%i==0){
            c=0;
            do{
                ++c;
                n/=i;
            }while(n%i==0);
            ret.push_back(P(i,c));
        }
    }
    return ret;
}

string to_string(string s){
    return s;
}

template<class T>
string to_string(vector<T> v){
    string ret="{";
    FOR(i,v.size()-1){
        ret+=to_string(v[i])+",";
    }
    if(v.size()>0){
        ret+=to_string(LAST(v));
    }
    ret+="}";
    return ret;
}

void debug_print(){
    cerr<<endl;
}

template<class Head,class... Tail>
void debug_print(Head head,Tail... tail){
    cerr<<to_string(head)<<" ";
    debug_print(tail...);
}

template<class... T>
void debug(T... args){
    cerr<<"["<<__LINE__<<"]: ";
    debug_print(args...);
}

void print(){
    cout<<endl;
}

template<class Head,class... Tail>
void print(Head head,Tail... tail){
    cout<<to_string(head);
    print(tail...);
}

int main(){
    ll N;
    cin>>N;
    vector<ll> A(5);
    FOR(i,5)cin>>A[i];
    ll neck=*min_element(ALL(A));
    print(5+(N-1)/neck);
    return 0;
}

Measured memory_bytes: 256
#組み合わせ個数
def choose(n, r, mod)
  return 0 if not (0 <= r and r <= n)
  return 1 if r == 0 or r == n
  fact(n, mod) * inverse(fact(r, mod) * fact(n-r, mod) % mod, mod) % mod
end
#階乗(MODあり)
@fact = [1]
def fact(n, mod)
  if n > @fact.size then
    f = @fact[-1]
    (@fact.size+1..n).each{|i|
      f = (f * i) % mod
      @fact << f
    }
  end
  @fact[n-1]
end
#逆元(MODあり)
def inverse(x, mod)
  pow(x, mod-2, mod)
end
#べき乗(MODあり)(繰り返し２乗法)
def pow(x, n, mod)
  ans = 1
  while n > 0
    ans = ans * x % mod if n.odd?
    x = x * x % mod
    n >>= 1
  end
  ans
end

N, K = gets.chomp.split(" ").map(&:to_i)
MOD = 10 ** 9 + 7

ans = 0
s = N > K-1 ? N - K : 1
(s..N).each{|n|
  ans = (ans + choose(N, n, MOD) * choose(N-1, n-1, MOD)) % MOD
}
ans = ans % MOD

puts ans


Measured memory_bytes: 3452
n,q = map(int,input().split())
s = input()
num_list = list()
#０文字目と１文字目はACの数０
ruisekiwa_tabun_rikaidekita = [0,0]

for i in range(q):
    num_list.append(list(map(int,input().split())))

for i in range(n-1):
    if s[i:i+2] == "AC":
        ruisekiwa_tabun_rikaidekita.append(ruisekiwa_tabun_rikaidekita[-1] + 1)
    else:
        ruisekiwa_tabun_rikaidekita.append(ruisekiwa_tabun_rikaidekita[-1])
        
for left,right in num_list:
    print(ruisekiwa_tabun_rikaidekita[right] - ruisekiwa_tabun_rikaidekita[left])
    

Measured memory_bytes: 30700
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <climits>
#include <cmath>
#include <functional>
// #include <bits/stdc++.h>
using namespace std;

#define size_t int
typedef long long ll;
// #define int long long
typedef vector<int> VI;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define debug(x) cerr << #x << " = " << (x) << " (line " << __LINE__ << ")" << endl;
#define debug1(i, x) cerr << "(" << (i) <<  ") " << #x << " = " << (x) << " (line " << __LINE__ << ")" << endl;
#define debug2(i, j, x) cerr << "(" << (i) << ", " << (j) <<  ") " << #x << " = " << (x) << " (line " << __LINE__ << ")" << endl;
template <typename T> class vec2d : public vector<vector<T>> {
public:
    vec2d(int H, int W): vector<vector<T>> (H, vector<T>(W)) {
    }
};
template <typename T> istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}
template <typename T> ostream& operator << (ostream& os, vector<T>& vec){
  REP(i, vec.size()) {
    os << vec[i] << ( i+1 == vec.size() ? "" : " " );
  }
  return os;
}
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0);
        // cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

signed main(signed argc, char **argv) {
  VI A(3);
  cin >> A;
  cout << A[0] * A[1] / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
input=lambda: sys.stdin.readline().rstrip()
n,k=map(int,input().split())
A=[int(i) for i in input().split()]
mod=10**9+7
A.sort(reverse=True,key=lambda x:abs(x))

if min(A)>0:
  ans=1
  for i in range(k):
    ans=(ans*A[i])%mod
  print(ans)
elif max(A)<0:
  ans=1
  if k%2==0:
    for i in range(k):
      ans=(ans*A[i])%mod
    print(ans)
  else:
    for i in range(k):
      ans=(ans*A[n-1-i])%mod
    print(ans)
elif n==k:
  ans=1
  for i in range(k):
    ans=(ans*A[i])%mod
  print(ans)
elif k==1:
  print(max(A)%mod)

else:
  L1,L2,R1,R2=[],[],[],[]
  ct=0
  for a in A:
    if a==0:
      continue
    if ct<k:
      if a>0:
        L1.append(a)
      elif a<0:
        L2.append(a)
      ct+=1
    else:
      if a>0:
        R1.append(a)
      elif a<0:
        R2.append(a)
  if ct<k:
    print(0)
  else:
    if not L1:
      if k%2==1:
        if not R1:
          print(0)


        else:
          c=R1[0]
          ans=1
          for i in range(len(L2)-1):
            ans=(ans*L2[i])%mod
          ans=(ans*c)%mod
          print(ans)
      else:
        ans=1
        for i in range(len(L2)):
          ans=(ans*L2[i])%mod
        print(ans)
    elif not L2:
      ans=1
      for i in range(len(L1)):
        ans=(ans*L1[i])%mod
      print(ans)
    else:
      if len(L2)%2==0:
        ans=1
        for a in L1:
          ans=(ans*a)%mod
        for a in L2:
          ans=(ans*a)%mod
        print(ans)
      else:
        if not R1:
          if not R2:
            if 0 in A:
              print(0)
            else:
              ans=1
              for a in L1:
                ans=(ans*a)%mod
              for a in L2:
                ans=(ans*a)%mod
              print(ans)
          else:
            d=-R2[0]
            ans=d
            for i in range(len(L1)-1):
              ans=(ans*L1[i])%mod
            for i in range(len(L2)):
              ans=(ans*abs(L2[i]))%mod
            print(ans)
        else:
          c=R1[0]
          a=L1[-1]
          b=L2[-1]
          if R2 and R2[0]*b>a*c:
            ans=R2[0]
            for i in range(len(L1)-1):
              ans=(ans*L1[i])%mod
            for i in range(len(L2)):
              ans=(ans*L2[i])%mod
            print(ans)
          else:
            ans=c
            for i in range(len(L1)):
              ans=(ans*L1[i])%mod
            for i in range(len(L2)-1):
              ans=(ans*L2[i])%mod
            print(ans)
    

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	int64_t ans; cin>>ans;
	auto gcd=[](auto p,auto q)->int64_t{
		while(p%q!=0){
			auto tmp=q;
			q=p%q;
			p=tmp;
		}
		return q;
	};
	auto lcm=[&](auto a,auto b)->int64_t{
		return a/gcd(a,b)*b;
	};
	for(int i=1;i<n;++i){
		int64_t t; cin>>t;
		ans=lcm(ans,t);
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    vector<int> b;
    if(n%2==0){
        for(int i=0;i<n;i++){
            if(i%2!=0){
                b.insert(b.begin(),a[i]);
            }
            else{
                b.push_back(a[i]);
            }
        }
    }
    else{
        for(int i=0;i<n;i++){
            if(i%2==0){
                b.insert(b.begin(),a[i]);
            }
            else{
                b.push_back(a[i]);
            }
        }
    }
    for(int i=0;i<n;i++){
        cout<<b[i]<<" ";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3828
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

//最後のところの処理がいい加減になっていた、こういう詰めの甘い実装がダメなんだよカス
signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,q;cin>>n>>q;

    vector<vector<ll>> xst(n);
    REP(i,n){
        ll s,t,x;cin>>s>>t>>x;
        xst[i]={x,s,t};
    }
    sort(ALL(xst));

    vector<ll> d(q);
    REP(i,q)cin>>d[i];

    vector<deque<ll>> ans_sectl(q);
    vector<deque<ll>> ans_sectr(q);
    REP(i,n){
        ll s,t,x;x=xst[i][0];s=xst[i][1];t=xst[i][2];
        ll L=(lower_bound(ALL(d),s-x)-d.begin());
        ll R=(upper_bound(ALL(d),t-x-1)-d.begin())-1;
        //lower,upper気を付ける
        //2RE
        if(L<=R){ans_sectl[L].PB(i);ans_sectr[R].PB(i);}
        //cout << L << " " << R << endl;
    }

    //複数存在しないので、map
    set<ll> ans;
    REP(i,q){
        ll sl=SIZE(ans_sectl[i]);
        ll sr=SIZE(ans_sectr[i]);
        REP(_,sl){
            ans.insert(*(ans_sectl[i].begin()));
            ans_sectl[i].pop_front();
        }
        if(ans.empty()){
            cout<<-1<<"\n";
        }else{
            cout<<xst[*ans.begin()][0]<<"\n";
        }
        REP(_,sr){
            ans.erase(*(ans_sectr[i].begin()));
            ans_sectr[i].pop_front();
        }
    }
}

Measured memory_bytes: 293856
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<int,int>
#define maxn 100005
using namespace std;
signed main()
{
    fast;
   
    int a,b;
    cin>>a>>b;
    if(2*b >a) cout<<"0";
    else cout<<a-2*b;
}

Measured memory_bytes: 256
//submitted by: Het Shah

#include<bits/stdc++.h>
using namespace std;

const int N=1e5+5;
int n;
int p[N];
long long pre[N];


int main(){
    cin>>n;

    for (int i=1;i<=n;i++){
        cin>>p[i];
    }

    sort(p+1,p+n+1);

    for (int i=1;i<=n;i++)
        pre[i]=pre[i-1]+p[i];
    
    int ans=0;

    for (int i=n;i>0;i--){
        if(pre[i]*2<p[i+1])
            break;
        ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 1408
#include<iostream>

#define REP(i,a) for(int i=0;i<(a);i++)
#define RREP(i,a) for(int i=(a);i>=0;i--)
#define CHK(x,a) for(int x:(a))
typedef long long ll;
using namespace std;


int main()
{
	int A, N;
	cin >> N >> A;
	N %= 500;
	if (N > A) cout << "No" << endl;
	else cout << "Yes" << endl;
}

Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N, M = getNM()
dp = [float("inf")] * (1 << N)
dp[0] = 0

# 1 ~ Nを全て開けられる鍵を揃えるコストの最小値がO(M * 2 ** N)でわかる
# 各鍵について
for i in range(M):
    a, b = getNM()
    c = getList()
    bit = 0
    # その鍵で開けられる部屋を揃える
    for item in c:
        bit |= (1 << (item - 1))
    # 部屋の各状態について
    # そこからさらに鍵cを取得した場合と他の鍵を使用した場合とで比較する
    for j in range(1 << N):
        dp[j | bit] = min(dp[j | bit], dp[j] + a)

if dp[(1 << N) - 1] == float("inf"):
    print(-1)
else:
    print(dp[(1 << N) - 1])

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


int main(){

	int X, Y, Z;
	long K, tmp;

	vector<long> A;
	vector<long> B;
	vector<long> C;
	vector<long> ans;

	cin >> X >> Y >> Z >> K;

	for (int i = 0 ; i < X; i++){
		cin >> tmp;
		A.push_back(tmp);
	}
	sort(A.begin(),A.end(), greater<long>());
	
	for (int i = 0 ; i < Y; i++){
		cin >> tmp;
		B.push_back(tmp);
	}
	sort(B.begin(),B.end(),greater<long>());

	for (int i = 0 ; i < Z; i++){
		cin >> tmp;
		C.push_back(tmp);
	}
	sort(C.begin(),C.end(),greater<long>());

	long min = 0;
	for (int i = 0; i < X; i++){
		for (int j = 0; j < Y; j++){
			for (int k = 0; k < Z; k++){
				tmp = A[i]+B[j]+C[k];
				//ans.push_back(tmp);
				
				if (tmp > min){
					ans.push_back(tmp);
					if (ans.size() > 10000){
						sort(ans.begin(),ans.end());
						ans.erase(ans.begin(), ans.begin()+7000);
						min = ans[0];

					}
				}
				
				

			}
		}	
	}
	sort(ans.begin(),ans.end(),greater<long>());

	for (int i = 0 ; i < K ; i++){
		cout << ans[i] << endl;
	}
	return 0;
}



Measured memory_bytes: 640
#include<iostream>
#include<vector>
std::vector<std::vector<int>> vec;
int x[2];
int main(){
	do{
		std::cin>>x[0]>>x[1];
		if(x[0]!=0 && x[1]!=0)vec.push_back(std::vector<int>{x[0],x[1]});
	}while(x[0]!=0 && x[1]!=0);
	for(auto v:vec){
		for(int i=0;i<v[0];++i){
			std::string str(v[1],'#');
			std::cout<<str<<std::endl;
		}
		std::cout<<std::endl;
	}
	return 0;
}

Measured memory_bytes: 1212
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    static long[][] dp;
    static PrintWriter pw = new PrintWriter(System.out);

    public static long f(int[] arr, int[] w, int n, int sum, int W) {
        if (n == arr.length)
            return 0;
        if (dp[n][sum] != -1)
            return dp[n][sum];
        if (w[n] + sum <= W) {
            return dp[n][sum] = Math.max(arr[n] + f(arr, w, n + 1, sum + w[n], W), f(arr, w, n + 1, sum, W));
        }
        return dp[n][sum] = f(arr, w, n + 1, sum, W);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int W = sc.nextInt();
        int[] arr = new int[n];
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
            arr[i] = sc.nextInt();
        }
        dp = new long[105][100000 + 5];
        for (int i = 0; i < dp.length; i++)
            for (int j = 0; j < dp[i].length; j++)
                dp[i][j] = -1;
        pw.println(f(arr, w, 0, 0, W));
        pw.flush();
        pw.close();
    }
}

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

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

  vector<vector<int>> A(N, vector<int>(2));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> A.at(i).at(j);
    }
  }

  vector<vector<int>> C(M, vector<int>(2));
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> C.at(i).at(j);
    }
  }

  for (int i = 0; i < N; i++) {
    int X = 1e9;
    for (int j = 0; j < M; j++) {
      X = min(X, abs(A.at(i).at(0) - C.at(j).at(0)) + abs(A.at(i).at(1) - C.at(j).at(1)));
    }
    for (int j = 0; j < M; j++) {
      if (abs(A.at(i).at(0) - C.at(j).at(0)) + abs(A.at(i).at(1) - C.at(j).at(1)) == X) {
        cout << j + 1 << endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 256
//created by pyoxiao on 2020/05/10
#include<bits/stdc++.h>
#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define CL(a, b) memset(a, b, sizeof(a))
using namespace std;
const int mod = 1e9 + 7;
LL fpow(LL a, LL b, LL p = mod){LL ans = 1; a %= p; while(b) {if(b & 1) ans = ans * a % p; b >>= 1; a = a * a % p;} return ans;}
LL gcd(LL a, LL b){return b == 0 ? a : gcd(b, a % b);}
string s, t;
void solve() {
    cin >> s >> t;
    for(int i = 0; i < s.size(); i ++) {
        if(s[i] == t[i]) continue;
        cout << "No";
        return;
    }
    if(t.size() - s.size() == 1) cout << "Yes";
    else cout << "No";
}
int main() {
    int T = 1;
    // scanf("%d", &T);
    while(T --) 
        solve();
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
using namespace std;
int main()
{
    int n, k;
    cin >> n >> k;
    int ans = 1;
    for (int i = 0; i < n; ++i)
    {
        if (i == 0)
            ans *= k;
        else
            ans *= (k - 1);
    }
    cout << ans << endl;
}

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

int main() {
  int N = 0;
  cin >> N;
  
  vector<int> a(N);
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
//    cout << a.at(i) << endl;
  }
  
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  
  int Alice = 0, Bob = 0;
  for(int i = 0; i < N; i++){
//    cout << a.at(i) << endl;
    if(i % 2 == 0){
      Alice += a.at(i);
    }
    else{
    Bob += a.at(i);
    }
  }
  cout << Alice - Bob << endl;
}


Measured memory_bytes: 256
n=gets.to_i
k=26
a=1
al=[*'a'..'z']
while n>k
  a+=1
  n-=k
  k=k*26
end
ans=Array.new(a,"a")
n-=1

ans=n.to_s(26).tr("0-9a-p", "a-z")

(a-ans.length).times do 
  ans = "a#{ans}" 
end
puts ans

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

const int N = 500009;
const int mod = 1000000007;

#define IOS                               \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);
#define int long long int
#define endl "\n"
#define sz(a) (int)((a).size())
#define all(a) a.begin(), a.end()



void pre()
{
}

int32_t main()
{
	IOS;
	pre();
	int a,b;
	cin>>a>>b;
	int c = __gcd(a,b);
	cout<<(a*b/c)<<endl;
}

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

int main() {
  long int A, B, K;
  cin >> A >> B >> K;
  if(A > K){
    A -= K;
  }  
  else if((A + B) >= K){
    B = B + A - K;
    A = 0;
  }  
  else{
    A = 0;
    B = 0;
  }  
  cout << A << " "<< B << endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  int a = n/1.08;
  if(a*1.08 == n) {
    cout << a << endl;
    return 0;
  }
  if(int((a+1)*1.08) == n) cout << a+1 << endl;
  else cout << ":(" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) ll aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) string aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	ll N;
	cin>>N;
if(N==2){
  ce(0)
}else{
	ll i=2;
	ll ans=0;
	while(i*i<=N){
		if(N%i==0){
			if(N%(i-1)==N/(i-1)){
				ans+=i-1;
			}
			ll m=N/i;
          if(m!=i){
			if(N%(m-1)==N/(m-1)){
				ans+=m-1;
			}
          }
		}
		i++;
	}
	ce(ans+N-1)
}
}


Measured memory_bytes: 384
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long lint;

int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  bool result = false;
  for (int a = 0; a <= n; ++a)
    for (int b = 0; b <= m; ++b) {
      int many = a * (m - b) + (n - a) * b;
      if (many == k)
        result = true;
    }
  printf(result ? "Yes\n" : "No\n");
  return 0;
}


Measured memory_bytes: 256
N, X, Y = map(int, input().split())
l = [0 for _ in range(N-1)]
for i in range(1, N+1):
    for j in range(i+1,N+1):
        n = min(j-i, abs(i-X)+1 + abs(j-Y))
        l[n-1] +=1
for m in l:
    print(m)


Measured memory_bytes: 3444
<?php
$i = 0;
$str_list = [];
while ($line = trim(fgets(STDIN))) {
    $i++;
    if ($i === 1) continue;
    $str_list[] = $line;
};

sort($str_list, SORT_STRING);

foreach ($str_list as $str) {
    echo $str;
}
echo "\n";


Measured memory_bytes: 16236
#include <stdio.h>
   
#define PutChar(c) ; *p = (char)(c); ++p;
   
#define MAX_N (2000001)
#define MAX_Ai (10001)
#define STR_SIZE (10000010)
   
int getNum(void);
void putNum(int n);
void CountingSort(int A[], int B[], int k, int len);
   
int A[MAX_N];
int B[MAX_N];
char str[STR_SIZE];
char *p = str;
   
int main(void) {
    register int i;
    int n;
   
    fread(str, 1, STR_SIZE, stdin);
       
    n = getNum();
    for (i = 1; i <= n; ++i) {
        A[i] = getNum();
    }
       
    CountingSort(A, B, MAX_Ai, n);
       
    p = str;
    --n;
    for (i = 1; i <= n; ++i) {
        putNum(B[i]);
        PutChar(' ');
    }
    putNum(B[i]);
    PutChar('\0');
       
    puts(str);
       
    return 0;
}
   
int getNum(void) {
    int n = 0;
    while ((*p >= '0') && (*p <= '9')) {
        n = n * 10 + (int)(*p - '0');
        ++p;
    }
    ++p;
    return n;
}
   
void putNum(int n) {
    int d;
    if (n < 10) {
        PutChar('0' + n);
        return;
    }
    d = n / 10;
    if (d) putNum(d);
    PutChar('0' + (n - (d * 10)));
}
   
void CountingSort(int A[], int B[], int k, int len) {
    int C[MAX_Ai] = { 0 };
    int i, j;
    for (j = 1; j <= len; ++j) {
        ++C[A[j]];
    }
    for (i = 1; i <= k; ++i) {
        C[i] += C[i - 1];
    }
    for (j = len; j > 0; --j) {
        B[C[A[j]]] = A[j];
        --C[A[j]];
    }
}
 

Measured memory_bytes: 26764
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define deb(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;

typedef long long int ll;
typedef string str;
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;     
  
    x = x % p;   
    while (y) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;  
        x = (x*x) % p; 
    } 
    return res; 
} 

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

void fast(){
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main ()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	ll t,n,m,k,i,a,b,j;
	cin >> k;
	
	if(k%2==0)
		cout << "-1\n";
	else if(k==1)
		cout << "1\n";
	else
	{
		ll po[k+7];
		po[0]=1;
		for(i=1;i<=k+3;i++)
		{
			po[i]=(po[i-1]*10)%k;
		}
		a=7,i=0;
		b=a%k;
		while(i<=k && b!=0)
		{
			i++;
			a=((7*po[i])%k+b)%k;
			b=a%k;	
		}
		if(b!=0)
			i=-2;
		cout << i+1 << "\n";
	}
	return 0;
}

Measured memory_bytes: 11444
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int X, Y;
	cin >> X >> Y;

	cout << X + Y / 2 << "\n";

	return 0;
}

Measured memory_bytes: 256
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::*;
use std::collections::VecDeque;
use std::io::stdin;
use std::str::FromStr;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let mut sc = Scanner::new();
    let a = sc.next_isize();
    let b = sc.next_isize();
    let c = sc.next_isize();
    let d = sc.next_isize();
    println!("{}", [a * c, a * d, b * c, b * d].iter().max().unwrap());
}

pub struct Scanner {
    buf: VecDeque<String>,
}

impl Scanner {
    pub fn new() -> Self {
        Self {
            buf: VecDeque::new(),
        }
    }
    
    fn scan_line(&mut self) {
        let mut flag = 0;
        while self.buf.is_empty() {
            let mut s = String::new();
            stdin().read_line(&mut s).unwrap();
            let mut iter = s.split_whitespace().peekable();
            if iter.peek().is_none() {
                if flag >= 5 {
                    panic!("There is no input!");
                }
                flag += 1;
                continue;
            }
            
            for si in iter {
                self.buf.push_back(si.to_string());
            }
        }
    }
    
    pub fn next<T: FromStr>(&mut self) -> T {
        self.scan_line();
        self.buf.pop_front().unwrap().parse().unwrap_or_else(|_| panic!("Couldn't parse!"))
    }
    
    pub fn next_usize(&mut self) -> usize {
        self.next()
    }
    
    pub fn next_isize(&mut self) -> isize {
        self.next()
    }
    
    pub fn next_chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect_vec()
    }
    
    pub fn next_string(&mut self) -> String {
        self.next()
    }
    
    pub fn fill_vec_line<T: FromStr>(&mut self, v: &mut Vec<T>) {
        for vi in v {
            *vi = self.next();
        }
    }
    
    pub fn fill_vec<T: FromStr>(&mut self, v: &mut Vec<Vec<T>>) {
        for vi in v {
            for vii in vi {
                *vii = self.next();
            }
        }
    }
    
    pub fn make_vec_line<T: FromStr + Default + Clone>(&mut self, i: usize) -> Vec<T> {
        let mut v = vec![Default::default(); i];
        self.fill_vec_line(&mut v);
        v
    }
    
    pub fn make_vec<T: FromStr + Default + Clone>(&mut self, i: usize, j: usize) -> Vec<Vec<T>> {
        let mut v = vec![vec![Default::default(); j]; i];
        self.fill_vec(&mut v);
        v
    }
}


Measured memory_bytes: 2164
import bisect
n=int(input())
l=sorted(map(int,input().split()))
ans=0
for a in range(n):
    for b in range(a):
        A=l[a]
        B=l[b]
        c=bisect.bisect_left(l,A+B)
        ans+=c-a-1
print(ans)

Measured memory_bytes: 3188
#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
    int a[5];
    int k;
    for(int i=0;i<5;i++)
        cin>>a[i];
    cin>>k;
    sort(a,a+5);
    if((a[4]-a[0])>k)
        printf(":(");
    else
        printf("Yay!");
    return 0;
}


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

using namespace std;
using ll = long long;

int main() {
    ll n,m,k = 0;
    cin >> n >> m >> k;
    vector<ll> a(n);
    vector<ll> b(m);
    for(ll i = 0;i < n;i++){
        cin >> a[i];
    }
    for(ll i = 0;i < m;i++){
        cin >> b[i];
    }
    vector<ll> aSum(n + 1);
    vector<ll> bSum(m + 1);
    aSum[0] = 0;
    bSum[0] = 0;
    for(ll i = 1;i < n + 1;i++){
        aSum[i] = a[i - 1] + aSum[i - 1];
    }
    for(ll i = 1;i < m + 1;i++){
        bSum[i] = b[i - 1] + bSum[i - 1];
    }
/*
    for(ll i = 0;i <= n;i++){
        cout << aSum[i] << endl;
    }
    for(ll i = 0;i <= m;i++){
        cout << bSum[i] << endl;
    }
*/
    ll bCP = m;
    ll sum = 0;
    for(ll i = 0;i <= n;i++){
        if(aSum[i] > k){
            continue;
        }
        for(ll j = bCP;j >= 0;j--){
            if(aSum[i] + bSum[j] <= k){
                bCP = j;
                break;
            }
        }
        //cout << aSum[i] << " " << bSum[bCP] << endl;
        sum = max(sum, i + bCP);
    }

    cout << sum << endl;
    
    return 0;
}

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

int main()
{

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

	std::vector<int>vec;

	vec.push_back(a);
	vec.push_back(b);
	vec.push_back(c);

	std::sort(vec.begin(), vec.end());

	std::cout << (vec[2] - vec[0]) << endl;
	return 0;
}

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

bool ab[100000]={}, ac[100000]={}, bc[100000]={};

bool match(char c1, char c2){
    return (c1 == c2 || c1 == '?' || c2 == '?');
}


int main(){
    string  a,b,c;
    cin >> a >> b >> c;

    int A = a.size();
    int B = b.size();
    int C = c.size();
    rep(i,A){
        rep(j,B){
            if(!match(a[i], b[j])){
                ab[i-j+50000] = true;
            }
        }
    }
    rep(i,A){
        rep(j,C){
            if(!match(a[i], c[j])){
                ac[i-j+50000] = true;
            }
        }
    }
    rep(i,B){
        rep(j,C){
            if(!match(b[i], c[j])){
                bc[i-j+50000] = true;
            }
        }
    }
    int m = 6000;
    for(int i = -4000; i<4001; i++)for(int j = -4000; j<4001; j++){
        if(!ab[i+50000] && !ac[j+50000] && !bc[j-i+50000]){
            int R = max(max(i+B,j+C),A);
            int L = min(min(i,j),0);
            m = min(m,R-L);
        }
    }
    cout << m << endl;
    /*int f = -1;
    int rec = 0;
    rep(i,a.size()){
        if(a[i] == b[0] || a[i] == '?' || b[0] == '?'){
            rep(j,b.size()){
                if(i+j < a.size()){
                    if(a[i+j] == b[j] || a[i+j] == '?' || b[j] == '?'){
                        f = 1;
                        rec = i;
                    }else{
                        f = 0;
                    }
                }else{
                    f = 2;
                    rec = i;
                }
            }
        }
    }
    string d,e
    if(f == 0){
        d = a+b;
        e = b+a;
    }else if(f == )*/


}


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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long



int32_t main() {

    int H, W, h, w; cin >> H >> W >> h >> w;

    int tot = H*W;
    int rem = h*W + w*(H-h);

    cout << tot - rem << endl;
    
    return 0;
}


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

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

using namespace std;

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

	int h,w;
	cin >> h >> w;

	char c[h][w];
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> c[i][j];
		}
	}
	
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(c[i][j] == '#'){
				if(i != 0 && c[i-1][j] == '#') continue;
				if(i != h-1 && c[i+1][j] == '#') continue;
				if(j != 0 && c[i][j-1] == '#') continue;
				if(j != w-1 && c[i][j+1] == '#') continue;
				cout << "No\n";
				return 0;
			}
		}
	}
	
	cout << "Yes\n";

	return 0;
}

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

int main(){
  // input
  int D;
  cin >> D;
  int c[26];
  rep(i,26) cin >> c[i];
  int s[D+1][26];
  rep(i,D) rep(j,26) cin >> s[i+1][j];
  
  // define parameter
  int last[D+1][26];
  int t[D+1];
  rep(i,D+1) rep(j,26) last[i][j] = 0;
  
  // calculate initial content climbing
  int content = 0;
  for(int day = 1; day <= D; day++) {
    int content_after = -INF;
    int best_kind = 0;
    rep(kind,26) {
      int res = content + s[day][kind];
      rep(j,26) {
        if(j == kind) last[day][j] = day;
        else last[day][j] = last[day-1][j];
        res -= c[j] * (day - last[day][j]);
      }
      if(res > content_after) {
        best_kind = kind;
        content_after = res;
      }
    }
    t[day] = best_kind;
    content = content_after;
    rep(j,26) {
      if(j == t[day]) last[day][j] = day;
      else last[day][j] = last[day-1][j];
    }
  }
  for(int day = 1; day <= D; day++) cout << t[day]+1 << endl;
  return 0;
}


Measured memory_bytes: 3688
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

int main() {
    int n, d, x;
    int ans = 0;
    cin >> n;
    cin >> d >> x;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n) {
        for(int j = 1; j <= d; j += a[i]) {
            ans += 1;
        }
    }

    ans += x;
    cout << ans << endl;

}


Measured memory_bytes: 256