akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

// macro
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
using ll = long long;
using P = pair<int,int>;

// code starts
#define INF 1020304050

int main()
{
	int h,w;
	cin >> h >> w;
	int ch,dh,cw,dw;
	cin >> ch >> cw >> dh >> dw;
	vector<vector<char>> s(h+10,vector<char>(w+10));
	int i,j,k;
	rep(i,h+10)rep(j,w+10)
	{
		if(i >= 5 && i < h+5 && j >= 5 && j < w+5)
		{
			cin >> s[i][j];
		}
		else s[i][j] = '#';
	}
	ch--;
	cw--;
	dh--;
	dw--;
	vector<vector<int>> mins(h+10,vector<int>(w+10,INF));
	mins[ch+5][cw+5] = 0;
	queue<P> q;
	queue<P> q2;
	vector<int> dx = {0,1,0,-1};
	vector<int> dy = {1,0,-1,0};
	q.push(make_pair(ch+5,cw+5));
	int cnt = 0;
	while(!q.empty())
	{
		vector<P> warp(0);
		while(!q.empty())
		{
			while(!q.empty())
			{
				P nowp = q.front();
				q.pop();
				int nh = nowp.first;
				int nw = nowp.second;
				warp.emplace_back(make_pair(nh,nw));
				/*for(i=nh-2;i<=nh+2;i++)
				{
					for(j=nw-2;j<=nw+2;j++)
					{
						if(mins[i][j] == INF && s[i][j] == '.')
						{
							warp.emplace_back(make_pair(i,j));
						}
					}
				}*/
				rep(i,4)
				{
					int toh = nh+dy[i];
					int tow = nw+dx[i];
					if(mins[toh][tow] == INF && s[toh][tow] == '.')
					{
						mins[toh][tow] = mins[nh][nw];
						q2.push(make_pair(toh,tow));
					}
				}
			}
			while(!q2.empty())
			{
				q.push(q2.front());
				q2.pop();
			}
		}

		for(k=0;k<warp.size();k++)
		{
			P nowp = warp[k];
			int nh = nowp.first;
			int nw = nowp.second;
			for(i=nh-2;i<=nh+2;i++)
			{
				for(j=nw-2;j<=nw+2;j++)
				{
					if(mins[i][j] == INF && s[i][j] == '.')
					{
						mins[i][j] = cnt+1;
						q.push(make_pair(i,j));
					}
				}
			}

		}

		cnt++;
	}
	if(mins[dh+5][dw+5] == INF) cout << -1 << endl;
	else cout << mins[dh+5][dw+5] << endl;
}


Measured memory_bytes: 8808
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
using namespace std;
#define N (1000000000+7)
typedef pair<int,int> P;
typedef long long ll;
bool prime[300000]={false};
void furui() {
	int i = 2;
    prime[0]=true;
    prime[1]=true;
	while (i <= 300000) {
		int j = 2;
		while (j*j <= i && !prime[i]) {
			if (i%j == 0) {
				prime[i] = true;
				break;
			}
			else j++;
		}
		int z = 2;
		while (!prime[i]) {
			if (i*z <= 300000) {
				prime[i*z] = true;
				z++;
			}
			else break;
		}
		i++;
	}
}

int p[300000]={0};

int main(void){
    int n;
    furui();
    for(int i=1;i<300000;i++){
        if(!prime[i])p[i]=p[i-1]+1;
        else p[i]=p[i-1];
    }
    while(true){
        cin>>n;
        if(n==0)break;
        cout<<p[2*n]-p[n]<<endl;
    }
    return 0;
}


Measured memory_bytes: 4548
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<set>
#include<functional>
#include<iomanip>

#define LLI long long int

using namespace std;

int main(){
	int N,M;cin>>N>>M;
	vector<int>A(N);
	for(int i=0;i<N;i++)cin>>A[i];
	sort(A.begin(),A.end());
	vector<pair<int,int> >CB(M);
	for(int i=0;i<M;i++){
		cin>>CB[i].second>>CB[i].first;
	}
	sort(CB.begin(),CB.end(),greater<pair<int,int> >());
	int i=0,j=0;
	while(i<N&&j<M&&A[i]<CB[j].first){
		A[i]=CB[j].first;
		i++;
		CB[j].second--;
		if(CB[j].second==0)
			j++;
	}
	LLI ans=0;
	for(int i=0;i<N;i++){
		ans+=A[i];
	}
	cout<<ans<<endl;
	return 0;
}



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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

template <typename T>
T BinarySearch(T lo, T hi, std::function<bool(T)> pred) {
  while (lo + 1 < hi) {
    T mid = (hi - lo) / 2 + lo;
    if (pred(mid)) {
      lo = mid;
    } else {
      hi = mid;
    }
  }
  return lo;
}

int main() {
  in(ll, n, m);
  vector<ll> x(m);
  rep(i, m) cin >> x[i];

  sort(all(x));
  ll ans = x[m - 1] - x[0];

  vector<ll> d(m - 1);
  rep(i, m - 1) d[i] = x[i + 1] - x[i];
  sort(all(d), greater());

  for (ll i = 0; i < min<ll>(n - 1, d.size()); ++i) ans -= d[i];
  out(ans);
}


Measured memory_bytes: 4732
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define divceil(A, B) ((A + (B - 1)) / B)
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr

using namespace std;

int main(){

    int n;
    cin >> n;

    bool ans = false;

    for(int i = 1; i <= 9; i++){
        if(n % i == 0){
            int k = n / i;
            if(1 <= k && k <= 9){
                ans = true;
                break;
            }
        }
    }

    cout << (ans ? "Yes" : "No") << endl;

    return 0;

}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10000)
 
N, Q = tuple(map(int, input().split()))
 
tree = [[-1, 1]  for _ in range(N)] # [next, rank]
 
def find(i):
    if tree[i][0] == -1:
        group = i
    else:
        group = find(tree[i][0]) 
        tree[i][0] = group
    return group
 
def unite(x, y):
    px = find(x)
    py = find(y)
     
    if tree[px][1] == tree[py][1]: # rank is same
        tree[py][0] = px
        tree[px][1] += 1
    else:
        if tree[px][1] < tree[py][1]:
            px, py = py, px
        tree[py][0] = px
 
for _ in range(Q):
    com, x, y = tuple(map(int, input().split()))
    if com: # same
        print(int(find(x) == find(y)))
    else: # unite
        if not int(find(x) == find(y)):
            unite(x, y)


Measured memory_bytes: 6716
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if (a + b + c <= 21) Console.WriteLine("win");
        else Console.WriteLine("bust");
    }
}

// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 11092
class MathAlgorithm(object):
    @classmethod
    def gcd(cls, a: int, b: int) -> int:
        if b < 0 or (a == 0 and b == 0):
            raise ValueError

        if b > a:
            return cls.gcd(b, a)

        if b == 0:
            return 0

        if a % b == 0:
            return b

        return cls.gcd(b, a % b)


if __name__ == "__main__":
    N = int(input())
    A = [int(i) for i in input().split()]

    ans = A[0]
    for a in A[1:]:
        ans = MathAlgorithm.gcd(ans, a)

    print(ans)


Measured memory_bytes: 14484
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();

    if( (a*b)%2 == 0 ){
      System.out.println("Even");
    }else{
      System.out.println("Odd");
    }
	}
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
int A, B, C, D, E, F, answ, anss;

bool check(int s, int w)
{
  return (s * 100 <= E * w) && (s * answ > anss * w);
}

int main()
{
  cin >> A >> B >> C >> D >> E >> F;
  vector<int64_t> W, S;
  A *= 100;
  B *= 100;
  for (int i = 0; i * A <= F; i++)
  {
    for (int j = 0; i * A + j * B <= F; j++)
    {
      W.push_back(i * A + j * B);
    }
  }
  for (int i = 0; i * C <= F; i++)
  {
    for (int j = 0; i * C + j * D <= F; j++)
    {
      S.push_back(i * C + j * D);
    }
  }
  anss = 0, answ = A;
  for (auto w : W)
  {
    for (auto s : S)
    {
      if (s + w > F)
        continue;
      if (check(s, w))
      {
        answ = w;
        anss = s;
      }
    }
  }
  cout << answ + anss << ' ' << anss << endl;
}

Measured memory_bytes: 5196
#include<stdio.h>
int main(){
	int n;
   int a[100];
	int i;
   int x=0,y=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		if(a[i]%2==0){
			x++;
			if(a[i]%3==0||a[i]%5==0){
				y++;
			}
		}
	}
	if(x==y){
		printf("APPROVED\n");
	}
	else{
		printf("DENIED\n");
	}
	return 0;
}

Measured memory_bytes: 1640
#include <stdio.h>
#define num_element 200
int main(void)
{
	int i,n,m;
	char array[num_element];
	char a[2];
	char b[2];
	char input[2];
	while(1)
	{
		for(i=0;i<num_element;i++)
		{
			array[i] = i;
		}
		scanf("%d",&n);
		if(n == 0)return 0;
		for(i=0;i<n;i++)
		{
			scanf("%s %s",a,b);
			array[a[0]] = b[0];
		}
		scanf("%d",&m);
		for(i=0;i<m;i++)
		{
			scanf("%s",input);
			printf("%c",array[input[0]]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 576
N, T = list(map(int, input().split()))
ct = []
for i in range(N):
    ct.append(list(map(int, input().split())))

ct.sort()

ans = 'TLE'
for i in range(N):
    if ct[i][1] <= T:
        ans = ct[i][0]
        break

print(ans)

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

int main(){
    string w;
    cin >> w;
    int n=w.length();
    int i,j;
    int check=0;

    for(i=0; i<n; i++){
        j=i;
        if(w[i]!=0){
            while(1){
                j++;
                if(w[j]!=0){
                    if(w[i]==w[j]){
                        w[j]=0;
                        break;
                    }
                }
                if(j==n){
                    check=1;
                    break;
                }
            }
        }
    }

    if(check==1){
        cout << "No" << endl;
    }
    else cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
/* Author : Ravikumar Navale */
#define fastIo() ios_base :: sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define pb push_back
#define endl  "\n"
typedef long long int ll;
vector<pair<ll,ll> >v1, v2, v3;
const ll MOD = 1e9 + 7;
const ll NM = 1e5 + 7;
const double peek = 1e7 ;
vector<ll> v[NM];
vector<ll> dp(NM,0);
bool  b[NM];

int main()
{
    fastIo();
    ll N;
    cin >> N;
    double A[N+1];
    for(ll i= 1; i <= N ; i++)
        cin >> A[i];
    
    double dp[N+1][N+1];
    dp[1][0]= 1.0-A[1];
    
    for(ll i= 2; i<=N; i++)
        dp[i][0] = (1.0-A[i]) * dp[i-1][0];
    
    dp[1][1] = A[1];
    for(ll i= 2; i <= N ; i++)
    {
        dp[i][i] = dp[i-1][i-1]*A[i];
    }
    
    for( ll i = 1; i <=N ; i++)
    {
        for(ll j = 1; j < i ; j++)
        {
            dp[i][j] = dp[i-1][j] * (1.0 -A[i]) + dp[i-1][j-1] *A[i];
        }
    }    
    
    double ans = 0.0;
    for(ll i=  N/2 + 1; i<=N ; i++)
        ans +=dp[N][i];
    cout<< fixed << setprecision(10) <<ans;
    
}

Measured memory_bytes: 73600
fun readInt(): Int {
    val N: Int = readLine()!!.toInt()
    return N
}

fun readString(): String {
    val N: String = readLine()!!
    return N
}

fun solveB(): Long{
    val N: Int = readLine()!!.toInt()
    var An: Array<Int?> = arrayOfNulls(N)
    var ans: Long = 0
    for (i in An.indices) {
        val num: Int = (i + 1)
        if (num%3 == 0 || num%5 == 0 ){
            continue
        }
        ans += num
    }
    return ans
}

fun main() {
    // 20200421 A problem
    /*
    if (readString().contains('7')){
        println("Yes")
    } else {
        println("No")
    }
    */
    println(solveB())
}

Measured memory_bytes: 38240
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        N: i64,
    }
    let mut N2 = N;
    let mut S = 0;
    while N2 >= 1{
        S += N2%10;
        N2 /= 10;
    }
    println!("{}", if N%S==0{"Yes"}else{"No"});
}

Measured memory_bytes: 4352
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<ll> dqll;

#define MOD 1000000007

int main() {
  ll N, H;
  cin >> N >> H;

  vll lst(N);

  ll swMax = -1;
  for (int i = 0; i < N; i++) {
    ll sw, th;
    cin >> sw >> th;
    swMax = max(sw, swMax);
    lst[i] = th;
  }  // i

  sort(lst.begin(), lst.end());
  reverse(lst.begin(), lst.end());

  ll sum = 0;
  ll cnt = 0;
  for (int i = 0; i < N; i++) {
    if(lst[i] > swMax){
      cnt++;
      sum += lst[i];
    }
    if(sum >= H){
      cout << cnt << endl;
      return 0;
    }
  }

  ll ans = cnt + ((H - sum) + swMax - 1) / swMax;
  cout << ans << endl;
  
  return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    ll T, A;
    cin >> N >> T >> A;
    T *= 1000;
    ll index = 0;
    ll mini = numeric_limits<ll>::max();
    A *= 1000;
    rep(i, N) {
        ll temp;
        cin >> temp;
        temp = T - temp * 6;
        if(abs(temp - A) < mini) {
            index = i;
            mini = abs(temp - A);
        }
    }
    cout << index + 1 << endl;
    return 0;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i = x; i < n; i++)
#define MAX 100
#define INF 1000000001

#define ad(x) int i = 100;
typedef long long ll;
// enum {
//   AST_INT,
//   AST_SYM,
//   AST_STR,
//   AST_FUNCALL,
// };



// double winProb(int Rp, int Rq) {
//     return 1/(1+pow(10, (Rq-Rp)/400.));
// }

// int R[1<<10];
// double dp[12][1<<10];
int h, w;
// int canvas[]
// int w[30010];
// int e[30010];
int n;
int main() {
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    
    REP(i,0,n) {cin >> a[i];
    b[i] = a[i];}
    
    sort(a.begin(),a.end());
    int x = a[(a.size()/2)-1];
    // cout << x << endl;
    int y = a[(a.size()/2)];
    float med = (x + y)/2.0;
    // cout << med << endl;
    
    REP(i,0,n) {
        if (b[i] < med) cout << y << endl;
        else cout << x << endl;
    }
    
}

Measured memory_bytes: 3712
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <iomanip>
#include <utility>
#include <bitset>
#include <set>
#include <map>
#include <ios>
#include <cstdlib>
using namespace std;
int main() {
    string N; cin >> N;
    int S = 0;
    for (int i=0;i<N.size();i++){
        S += N[i]-'0';
    }
    if (stoi(N)%S==0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
A,B = (input() for T in range(0,2))
if len(A)!=len(B):
    print(['GREATER','LESS'][len(A)<len(B)])
else:
    EqualFlag = True
    for TL in range(0,len(A)):
        if A[TL]!=B[TL]:
            EqualFlag = False
            break
    if EqualFlag:
        print('EQUAL')
    else:
        print(['GREATER','LESS'][A[TL]<B[TL]])

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

int main() {
	int h, w; cin >> h >> w;
	string a[100],sharp(w + 2, '#');
	for (int i = 0; i < h; i++) cin >> a[i];

	cout << sharp << endl;

	for (int i = 0; i < h; i++) {
		cout << '#' << a[i] << '#' << endl;
	}

	cout << sharp << endl;

	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

const int N = 365 + 7;
const int K = 26 + 7;
int n;
int c[K], s[N][K], t[N], last[K];

int get(int m) {
  for (int j = 1; j <= 26; j++) {
    last[j] = 0;
  }
  int sol = 0;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= 26; j++) {
      sol -= c[j] * i;
    }
  }
  for (int i = 1; i <= m; i++) {
    sol += s[i][t[i]];
    last[t[i]] = i;
    for (int j = 1; j <= 26; j++) {
      sol += c[j] * last[j];
    }
  }
  return sol;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= 26; i++) {
    cin >> c[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 26; j++) {
      cin >> s[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    cin >> t[i];
  }
  for (int i = 1; i <= n; i++) {
    cout << get(i) << "\n";
  }
  return 0;
}


Measured memory_bytes: 3700
INF = 10**18

N, K = map(int, input().split())
H = list(map(int, input().split()))

dp = [INF for _ in range(N)]
dp[0] = 0

for i in range(1, N):
    for k in range(1, K + 1):
        if i - k < 0:
            break
        dp[i] = min(dp[i], dp[i - k] + abs(H[i] - H[i - k]))

print(dp[N - 1])

Measured memory_bytes: 90040
n,l=list(map(int,input().split()))
taste=[i+l for i in range(n)]
ans=0
if taste[0]>=0:
  ans=sum(taste)-taste[0]
elif taste[n-1]<=0:
  ans=sum(taste)-taste[n-1]
else:
  ans=sum(taste)
print(ans)
  

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

typedef long long  LL;
int n,a[100010];
LL s,s2,ans;
char op[100010];

void work()
{
	scanf("%d %d",&n,&a[1]),s=a[1];
	for (int i=2; i<=n; i++)
		{
			do  op[i]=getchar();  while ((op[i]!='+')&&(op[i]!='-'));
			scanf("%d",&a[i]);
			if (op[i]=='+')  s+=a[i];  else  s+=a[i];
		}
	ans=-1LL<<60,op[n+1]='-',s2=1LL<<60;
	for (int i=1; i<=n+1; i++)
		if (op[i]=='-')  ans=max(ans,s-s2),s2=0,s-=2*a[i];
		else  s2+=2*a[i];
	printf("%lld",max(ans,s));
}

int main()
{
	work();
	return 0;
}


Measured memory_bytes: 768
import Data.Char

main = do
  [_, k] <- map read . words <$> getLine
  s <- getLine
  putStrLn $ f s k

f :: String -> Int -> String
f xs n = f' xs n 1
  where
    f' (x:xs) n 1
      | n == 1 = toLower x : xs
      | otherwise = x : f' xs (n - 1) 1

Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
int32_t main()
{
    IOS
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif
    string s,t;
    cin>>s>>t;
    int dp[s.length()+1][t.length()+1];
    for(int i=0;i<=s.length();i++) dp[i][0]=0;
    for(int i=0;i<=t.length();i++) dp[0][i]=0;
    for(int i=1;i<=s.length();i++)
    {
        for(int j=1;j<=t.length();j++)
        {
            if(s[i-1]==t[j-1]) dp[i][j]=dp[i-1][j-1]+1;
            else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    // for(int i=0;i<=s.length();i++)
    // {
    //     for(int j=0;j<=t.length();j++)
    //     {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
    int index = dp[s.length()][t.length()]; 
  
   // Create a character array to store the lcs string 
   char lcs[index+1]; 
   lcs[index] = '\0'; // Set the terminating character 
  
   // Start from the right-most-bottom-most corner and 
   // one by one store characters in lcs[] 
   int i = s.length(), j = t.length(); 
   while (i > 0 && j > 0) 
   { 
      // If current character in X[] and Y are same, then 
      // current character is part of LCS 
      if (s[i-1] == t[j-1]) 
      { 
          lcs[index-1] = s[i-1]; // Put current character in result 
          i--; j--; index--;     // reduce values of i, j and index 
      } 
  
      // If not same, then find the larger of two and 
      // go in the direction of larger value 
      else if (dp[i-1][j] > dp[i][j-1]) 
         i--; 
      else
         j--; 
   } 
  
   // Print the lcs 
   cout << lcs; 
 
    // cout<<dp[s.length()][t.length()];
    return 0;
}

Measured memory_bytes: 70656
using Atcoder;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var tmp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            foreach (var val in tmp)
            {
                if (val >= 10)
                {
                    Console.Write("-1");
                    return;
                }
            }

            var result = tmp[0] * tmp[1];
            Console.Write(result);
        }
        //static void Main(string[] args)
        //{
        //    var temp = new Atcoder.ABC130.D();
        //    temp.Run();
        //}

    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

const int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n, r;
    cin >> n >> r;
    if (n >= 10) cout << r << endl;
    else cout << r + 100 * (10 - n) << endl;
    return 0;
}


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


/*
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <ctype.h>
*/
typedef struct  llnode
{
	int x;
	struct llnode *next;
}
slnode;


using namespace std;

typedef pair<int , int > pii;
typedef pair<long , long> pll;
typedef pair<pii , int > piii;
typedef pair<pll , long > plll;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector <pii> vii;
typedef vector<pll> vll;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned long long int ulli;
typedef long long int lli;
typedef double d;
typedef float f;
typedef string s;
typedef char ch;
typedef pair<int,ll> pill;

#define loop(n) for(int i = 0; i < (n); i++)
#define lp(x , s , e) for(int x = (s); x < (e); x++)
#define lpe(x , s , e) for(int x = (s); x <= (e); x++)
#define readline(s) getline(cin,s)
#define NumofDigits(n) ((int)log10(n)+1)
#define CountofNumber(array,n,x)  (upper_bound(array, array+n, x)-lower_bound(array, array+n, x))
#define F first
#define S second
#define EPS 1e-7
#define modulo ll (1e9 + 7)
const long double PI = 3.141592653589793238L;
#define MP make_pair
#define PB push_back
#define all(a) a.begin(),a.end()
#define clr(x , val) memset((x) , (val) , sizeof(x))
#define endl '\n'

ll power(ll a, ll b)
{
    ll res = 1;
    for(int i = 0; i<b; i++)
       res *= a;

    return res;
}
int gcd(int a, int b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
int gcd3 (int a , int b ,int c)
{
	return gcd(gcd(a , b) , c);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    ll sum = 0;
    for(int i = 1; i <= n; i++)
    {
    	for(int j = 1; j <= n; j++)
    	{
    		for(int k = 1; k <= n; k++)
    		{
    			sum += gcd3(i , j , k);
    		}
    	}
    }
    cout << sum;
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);

int main() {
int n;
cin >> n;
vector<int> a(n+1);
vector<int> b(n);
rep(i,n+1) cin >> a.at(i);
rep(i,n) cin >> b.at(i);
ll ans = 0;
rep(i,n){
  int left = min(a.at(i),b.at(i));
  ans += left;
  a.at(i) -= left;
  b.at(i) -= left;

  int right = min(a.at(i+1),b.at(i));
  ans += right;
  a.at(i+1) -= right;
  b.at(i) -= right;
}
cout << ans << endl;
}


Measured memory_bytes: 4028
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()

fourseven = set([0])

for f in range(30):
    for s in range(20):
        fourseven.add(4*f + 7*s)
    
print('Yes') if n in fourseven else print('No')


Measured memory_bytes: 3064
S = int(str(input()))

if (1 <= S//100 <= 12) and (1 <= S % 100 <= 12):
    print("AMBIGUOUS")
elif 1 <= S % 100 <= 12:
    print("YYMM")
elif 1 <= S // 100 <= 12:
    print("MMYY")
else:
    print("NA")

Measured memory_bytes: 3060
// #include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <numeric>
#include <cmath>

#define rep(i,n) for (int i = 0; i < n; ++i)
#define repr(i,n) for (int i = n; i > 0; --i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int MAX = 100;
const int INF = (1<<12);

int main() {
  int L, R, d;
  cin >> L >> R >> d;
  int ans = 0;
  for (int i = L; i <= R; i++)
  {
    if (i % d == 0) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3168
Var   s,s1:ansistring;
     i,j:longint;t:char;
begin
   readln(s);
    readln(s1);
   for i:=1 to length(s)-1 do
     for j:=i+1 to length(s) do
     if  s[i]>s[j] then begin t:=s[i];s[i]:=s[j];s[j]:=t;end;
   for i:=1 to length(s1)-1 do
     for j:=i+1 to length(s1) do
     if  s1[i]<s1[j] then begin t:=s1[i];s1[i]:=s1[j];s1[j]:=t;end;
    if s<s1 then writeln('Yes')else writeln('No');
end.

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i]
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
bool isPerfectSquare(long double x) {   
    long double sr = sqrt(x); 
    return ((sr - floor(sr)) == 0); 
} 
bool isPrime(int x){
    for(int i = 2; i * i <= x; ++i){
        if(x % i == 0) return 0;
    }
    return 1;
}
int fun(int n){
    if(n & 1) return 3 * n + 1;
    else return n/2;
}
int32_t main(){
    SPEED;
    int n, m, x;
    cin >> n >> m >> x;
    int arr[m];
    set<int> s;
    for(int i = 0; i < m; ++i){
        cin >> arr[i];
        s.insert(arr[i]);
    }
    int ans = 0, res = 0;
    for(int i = x + 1; i < n; ++i){
        if(s.count(i)) ans++;
    }
    for(int i = 1; i < x; ++i){
        if(s.count(i)) res++;
    }
    cout << min(ans, res);
}


Measured memory_bytes: 3708
#include <stdio.h>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>


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; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;


vector<int> topological(vector<vector<int>>& g) {
	vector<int> topo;
	int n = g.size();
	vector<int> deg(n);
	for (int i = 0; i < n; i++) for (auto next : g[i]) deg[next]++;
	queue<int> q;
	for (int i = 0; i < n; i++) if (deg[i] == 0) q.push(i), topo.push_back(i);
	while (!q.empty()) {
		int cur = q.front();
		q.pop();
		for (auto next : g[cur]) {
			deg[next]--;
			if (deg[next] == 0) {
				q.emplace(next);
				topo.push_back(next);
			}
		}
	}
	return topo;
}
int main()
{
	
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	

	int m, n; cin >> m >> n;
	vector<vector<int>> g(m);
	vector<vector<int>> l(m, vector<int>(n)), r(m, vector<int>(n, inf));
	for (int i = 0; i < m; i++) {
		int k; cin >> k;
		for (int j = 0; j < k; j++) {
			int s, t;
			string str;
			cin >> s >> str >> t;
			s--;
			if (str == ">=") {
				chmax(l[i][s], t);
			}
			else {
				chmin(r[i][s], t);
			}
		}
		for (int j = 0; j < n; j++) {
			if (l[i][j] > r[i][j]) {
				cout << "No" << "\n";
				return 0;
			}
		}
	}
	for (int i = 0; i < m; i++) {
		for (int j = i + 1; j < m; j++) {
			bool lr = false;
			bool rl = false;
			for (int k = 0; k < n; k++) {
				if (r[i][k] < l[j][k]) {
					lr = true;
				}
				if (r[j][k] < l[i][k]) {
					rl = true;
				}
			}
			if (lr and rl) {
				cout << "No" << "\n";
				return 0;
			}
			if (lr) g[i].emplace_back(j);
			if (rl) g[j].emplace_back(i);
		}
	}
	auto t = topological(g);
	if (t.size() == m) cout << "Yes" << "\n";
	else cout << "No" << "\n";
}



Measured memory_bytes: 3340
#include <iostream>

using namespace std;

typedef long long ll;

ll gcd(ll a,ll b){
    return b==0?a:gcd(b,a%b);
}
ll lcm(ll a,ll b){
    return a*b / gcd(a,b);
}
int main(){
    ll a,b;
    while(cin >> a >> b){
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
    return 0;
}

Measured memory_bytes: 1156
n = int(input())
h = list(map(int, input().split()))

if len(h) == 1:
	print("Yes")
	quit()
	
for i in range(n-1,0,-1):
	if h[i-1] - h[i] >= 2:
		print("No")
		quit()
	elif h[i-1] - h[i] == 1:
		h[i-1] -= 1
print("Yes")


Measured memory_bytes: 14396
def main():
    import sys
    input=sys.stdin.readline
    n=int(input())
    hp=sorted([list(map(int,input().split())) for _ in [0]*n],key=lambda x:sum(x))
    dp=[10**10]*(n+1)
    dp[0]=0
    for c,[h,p] in enumerate(hp):
        for k in range(c,-1,-1):
            if dp[k]<=h:
                dp[k+1]=min(dp[k+1],dp[k]+p)
    for i in range(n,-1,-1):
        if dp[i]!=10**10:
            print(i)
            break
if __name__=='__main__':
    main()

Measured memory_bytes: 42096
using System;

public class Hello
{
    public static void Main()
    {
        var L = new int[4]; var r = new int[4];
        string line;
        for (; (line = Console.ReadLine()) != null;)
        {
            var a = Array.ConvertAll(line.Trim().Split(' '), decimal.Parse);
            goEyeTest(a[0], L);
            goEyeTest(a[1], r);
        }
        for (int i = 0; i < 4; i++)
            Console.WriteLine("{0} {1}", L[i], r[i]);
    }
    public static void goEyeTest(decimal a, int[] b)
    {
        if (a >= 1.1m) b[0]++;
        else if (a >= 0.6m && a < 1.1m) b[1]++;
        else if (a >= 0.2m && a < 0.6m) b[2]++;
        else if (a < 0.2m) b[3]++;
    }
}

Measured memory_bytes: 9080
#include <iostream>
#include <string>
#include <math.h>

using namespace std;

int main() {
    int t1 , t2 , t3 ;
    cin >> t1 >> t2 >> t3 ;
    if (t1 + t2 >= t3){
        cout << "Yes" ;
    }
    else{
        cout << "No" ;
    }
    return 0 ;
}


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

//素集合データ構造
// ref:https://ei1333.github.io/luzhiled/snippets/structure/union-find.html
struct union_find {
    // parent[v]==w(>=0):vの親はw
    // parent[v]==k(<0):vは根&&vの属するグループの要素数は-k
    vector<long long int> parent;
    //コンストラクタ
    union_find(long long int n) {
        parent.assign(n, -1);
    }
    // vの根を求める
    //求めると同時に親を根に置き換える(木の圧縮)
    long long int root(long long int v) {
        if (parent[v] < 0) {
            return v;
        } else {
            parent[v] = root(parent[v]);
            return parent[v];
        }
    }
    // vが属するグループの要素数を求める
    long long int size(long long int v) {
        return -parent[root(v)];
    }
    // vとwを繋げる
    void unite(long long int v, long long int w) {
        v = root(v);
        w = root(w);
        if (v == w) return;
        if (parent[v] < parent[w]) swap(v, w);
        parent[w] += parent[v];
        parent[v] = w;
    }
    // vとwが同値か判定
    bool isSame(long long int v, long long int w) {
        return root(v) == root(w);
    }
};

int n, m;

int main() {
    cin >> n >> m;
    union_find uf(n);
    int num = n;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        if (!uf.isSame(a, b)) {
            uf.unite(a, b);
            num--;
        }
    }
    cout << num - 1 << endl;
}

Measured memory_bytes: 3956
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

bool kaibun(int i)
{
    int a, b, c, d, e;
    e = i % 10;
    i = (i - e) / 10;
    d = i % 10;
    i = (i - d) / 10;
    c = i % 10;
    i = (i - c) / 10;
    b = i % 10;
    i = (i - b) / 10;
    a = i % 10;
    if ((a == e) && (b == d)) {
        return true;
    }
    return false;
}

int main()
{
    int A, B, ans = 0;
    std::cin >> A >> B;
    for (int i = A; i <= B; i++) {
        if (kaibun(i) == true) {
            ans++;
        }
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 3632
#define rep(i,n) REP(i,0,n)
#define REP(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;

// const ll MAXN = (ll)1e3+10;
const ll DIV = (ll)1e9+7;
// ll dp[MAXN][MAXN];

int main(void) {
   ll N;
   cin>>N;
   ll A[N];
   rep(i,N) cin>>A[i];
   map<ll,ll> As;
   rep(i,N) {
      if (As.count(A[i])) As[A[i]]++;
      else As[A[i]] = 1;
   }
   ll ans = 0;
   for (auto itr = As.begin();itr != As.end();itr++) {
      ll i = itr->first;
      ll ans_this = itr->second;
      if (As.count(i-1)) ans_this+= As[i-1];
      if (As.count(i+1)) ans_this+= As[i+1];
      chmax(ans,ans_this);
      // cout<<i<<" "<<ans_this<<endl;
   }
   cout<<ans<<endl;


   return 0;
}

Measured memory_bytes: 4992
#include<cstdio>
#include<algorithm>
using std::max;
#define reg register
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
static char buf[100000],*p1=buf,*p2=buf;
inline int read(void){
	reg bool f=false;
	reg char ch=getchar();
	reg int res=0;
	while(ch<'0'||'9'<ch)f|=(ch=='-'),ch=getchar();
	while('0'<=ch&&ch<='9')res=10*res+ch-'0',ch=getchar();
	return f?-res:res;
}

const int MAXN=50+5;

int n;
int d[MAXN];

int main(void){
	reg int i,j,ans=0;
	n=read();
	for(i=1;i<=n;++i)
		d[i]=read();
	for(i=1;i<=n;++i)
		for(j=i+1;j<=n;++j)
			ans+=d[i]*d[j];
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
import java.util.*;
 
public class Main {
    
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int s=N;
        long q=0;
        while(N>0){
            int rem=N%10;
            q+=rem;
            N/=10;
        } 
        //System.out.println("q="+q);
        if(s%q==0){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }    
    }
}

Measured memory_bytes: 22100
n,d=map(int,input().split())
x=[0]*n
count=0
temp=[0]*d
import math
for i in range(0,n):
  x[i]=list(map(int,input().split()))
  for j in range(0,i):
    for k in range(0,d):
      temp[k]=(x[i][k]-x[j][k])**2
    if math.sqrt(sum(temp)).is_integer()==True:
      count=count+1
print(count)


Measured memory_bytes: 3064
N = int(input())
L = list(map(int, input().split()))

ans = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            a, b, c = L[i], L[j], L[k]
            if a != b != c != a and a + b > c and  b + c > a and c + a > b:
                # print(a, b, c)
                ans += 1
print(ans)

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

int main()
{
    string N;
    cin >> N;
    bool flag = false;
    for (int i = 0; i < 3; i++)
    {
        if (N[i] == '7')
        {
            flag = true;
            break;
        }
    }
    if (flag)
    {
        puts("Yes");
    }
    else
    {
        puts("No");
    }
    return 0;
}

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

using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll X,Y,Z;
  cin>>X>>Y>>Z;

  ll res=0;
  X-=Z;
  res=X/(Y+Z);
  cout<<res<<endl;
}


Measured memory_bytes: 384
import java.util.Scanner;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double base = 100;
        double now = base;
        for(int i=0; i<n; i++){
            now = now*0.05+now;
            now=Math.ceil(now);
        }
        System.out.println((int)now*1000);
    }
}


Measured memory_bytes: 25876
#include <cstdio>
#include <algorithm>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

using ll = long long;
constexpr ll mod = 1000000007;

ll N, K;
ll A[100010];

ll powMod( ll x, ll y )
{
  ll ret = 1ll;

  while( y > 0 )
  {
    if( y & 1 )
      ret = (ret * x) % mod;

    x = (x*x) % mod;

    y >>= 1;
  }

  return ret;
}

ll fact[200010], inv[200010];

ll comb( ll n, ll r )
{
  if( n < r || n <= 0 || r < 0 )
    return 0;

  return fact[n]*inv[r]%mod*inv[n-r]%mod;
}

int main()
{
  scanf( "%lld%lld", &N, &K );
  rep( i, N )
    scanf( "%lld", A+i );

  fact[0] = 1;
  rep( i, 100010 )
    fact[i+1] = (i+1)*fact[i]%mod;

  rep( i, 100010 )
    inv[i] = powMod( fact[i], mod-2 );

  std::sort( A, A+N );

  ll ans = 0;

  for( int i = N-1; i >= 0; --i )
  {
    ans = (ans+A[i]*comb(i,K-1)%mod) % mod;
    ans = (ans-A[N-1-i]*comb(i,K-1)%mod+mod)%mod;
  }

  printf( "%lld\n", ans );

  return 0;
}

Measured memory_bytes: 2560
n = int(input())
A = []
B = []
for i in range(n):
  a,b = list(map(int, input().split()))
  A.append(a)
  B.append(b)
A.sort()
B.sort()
j = n//2
if n%2 == 0:
  print((B[j]+B[j-1])-(A[j]+A[j-1])+1)
else:
  print(B[j]-A[j]+1)

Measured memory_bytes: 25456
#include <stdio.h>

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


Measured memory_bytes: 2620
N = int(input())
abc = list(list(map(int,input().split()))for i in range(N))
DP = [[0]*3 for i in range(N+1)]
for i in range(N):
    for j in range(3):
        DP[i+1][j] = max(DP[i][j-1],DP[i][j-2])+abc[i][j]
print(max(DP[-1]))

Measured memory_bytes: 47332
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <numeric>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF (LL)1e15
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

//#define int long long

/*************** using variables ***************/
int n, k;
vector<int> d;
map<int, bool> mp;
LL ans;
/**********************************************/

bool check_num(LL num){
    while(num > 0){
        if(mp[num%10] == true){
            return false;
        }
        num /= 10;
    }
    return true;
}

signed main(){
    cin >> n >> k;
    d.resize(k);
    REP(i, k) cin >> d[i];
    REP(i, 10){
        mp[i] = false;
    }
    REP(i, k) mp[d[i]] = true;
    ans = n;
    while(1){
        if(check_num(ans)) break;
        ans++;
    }
    
    cout << ans << endl;
}


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

int main(){
  string srl;
  cin >> srl;
  bool nise =false;
    
  for (int i=0;i<srl.size();i++){
  //  cout << srl.at(i);
    if((srl.at(i)=='h')){
      if( (i+1 <srl.size()) && (srl.at(i+1)=='i') ){
        // do nothing
      }else nise=true;
    }else if(srl.at(i)=='i'){
      if( (i-1 >=0) && (srl.at(i-1)=='h') ){
        // do nothing
      }else nise=true;
    }else nise=true;
  }
  if(nise)cout << "No";
  else cout << "Yes";
  
  return 0;
  
}

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

#define f first
#define s second

using namespace std;

const int INF = 1e5;

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

int h, w;
vector<vector<char>> b;
vector<vector<int>> mn;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> h >> w;
    b.assign(h, vector<char>(w, ' '));
    mn.assign(h, vector<int>(w, INF));
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
            cin >> b[i][j];
        }
    }
    queue<pair<int, int>> q;
    q.push({0, 0});
    if(b[0][0] != '.') mn[0][0] = 1;
    else mn[0][0] = 0;
    while(!q.empty()){
        pair<int, int> cur = q.front();
        q.pop();
        for(int i = 0; i < 2; ++i){
            pair<int, int> nxt = {cur.f + dx[i], cur.s + dy[i]};
            if(nxt.f >= 0 && nxt.f < h && nxt.s >= 0 && nxt.s < w){
                if(b[nxt.f][nxt.s] == b[cur.f][cur.s] && mn[nxt.f][nxt.s] > mn[cur.f][cur.s]){
                    mn[nxt.f][nxt.s] = mn[cur.f][cur.s];
                    q.push({nxt.f, nxt.s});
                }
                if(b[nxt.f][nxt.s] != b[cur.f][cur.s]){
                    if(b[nxt.f][nxt.s] == '#' && mn[nxt.f][nxt.s] > mn[cur.f][cur.s] + 1){
                        mn[nxt.f][nxt.s] = mn[cur.f][cur.s] + 1;   
                        q.push({nxt.f, nxt.s});
                    }
                    else if(b[nxt.f][nxt.s] == '.' && mn[nxt.f][nxt.s] > mn[cur.f][cur.s]){
                        mn[nxt.f][nxt.s] = mn[cur.f][cur.s];   
                        q.push({nxt.f, nxt.s});
                    }
                }
            }
        }
    }
    // for(auto i : mn){
    //     for(auto j : i) cout << j << " ";
    //     cout << "\n";
    // }
    cout << mn[h - 1][w - 1];
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(){
  int n,u,adj[110][110],k,v[100],i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v[j]);
      adj[u-1][v[j]-1]=1;
    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j==0) printf("%d",adj[i][j]);
      else printf(" %d",adj[i][j]);
    }
    printf("\n");
  }


  return 0;

}

Measured memory_bytes: 644