akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

func main() {
	sc := NewScanner()
	H := sc.NextInt()
	W := sc.NextInt()

	for i := 1; i <= H; i++ {
		for j := 0; j < W; j++ {
			if (sc.Next() == "snuke") {
				fmt.Println(string(j + 'A') + strconv.Itoa(i))
				return
			}
		}

	}

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r:rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}



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

bool distance_is_integral(const vector<int>& xs1, const vector<int>& xs2)
{
    vector<int> as;
    transform(
        begin(xs1), end(xs1), begin(xs2),
        back_inserter(as),
        [](int a, int b) { return (a - b) * (a - b); });
    int sum = accumulate(begin(as), end(as), 0);
    int sqrt_sum = static_cast<int>(sqrt(sum));
    return sqrt_sum * sqrt_sum == sum;
}

void main_()
{
    int N, D;
    cin >> N >> D;
    vector<vector<int>> Xss(N);
    for (auto&& xs : Xss) {
        copy_n(istream_iterator<int>(cin), D, back_inserter(xs));
    }

    int count = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            if (i < j && distance_is_integral(Xss[i], Xss[j])) {
                count++;
            }
        }
    }
    cout << count << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <tuple>
#include <vector>

using namespace std;

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

    vector<tuple<int, int, long long>> graph(0);
    for (int i = 0; i < m; i++) {
        int a, b;
        long long c;
        cin >> a >> b >> c;
        graph.push_back(make_tuple(a - 1, b - 1, -c));
    }

    vector<long long> dist(n, 1LL << 61);
    dist[0] = 0;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (dist[get<1>(graph[j])] > dist[get<0>(graph[j])] + get<2>(graph[j])) {
                dist[get<1>(graph[j])] = dist[get<0>(graph[j])] + get<2>(graph[j]);
            }
        }
    }

    long long res = dist[n - 1];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (dist[get<1>(graph[j])] > dist[get<0>(graph[j])] + get<2>(graph[j])) {
                dist[get<1>(graph[j])] = dist[get<0>(graph[j])] + get<2>(graph[j]);
            }
        }
    }

    if (res == dist[n - 1]) {
        cout << -res << endl;
    } else {
        cout << "inf" << endl;
    }
}


Measured memory_bytes: 256
h,w=map(int,input().split())
a=['*'*(w+2)]+['*'+input()+'*' for _ in range(h)]+['*'*(w+2)]
s=0
for i in range(1,h+1):
  s+=a[i].count('.')
from collections import deque
d=deque()
d.append([1,1])
c=[[10000]*w for _ in range(h)]
c[0][0]=1
di=[[0,1],[1,0],[-1,0],[0,-1]]
while d:
  g=d.popleft()
  for i in di:
    x=g[0]+i[0]
    y=g[1]+i[1]
    if a[x][y]=='.':
      if c[x-1][y-1]==10000:
        d.append([x,y])
        c[x-1][y-1]=c[g[0]-1][g[1]-1]+1
if c[h-1][w-1]==10000:
  print(-1)
else:
  print(s-c[h-1][w-1])

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 10000000000000000; //10^16
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
 
int main(){
  ll H,W; cin >> H >> W;
  if(H == 1 || W == 1){
    cout << 1 << endl;
    return 0;
  }
  printf("%lld\n", (H*W+1)/2);
  return 0;
}

Measured memory_bytes: 256
import sys
from collections import Counter

input = sys.stdin.readline
P = 10 ** 9 + 7


def calc_prime_factors(n):
    """Trial division"""
    factors = []
    # factor: 2
    while n % 2 == 0:
        factors.append(2)
        n //= 2
    # factor: 3, 5, 7, 11, ...
    f = 3
    root_n = int(n ** 0.5) + 1
    while f <= root_n:
        if n % f == 0:
            factors.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        factors.append(n)
    factors = Counter(factors).items()
    return factors


def main():
    N = int(input())

    count = [1] * 1001

    for i in range(1, N + 1):
        factors = calc_prime_factors(i)
        for k, v in factors:
            count[k] += v

    ans = 1
    for c in count[1:]:
        ans = (ans * c) % P

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+5;
const ll MOD=1e9+7;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n,m;cin>>n>>m;
    vector<ll> a(m),b(m);
    for(ll i=0;i<m;i++)cin>>a[i]>>b[i];
    vector< pair<ll,ll> >v;
    for(ll i=0;i<m;i++){
        a[i]--;b[i]--;
        v.push_back({a[i],b[i]});
    }
    sort(v.begin(),v.end());
    ll ans = 0 , nxt = n+1;
    for(ll i=0;i<m;i++){
        ll a = v[i].first, b = v[i].second;
        if(nxt<=a)ans++,nxt=n+1;
        nxt = min(nxt,b);
    }
    if(nxt!=n+1)ans++;
    cout<<ans;
}


Measured memory_bytes: 3956
#include <bits/stdc++.h>
#include <random>
using namespace std; typedef unsigned long long _ulong; typedef long long int lint; typedef pair<lint, lint> plint; typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define endk '\n'
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
const lint MOD = 1e9 + 7, INF = 1e18;
lint dx[8] = { 0, -1, 1, 0, 1, -1, 1, -1 }, dy[8] = { 1, 0, 0, -1, -1, -1, 1, 1 };
typedef pair<lint, char> pa;

lint N;
int main() {
	cin >> N;
	cout << (N ^ 1) << endk;
}


Measured memory_bytes: 3632
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, K, Q, A):
    C = Counter(A)
    M = [K - Q] * N
    for k in range(1, N+1):
        v = C[k]
        M[k-1] += v
        if M[k-1] > 0:
            print('Yes')
        else:
            print('No')


def main():
    N, K, Q = read_int_n()
    A = [read_int() for _ in range(Q)]
    (slv(N, K, Q, A))


if __name__ == '__main__':
    main()


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

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

ll dp[110000][3];
ll a[110000][3];

int main() {
	int n;
	cin >> n;
	rep(i, n)rep(j, 3) cin >> a[i][j];


	rep(i, n) {
		rep(j, 3) {
			rep(k, 3) {
				if (j == k) continue;
				chmax(dp[i + 1][j], dp[i][k] + a[i][j]);
			}
		}
	}
	ll ans = 0;
	rep(i, 3) ans = max(ans, dp[n][i]);
	cout << ans << endl;
}

Measured memory_bytes: 5120
#include <cstdio>

const int mxn = 105;

int n, a[mxn], cnt = 0;

inline int swap(int &x, int &y) {
	int z;
	z = x;
	x = y;
	y = z;
	++cnt;
}

signed main() {
	scanf("%d", &n);
	
	for (int i = 0; i < n; ++i)
		scanf("%d", a + i);
	
	// bubble sort
	for (bool flag = true; flag; ) {
		flag = false;
		
		for (int i = n - 1; i > 0; --i)
			if (a[i] < a[i - 1])
				swap(a[i], a[i - 1]), flag = true;
	}
	
	// print array
	for (int i = 0; i < n - 1; ++i)
		printf("%d ", a[i]);
	printf("%d\n", a[n - 1]);
	
	printf("%d\n", cnt);
	
	return 0;
}

Measured memory_bytes: 2712
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
//#define biGinf 9e+18
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define inpv(v) for(auto &x:v) cin>>x
#define otpv(v) for(auto &x:v) cout<<x<<nwl
#define otpv2(v) for(auto &x:v) cout<<x<<" "
#define CASES int tt;cin>>tt; while(tt--)
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define forr(i,r,n) for(int i=r; i<=n; i++)
#define forj(j,n) for(int j=n; j>=0; j--)
#define forx(x,v) for(auto &x:v)
#define sz(v) (int)(v).size()
#define rz(n) resize(n)
#define vec(x) vector < x >
using int64 = long long;
using vi = vector < int >;
using vi64 = vector < int64 >;
using mii = map <int , int >;
using vvi = vector < vi >;
using pii = pair < int , int >;
using vpii = vector < pii >;
const int inf = 2e9 + 7;
const char nwl = '\n';
const int mxx = 1e6 + 3;
int64 sumV(vi &v) {
	int64 s = 0;
	for (int x : v) {
		s += (int64)x;
	}
	return s;
}
int gcd(int a, int b) {
	if (!b) return a;
	return gcd(b, a % b);
}
//const int64 biGinf = 9e+18;
//const string yo = "Yes\n", no = "No\n";
int64 mod = (int64)1e9 + 7;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//ur code
	int64 n;
	cin >> n;
	vec(int64) v(n);
	inpv(v);
	int64 s = 0;
	vec(int64) sm(n);
	sm[0] = v[0] % mod;
	for1(i, n - 1) {
		sm[i] = (sm[i - 1] + v[i]) % mod;
	}
	for1(i, n - 1) {
		s = (s + (sm[i - 1] % mod * v[i] % mod) % mod) % mod;
	}
	cout << s;






	return 0;
}


Measured memory_bytes: 6336
N = int(raw_input())
cost = [map(int,raw_input().split(" ")) for _ in range(N)]
all_cost = 0
for i in range(N):
	for j in range(i):
		all_cost += cost[i][j] if cost[i][j] <= cost[j][i] else cost[j][i]
print all_cost

Measured memory_bytes: 4540
s = input()

fore = int(str(s[0]) + str(s[1]))
aft = int(str(s[2]) + str(s[3]))

if 1 <= fore <= 12:
    if 1 <= aft <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')

elif 1 <= aft <= 12:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3064
import java.util.*;
public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int n = sc.nextInt();
                int x = sc.nextInt();
                int[] m = new int[n];
                int yono = 0;
                for(int i = 0 ; i < n ; i++){
                        yono++;
                        m[i] = sc.nextInt();
                        x -= m[i];
                }
                sc.close();
                Arrays.sort(m);
                yono += x / m[0];
                System.out.println(yono);
        }
}//0=48
//鶏になれ

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

int main(){
    int N;
    cin >> N;
    int s[100];
    for(int i=0;i<N;i++)
        cin >> s[i];
    //昇順ソート
    sort(s, s + N);
    int point = 0;
    //満点を計算
    for(int i=0;i<N;i++){
        point += s[i];
    }
    if(point % 10 != 0){
        cout << point << endl;
        return 0;
    }
    //満点が10の倍数であった場合
    for(int i=0;i<N;i++){
        point -= s[i];
        if(point % 10 != 0){
            cout << point << endl;
            return 0;
        }
        point += s[i];
    }
    cout << '0' << endl;
    return 0;
}

Measured memory_bytes: 256
def maxdif(a,b):
    if a % 3 == 0:
        return 0
    sabuns = []
    if a%2 == 0:
        s = a//2
        t = a//2
    else:
        s = a//2
        t = s + 1
    for i in range(b+1):
        sabun = max(abs(s*i-t*i),abs(s*i-(s+t)*(b-i)),abs(t*i-(s+t)*(b-i)))
        sabuns.append(sabun)    
    sabuns.append(b)
    return min(sabuns)


H ,W = [int(i) for i in input().split()]


print(min(maxdif(H,W),maxdif(W,H)))

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

int main() {
  string s;
  cin >> s;
 
  int c = 0;
  for(int i = 0; i<3; i++){
    if(s[i] == 'o'){
      c++;
    }
  }
  cout << 700 + c * 100 << endl;
}

Measured memory_bytes: 256
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(A[K-1])

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 1010

int huga(int i){
	if(i < 10)return true;
	string s = to_string(i);
	int size = s.size();
	
	for(int i = 1; i < size; i++)
		if(s[i]-s[i-1] != 1) return false;
	
	return true;
}

int main(){
	int N, a[MAX_N], ans = -1;
	
	cin>>N;
	
	for(int i = 1; i <= N; i++)
		cin>>a[i];
	
	for(int i = 1; i < N; i++)
		for(int j = i+1; j <= N; j++)
			if(huga(a[i]*a[j]))ans = max(ans, a[i]*a[j]);
	
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3276
#include<iostream>
using namespace std;
int main(void)
{
	int n,a,b,i,tmp,cnt=0,sum=0;
	cin>>n>>a>>b;
	for(i=1;i<=n;i++){
		tmp=i;
		sum=0;//???
		while(tmp!=0) {
			sum+=tmp%10;
			tmp=tmp/10;
		}
		if(a<=sum && sum<=b) cnt=cnt+i;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	rep(i,n){
		int a;
		cin >> a;
	}
	int ans = (n-1 + k-1 - 1) / (k - 1);
	chmax(ans, 1);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3644
import java.util.*;

class Main{
	public static void main(String[] args){
		new Main().run();
	}

	void run(){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		long[] A=new long[n];
		long[] K=new long[n];
		long grundy=0;
		for(int i=0;i<n;++i){
			A[i]=sc.nextLong();
			K[i]=sc.nextLong();
			grundy^=f(A[i],K[i]);
		}
		if(grundy==0){
			System.out.println("Aoki");
		}else{
			System.out.println("Takahashi");
		}
	}

	long f(long A,long K){
		if(A%K==0){
			return A/K;
		}else{
			long tmp=(A%K)/(A/K+1);
			if(tmp>1){
				return f(A-(A/K+1)*tmp,K);
			}else{
				return f(A-A/K-1,K);
			}
		}
	}
}

Measured memory_bytes: 28372
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
  public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}


void solve(long long A, long long B){
    cout << lcm(A,B) << endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 X, Y, Z;
  std::cin >> X >> Y >> Z;
  std::cout << Z << ' ' << X << ' ' << Y << std::endl;
  return 0;
}

Measured memory_bytes: 3624
l, r = map(int, input().split())
ans = 2019

for i in range(l, min(r, l + 2019)):
    for j in range(l + 1, min(r + 1, l + 2019)):
        ans = min(i*j%2019, ans)
        if ans == 0:
            break

print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>

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

int main(){

    int a,b,c; cin >> a >> b >> c;
    string ans="No";
    if(a==c&&a!=b)
        ans="Yes";
    if(a==b&&a!=c)
        ans="Yes";
    if(b==c&&b!=a)
        ans="Yes";

    cout << ans << endl;  


     return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define SaveTime ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define mx *max_element
#define mi *min_element
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 1e6+5;
const int INF = 1e18L;
int ncr(int n,int r){if(n<r)return 0;int p=1,k=1;if(n-r<r)r=n-r;if(r!=0){while(r){p*=n;k*=r;int g=__gcd(p, k);p/=g;k/=g;n--;r--;}}else p=1;return p;}
#define pi 2*acos(0.0)
int ar[N];
int tree[2*N];
int dp[N];
int bit[N];
signed main(){
 	
	SaveTime;
	int T=1;
	// cin >> T;
	while(T--){
		int n;
		cin >> n ;
		fn{
			cin >> ar[i];
		}
		sort(ar,ar+n);
		int ans =0 ;
		for(int i =0 ;i < n;i++){
			for(int j =0;j < i ;j++){
				int val = ar[i] + ar[j];
				int idx = lower_bound(ar,ar+n,val)-ar;
				ans += max(0ll,idx-i-1);
			}
		}
		cout << ans << endl;
	}
	
	return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;

void disp(int i)
{
    cout << i << endl;
    exit(0);
}


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

    map<int, int> map_gu, map_ki;
    for (int i = 0; i < n / 2; i++)
    {
        int j, k;
        cin >> j >> k;
        map_gu[j]++;
        map_ki[k]++;
    }

    if (map_gu.size() == 1 && map_ki.size() == 1) // 偶数番目と奇数番目がそれぞれ全部一致
    {
        if (map_gu.begin()->first != map_ki.begin()->first) disp(0);
        else disp(n / 2);
    }
    else
    {
        priority_queue<pint, vector<pint>> gus, kis;
        for (auto pa : map_gu) gus.push(pint(pa.second, pa.first));
        for (auto pa : map_ki) kis.push(pint(pa.second, pa.first));
        if (gus.top().second != kis.top().second)
        {
            disp(n - gus.top().first - kis.top().first);
        }
        else if (map_gu.size() == 1)
        {
            if (gus.top().second == kis.top().second) kis.pop();
            disp(n - gus.top().first - kis.top().first);
        }
        else if (map_ki.size() == 1)
        {
            if (gus.top().second == kis.top().second) gus.pop();
            disp(n - gus.top().first - kis.top().first);
        }
        else
        {
            int u = gus.top().first;
            int v = kis.top().first;
            gus.pop();
            kis.pop();
            int ans = max(u + kis.top().first, v + gus.top().first);
            disp(n - ans);
        }
    }
}


Measured memory_bytes: 6136
package main

import "fmt"

const mod int = 1e9 + 7

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	g := make([][]int, n+1)
	var a, b int
	for i := 0; i < n-1; i++ {
		fmt.Scan(&a, &b)
		g[a] = append(g[a], b)
		g[b] = append(g[b], a)
	}

	done := make([]int, n+1)
	ans := 1
	var dfs func(v, p, c int)
	dfs = func(v, p, c int) {
		ans *= c
		ans %= mod

		if p == -1 {
			c = k
		} else {
			c = k - 1
		}

		for _, u := range g[v] {
			if u == p {
				continue
			}
			done[v]++
			dfs(u, v, c-done[v])
		}
	}
	dfs(1, -1, k)

	fmt.Println(ans)
}


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

using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define allpt(v) (v).begin(), (v).end()
#define allpt_c(v) (v).cbegin(), (v).cend()
#define allpt_r(v) (v).rbegin(), (v).rend()


const int mod = 1e9 + 7;
const string wsp = " ";
const string tb = "\t";
const string rt = "\n";

template <typename T>
void show1dvec(const vector<T> &v)
{
    if (v.size() == 0)
        return;
    int n = v.size() - 1;
    rep(i, n) cout << v[i] << wsp;
    cout << v[n] << rt;
    return;
}

template <typename T>
void show2dvec(const vector<vector<T>> &v)
{
    int n = v.size();
    rep(i, n) show1dvec(v[i]);
}

template <typename T, typename S>
void show1dpair(const vector<pair<T, S>> &v)
{
    int n = v.size();
    rep(i, n) cout << v[i].first << wsp << v[i].second << rt;
    return;
}

template <typename T, typename S>
void pairzip(const vector<pair<T, S>> &v, vector<T> &t, vector<T> &s)
{
    int n = v.size();
    rep(i, n)
    {
        t.push_back(v[i].first);
        s.push_back(v[i].second);
    }
    return;
}

template <typename T>
void maxvec(vector<T> &v)
{
    T s = v[0];
    int n = v.size();
    rep(i, n - 1)
    {
        if (s > v[i + 1])
        {
            v[i + 1] = s;
        }
        s = v[i + 1];
    }
}

template <typename T, typename S>
bool myfind(T t, S s)
{
    return find(t.cbegin(), t.cend(), s) != t.cend();
}

vector<int> make_kmp_table(string t)
{
    int lt = t.length();
    VI kmptable(lt, 0);
    kmptable[0] = -1;

    return kmptable;
}

void search(string &s, string &t, char a, char b, int p, int q, string &ans)
{
    int n = s.length();
    rep(i, n)
    {
        if (s[i] == a)
            p++;
        if (p == 0 || p == q + 1)
        {
            ans = "NO";
            return;
        }
        if (p != 1 && t[i] == b)
            p--;
    }
}

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    // int n;
    // string s, t;
    // cin >> n >> s;
    // VL dp(n + 1, 0ll);
    // vector<set<int>> callspell(n);
    // dp[0] = 1;
    // rep(i, n)
    // {
    //     cin >> t;
    // }

    // rep(i, n)
    // {
    //     for (int z : callspell[i])
    //     {
    //         dp[i + z - 1] += dp[i - 1];
    //         dp[i + z - 1] %= mod;
    //     }
    // }

    // cout << dp[n] << rt;

    int h, w, n, sy, sx;
    cin >> h >> w >> n >> sy >> sx;
    string s, t, ans = "YES";
    cin >> s >> t;
    search(s, t, 'D', 'U', sy, h, ans);
    search(s, t, 'U', 'D', h + 1 - sy, h, ans);
    search(s, t, 'R', 'L', sx, w, ans);
    search(s, t, 'L', 'R', w + 1 - sx, w, ans);
    cout << ans << rt;
    return 0;
}


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

#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define SZ(x) ((int) (x).size())
#define ALL(x) x.begin(), x.end()
#define debug(x) cerr << #x" = " << x << endl

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef unsigned long long u64;
typedef vector<int> VI;

template <typename T> inline bool cmin(T & a, const T & b) { return a > b ? a = b, 1 : 0;}
template <typename T> inline bool cmax(T & a, const T & b) { return a < b ? a = b, 1 : 0;}
template <typename T> void read(T & x) {
	int f = 1; char ch; x = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
	while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar(); x *= f;
}

const int N = 201234;

int n, x[N];
int main() {
	read(n); 
	for (int i = 1; i <= n; i++) {
		read(x[i]);
	}
	if(x[1]) {
		puts("-1"); 
	} else {
		for (int i = 1; i < n; i++)
			if(x[i + 1] - x[i] > 1)
				return puts("-1"), 0;
		LL sum = 0;
		for (int i = 1; i <= n; i++) {
			if(x[i]) {
				++sum;
				if(x[i] - 1 != x[i - 1])
					sum += x[i] - 1;
			}
		}
		printf("%lld\n", sum);
	}
	return 0;
}





Measured memory_bytes: 1024
#!/usr/bin/env python3
import sys


def solve(N: int, V: "List[int]", C: "List[int]"):
    ret = 0
    for v, c in zip(V, C):
        ret += max(0, v - c )
    print(ret)

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    V = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    C = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, V, C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#!/usr/local/bin/ruby
num = Hash.new(0)
max = 0
while (n=gets.to_i)!=0
#while (n=gets.to_i) != true
 num[n] += 1
end
num.to_a.sort{|p,q| -(p[1]<=>q[1]) }.each do |key,value|
 if value >= max
  max = value
  puts key
 else
  break
 end
end

Measured memory_bytes: 6096
#include<cmath>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<deque>
#include<queue>
#include<algorithm>
#include<list>
#include<cstring>
#include <numeric>

#define ll long long
#define int long long
#define ld long double
#define endl "\n"
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(p) cerr<<#p<<'='<<(p.first)<<" "<<p.second<<endl;
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define output(x)   cout << (x ? "YES" : "NO")<<endl;
const ll MOD = 1e9 + 7;
const int N = 1000000000000001;
const int demo = 10;
using namespace std;
const ll cfmod=998244353;
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
char button[4]={'L','R','U','D'};

// Ahhiya thi lakhvanu chalu thasse....


signed main() {
    FAST
    int q = 1;
    //cin>>q;
    while (q--) {
        int n,m,shrey;
        cin>>n>>m>>shrey;
        string arr[n];
        for(int i=0;i<n;i++){
            cin>>arr[i];
        }
        int ans=0;
        for(int i=0;i<pow(2,n);i++){
            for(int j=0;j<pow(2,m);j++){
                int lol[n][m];
                memset(lol,0, sizeof(lol));
                int x=i,y=j;
                int xx=0,yy=0;
                while(x){
                    if(x%2){
                        for(int k=0;k<m;k++){
                            lol[xx][k]=1;
                        }
                    }
                    x/=2;
                    xx++;
                }
                while(y){
                    if(y%2){
                        for(int k=0;k<n;k++){
                            lol[k][yy]=1;
                        }
                    }
                    y/=2;
                    yy++;
                }
                int black=0;
                for(int a=0;a<n;a++){
                    for(int b=0;b<m;b++){
                        if(arr[a][b]=='#'){
                           if(lol[a][b]!=1) black++;
                        }
                    }
                }
                //debug(black)
                if(black==shrey){
                    ans++;
                }
            }
        }
        cout<<ans;
    }
}

Measured memory_bytes: 3312
import java.util.Scanner;

public class Main {

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

	    int N=gi();
	    String S=gs();

	    int min=N-1;
	    int e=0;
	    int w=0;
        for(int i=1; i<S.length();i++) {
        	char c=S.charAt(i);
        	if(c=='E') {
        		e++;
        	}
        }

        min=e;
        for(int i=1; i<S.length();i++) {
        	char c=S.charAt(i);
        	char bc=S.charAt(i-1);
        	int n=0;
        	if(c=='E') {
        		e--;
        	}
        	if(bc=='W') {
        		w++;
        	}
            n=e+w;
        	min=Math.min(min, n);
        }

		System.out.println(min);
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

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

int main(){
    int n, m; cin >> n >> m;
    vector<vector<int>> s(n, vector<int>(2));
    vector<vector<int>> c(m, vector<int>(2));
    //cout << "here" << endl;
    // input data
    for (int i=0; i<n; i++){
        cin >> s.at(i).at(0);
        cin >> s.at(i).at(1);
    }
    for (int i=0; i<m; i++){
        cin >> c.at(i).at(0);
        cin >> c.at(i).at(1);
    }
    //cout << "here" << endl;
    // calculate result 
    vector<int> ans(n);
    for (int i=0; i<n; i++){
        int min_d=0;
        int ans_num=1;
        for (int j=0; j<m; j++){
            int now_d=abs(s.at(i).at(0)-c.at(j).at(0))+abs(s.at(i).at(1)-c.at(j).at(1));
            if (j==0){
                min_d=now_d;
            } else {
                if (min_d>now_d){
                    ans_num=j+1;
                    min_d=now_d;
                }
            }
        }
        ans.at(i)=ans_num;
        //cout << "here" << endl;
    }
    //cout << "here" << endl;
    // print ans   
    for (int i=0; i<n; i++){
        cout << ans.at(i) << endl;
    }
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int P, Q, R;
    cin >> P >> Q >> R;
    
    cout << P + Q + R - max(max(P, Q), R) << endl;
    return 0;
}


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

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

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


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

    ll dp[N+1][W+1] = {};

    ll w[N], v[N];
    for (int i = 0; i < N; i++) cin >> w[i] >> v[i];
    //for (int i = 0; i < N; i++) cout << w[i] << v[i] << endl;

    
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= W; j++) {
            if (j >= w[i]) {
                //cout << dp[i][j-w[i]] << endl;
                chmax(dp[i+1][j], dp[i][j-w[i]] + v[i]);
                //cout << dp[i+1][j] << endl;
            }
            chmax(dp[i+1][j], dp[i][j]);
        }
    }
    /*
    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= W; j++) {
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
    */
    cout << dp[N][W] << endl;
    return 0;
}



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

using namespace std;

int main()
{
	int N, X, temp, sum = 0, source, count = 0;;
	vector<int> m;

	cin >> N;
	cin >> X;

	count = N;
	source = X;

	for (int i = 0; i < N; i++) {
		cin >> temp;
		m.push_back(temp);
	}
	sort(m.begin(), m.end());

	for (int i = 0; i < N; i++) {
		sum += m.at(i);
	}

	source -= sum;

	for (int i = 0; source >= m.at(0); i++) {
		source -= m.at(0);
		count++;
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <vector>
using namespace std;

bool AssignMin(int* p, int v) {
    if (v < *p) return *p = v, true;
    return false;
}

bool AssignMax(int* p, int v) {
    if (*p < v) return *p = v, true;
    return false;
}

struct Solution {
    int N, K;
    vector<vector<int> > Out;
    vector<int> Distance;

    void SetDistanceToMax() {
        Distance.resize(N);
        for (int i = 0; i < N; ++i) Distance[i] = INT_MAX;
    }

    void DFS(int start) {
        for (int i = 0; i < Out[start].size(); ++i) {
            int target = Out[start][i];
            if (AssignMin(&Distance[target], Distance[start] + 1)) {
                DFS(target);
            }
        }
    }

    int VisitedSize(int limit) {
        int answer = 0;
        for (int i = 0; i < N; ++i) {
            if (Distance[i] <= limit) ++answer;
        }
        return answer;
    }

    int EvenCase() {
        int answer = 0;
        for (int i = 0; i < N; ++i) {
            SetDistanceToMax();
            Distance[i] = 0;
            DFS(i);
            AssignMax(&answer, VisitedSize(K / 2));
        }
        return answer;
    }

    int OddCase() {
        int answer = 0;
        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < Out[i].size(); ++j) {
                int target = Out[i][j];
                SetDistanceToMax();
                Distance[i] = Distance[target] = 0;
                DFS(i);
                DFS(target);
                AssignMax(&answer, VisitedSize(K / 2));
            }
        }
        return answer;
    }

    void Solve() {
        scanf("%d%d", &N, &K);
        Out.resize(N);
        for (int i = 1; i < N; ++i) {
            int v1, v2;
            scanf("%d%d", &v1, &v2);
            Out[v1 - 1].push_back(v2 - 1);
            Out[v2 - 1].push_back(v1 - 1);
        }
        int answer = K % 2 == 0 ? EvenCase() : OddCase();
        printf("%d\n", N - answer);
    }
};

int main() {
    Solution().Solve();
    return 0;
}


Measured memory_bytes: 512
//aea ctmr
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
//v.erase(unique(v.begin(),v.end()),v.end());
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define PI 3.14159265358979323846
 
typedef long double ld;
typedef long long ll;
const ll N = 100500;
const ll mod = 1e9 + 7;
using namespace std;
 
#define TRACE
#ifdef TRACE
#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

ll xd[32];

ll _lcm(ll a, ll b){
    if(a == -1) return b;
    else return a * b / __gcd(a, b);
}

ll bi(ll n){
    ll ans = 0;

    while(n % 2 == 0){
        ans++;
        n /= 2;
    }

    return ans;
}

int main(){
    fastio;

    ll n, m;
    cin >> n >> m;
    ll lc = -1;
    ll ans = 0;
    for(ll i = 0; i < n; i++){
        ll a;
        cin >> a;
        lc = _lcm(lc, a / 2);
        if(lc > m){
            ans = -1;
            break;
        }
        xd[bi(a)]++;
    }

    if(ans == -1){
        cout << 0 << endl;
    }
    else{
        bool f = true;
        for(ll i = 0; i < 32; i++){
            if(xd[i] != n and xd[i] != 0) f = false;
        }
        if(!f) cout << 0 << endl;
        else{
            cout << (m + lc) / (2 * lc) << endl;
        }
    }



    return 0;


}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n, from, to;
int ans = 0;

int main() {
    scanf("%d", &n);
    forn(i, n) {
        scanf("%d%d", &from, &to);
        ans += to - from + 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i=0; i<(n); i++)//第一引数の変数をカウンタ変数としてn回回す
//repはカウンタ変数が1ずつ増える場合にしか使えない
using veci = vector<int>;
using vecd = vector<double>;
int main(){
  string s;
  cin >> s;
  string ans = "";
  for (int i=0; i<s.size(); i+=2){
    ans += s.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
a = [[0 for i in range(10)] for j in range(12)]

n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    a[3 * b + f - 4][r - 1] += v
    
for i, j in enumerate(a):
    if i % 3 == 0 and i != 0:
        print('#' * 20)
    print("", *j)


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

ll const MX = 1e9 + 1;

int main()
{
    int x;
    cin >> x;
    for (int a = 1; a < 1000; ++a)
    {
        ll a5 = 1;
        rep(i, 5) a5 *= a;
        for (int b = -1000; b < 1000; ++b)
        {
            ll b5 = 1;
            rep(i, 5) b5 *= b;
            if (a5 - b5 == x)
            {
                printf("%d %d\n", a, b);
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3764
#11
N = int(input())
num = 0
Max = 0
Max_num = 0
cou = 0

for i in range(1,N+1):
    num = i
    cou = 0
    while num % 2 == 0:
        num = int(num/2)
        cou +=1
    if Max <= cou:
        Max = cou
        Max_num = i

print(Max_num)
        

Measured memory_bytes: 9060
import sys
sys.setrecursionlimit(10**6)

#a = int(input())
#b = list(map(int, input().split()))
n, a, b = map(int, input().split())
#s = input()
#s,t = input().split()
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

ans = min(a*n, b)

print(ans)

Measured memory_bytes: 2940
//g++  5.4.0

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n; cin >> n;
    vector<int> arr(n);
    for(int i = 0; i < n; i++) cin >> arr[i];
    
    long long dp[3005][3005];
    
    for(int l = n-1; l >= 0; l--){
        for(int r = l; r < n; r++){
            if(l == r){
                dp[l][r] = arr[l];
            }
            else{
                dp[l][r] = max(arr[l]-dp[l+1][r],arr[r]-dp[l][r-1]);
            }
            
        }
    }
    
    cout << dp[0][n-1] << endl;
}

Measured memory_bytes: 70784
if __FILE__ == $0
  while line = gets
    min_speed = line.to_f
    t = min_speed / 9.8
    min_height = 4.9 * t**2
    n = 1
    while true
      if n * 5 - 5 >= min_height
        break
      end
      n += 1
    end
    puts n
  end
end

Measured memory_bytes: 6132
fun main(args : Array<String>) {
    val x = readLine()!!.toInt()

    println(when {
        x <= 599 -> 8
        x <= 799 -> 7
        x <= 999 -> 6
        x <= 1199 -> 5
        x <= 1399 -> 4
        x <= 1599 -> 3
        x <= 1799 -> 2
        x <= 1999 -> 1
        else -> 0
    })
}

Measured memory_bytes: 34476
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <iterator>
#include <bitset>
#include <random>
#include <assert.h>
#include <unordered_map>
#include <array>
#include <ctime>

#ifdef _MSC_VER
#include <agents.h>
#endif

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define X first
#define Y second
#define MP make_pair
#define umap unordered_map

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> P;
typedef unsigned int uint;

const int N = 5;

int score[N];

pair<int, vector<vector<int>>> check(vector<vector<int>> v){
	auto nxt = v;
	rep(i, N) rep(j, N){
		int c = v[i][j];
		if (0 < i && i < N - 1 && v[i - 1][j] == c && c == v[i + 1][j]){
			for (int k = -1; k <= 1; ++k) nxt[i + k][j] = 0;
		}
		if (0 < j && j < N - 1 && v[i][j - 1] == c && c == v[i][j + 1]){
			for (int k = -1; k <= 1; ++k) nxt[i][j + k] = 0;
		}
	}
	int cnt = 0;
	rep(i, N) rep(j, N) if (!nxt[i][j] && v[i][j]) cnt += score[v[i][j]-1];

	return MP(cnt, nxt);
}

void down(vector<vector<int>> &v){
	for (int i = N - 2; i >= 0; --i) rep(j, N){
		int k = i;
		while (++k < N) if (!v[k][j]) swap(v[k][j], v[k - 1][j]);
	}
}

int simulate(vector<vector<int>> v){
	int res = 0, bonus = 1, x;
	rep(i, 8){
		tie(x, v) = check(v);
		res += bonus++*x;
		down(v);
	}
	return res;
}

int dx[] = { 0, 1, 0, -1 };
int dy[] = { 1, 0, -1, 0 };
int dfs(int i, int j, int n, vector<vector<int>> &v){
	int res = simulate(v);
	if (n == 0) return res;
	rep(d, 4){
		int ni = i + dx[d], nj = j + dy[d];
		if (ni < 0 || ni >= N || nj < 0 || nj >= N) continue;
		swap(v[i][j], v[ni][nj]);
		res = max(res, dfs(ni, nj, n - 1, v));
		swap(v[i][j], v[ni][nj]);
	}
	return res;
}

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

	auto v = vector<vector<int>>(N, vector<int>(N));

	int n;
	while (cin >> n, ~n){
		rep(i, N) rep(j, N) cin >> v[i][j];
		rep(i, N) cin >> score[i];
		int ans = 0;
		rep(i, N) rep(j, N) ans = max(ans, dfs(i, j, n, v));
		cout << ans << endl;
	}


	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int r, b, w, g;
    cin >> r >> b >> w >> g;
    cout << r + b + w + g << '\n';
    return 0;
}


Measured memory_bytes: 3216
/// Bismillahir Rahmanir Rahim
/* Mohammad Morsalin
   Dept of ICE, NSTU
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define int long long
#define f0(n) for(int i=0;i<n;i++)
#define ms(x) memset(x,0,sizeof(x))
#define ms2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pi pair<int,int>
#define tc(t) int t;cin>>t;while(t--)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ins insert
#define ALL(v) v.begin(),v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define fi first
#define se second
#define PI acos(-1)
#define sz(a) (int)a.size();
#define IOS ios::sync_with_stdio(false);
using namespace std;
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
double sq(double x) {return x*x;}
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
signed main()
{
    IOS
    ll x;
    while(cin>>x){
        int lim=100;
        int cnt=0;
        while(lim<x){
            lim = lim + (lim/100);
            cnt++;
        }
        cout << cnt << endl;
    }
    return 0;
}
///Alhamdulillah


Measured memory_bytes: 3656
S = input()
T = input()
n = len(T)

ans = 10**9
for i in range(n,len(S)+1):
    dummy = S[i-n:i]
    tmp = 0
    for j in range(n):
        if dummy[j] != T[j]:
            tmp +=1

    if ans > tmp:
        ans = tmp
print(ans)

Measured memory_bytes: 73168
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>

using namespace std;

#define MOD 1000000007
#define INF 1050000000

int main() {
	int n; cin >> n;
	int a;
	int ans[9];
	memset(ans, 0, sizeof(ans));

	for (int i = 0; i < n; i++) {
		cin >> a;
		if (a >= 3200) { ans[8]++; }
		else { ans[a / 400]++; }
	}

	int x = 0;

	for (int i = 0; i < 8; i++) {
		if (ans[i] > 0) { x++; }
	}

	cout << max(x,1) << " " << x + ans[8] << endl;

}

Measured memory_bytes: 256
r,g,b,n = map(int,input().split())

ans = 0
for i in range(3001):
    if r*i > n:
        break
    for j in range(3001):
        if g*j > n:
            break
        res = n-(r*i+g*j)
        if (res % b == 0) and res//b >= 0:
            ans += 1

print(ans)


Measured memory_bytes: 40812