akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define ndl '\n'
#define mp make_pair
#define pb push_back
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(),x.end()

using namespace std;
using namespace __gnu_pbds;

template<typename T> using indexed_set=tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<int,ull> piu;
typedef vector<vector<int>> matrix;

const ll INF=1e18+123;
const ld EPS=1e-9;
const int inf=1e9+123;
const int MOD=1e9+7;
const int N=5e5+123;
const int M=1e6+123;
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};

map<pii,bool>m;

pii p[N];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>p[i].x>>p[i].y;
        m[p[i]]++;
    }
    int mx=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(i==j)continue;
            int x=p[i].x-p[j].x;
            int y=p[i].y-p[j].y;
            int cnt=0;
            for(int k=1;k<=n;k++){
                cnt+=m[{p[k].x+x,p[k].y+y}];
            }
            mx=max(mx,cnt);
        }
    }
    cout<<n-mx;
    return 0;
}


Measured memory_bytes: 4096
#!/usr/bin/env python3

# import itertools
# n = int(input())

# test_list = list(range(1, n+1))

# ans = 0
# ans_list = []
# ans_score = []
# for i in itertools.permutations(test_list, n):
#     # print(i)
#     ans_tmp = 0
#     for j in range(len(i)):
#         ans_tmp += (j+1) % i[j]
#     ans_score.append(ans_tmp)
#     ans_list.append(i)
#     # print(ans_tmp)

#     ans = max(ans_tmp, ans)

# print("ans:", ans)
# for i in range(len(ans_list)):
#     if ans_score[i] == ans:
#         print(ans_list[i])

n = int(input())

print(((n-1)+1)*(n-1)//2)


Measured memory_bytes: 3064
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        v: [i32; n],
        c: [i32; n],
    }
    let mut sum = 0;
    for i in 0..n {
        let m = v[i] - c[i];
        if m > 0 {
            sum += m;
        }
    }
    println!("{}", sum);
}


Measured memory_bytes: 4352
import heapq
from collections import deque
n,k=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]

for i in range(n):
  l[i].reverse()
  l[i][0]*=-1
heapq.heapify(l)

check=[0 for i in range(10**5+1)]
L=[]
L2=[]
L2=deque(L2)
ans=[]

for i in range(k):
  x=heapq.heappop(l)
  if check[x[1]]==0:
    L.append(-x[0])
    check[x[1]]=1
  else:
    L2.append(-x[0])
p=sum(check)
ans.append(sum(L)+sum(L2)+p**2)

y=n-k
while y!=0:
  x=heapq.heappop(l)
  if check[x[1]]==0:
    L.append(-x[0])
    check[x[1]]=1
    if len(L2)==0:
      break
    z=L2.pop()
    p+=1
    ans.append(ans[-1]-(p-1)**2-x[0]-z+p**2)
  y-=1

print(max(ans))

Measured memory_bytes: 29152
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
using P = pair<ll, ll>;
using Vec = vector<ll>;
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); (i)++)
#define FORN(i, m, n) for(ll (i) = (m); (i) <= (n); (i)++)
#define FORR(i, m, n) for(ll (i) = (m); (i) >= (n); (i)--)
#define rep(i, n) FOR(i, 0, n)
#define repn(i, n) FORN(i, 1, n)
#define repr(i, n) FORR(i, n, 0)
#define repnr(i, n) FORR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second

const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

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

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

	ll ans = 1;
	rep(i, n){
		ll t;
		cin >> t;
		ans = ans/gcd(ans, t)*t;
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = input().split(" ")
A = [int(i) for i in A]
A = sorted(A,reverse = True)
#print(A)
ans = 1
flag = 0
count = 0
for i in range(N-1):
    if count >= 2:
        break
    if A[i+1] == A[i] and A[i] > 0:
        ans *= A[i]
        A[i],A[i+1] = 0,0
        flag = 1
        count += 1
        #print(A)
if flag == 0:
    print(0)
else:
    print(ans)

Measured memory_bytes: 14244
#include <iostream>
 
 using namespace std;
 
 int main(void){

     int A,B;

     cin >> A >> B;

     if(A==B) cout << "Draw" << endl;

     else if(A==1) cout << "Alice" << endl;

     else if(B==1) cout << "Bob" << endl;

     else if(A>B) cout << "Alice" << endl;

     else cout << "Bob"<< endl;

     return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jeel Vaishnav
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AAirConditioner solver = new AAirConditioner();
        solver.solve(1, in, out);
        out.close();
    }

    static class AAirConditioner {
        public void solve(int testNumber, InputReader sc, PrintWriter out) {
            int x = sc.nextInt();

            if (x >= 30)
                out.print("Yes");
            else
                out.print("No");
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 32468
package main

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

const (
	initialBufSize = 1024
	maxBufSize     = 1e6
)

var (
	scanner = bufio.NewScanner(os.Stdin)
)

func main() {
	scanner.Split(bufio.ScanWords)
	n, m := scanInt(), scanInt()
	a := make([]float64, n)
	sum := 0.
	for i := 0; i < n; i++ {
		t := scanFloat64()
		a[i] = t
		sum += t
	}

	b := sum / (4. * float64(m))
	cnt := 0
	ans := false
	for i := 0; i < n; i++ {

		if a[i] >= b {
			cnt++
		}

		if cnt >= m {
			ans = true
			break
		}
	}

	if ans {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func scanInt() int {
	i, _ := strconv.Atoi(scanText())
	return i
}

func scanInts(size int) []int {
	ints := make([]int, size)
	for i := 0; i < size; i++ {
		ints[i] = scanInt()
	}
	return ints
}

func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanText(), 64)
	return f
}

func scanFloat64s(size int) []float64 {
	f := make([]float64, size)
	for i := 0; i < size; i++ {
		f[i] = scanFloat64()
	}
	return f
}

func scanText() string {
	scanner.Scan()
	return scanner.Text()
}

func scanTexts(size int) []string {
	s := make([]string, size)
	for i := 0; i < size; i++ {
		s[i] = scanText()
	}
	return s
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func pow(x, y int) int {
	return int(math.Pow(float64(x), float64(y)))
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define dep(i,a,b) for(int i = a; i >= b; i--) 
#define Rep(i,a) for(int i = 0; i < a; i++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ab(x) ((x) < 0 ? -(x) : (x))
using namespace std;
typedef long long LL;
typedef map<int, int>::iterator mit;
typedef set<int>::iterator sit;
typedef pair<int, int> pii;
#define x first
#define y second
const int N = 1e5 + 10;
int n, a[N], b[N], c[N], d[N], p[N], l;
map<int, int> val;
int f[N];
inline int find(int x) { return x == f[x] ? x : f[x] = find(f[x]); }
void merge(int a, int b) {
	a = find(a), b = find(b);
	if (a != b) f[a] = b;
}
int main() {
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",a + i);
	rep(i,1,n) scanf("%d",b + i);
	a[n + 1] = 0; rep(i,1,n) a[n + 1] ^= a[i];
	b[n + 1] = 0; rep(i,1,n) b[n + 1] ^= b[i];
	n++;
	memcpy(c + 1, a + 1, n * sizeof(a[0]));
	memcpy(d + 1, b + 1, n * sizeof(b[0]));
	sort(c + 1, c + n + 1); sort(d + 1, d + n + 1);
	rep(i,1,n) if (c[i] != d[i]) { printf("-1\n"); return 0; }
	l = unique(c + 1, c + n + 1) - c - 1;
	rep(i,1,l) val[c[i]] = i;
	rep(i,1,n) a[i] = val[a[i]], b[i] = val[b[i]];
	static vector<int> pos[N];
	rep(i,1,n) pos[b[i]].pb(i);
	static bool vs[N];
	rep(i,1,n) if (a[i] == b[i]) p[i] = i, vs[i] = true;
	rep(i,1,n) if (!vs[i]) {
		while (vs[*pos[a[i]].rbegin()]) pos[a[i]].pop_back();
		p[i] = *pos[a[i]].rbegin();
		pos[a[i]].pop_back();
	}
	rep(i,1,n) f[i] = i; static bool vis[N];

	rep(i,1,n) if (!vis[i]) {
		vis[i] = true;
		for(int j = p[i]; j != i; j = p[j]) vis[j] = true, merge(j, i);
	}
	rep(i,1,n) pos[a[i]].pb(i);
	rep(i,1,n) if (pos[i].size()) {
		int len = pos[i].size(), t = 0;
		rep(j,0,len - 1) {
			int x = pos[i][j];
			if (p[x] != x || x == n) {
				if (!t) t = x; else merge(t, x);
			}
		}
	}
	static int cnt[N];
	rep(i,1,n) cnt[find(i)]++;
	int ans = 0;
	rep(i,1,n) if (f[i] == i) {
		if (i == find(n)) ans += cnt[i] - 1;
		else if (cnt[i] > 1) ans += cnt[i] + 1;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 13312
fun main(args: Array<String>) {

    val S = readLine()!!

    var zeroOrigin = 0
    var oneOrigin = 0

    for (i in S.indices) {
        if (i % 2 == 0) {
            if (S[i] == '0') {
                zeroOrigin++
            }
        } else {
            if (S[i] == '1') {
                zeroOrigin++
            }
        }
    }
    for (i in S.indices) {
        if (i % 2 == 1) {
            if (S[i] == '0') {
                oneOrigin++
            }
        } else {
            if (S[i] == '1') {
                oneOrigin++
            }
        }
    }

    Math.min(S.length - oneOrigin, S.length - zeroOrigin).let(::println)
}



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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    int K, A, B;
    cin >> K >> A >> B;

    if(A%K==0||B%K==0)
    {
        cout << "OK" << endl;
        return 0;
    }

    if(A/K==B/K)
    {
        cout << "NG" << endl;
    }
    else
    {
        cout << "OK" << endl;
    }
    

 

 

    return 0;
}



Measured memory_bytes: 3652
from sys import stdin

A = list(map(int,stdin.readline().split()))

if A[1]-2*A[0]<0:
    print('No')
else:
    if (A[1]-2*A[0])%2==0:
        if (A[1]-2*A[0])/2>A[0]:
            print('No')
        else:
            print('Yes')
    else:
        print('No')

Measured memory_bytes: 9184
/**
*    created: 14.05.2020 11:14:55
**/
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int a, b; cin >> a >> b;
    cout << max(max(a+a-1, b+b-1), a+b) << endl;
    return 0;
}

Measured memory_bytes: 3656
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <sstream>
#include <string>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define EPS 1e-14
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) FOR(i, 0, n)
#define PI 2*acos(0.0)
#define ALL(a) (a).begin(),(a).end()
#define DEBUG(x) cout<<#x <<": "<< x << "\n"
#define DEBUG_ARR(a) REP(i, size(a)){ cout << #a << "[" << i << "]: " << a[i] << "\n"; }
const int VX[] = { 0, 1, 0, -1 };
const int VY[] = { 1, 0, -1, 0 };
const long MOD = 1000000007;

int main()
{
	//	--- I/O 高速化 ---
	cin.tie(0);
	ios::sync_with_stdio(false);
	// --- ここまで ---

	int n, a, a_max = 0, a_min = 1001;
	cin >> n;

	REP(i, n)
	{
		cin >> a;
		if (a > a_max) a_max = a;
		if (a < a_min) a_min = a;
	}

	cout << a_max - a_min << "\n";

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    while(cin >> n, n){
        for (int i = 0; i < n; ++i) {
            int a, b, c;
            cin >> a >> b >> c;
            if(max({a, b, c}) == 100) puts("A");
            else if(a+b >= 180) puts("A");
            else if(a+b+c >= 240) puts("A");
            else if(a+b+c >= 210) puts("B");
            else if(a+b+c >= 150 && max(a, b) >= 80) puts("B");
            else puts("C");
        }
    }
    return 0;
}


Measured memory_bytes: 2912
n=int(input())
list_a = []
list_b = []
for i in range(n):
    a,b=map(int,input().split())
    list_a.append(a)
    list_b.append(b)
"""n=5
list_a = [2,1,1,4,3]
list_b = [4,9,8,9,12]"""


list_dd =[]
for d in zip(list_b, list_a):

    #print(d)
    list_dd.append(list(d))
    
#print(list_dd)

list_dd=sorted(list_dd)
ss=0
for i in range(n):
    tmp=list_dd[i][1]
    ss+=tmp
    list_dd[i][1]=ss

#print(list_dd)

for i in range(n):
    if list_dd[i][0]<list_dd[i][1]:
        
        print("No")
        break
    elif i == n-1:
        print("Yes")


Measured memory_bytes: 99928
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int digitsum(int x) {
    int ret = 0;
    while (x != 0) {
        ret += x % 10;
        x /= 10;
    }
    return ret;
}

int main() {
    int n;
    cin >> n;
    int a, b;
    cin >> a >> b;
    int ret = 0;
    for (int i = 1; i <= n; ++i) {
        int sum = digitsum(i);
        if (a <= sum && sum <= b)
            ret += i;
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T, class T2> void smin(T& a, T2 val) {if (a > val) a = val;}template<class T, class T2> void smax(T& a, T2 val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N];

int32_t main(){_
   

   string s;
   cin >> s;

   int ans = 0;

   n = (int)(s.size());
   int cnt = 0;
   for (int i = 0; i < n; ++i)
   {
      if (s[i] == 'S'){
         smax(ans, cnt);
         cnt = 0;
      }
      else{
         cnt++;
      }
   }

   smax(ans, cnt);
   cout<<ans;

   return 0;
}

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

using namespace std;

const int N = 3e3 + 3;
int dp[N][N];

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

	int n1 = a.size(), n2 = b.size();

	int mx = 0;
	string ans = "";
	for(int i = 1; i <= n1; i++){
		for(int j = 1; j <= n2; j++){
			dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			if(a[i - 1] == b[j - 1])
				dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1);
		}
	}

	int x = 0, y = 0;

	for(int i = 1; i <= n1; i++){
		for(int j = 1; j <= n2; j++)
			if(a[i - 1] == b[j - 1] && dp[i][j] > mx){
				mx = dp[i][j];
				x = i, y = j;
			}
	}

	while(x > 0 && y > 0){
		int i = x;
		for(int j = y; j > 0; j--){
			if(a[i - 1] == b[j - 1] && dp[i][j] == mx){
				ans += a[i - 1];
				mx--;
				y--;
				break;
			}
		}
		x--;
	}

	reverse(ans.begin(), ans.end());
	cout << ans << "\n";
}

Measured memory_bytes: 35456
a,b,c,d = [int(i) for i in input().split(" ")]
attack_round_a = c // b if c % b == 0 else c // b + 1
attack_round_b = a // d if a % d == 0 else a // d + 1
print('Yes' if attack_round_a <= attack_round_b else 'No')

Measured memory_bytes: 9108
import heapq
import math
n,m = map(int,input().split())
A = list(map(int,input().split()))
A = list(map(lambda x: x*(-1), A))
heapq.heapify(A)

for _ in range(m):
    temp = math.ceil(heapq.heappop(A)/2)
    A.append(temp)

A = list(map(lambda x: x*(-1), A))
print(sum(A))

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

template<typename A, typename B> bool chmin(A &a, const B &b){ return b < a && (a = b, true); }
template<typename A, typename B> bool chmax(A &a, const B &b){ return a < b && (a = b, true); }

int main(){
  int x,y;
  cin >> x >> y;
  cout << x + y / 2 << '\n';
  return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
typedef long long ll;
typedef long double  ld;
#define pii pair<ll,ll> 
#define pic pair<ll,char>
#define vi vector< ll > 
#define vvi vector< vi > 
#define vpi vector< pii > 
#define vvpi vector< vpi > 
#define st  set <ll, greater <ll> >
#define mst  multiset <ll, greater <ll> >
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mapp  unordered_map <ll, ll>
#define ppii pair< pii, pii > 
#define test(t) ll t;cin>>t;while(t--)
#define inarr(n) ll arr[n];for(ll i=0;i<n;i++)cin>>arr[i];
#define ingra(m) vvi arr(100005);for(ll i=0;i<m;i++){ll u,v;cin>>u>>v;arr[u].pb(v);arr[v].pb(u);}
#define mem(a,b) memset(a,b,sizeof(a))
#define inn freopen("input.txt", "r", stdin)
#define outt freopen("output.txt", "w", stdout)
#define all(arr) arr.begin(),arr.end()
ll power(ll x,ll y){ll res = 1;while(y){if(y&1) res = (res*x)%mod;y=y/2,x=(x*x)%mod;}return res%mod;}
signed main()
{
    fast;
    ll a,b,c;
    cin>>a>>b>>c;
    cout<<b+min(c,a+b+1);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
#define MOD (ll)(1e9+7)
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;

signed main(){
    ll n;
    cin >> n;
    ll cnt = 0,ans = -1,memo,a;
    rep(i,1,n+1){
        a = i;
        cnt = 0;
        while(a % 2 == 0){
            cnt++;
            a /= 2;
        }
        if(ans != (ll)max(ans,cnt)){
            ans = max(ans,cnt);
            memo = i;
        }
        
    }

    cout << memo << endl;
    return 0;
}


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

int main(){
    int N;
    cin >> N;
    string str = to_string(N);
    if (str.find('7') != string::npos)
    {
        cout << "Yes" << "\n";
    }else{
        cout << "No" << "\n";
    }
    
}


Measured memory_bytes: 3640
// In the name of God

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2*(int)1e5+5;
vector<int> adj[N];
int dp[N], n;
void dfs(int u, int p) {
	for(auto v : adj[u]) if(v!=p) dp[v]+=dp[u];
	for(auto v : adj[u]) if(v!=p) dfs(v, u);
}
signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int q;
	cin >> n >> q;
	for(int i=0;i<n-1;i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	for(int i=0;i<q;i++) {
		int p, x;
		cin >> p >> x;
		p--;
		dp[p]+=x;
	}
	dfs(0, 0);
	for(int i=0;i<n;i++) cout << dp[i] << " ";
	return 0;
}


Measured memory_bytes: 24320
import java.util.Scanner;
public class Main {
	public static int N;
	public static int[] A;
	public static int[] A_work;

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		N = Integer.parseInt(scan.next());
		A = new int[N];
		A_work = new int[N];
		for (int n = 0;n < N ;n++ ) {
			A[n] = Integer.parseInt(scan.next());
		}
		scan.close();

		System.out.println(search());
	}

	private static long search() {
		long sum = 0;
		for (int n = 0;n < N-1 ;n++ ) {
			int X = A[n] + A_work[n];
			int Y = A[n + 1] + A_work[n + 1];
			if (X > Y) {
				int diff = X - Y;
				A_work[n + 1]+=diff;
				Y+=diff;
				sum+=diff;
			}
		}
		return sum;
	}
}


Measured memory_bytes: 62132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    int ma=0, ans=0;
    rep(i, n){
        int t; cin>>t;
        ma = max(ma, t);
        if(ma == t) ans++;
    }
    cout << ans <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <sys/stat.h>
using namespace std;
using ll = int64_t;

int main(int , char **)
{
#ifdef LOCAL_DEBUG
	struct stat sb;
	ifstream in("/dev/shm/input.txt");
	if (stat("/dev/shm/input.txt",&sb)==0){ cin.rdbuf(in.rdbuf()); }
#endif
	char map[100][100]={};
	int H,W;
	cin >> H >> W;
	for(int h=1;h<=H;h++){
		for(int w=1;w<=W;w++){
			cin >> map[h][w];
		}
	}

	for(int h=1;h<=H;h++){
		for(int w=1;w<=W;w++){
			int ans=0;
			if (map[h][w]=='#'){printf("#");continue;}
			if (map[h-1][w-1]=='#'){ans++;}
			if (map[h-1][w]=='#'){ans++;}
			if (map[h-1][w+1]=='#'){ans++;}

			if (map[h][w-1]=='#'){ans++;}
			if (map[h][w+1]=='#'){ans++;}

			if (map[h+1][w-1]=='#'){ans++;}
			if (map[h+1][w]=='#'){ans++;}
			if (map[h+1][w+1]=='#'){ans++;}
			printf("%d",ans);
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
//#define int long long
using namespace std;
typedef long long ll;
const int INF = 1e9;

const int MAX_V = 500;  //??????????????????????????????
struct edge { int to, cap, rev; };
vector<edge> G[MAX_V];
bool used[MAX_V];

//from??????to??????????????????cap???????????°?????????????????????
void add_edge(int from, int to, int cap)
{
    G[from].push_back((edge){to, cap, G[to].size()});
    G[to].push_back((edge){from, 0, G[from].size() - 1});
}

//?¢?????????????DFS??§??¢???
int dfs(int v, int t, int f)
{
    if (v == t) return f;
    used[v] = true;
    for (int i=0; i<G[v].size(); i++) {
        edge &e = G[v][i];
        if (!used[e.to] && e.cap > 0) {
            int d = dfs(e.to, t, min(f, e.cap));
            if (d > 0) {
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

//s??????t???????????§???????±???????
int max_flow(int s, int t)
{
    int flow = 0;
    for (;;) {
        memset(used, 0, sizeof(used));
        int f = dfs(s, t, INF);
        if (f == 0) return flow;
        flow += f;
    }
}

signed main()
{
    int X, Y, E;
    int x, y;

    cin >> X >> Y >> E;
    REP(i,X) add_edge(300, i, 1);
    REP(i,Y) add_edge(100 + i, 301, 1);
    REP(i,E) {
        cin >> x >> y;
        add_edge(x, 100 + y, 1);
    }

    cout << max_flow(300, 301) << endl;
}

Measured memory_bytes: 3312
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 100000+5
#define MOD 20190823
#define eps 1e-8
#define mp make_pair
#define INF 1000000000+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
inline void read(ll &f){
    f=0;
    ll x=1;
    char ch=getchar();
    while(ch<48 || ch>57) {
        if(ch=='-') {
            x=-1;
        }
        ch=getchar();
    }
    while(ch<=57 && ch>=48) {
        f=f*10+ch-'0';
        ch=getchar();
    }
    f*=x;
}
ll n,m;
int main(){
    read(n),read(m);
    if(n==1 || m==1){
        cout<<1<<endl;
        return 0;
    }
    ll p=n*m;
    if(p%2==0)
    {
        cout<<p/2<<endl;
    }
    else{
        cout<<p/2+1<<endl;
    }
    return 0;
}


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

int s,k,x,y,z;

int main(){
    cin>>k>>s;
    int cnt=0;
    for(int x=0;x<=s&&x<=k;x++){
        for(int y=0;y<=s-x&&y<=k;y++){
            z=s-x-y;
            if(z>k)continue;
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
/* template.cpp {{{ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)(s))
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)(s))
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = (ll)1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
/* }}} */

int n, m;
pair<int, int> a[200000];

int main(){
  cin >> n >> m;
  rep(i, n) a[i].second = i;
  rep(i, m){
    int x;
    cin >> x, x--;
    a[x].first = -i - 1;
  }
  sort(a, a + n);
  rep(i, n) cout << a[i].second + 1 << endl;
}

Measured memory_bytes: 4756
n = int(input())
v = list(map(int,input().split()))

v1 = v[::2]
v2 = v[1::2]

from collections import Counter

v1c = Counter(v1).most_common()
v2c = Counter(v2).most_common()

v1c.append([0,0])
v2c.append([0,0])

if v1c[0][0] == v2c[0][0]:
    ans = max(v1c[0][1] + v2c[1][1], v1c[1][1] + v2c[0][1])
else:
    ans = v1c[0][1] + v2c[0][1]

print(n-ans)


Measured memory_bytes: 20956
while True:
    n = int(input())
    if n == 0:
        break
    line = list(map(int, input().split()))
    i = 0
    while i < n:
        j = i
        while j+1 < n and line[j+1]-line[j] == 1:
            j += 1
        s = "\n" if n-1 == j else " "
        if i == j:
            print("%d%s" % (line[i], s), end='')
            i += 1
        else:
            print("%d-%d%s" % (line[i], line[j], s), end='')
            i = j+1

Measured memory_bytes: 7600
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535897932;
const ll MOD = 1000000007;
const ll MAX = 1000000000000000000;

ll a[100000];

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

	rep(i, n) {
		cin >> a[i];
		if (a[i] == 0) {
			cout << 0 << endl;
			return 0;
		}
	}

	ll ans = 1;
	rep(i, n) {
		ll tmp = ans;
		ans *= a[i];
		if (ans > MAX || ans < tmp) {
			ans = -1;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4372
S = list(input())
N = len(S)

S_1=S[:N//2]
S_2=S[N//2+1:]

N_=len(S_1)
ans='Yes'
for n in range(N_):
    if S_1[n] != S_1[-(n+1)]:
        ans='No'
        break
    if S_2[n] != S_2[-(n+1)]:
        ans='No'
        break   
        
for n in range(N):
    if S[n] != S[-(n+1)]:
        ans='No'
        break

print(ans)

Measured memory_bytes: 61948
#include <iostream>
using namespace std;
int main(void){
  int n,s[100],i,j,b,sum=0;
  cin >> n;
  for (i=0;i<n;i++){
    cin >> s[i];
    sum+=s[i];
  }
  if (sum%10){
    cout << sum << '\n';
    return 0;
  }
  for (i=0;i<n-1;i++){
    for (j=i+1;j<n;j++){
      if (s[i]>s[j]){
        b=s[i];
        s[i]=s[j];
        s[j]=b;
      }
    }
  }
  i=0;
  while (s[i]%10==0&&i<n) i++;
  if (i==n) cout << "0\n";
  else cout << sum-s[i] << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    ll a,b,c,d;
    cin >> a >> b >> c >> d;

    if((a<0 && b>=0) && (c<0 && d>=0)){
        cout << max(a*c,b*d) << endl;
    }else if((a<0 && b>=0) && (d<0)){
        cout << a*c << endl;
    }else if((a<0 && b>=0) && (c>=0)){
        cout << b*d << endl;
    }else if((b<0) && (c<0 && d>=0)){
        cout << a*c << endl;
    }else if((b<0) && (d<0)){
        cout << a*c << endl;
    }else if((b<0) && c>=0){
        cout << b*c << endl;
    }else if(a>=0 && (c<0 && d>=0)){
        cout << b*d << endl;
    }else if(a>=0 && d<0){
        cout << a*d << endl;
    }else if(a>=0 && c>=0){
        cout << b*d << endl;
    }

    return 0;
}


Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main()
{
	long long i, j, n, f=0;
	cin >> n;	j = n;

	while(n>0) {
		f += n % 10;
		n /= 10;
	}

	if (j%f)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;

	return 0;
}

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

int main(void){
  string N;
  cin>>N;
  long NNum=0;
  for(int i=0;i<N.size();i++){
    NNum+=N[i]-'0';
  }
  if(NNum%9==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  return 0;
}


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

#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define rev(v) reverse(v.begin(), v.end());
#define io() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); srand(time(NULL));
#define check cout<<"?\n";
 
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

signed main(){
    io();
    int maxN = 1000000;
    int k, x; cin >> k >> x;
    --k;
    int mn = max(x - k, -maxN);
    int mx = min(x + k, maxN);
    for(int i = mn; i <= mx; ++i){
        cout << i << ' ';
    }
    return 0;
}

Measured memory_bytes: 3584
import java.util.Scanner;
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 >=0 && A <=100 && B%2==0 && B >=2 && B <=1000) {
if(A >= 13 ) {
System.out.println(B);
}else if(A >=6 && A <= 12) {
System.out.println(B/2);
}else{
System.out.println(0);
}
}
}
}

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

int main(){
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  int max_a = x;
  int min_b = y;
  for(int i = 0; i < n; i++){
    int c;
    cin >> c;
    max_a = max(c, max_a);
  }
  for(int i = 0; i < m; i++){
    int d;
    cin >> d;
    min_b = min(d, min_b);
  }
  if(min_b <= max_a){
    cout << "War" << endl;
  }
  else{
    cout << "No War" << endl;
  }
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <string.h>
//#include <unordered_set>
//#include <unordered_map>
//#include <bits/stdc++.h>

#define MP(A,B) make_pair(A,B)
#define PB(A) push_back(A)
#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define fi first
#define se second

using namespace std;

template<typename T>inline bool upmin(T &x,T y) { return y<x?x=y,1:0; }
template<typename T>inline bool upmax(T &x,T y) { return x<y?x=y,1:0; }

typedef long long ll;
typedef unsigned long long ull;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod eps=1e-11;
const lod pi=acos(-1);
const int oo=1<<30;
const ll loo=1ll<<62;
const int mods=998244353;
const int MAXN=600005;
const int INF=0x3f3f3f3f;//1061109567
/*--------------------------------------------------------------------*/
inline int read()
{
	int f=1,x=0; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') f=-1; c=getchar(); }
	while (c>='0'&&c<='9') { x=(x<<3)+(x<<1)+(c^48); c=getchar(); }
	return x*f;
}
int s[MAXN],a[MAXN],n;
bool check(int x)
{
	int ans=0;
	for (int i=1;i<n;i+=2)
		if (s[i]-ans>=x) upmin(ans,s[i+1]);
	return s[n]-ans>=x;
}
int main()
{
	n=read();
	int sum=0;
	for (int i=1;i<=n;i++) a[i]=read(),sum+=a[i];
	if (!(n&1))
	{
		int s=0;
		for (int i=1;i<=n;i++) s+=(i&1)*a[i];
		printf("%d %d\n",max(s,sum-s),min(s,sum-s));
		return 0;
	}
	for (int i=1;i<=n;i++) s[i]=s[i-1]+a[i]*((i&1)?1:-1);
	int l=0,r=n*1000;
	while (l<r)
	{
		int mid=(l+r+1)>>1;
		if (check(mid)) l=mid;
		else r=mid-1;
	}
	for (int i=1;i<=n;i++)
		if (!(i&1)) l+=a[i];
	printf("%d %d\n",l,sum-l);
	return 0;
}

Measured memory_bytes: 3456
/*
  ∧,,∧
( 'ω' )つ ＜WA,またお前か！！　
（m9 ＼ 　　
　 ＼　 ＼
　 　 ) ) ＼
　 ／／ ＼ ＼
　 (＿） 　 (＿)
*/

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

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    int n;
    cin >> n;
    vector<int> p(n, 0);
    for (int i = 0; i < n; i++)
        cin >> p[i];

    int ans = 0;
    for (int i = 1; i <= n-2; i++) {
        int tar = p[i];
        int prev = p[i-1];
        int next = p[i+1];

        if (tar - min({tar, prev, next}) && tar - max({tar, prev, next})) {
            ans++;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};

//全二点間の距離
//ヨ i,d[i][i]<0なら負の閉路
int MAX_dist=1e9+7;
int V=0;
vector<vector<int>> d(0,vector<int>(0,MAX_dist));//d[x][y]:=x->yのcost,枝が無ければMAX_dist,d[i][i]=0

void init(int n){
    d=vector<vector<int>>(n,vector<int>(n,MAX_dist));
    rep(i,n) d[i][i]=0;
    V=n;
}

void warshall(){
    rep(k,V){
        rep(i,V){
            if(d[i][k]==MAX_dist) continue;
            rep(j,V){
                if(d[k][j]==MAX_dist) continue;
                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }
}

int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int h,w;
    cin>>h>>w;
    vector<string> a(h);
    rep(i,h) cin>>a[i];
    init(h*w);
    rep(i,h-1)rep(j,w){
        if(a[i][j]=='.'&&a[i+1][j]=='.'){
            d[i*w+j][i*w+j+w]=1;
            d[i*w+j+w][i*w+j]=1;
        }
    }
    rep(i,w-1)rep(j,h){
        if(a[j][i]=='.'&&a[j][i+1]=='.'){
            d[j*w+i][j*w+i+1]=1;
            d[j*w+i+1][j*w+i]=1;
        }
    }
    warshall();
    int ans=0;
    rep(i,h*w)rep(j,h*w){
        if(d[i][j]!=MAX_dist) ans=max(ans,d[i][j]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 896
#include <bits/stdc++.h> 
#include <boost/multiprecision/cpp_int.hpp> 
using boost::multiprecision::cpp_int; 
using namespace std;
 
 
int main()
{
 
cpp_int n;
cin>>n;
 
cpp_int r=n%9;
 
if(r%9==0)
cout<<"Yes\n";  
else
cout<<"No\n";      
 
return 0;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
#define mx 99999
int main() {
	int n,k;
	cin>>n>>k;
	int ans = mx;
	while(n--)
	{
		int a,b;
		cin>>a>>b;
		if(b<=k)
			ans = min(ans,a);
	}
	if(ans == mx)
		cout<<"TLE";
	else
		cout<<ans;
    return 0;
}

Measured memory_bytes: 256
/*input
35897 932
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define sz(_a) (ll)(_a.size())
#define FILL(n) memset(n,0,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;

ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
ll sub(ll x,ll y){
    return (x % MOD - y % MOD + MOD) % MOD;
}
ll mult(ll a,ll b) 
{ 
    ll res = 0; 
    if(b<=0) return 0;
    a %= MOD; 
  
    while (b) 
    { 
        if (b & 1) 
            res = (res + a) % MOD; 
        a = (2LL * a) % MOD; 
    } 
  
    return res; 
} 
int arr[maxn];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
    ll n,k;
    cin>>n>>k;
    if(k%2) cout<<(n/k)*(n/k)*(n/k);
    else{
        ll ans=(n/k)*(n/k)*(n/k);
        n+=(k/2);
        cout<<(n/k)*(n/k)*(n/k)+ans;
    }
}

Measured memory_bytes: 764
'use strict'

const main = input => {
	const args = input.split('\n')[0].split(' ')

	if (args[0] === '5' && args[1] === '5' && args[2] === '7') console.log('YES')
	else if (args[0] === '7' && args[1] === '5' && args[2] === '5') console.log('YES')
	else if (args[0] === '5' && args[1] === '7' && args[2] === '5') console.log('YES')
	else console.log('NO')
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7372
#include<iostream>
#include<algorithm>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

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

    int ans = 0;
    rep(i,3){
        ++i;
        if(a*b*i % 2 != 0) {
            puts("Yes");
            return 0;
        }
    }

    puts("No");
    
}

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

#define rep(i, n) for(int i=0; i < n; i++)
#define REP(i, n, m) for(int i=n; i < m; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

ll mod=1000000007;

const ll INF = 1LL << 60;

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

int main(){
  int k,s;cin>>k>>s;
  vector<int> a;
  rep(i,k+1)rep(j,k+1){int t=i+j;if(t<=s)a.pb(t);}
  sort(ALL(a));
  int ans=0;
  rep(i,k+1)ans+=upper_bound(ALL(a),s-i)-lower_bound(ALL(a),s-i);
  cout<<ans<<endl;
}

Measured memory_bytes: 34916
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC(T, v) static_cast<T>(v)
#define SI(v) SC(int, v.size())
#define SL(v) SC( LL, v.size())
#define RF(e, v) for(auto & e: v)
#define ei else if
#define UR assert(false)

// ---- ----

int a, b, c;

int main() {
	cin >> a >> b >> c;
	
	cout << min(c, b / a) << endl;
	
	return 0;
}


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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 11451419194545;
//プライオリティキューを使うと要素を入れてだすだけで大きい順にK個揃う

int main() {

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

    vector<ll > A(X,0);
    vector<ll > B(Y,0);
    vector<ll > C(Z,0);

    for(ll i = 0; i < X; i++){
        cin >> A[i];
    }

    for(ll i = 0; i < Y; i++){
        cin >> B[i];
    }

    for(ll i = 0; i < Z; i++){
        cin >> C[i];
    }

    sort(A.rbegin(), A.rend());
    sort(B.rbegin(), B.rend());
    sort(C.rbegin(), C.rend());

    priority_queue<pair<ll ,vector<ll > > > que;
    //初期値
    //入力A,B,Cは降順にソートされているのでA=1,B=1,C=1が最大なのは既知
    que.push(make_pair(A[0]+B[0]+C[0], vector<ll >({0, 0, 0})));

    //プライオリティキューに一度入れてるかどうかのチェック用
    map<vector<ll >, ll > check;
    //初期値
    check[vector<ll >({0, 0, 0})] = 1;
    //それぞれの要素数チェック用
    vector<ll > XYZ = {X,Y,Z};

    for(ll i = 0; i < K; i++){
        cout << que.top().first << endl;
        //一番上は表示済みで用済みなので出す
        vector<ll > tmp = que.top().second;
        que.pop();
        //次の候補をキューに加える
        //候補はA,B,Cのindexをそれぞれ1加えたものなので3つある
        //先にキューに入っているものや外に出したものと重複が発生するのでそれらを除く
        for(ll j = 0; j < 3; j++){
            vector<ll > idx = tmp;
            idx[j] += 1;
            
            if(XYZ[j] <= idx[j]) continue;

            //すでに追加済みなら飛ばす
            //cout << idx[0] << " " << idx[1] << " " << idx[2] << endl;
            //cout << check[idx] << endl;
            if(check[idx] == 1) continue;

            check[idx] = 1;
            que.push(make_pair(A[idx[0]]+B[idx[1]]+C[idx[2]], idx));
            
            //cout << A[idx[0]]+B[idx[1]]+C[idx[2]] << endl;
        }
    }
}

Measured memory_bytes: 1408
def solve_f(n, s_list):
    res = 'Yes'
    stage = 0
    s_list_s = sorted(s_list)
    length = len(s_list_s)
    resolved = [0] * length
    resolved[-1] = 1

    for i in range(n):
        parents = [s_list_s[k] for k in range(length) if resolved[k]]
        for j in range(length - 1, -1, -1):
            if parents[-1] > s_list_s[j] and resolved[j] == 0:
                resolved[j] = 1
                _ = parents.pop()
            if len(parents) == 0:
                break
        if len(parents) > 0:
            res = "No"
            break

    return res


def main():
    n = int(input())
    s_list = list(map(int, input().split()))
    print(solve_f(n, s_list))


if __name__ == "__main__":
    main()


Measured memory_bytes: 32764