akhauriyash/Code-Regression huggingface dataset:
program g
  implicit none
  integer :: N,D
  integer,allocatable :: X(:,:)
  integer :: xl,yl,dx,di,pairs

  read(*,*) N,D
  allocate(X(D,N))
  read(*,*) X
  pairs=0
  do xl=1,n-1
     do yl=xl+1,n
        di=0
        do dx=1,d
           di=di+(X(dx,xl)-X(dx,yl))**2
        enddo
        if(int(sqrt(real(di)))**2.eq.di) then
           pairs=pairs+1
        endif
     enddo
  enddo
  write(*,'(i0)') pairs

end program g


Measured memory_bytes: 640
(defun digit-sum (n)
  (labels ((inner (m rv)
             (cond
               ((zerop m) rv)
               (t
                (multiple-value-bind (q r) (floor m 10)
                  (inner q (+ rv r)))))))
    (inner n 0)))

(defparameter sums
  (loop for n from 0 upto 10000
        collect `(,n ,(digit-sum n))))

(defun filter-sum (n a b)
  (let ((k (if (< 10001 n)
               10001
               (1+ n))))
    (remove-if-not #'(lambda (m) (<= a m b))
                   (subseq sums 0 k)
                   :key #'cadr)))

(defun answer (n a b)
  (loop for k in (filter-sum n a b)
        sum (car k)))

(let ((n (read)) (a (read)) (b (read)))
  (format t "~a~%" (answer n a b)))

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

bool dfs(int p, const vector<vector<int>> & Cs, const vector<int> & Xs, vector<int> & Ys){
    for (auto c : Cs[p]){
        if (not dfs(c, Cs, Xs, Ys)) return false;
    }

    int cum = 0;
    int cum_min = 0;
    vector<int> dif;
    for (auto c : Cs[p]){
        cum += Xs[c] + Ys[c];
        cum_min += min(Xs[c], Ys[c]);
        dif.push_back(abs(Xs[c] - Ys[c]));
    }

    if (cum_min > Xs[p]) return false;

    vector<bool> dp(Xs[p] + 1 - cum_min, false);
    dp[0] = true;
    for (auto d : dif) for (int i = Xs[p] - cum_min; i >= d; --i) if (dp[i - d]) dp[i] = true;

    for (int i = Xs[p] - cum_min; i >= 0; --i){
        if (dp[i]) {
            Ys[p] = cum - i - cum_min;
            return true;
        }
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<vector<int>> Cs(N, vector<int>());
    for (int i = 1; i < N; ++i){
        int p;
        cin >> p;
        Cs[--p].push_back(i);
    }
    vector<int> Xs(N);
    for (auto & x : Xs) cin >> x;
    vector<int> Ys(N, 0);
    if (dfs(0, Cs, Xs, Ys)){
        cout << "POSSIBLE" << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
def solve():
  n, k = map(int, input().split(' '))
  cost = list(map(int, input().split(' ')))
  dp = [float('inf') for _ in range(n)]
  dp[0] = 0
  dp[1] = abs(cost[1] - cost[0])
  
  for i in range(2, n):
    ls_tmp = []
    for j in range(1, k+1):
      if i - j >= 0:
        ls_tmp.append(dp[i-j] + abs(cost[i] - cost[i-j]))
    if ls_tmp:
      dp[i] = min(ls_tmp)
  print(dp[-1])


solve()

Measured memory_bytes: 56544
#include<bits/stdc++.h>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define ff(i, n) for (int i = 1; i <= n; i++)
#define F first
#define S second
#define vpii vector<pair<int,int> >
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back   
#define PB pop_back
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;





void solve(){
    int n, ans = 0;
    cin>>n;
    int a[n+5], b[n+5], c[n+5];
    ff(i,n)cin>>a[i];
    ff(i,n)cin>>b[i];
    ff(i,n-1)cin>>c[i];
    a[0] = a[n+1] = 123456789;
    ff(i,n)ans += b[i];
    ff(i,n-1)if(a[i] + 1 == a[i+1])ans += c[a[i]];
    cout<<ans;
}

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


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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;


int main() {
  int a,b,c;cin >> a >> b >> c;
  int sum=a+ b+ c;
  cout << (sum<22?"win":"bust");
}

Measured memory_bytes: 256
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

ll kw(ll x){
  ll ret = 0;
  while(x){
    ret += x%10;
    x /= 10;
  }
  return ret;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  string s;
  cin >> s;
  s = "0" + s;
  string ans = s;
  reprb(i, 1, SZ(ans)){
    if((ans[i] == '5' && ans[i-1] >= '5') || ans[i] > '5'){
      ll j = i;
      ans[j]++;
      while(j >= 1 && ans[j] > '5'){
        ans[j-1]++;
        ans[j] = '0';
        j--;
      }
    }
  }
  string b = string(SZ(ans), ans[0]);
  repr(i, 1, SZ(ans)){
    if(s[i] > ans[i]){
      b[i-1]--;
      b[i] = 10+ans[i]-s[i]+'0';
    }else{
      b[i] = ans[i]-s[i]+'0';
    }
  }
  ll ansp = 0;
  rep(i, SZ(ans)){
    ansp += ans[i]-'0';
    ansp += b[i]-'0';
  }
  dump(s);
  dump(ans);
  dump(b);
  print(ansp);
}


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

signed  main(void)
{
	string s;
	set<char> st;
	
	cin >> s;
	rep(i, s.size())
		st.insert(s[i]);
	if (st.size() != 26)
	{
		for(char c = 'a'; c <= 'z'; c++)
		{
			if (!st.count(c)) 
			{
				s += c;
				break;
			}
		}
		cout << s << endl;
	}
	else
	{
		if (s == "zyxwvutsrqponmlkjihgfedcba")
			cout << -1 << endl;
		else
		{
			string t = s;
			next_permutation(t.begin(), t.end());
			rep(i, 26)
			{
				if (t[i] != s[i])
				{
					cout << t.substr(0, i + 1) << endl;
					break;
				}
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int m,f,r;
	while(1){
		scanf("%d %d %d",&m,&f,&r);
		if(m==-1&&f==-1&&r==-1){
			break;
		}
		else if(m==-1||f==-1){
			printf("F\n");
		}
		else if(m+f>=80){
			printf("A\n");
		}
		else if(65<=m+f&&m+f<80){
			printf("B\n");
		}
		else if(50<=m+f&&m+f<65){
			printf("C\n");
		}
		else if(30<=m+f&&m+f<50){
			if(r>=50){
				printf("C\n");
			}
			else{
				printf("D\n");
			}
		}
		else if(m+f<30){
			printf("F\n");
		}
	}
	return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll xn = a[0];
    repSE(i,1,n) {
        xn = xn ^ a[i];
    }
    vector<int> ans(n);
    rep(i,n) {
        ans[i] = xn ^ a[i];
    }
    rep(i,n) cout << ans[i] << " ";
    cout << "\n";
    return 0;
}


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

const int N=1001000,mod=1000000007;
typedef long long ll;
int f[N],n,ans;
inline void reduce(int&x){x+=x>>31&mod;}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	f[0]=f[1]=0;f[2]=1;cin>>n;
	for(int i=3;i<=n+1;++i)f[i]=(2ll*f[i-1]-f[i-2]+f[i-3]+mod)%mod;
	reduce(ans=((ll)(n+1)*f[n+1]+(ll)(n-1)*(n-1)%mod*f[n]+f[n-1])%mod);
	for(int i=0;i<=n+1;++i)reduce(ans-=f[i]);
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 4224
function Main(input) {
    input = input.split("\n");
    for (i=0; i < input.length-1; i++) {
        tmp = input[i].split(" ")
        var a = tmp[0]
        var b = tmp[1]
        if (a === b) {
            console.log("a == b") 
        } else if (a > b) {
            if (Math.sign(a) === -1 && Math.sign(b) === -1) {
                console.log("a < b")
            } else {
                console.log("a > b")
            }
        } else {
            if (Math.sign(a) === -1 && Math.sign(b) === -1) {
                console.log("a > b")
            } else {
                console.log("a < b")
            }
        }
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 17140
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <set>
using namespace std;

int main(int argc, char const *argv[]) {
  long long x,y;cin>>x>>y;
  long long res=1ll<<60;
  if(y>=x)res = min(res,y-x);
  if(y>=-x)res = min(res,y+x+1);
  if(-y>=x)res = min(res,-y-x+1);
  if(-y>=-x)res = min(res,-y+x+2);
  cout<<res<<endl;
  return 0;
}


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

#define int ll

#define pb push_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define fs first
#define sd second

typedef long long ll;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

double get_time() {
	return 1.0 * clock() / CLOCKS_PER_SEC;
}

const int MOD = 1E9 + 7;

int32_t main() {
	int n, k;
	cin >> n >> k;
	vvi adj(n, vi(n)), res(n, vi(n));
	for(int i = 0; i < n; i++)
		res[i][i] = 1;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < n; j++)
			cin >> adj[i][j];
	for(int i = 0; i < 63; i++) {
		if(k & (1LL << i)) {
			vvi tmp(n, vi(n));
			for(int u = 0; u < n; u++)
				for(int v = 0; v < n; v++)
					for(int w = 0; w < n; w++)
						tmp[u][v] = (tmp[u][v] + res[u][w] * adj[w][v] % MOD) % MOD;
			swap(res, tmp); 
		}
		vvi tmp(n, vi(n));
		for(int u = 0; u < n; u++) {
			for(int v = 0; v < n; v++) {
				for(int w = 0; w < n; w++)
					tmp[u][w] = (tmp[u][w] + adj[u][v] * adj[v][w] % MOD) % MOD;
			}
		}
		swap(adj, tmp);
	}
	int ans = 0;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++)
			ans = (ans + res[i][j]) % MOD;
	}
	cout << ans << '\n';
}


Measured memory_bytes: 256
public class Main {

	public static void main(String[] args) {
		java.util.Scanner in = new java.util.Scanner(System.in);
		int n = in.nextInt();
		int[] team = new int[n];
		int[] tmp = new int[4];
		for (int j=0; j<(n*(n-1)/2); j++) {
			for (int i=0; i<4; i++) {
				tmp[i] = in.nextInt();
			}
			if(tmp[2] < tmp[3])
				team[tmp[1]-1] += 3;
			if(tmp[2] == tmp[3]) {
				team[tmp[0]-1] += 1;
				team[tmp[1]-1] += 1;
			}
			if(tmp[2] > tmp[3])
				team[tmp[0]-1] += 3;
		}
		for (int i=0; i<n; i++) {
			int cnt = 1;
			for (int j=0; j<n; j++) {
				if(team[i] < team[j]) cnt++;
			}
			System.out.println(cnt);
		}
	}
}

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

int main() {
  int n;
  cin >> n;
  int ct;
  
  for (int i = 0; i < n; i++) {
    int a;
    cin >>a;
    if (a != i+1) ct++;
  
  }
  
  if (ct <= 2) cout << "YES" <<endl;
  else cout << "NO" <<endl;

}

Measured memory_bytes: 256
mod=10**9+7
n=int(input())
d=n.bit_length()
DP=[[0]*3 for _ in range(d+1)]
DP[0][0]=1
for i in range(d):
    if n>>(d-i-1)&1:
        DP[i+1][0]=DP[i][0]
        DP[i+1][1]=(DP[i][0]+DP[i][1])%mod
        DP[i+1][2]=(DP[i][1]*2+DP[i][2]*3)%mod
    else:
        DP[i+1][0]=(DP[i][0]+DP[i][1])%mod
        DP[i+1][1]=DP[i][1]
        DP[i+1][2]=(DP[i][1]+DP[i][2]*3)%mod
print(sum(DP[-1])%mod)

Measured memory_bytes: 38384
#include <iostream>
#include <vector>

using namespace std;
const long long int mod = 1e9 + 7;
int main() {
	int N, M;
	cin >> N >> M;
	vector<int> oks(N + 1, true);
	for (int i = 0; i < M; ++i) {
		int a;
		cin >> a;
		oks[a] = false;
	}

	vector<long long int> dp(N + 1);
	dp[0] = 1;
	for (int now = 0; now < N; ++now) {
		for (int next = now + 1; next <= min(N, now + 2); ++next) {
			if (oks[next]) {
				dp[next] += dp[now];
				dp[next] %= mod;
			}
		}
	}
	cout << dp[N] << endl;
}


Measured memory_bytes: 1408
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Queue;
import java.util.Scanner;
 


public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static int K,N;
	static int mod =1000000007;
	public static void main(String[] args) {
		//45
		int A=sc.nextInt();
		int B=sc.nextInt();
		String S=sc.next();
		boolean x=true;
		for(int i=0;i<A+B+1;i++) {
			if(S.charAt(i)==45&&i!=A) {
				x=false;
			}
			if(S.charAt(i)!=45&&i==A) {
				x=false;
			}
		}
		if(x)p("Yes");
		else p("No");
		}

	
	//static ArrayList<Integer> cc = new ArrayList<>(10001);
	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
long N,A,B;
int main(){
  cin>>N>>A>>B;
  if(A>B)swap(A,B);
  if((B-A)%2==0)cout<<(B-A)/2<<endl;
  else cout<<min(A-1,N-B)+1+(B-A-1)/2<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll lcm(ll a,ll b){return a*b/__gcd(a,b);}
ll const MOD = 1e9 + 7;
int main()
{
    int n,t,s;
    cin>>n>>t>>s;
    if(t*s>=n)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3612
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.NoSuchElementException;
public class Main {
	public static void main(String[] args)throws Exception{
		PrintWriter out = new PrintWriter(System.out);
		char a=next().charAt(0);
		if(Character.isLowerCase(a))
			System.out.println('a');
		else
			System.out.println('A');
		out.flush();
	}
	static boolean isOK(int index,int key,ArrayList<Integer>a){
		if (a.get(index) >= key) return true;
	    else return false;
	}
	static int binary_search(int key,ArrayList<Integer> a) {
	    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	    int ok = (int)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	    while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;

	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    }
	    return ok;
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
}


Measured memory_bytes: 32516
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
/*int min(double *x,int n){
	int i,c=0;
	double ans;
	ans=100005;
	for(i=0; i<n; i++){
		if(ans>x[i]){
			ans=x[i];
			c=i;
		}
	}
	return c;
}*/
int main()
{
	int n,i,c=0;
	double h[1005],max;
	double m=0.006,f,t,a;
	double ans[1005];
	scanf("%d%lf%lf",&n,&t,&a);
	max=1000000.000;
	for(i=0; i<n; i++){
		scanf("%lf",&h[i]);
		f=(h[i]*m);
		f=t-f;
		ans[i]=abs(a-f);
		if(ans[i]<max){
			max=ans[i];
			c=i;
		}
		//printf("%lf\n",ans[i]);
	}
	printf("%d\n",c+1);
	return 0;
}

Measured memory_bytes: 256
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
from itertools import accumulate
accumulated1 = [0] + list(accumulate(A))
accumulated2 = [0] + list(accumulate(B)) + [10**10]
def check(x,now):
    if accumulated1[now] + accumulated2[x] <= K: return True
    else: return False

# [True, .. ,True ,False,.. , False ] のときは探索区間を半開区間で持つ
#[l,r)

def bisect(l,r,now):
    if r - l == 1: return  l
    mid = (r+l)//2
    # l <= r ならば自明に l <= mid <= r  でこれの仮定は呼び出し1,2のいずれでも成立するので始めの呼び出しさえ正しければ永遠に成立.

    # //2 するので mid * 2 == r + l  か  mid * 2 ==  r + l + 1 のどっちか

    # 引数が l == r って時あるか? 
    # いま引数 l, rが l < r として,次の呼び出し1,2を考える.

    # mid == r  <=>  r - l == 0 (仮定より無い)か r - l == 1 (始めのifでカットするので無い)
    # mid == l  <=>  r - l == 0 (仮定より無い)か l - r == 1 (l > r なので無い)

    # 結局 一番始めの呼び出しのl,rを l < r とすれば 
    # l < mid < r となりずーっと l < r が保たれる.
    # l != mid かつ mid != r だから 1,2のどっちを呼び出されても更新される(無限ループとはならない)のでそのうち r - l == 1 になって止まる.

    if check(mid,now):
        #呼び出し1
        return bisect(mid,r,now)
    else:
        #呼び出し2
        return bisect(l,mid,now)


ans = 0
for i in range(N+1):
    if accumulated1[i] > K: pass
    else: ans = max(ans,bisect(0,M+1,i) + i)
print(ans)



Measured memory_bytes: 50528
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
 
#define int ll
#define FOR(i,n,k) for(int i=n;i<k;i++)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int32_t main()
{
    IOS;
    string s;
    cin>>s;
    int x,y,n;
    x = y = 0;
    n = s.length();
    FOR(i,0,n)
    {
    	if(s[i]=='A')
    	{
    		y = i;
    		break;
    	}
    }
    FOR(i,0,n)
    {
    	if(s[n-i-1]=='Z')
    	{
    		x = n-i-1;
    		break;
    	}
    }
    cout<<x-y+1<<"\n";
    return 0;
}

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


int main() {
    ll N;
    cin >> N;
    vector<ll> vec;
    ll big = 1000000000000000000;
    for (ll i = 0;i<N;i++) {
        ll a;
        cin >> a;
        vec.push_back(a);
    }
    ll ans = 1;
    for (ll i = 0;i<N;i++) {
        if (ans > big/vec.at(i)) {
            ans = -1;
            break;
        }
        ans *= vec.at(i);
    }
    bool zero = false;
    for (ll i = 0;i<N;i++) {
        if (vec.at(i) == 0) zero = true;
    }
    if (zero) cout << 0 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 4316
// AOJ 1330: Never Wait for Weights
// 2017.12.3 bal4u@uu

#include <stdio.h>
#include <string.h>

// <????????????Union Find>
#define MAX 100003

int par[MAX], ws[MAX];

#if 0
void initWeightedUnionFind()
{
	int i;
	for (i = 0; i < n; i++) par[i] = -1;
}
#endif

int find(int x)
{
	int p;
	if (par[x] < 0) return x;
    p = find(par[x]), ws[x] += ws[par[x]];
    return par[x] = p;
}
    
int weight(int x)
{
    find(x); 
    return ws[x];
}
    
int unite(int x, int y, int w)  // x <-(w)- y (x + w = y)
{
	int tmp;

    w += weight(x), w -= weight(y);
    x = find(x), y = find(y);
    if (x == y) return 0;
    if (par[y] < par[x]) // ???????????????????????????????????????????????????.
        tmp = x, x = y, y = tmp, w = -w;
    
    par[x] += par[y], par[y] = x;
    ws[y] = w;
    return 1;
}
    
int same(int x, int y)
{
	return find(x) == find(y);
}

// *ans = x - y. ?????????????????? return 0.
int diff(int *ans, int x, int y)
{
    if (find(x) != find(y)) return 0;
	*ans = ws[x] - ws[y];
	return 1;
}
// </????????????Union Find>

char buf[40], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	p++;
	return n;
}

int main()
{
	int n, m, q, a, b;

	while (fgets(p=buf, 40, stdin) && *p != '0') {
		n = getint(), m = getint();
		memset(par, 0xff, (n+1)*sizeof(int));
		memset(ws, 0, (n+1)*sizeof(int));
		while (m--) {
			fgets(p=buf, 40, stdin);
			q = *p, p += 2, a = getint(), b = getint();
			if (q == '!') unite(b, a, getint());
			else {
				if (find(a) != find(b)) puts("UNKNOWN");
				else printf("%d\n", ws[a] - ws[b]);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 2508
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

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

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

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

  int N, K;
  cin >> N >> K;
  vector<vector<int>> A(K);
  rep(i, K) {
    int tmp {};
    cin >> tmp;
    vector<int> A_tmp(tmp);
    rep(i, tmp) {
      cin >> A_tmp[i];
    }
    A[i] = A_tmp;
  }

  vector<int> B(N, 0);
  rep(i, K) {
    rep(j, A[i].size()) {
      ++B[A[i][j] - 1];
    }
  }

  int answer {};
  rep(i, N) {
    if (B[i] == 0)++answer;
  }
  cout << answer << '\n';
}


Measured memory_bytes: 3668
#include <iostream>
using namespace std;
 
int main(){
	int s;
	cin >> s;

    int prev = s;
    int curr;
    
    int i = 0;

    int stack[10000];

    stack[0] = prev;

    while(1){
        if(prev%2==0){
            curr = prev / 2;
        }else
        {
            curr = 3 * prev + 1;
        }
        i++;
        stack[i] = curr;

        for(int j=0; j<i;j++){
            if(stack[j] == curr){cout << i+1 << endl; return 0;}
        }

        
        prev = curr;

    }

    

    
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
char a[100000+10],b[100000+10];
int main()
{
	scanf("%s",a);
	int len=strlen(a);
	int h=0;
	for(int i=0;i<=len;i++)
	{
		if(a[i]==a[i+1])
		{
			continue;
		}
		else
		{
			b[h++]=a[i];
		}
	}
	int ans=h-1;
	printf("%d\n",ans);
	return 0;
}

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

class hoge{
private:
    int n;
    int in[50];
    bool f[50];

public:
    hoge(int _n){
        n = _n;
        
        for(int i;i<50;++i)
        {
            in[i] = 0;
            f[i] = 0;
        }
        
    }
    void input(int _in,int _i){
        in[_i] = _in;
        //cout << _i << ":" << in[_i]<< endl;
    }
    void setf(){
        for(int i=0;i<n;i++){
            if(in[i]+1==in[i+1]){
                f[i] = true;
            }
        }
    }
    int rec(int _i){
        int t;
        if (f[_i]) {
            t = this->rec(_i + 1);
        }
        else {
            t = _i;
        }
        return t;
    }
    void ans(){
        string result;
        int t;

        for(int i=0;i<n;i++){
            //cout << "i=" << i << "/";
            t = this->rec(i);
            i==t ? cout << in[i] : cout << in[i] << "-" << in[t];
            if (t != (n - 1))
                cout << " ";
            i = t;
        }
        cout << endl;
        //return result;
    }


};

int main() {

    hoge *hg;
    int n;
    int in;

    while(true) {
        cin >> n;
        //cout << "n:" << n << endl;
        if(n==0)
            break;
        hg = new hoge(n);

        for(int i=0;i<n;i++){
            cin >> in;
            hg->input(in,i);
        }

        hg->setf();
        hg->ans();

        delete hg;
        hg = 0;
    }

    return 0;
}

Measured memory_bytes: 1196
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};


void solve(){
    ll c[10][10];
    rep(i,3)rep(j,3) cin>>c[i][j];
    bool ok=true;
    ll a=c[1][0]-c[0][0];
    ll b=c[2][0]-c[1][0];
    rep(j,3){
        if( (c[1][j]-c[0][j]!=a) || (c[2][j]-c[1][j]!=b) ){
            ok=false;
        }
    }
    a=c[0][1]-c[0][0];
    b=c[0][2]-c[0][1];
    rep(i,3){
        if(c[i][1]-c[i][0]!=a||c[i][2]-c[i][1]!=b){
            ok=false;
        }
    }
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}




signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    solve();

    return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define PI acos(-1)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

int modpow(int x, int n, int m) {
	x %= m;
	int res = 1;
	while(n > 0) {
		if(n & 1)
			res = res * x % m;
		x = x * x % m;
		n >>= 1;
	}
	return res;
}

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 1e5 + 10;

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	srand(chrono::steady_clock::now().time_since_epoch().count());

	map<string, int> m;
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) {
		string s;
		cin >> s;
		m[s]++;
	}
	int mx = 0;
	for(auto it : m) {
		mx = max(mx, it.se);
	}
	for(auto it : m) {
		if(it.se == mx) {
			cout << it.fi << endl;
		}
	}

	return 0;
}

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

using namespace std;

int main(){
    int x;
    cin >> x;
    int k;
    cin >> k;
    vector<int> r(k+1),d(k+1);
    vector<int> sl(k+1),si(k+1);
    vector<int> ll(k+1),li(k+1);
    r[0] = 0;
    sl[0] = 0;
    si[0] = 0;
    ll[0] = x;
    li[0] = x;
    d[0] = 0;
    for(int i = 1;i <= k;i++){
        cin >> r[i];
        if(i%2){
            if(sl[i-1] - r[i] + r[i-1] > 0){
                sl[i] = sl[i-1] - r[i] + r[i-1];
                si[i] = si[i-1];
            }
            else{
                sl[i] = 0;
                si[i] = si[i-1] - (sl[i-1] - r[i] + r[i-1]);
            }
            if(ll[i-1] - r[i] + r[i-1] > 0){
                ll[i] = ll[i-1] - r[i] + r[i-1];
                li[i] = li[i-1];
            }
            else{
                ll[i] = 0;
                li[i] = 0;
            }
        }
        else{
            if(ll[i-1] + r[i] - r[i-1] < x){
                ll[i] = ll[i-1] + r[i] - r[i-1];
                li[i] = li[i-1];
            }
            else{
                ll[i] = x;
                li[i] = li[i-1] - (ll[i-1] + r[i] - r[i-1] - x);
            }
            if(sl[i-1] + r[i] - r[i-1] < x){
                sl[i] = sl[i-1] + r[i] - r[i-1];
                si[i] = si[i-1];
            }
            else{
                sl[i] = x;
                si[i] = x;
            }
        }
        //cout << sl[i] << ' ' << si[i] << ' ' << ll[i] << ' ' << li[i] << endl;
    }
    int q;
    cin >> q;
    for(int i = 0;i < q;i++){
        int t,a;
        cin >> t >> a;
        int index = upper_bound(r.begin(),r.end(),t) - r.begin() - 1;//cout << index << endl;
        if(a < si[index]) a = sl[index];
        else if(a > li[index]) a = ll[index];
        else a = sl[index] + a - si[index];
        if(index % 2){
            if(a + t - r[index] < x){
                cout << a + t - r[index] << endl;
            }
            else{
                cout << x << endl;
            }
        }
        else{
            if(a - t + r[index] > 0){
                cout << a - t + r[index] << endl;
            }
            else{
                cout << 0 << endl;
            }
        }
    }
}

Measured memory_bytes: 3584
def resolve():
    n, k = map(int, input().split())
    input_list = []
    for _ in range(n):
        ai, bi = map(int, input().split())
        input_list.append([ai, bi])

    input_list.sort()
    count_dic = {}
    prev_max = 0
    for key, value in input_list:
        if key in count_dic.keys():
            count_dic[key] += value
        else:
            count_dic[key] = value + prev_max
        prev_max = count_dic[key]

        if count_dic[key] >= k:
            print(key)
            return
          
resolve()

Measured memory_bytes: 30376
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<bool> vb;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);
const double eps=1e-8;

class Network{
	private:
	int GV,GE;
	struct edge{
		int to,cap,rev;
	};
	vector<vector<edge> > List;
	int DFS(int v,int t,int f,vi& iter,vi level){
		if(v==t) return f;
		for(int &i=iter[v];i<List[v].size();i++){
			edge &e=List[v][i];
			if(e.cap>0&&level[v]<level[e.to]){
				int d=DFS(e.to,t,min(f,e.cap),iter,level);
				if(d>0){
					e.cap-=d;
					List[e.to][e.rev].cap+=d;
					return d;
				}
			}
		}
		return 0;
	}
	void BFS(int s,vi& level){
		level=vi(GV,-1);
		queue<int> que;
		level[s]=0;
		que.push(s);
		while(!que.empty()){
			int v=que.front();
			que.pop();
			for(int i=0;i<List[v].size();i++){
				edge &e=List[v][i];
				if(e.cap>0&&level[e.to]<0){
					level[e.to]=level[v]+1;
					que.push(e.to);
				}
			}
		}
	}
	public:
	Network(int v,int e){
		GV=v;
		GE=e;
		List=vector<vector<edge> >(v);
	}
	void add_edge(int s,int t,int c){
		List[s].push_back(edge{t,c,(int)List[t].size()});
		List[t].push_back(edge{s,0,(int)List[s].size()-1});
	}
	int MFplus(int s,int t){
		int ans=0;
		while(1){
			vi iter(GV),level;
			BFS(s,level);
			if(level[t]<0) return ans;
			int f;
			while((f=DFS(s,t,inf,iter,level))>0) ans+=f;
		}
	}
};

int V,E;

int main(){
	cin>>V>>E;
	Network net(V,E);
	int s,t,c;
	for(int i=0;i<E;i++){
		cin>>s>>t>>c;
		net.add_edge(s,t,c);
	}
	cout<<net.MFplus(0,V-1)<<endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

#define All(x) (x).begin(),(x).end()

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
#define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

    int x, y;

	cin >> x >> y;

	Out(x + y / 2);
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for (int i=a; i<b; ++i)

void DFS(vector < vector <int> > &adjList, vector <ll> &counter, ll val, ll start)
{
    counter[start]+=val;
    val=counter[start];
    loop(i, 0, adjList[start].size())
    {
        DFS(adjList, counter, val, adjList[start][i]);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll N,Q;
    cin >> N >> Q;
    vector < vector <int> > adjList(N+1);
    vector <ll> counter(N+1, 0);
    loop(i, 0, N-1)
    {
        ll a,b;
        cin >> a >> b;
        adjList[a].push_back(b);
    }
    // cout << "X" << endl;
    loop(i, 0, Q)
    {
        ll a, b;
        cin >> a >> b;
        counter[a]+=b;
    }
    // cout << "Y" << endl;
    DFS(adjList, counter, 0, 1);
    loop(i,1,N+1) cout << counter[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 24320
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
    
int main() {
    string s;
    cin >> s;
    int n = s.length();
    bool flag = true;
    rep(i,n) {
        if (i % 2 == 1) {
            if (s[i] == 'R') flag = false;
        }else{
            if (s[i] == 'L') flag = false;
        }
    }
    
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
N,K = map(int, input().split())

X = []
idx = 0
for i,x in enumerate(input().split()):
    x = int(x)
    X.append(x)
    if x < 0:
        idx = i + 1
if idx == N:
    idx = N-1
ans = 10**9
for i in range(max(0,idx-K), min(N-K+1,idx+K)):
    tmp = 0
    if i <= idx <= i+K-1 or i >= idx or i+K-1 <= idx:
        tmp = min(abs(X[i]), abs(X[i+K-1]))
    # print(i,tmp)
    ans = min(ans, X[i+K-1] - X[i] + tmp)
print(ans)

Measured memory_bytes: 14480
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let s: String = scan(tokens);
    let mut s: Vec<u8> = s.into_bytes();
    let mut h: Vec<u8> = Vec::new();
    let mut rev = false;
    let q: usize = scan(tokens);
    for _ in 0..q {
        let t: usize = scan(tokens);
        if t == 1 {
            rev = !rev;
        } else {
            let f: usize = scan(tokens);
            let c: String = scan(tokens);
            let c: u8 = c.as_bytes()[0];
            if (f == 1) ^ rev {
                h.push(c);
            } else {
                s.push(c);
            }
        }
    }
    if rev {
        s.reverse();
        println!(
            "{}{}",
            String::from_utf8(s).unwrap(),
            String::from_utf8(h).unwrap()
        );
    } else {
        h.reverse();
        println!(
            "{}{}",
            String::from_utf8(h).unwrap(),
            String::from_utf8(s).unwrap()
        );
    }
}


Measured memory_bytes: 6652
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k); i > (n); i--)
#define FORre(i, k, n) for(int i = (k); i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;

const int mod = 1000000007;

class mint{
  public:
  ll x;
  mint(ll x = 0):x(x % mod){};
  mint pow(ll y) const {
    mint res(1);
    mint a(x);
    while(y>0){
      if(y&1) res *= a;
      a *= a;
      y >>= 1;
    }
    return res;
  }
  mint inv() const{
    return pow(mod-2);
  }
  mint& operator+= (const mint a) noexcept {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-= (const mint a) noexcept {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*= (const mint a) noexcept {
    (x *= a.x) %= mod;
    return *this;
  }
  mint& operator/= (const mint a) noexcept {
    return (*this) *= a.inv();
  }
  mint operator+ (const mint a) const noexcept {
    mint res(*this);
    return res += a;
  }
  mint operator- (const mint a) const noexcept {
    mint res(*this);
    return res -= a;
  }
  mint operator* (const mint a) const noexcept {
    mint res(*this);
    return res *= a;
  }
  mint operator/ (const mint a) const noexcept{
    mint res(*this);
    return res /= a;
  }
};

mint modncm(ll n, ll m){
  mint a = 1, b = 1;
  REP(i, m) a *= mint(n-i), b *= (m-i);
  return a * b.inv();
}

int main(void){
  int x, y;
  cin >> x >> y;
  if((x+y)%3){
    cout << 0 << endl;
    return 0;
  }
  int n = (x+y)/3;
  x-=n, y-=n;
  if(x < 0 || y < 0){
    cout << 0 << endl;
    return 0;
  }
  mint ans = modncm(x+y, x);
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
const int mod = 1e9+7;
int ad(int a, int b){
  if(a+b>mod) return a+b-mod;
  else return a+b;
}

int main(){

  int h,w;
  cin >> h >> w;
  string s[h];
  rep(i,h) cin >> s[i];
  int dp[h][w];
  rep(i,h) rep(j,w) dp[i][j]=0;
  dp[0][0]=1;
  queue<pair<int, int> > q;
  q.push(mp(0,0));
  while(!q.empty()){
    pair<int, int> p=q.front();q.pop();
    int hi=p.first;
    int wi=p.second;
    if(hi+1<h){
      if(s[hi+1][wi]=='.'){
	if(dp[hi+1][wi]==0) q.push(mp(hi+1,wi));
	dp[hi+1][wi]=ad(dp[hi+1][wi],dp[hi][wi]);
      }
    }
    if(wi+1<w){
      if(s[hi][wi+1]=='.'){
	if(dp[hi][wi+1]==0)q.push(mp(hi,wi+1));
	dp[hi][wi+1]=ad(dp[hi][wi+1],dp[hi][wi]);
      }
    }
    //    cout << hi << " " << wi << endl;
  }
  cout << dp[h-1][w-1] << endl;
  
  
  return 0;

}


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

int main() {
  int N;
  int a = 0;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    
    a += r - l + 1;
  }
  cout << a << endl;
}


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

#ifdef LOCAL
#include "contest.h"
#else
#define error(args...) 
#endif

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w; }

void iostream_init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(12);
}
//}}}

int main(){
    iostream_init();
    int N;
    LL A, B;
    cin >> N >> A >> B;
    vector<int> X(N);
    REP(i, N) cin >> X[i];
    LL ans = 0;
    for(int i = 1; i < N; i++) {
        LL d = X[i] - X[i-1];
        ans += min(d * A, B);
    }
    cout << ans << endl;
    return 0;
}



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

int main(){
	int n,x,d,a;
  	cin>>n>>d>>x;
  	for(int i=0;i<n;i++){
    	cin>>a;
      	for(int i=1;i<=d;i+=a){
        	x+=1;
        }
    }
  cout<<x;
  	
}

Measured memory_bytes: 3608