akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 18 22:48:00 2019

@author: Yamazaki Kenichi
"""
import sys

N = int(input())
A = [list(map(int,input().split())) for i in range(N)]
A.sort(key = lambda x:x[2], reverse = True)
ans = [-1,-1,1]
if A[0][2] == 1:
    print(' '.join(map(str,A[0])))
    sys.exit()

for i in range(101):
    for j in range(101):
        h = A[0][2] + abs(A[0][0]-i) + abs(A[0][1]-j)
        counta = 0
        for c in A:
#            print(i,j,h)
            if h == c[2] + abs(c[0]-i) + abs(c[1]-j) or c[2] == 0:
                counta += 1
            else:
                break
            if counta == N:
                if h > ans[2]:
                    ans = [i,j,h]
print(' '.join(map(str,ans)))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main()
{
    char c1,c2,c3,c4,c5,c6;
    cin>>c1>>c2>>c3>>c4>>c5>>c6;
    int flag=1;
    if(c1!=c6){
        flag=0;
    }
    if(c2!=c5){
        flag=0;
    }
    if(c3!=c4){
        flag=0;
    }
    if(flag==0){
        cout<<"NO";
    }
    else{
        cout<<"YES";
    }
}


Measured memory_bytes: 3560
(n, m, l) = map(int, raw_input().split())

A = []
for i in xrange(0,n):
	line_A = map(int, raw_input().split())
	A.append(line_A)

B = []
for j in xrange(0,m):
	line_B = map(int, raw_input().split())
	B.append(line_B)

C = []
for x in xrange(0,n):
	temp_list = []
	for y in xrange(0,l):
		temp = 0
		for z in xrange(0,m):
			temp = temp + A[x][z] * B[z][y]

		temp_list.append(temp)
		
	C.append(temp_list)
	temp_list = []
			

for k in xrange(0,n):
	if k > 0:
		print
	for h in xrange(0,l):
		print C[k][h],
print

Measured memory_bytes: 5008
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==v.size()-1?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint& a) { if ((x += a.x) >= mod) x -= mod; return *this;}
    mint& operator++() { return *this += mint(1); }
    mint& operator-=(const mint& a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; }
    mint& operator--() { return *this -= mint(1); }
    mint& operator*=(const mint& a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint& a) const { mint res(*this); return res+=a; }
    mint operator-(const mint& a) const { mint res(*this); return res-=a; }
    mint operator*(const mint& a) const { mint res(*this); return res*=a; }
    mint pow(ll t) const {
        mint res = mint(1),a(*this);
        while(t > 0) {
            if(t&1) res *= a;
            t >>= 1;
            a *= a;
        }
        return res;
    }
    // for prime mod
    mint inv() const { return pow(mod-2); }
    mint& operator/=(const mint& a) { return *this *= a.inv(); }
    mint operator/(const mint& a) const { mint res(*this); return res/=a; }
};
ostream& operator<<(ostream& os,const mint& m) { return os << m.x; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    vi x(n);
    cin >> x;
    mint ans;
    mint now = 0;
    rep(i,n-1) {
        now += mint(1)/mint(i+1);
        ans += now*(x[i+1]-x[i]);
    }
    rep(i,n-1) ans *= i+1;
    cout << ans << endl;
}

Measured memory_bytes: 640
class Cell 
  attr_reader :x, :y, :cost, :goal, :eval
  
  def initialize(x, y, c)
    @x = x
    @y = y
    @cost = c
    @goal = $w - 1 - x + $h - 1 - y
    @eval = @cost + @goal
  end
end
 
class PriorityQueue
  attr_reader :elements
  
  def initialize
    @elements = []
  end
 
  def push(n)
    i = @elements.size
    while i > 0
      p = (i-1) / 2
      break if @elements[p].eval <= n.eval
      @elements[i] = @elements[p]
      i = p
    end
    @elements[i] = n
  end
  alias :<< :push
  
  def pop
    min = @elements[0]
    n   = @elements.pop
    unless @elements.empty?
      i = 0
      while i * 2 + 1 < @elements.size
        if @elements[i * 2 + 2].nil? or @elements[i * 2 + 1].eval < @elements[i * 2 + 2].eval
          buf = i * 2 + 1
        else
          buf = i * 2 + 2
        end
        break if @elements[buf].eval >= n.eval
        @elements[i] = @elements[buf]
        i = buf
      end
      @elements[i] = n
    end
    min
  end
  
  def empty?
    @elements.empty?
  end
end
 
$h, $w = gets.chomp.split.map(&:to_i)
matrix = Array.new($h) { gets.chomp.split("").map{ |x| x == "." ? 0 : 1 } }
opened = Array.new($h) { Array.new($w, false) }
 
x, y, cost = 0, 0, 0
opened[y][x] = true

queue = PriorityQueue.new
queue << Cell.new(x, y, 1)
until [x, y] == [$w-2, $h-1] or [x, y] == [$w-1, $h-2]
  cell = queue.pop
  x, y, c = cell.x, cell.y, cell.cost
  
  [[1,0], [-1,0], [0,1], [0,-1]].each do |dx, dy|
    if (x+dx).between?(0, $w-1) and (y+dy).between?(0, $h-1) \
      and matrix[y+dy][x+dx] == 0 and !opened[y+dy][x+dx]
      queue << Cell.new(x+dx, y+dy, c+1)
      opened[y+dy][x+dx] = true
    end
  end
  cost = c+1
  
  if queue.empty?
    puts -1
    exit
  end
end
puts matrix.flatten.select { |x| x == 0 }.size - cost

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

using namespace std;

class Node {
public:
    unsigned int id;
    long counter = 0;
    Node *parent = nullptr;
    vector<Node *> links;

    Node() {
        this->id = 0;
    }

    explicit Node(unsigned int id) {
        this->id = id;
    }
};

void count(Node *node) {
    node->counter += node->parent->counter;

    for (Node *linkedNode : node->links) {
        if (linkedNode->id == node->parent->id) {
            continue;
        }
        linkedNode->parent = node;
        count(linkedNode);
    }
}

int main() {
    int numberOfNodes, numberOfOperations;
    cin >> numberOfNodes >> numberOfOperations;

    Node nodes[numberOfNodes];
    for (int i = 0; i < numberOfNodes; i++) {
        nodes[i].id = i + 1;
    }

    for (unsigned int i = 0; i < numberOfNodes - 1; i++) {
        int idOfNodeA, idOfNodeB;
        cin >> idOfNodeA >> idOfNodeB;

        Node &nodeA = nodes[idOfNodeA - 1];
        Node &nodeB = nodes[idOfNodeB - 1];

        nodeA.links.push_back(&nodeB);
        nodeB.links.push_back(&nodeA);
    }

    for (int i = 0; i < numberOfOperations; i++) {
        int rootNodeIdOfTargetSubtree, numberToBeAdded;
        cin >> rootNodeIdOfTargetSubtree >> numberToBeAdded;

        nodes[rootNodeIdOfTargetSubtree - 1].counter += numberToBeAdded;
    }

    for (Node *linkedNode : nodes[0].links) {
        linkedNode->parent = &nodes[0];
        count(linkedNode);
    }

    for (const Node &node : nodes) {
        if (node.id != 1) {
            cout << " ";
        }
        cout << node.counter;
    }
    cout << endl;
}


Measured memory_bytes: 24320
N, M = [int(s) for s in input().split(' ')]
ac = 0
wa = 0
result = dict()
fail = dict()
for m in range(M):
    p, s = input().split(' ')
    if p in result and result[p] == 'AC':
        continue
    if s == 'WA':
        fail[p] = fail.get(p, 0) + 1
        result[p] = s
    elif s == 'AC': # AC
        ac += 1
        wa += fail.get(p, 0) 
        result[p] = s
    
print(str(ac) + ' ' + str(wa))


Measured memory_bytes: 27724
#include <bits/stdc++.h>
using namespace std;
int LOG = 63;
int main(){
  int N;
  long long K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
    A[i]--;
  }
  vector<vector<int>> p(N, vector<int>(LOG));
  for (int i = 0; i < N; i++){
    p[i][0] = A[i];
  }
  for (int i = 1; i < LOG; i++){
    for (int j = 0; j < N; j++){
      p[j][i] = p[p[j][i - 1]][i - 1];
    }
  }
  int ans = 0;
  for (int i = 0; i < LOG; i++){
    if ((K >> i) & 1){
      ans = p[ans][i];
    }
  }
  cout << ans + 1 << endl;
}

Measured memory_bytes: 61864
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
constexpr int MOD = 1000000007;
constexpr int INF = 2000000000;

int main() {
	int n, q;
	std::vector<int> s, t;
	std::cin >> n;
	int a;
	for (int i = 0; i < n; i++) {
		std::cin >> a;
		s.emplace_back(a);
	}
	std::sort(s.begin(), s.end());
	std::cin >> q;
	for (int i = 0; i < q; i++) {
		std::cin >> a;
		t.emplace_back(a);
	}
	int ans = 0;
	for (int i = 0; i < q; i++) {
		if (*std::lower_bound(s.begin(), s.end(), t[i])==t[i])ans++;
	}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 3464
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね

//ここから編集する


int main() {
    int N;
    cin >> N;
    vector<ll> a(N);
    REP(i, 0, N) cin >> a[i];
    sort(a.begin(),a.end());
    vector<ll> b(N + 1, 0);//(b[i+1])is a[0]からa[i]までの和
    REP(i, 1, N + 1) {
        b[i] = a[i-1] + b[i - 1];
    }

    int last = 0;
    REP(i,1,N){
        if(b[i] * 2LL < a[i]){
            last = i;
        }
    }

    cout << N - last << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <sstream>
#include <cstdlib>
using namespace std;
int main(){
	string Tstr[1001],Hstr[1001];
	int m,Tpt=0,Hpt=0;
	cin>>m;
	for(int i=0;i<m;i++){
		cin>>Tstr[i]>>Hstr[i];
		if(Tstr[i]>Hstr[i]) Tpt+=3;
		else if(Tstr[i]<Hstr[i]) Hpt+=3;
		else Tpt++,Hpt++;
	}
	cout<<Tpt<<" "<<Hpt<<endl;
	return 0;
}


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

using namespace std;
using ll = long long int;

int main(void){

    int n;
    cin >> n;
    vector<int> s(4, 0);
    string a[] = {"AC", "WA", "TLE", "RE"};

    for(int i = 0;i < n;i++){
        string str;
        cin >> str;
        if(str == "AC"){
            s[0]++;
        }else if(str == "WA"){
            s[1]++;
        }else if(str == "TLE"){
            s[2]++;
        }else{
            s[3]++;
        }
    }

    for(int i = 0;i < 4;i++){
        cout << a[i] << " x " << s[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 3596
#pragma GCC optimize("Ofast")

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

#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define mp make_pair

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

typedef pair<int, int> pii;
typedef pair<ll, int> pli;

typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<int> vi;

typedef map<string, int> msi;
typedef map<int, int> mii;
typedef map<int, ll> mill;
typedef map<int, vi> mivi;

const int MAXN = 17;
const int MAXS = 160;

int memo[MAXN][MAXS][2];
vi dig;

ll n;
int N;

void fast_io() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
}

void prepare() {
	memset(memo, -1, sizeof(memo));
	while(n) {
		dig.pb(n % 10);
		n /= 10;
	}
	N = dig.size();
	reverse(all(dig));
}

int solve(int pos, int sum, bool tight) {
	if(pos == N) 
		return sum;
	
	if(memo[pos][sum][tight] != -1)
		return memo[pos][sum][tight];
	
	int lim = (tight ? dig[pos] : 9);
	int res = 0;
	
	for(int i = 0; i <= lim; i++) {
		bool nt = (i == lim) ? tight : 0;
		res = max(res, solve(pos + 1, sum + i, nt));
	}
	
	return memo[pos][sum][tight] = res;
}

int main() {
	fast_io();
//	freopen("input/agc021a.txt", "r", stdin);
	
	cin >> n;
	prepare();
	cout << solve(0, 0, 1) << '\n';
}

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

void solve(){
	ll n;
	scanf("%lld",&n);
	vector<ll> v(n),rain(n);
	ll vn = 0;
	for(int i = 0 ; i < n ; ++i){
		scanf("%lld",&v[i]);
		vn += v[i];
	}vn /= 2;
	for(int i = 0 ; i < n-1 ; i+=2){
		vn -= v[i];
	}
	rain[0] = v[n-1] - vn;
	for(int i = 1 ; i < n ; ++i){
		rain[i] = v[i-1] - rain[i-1];
	}
	for(int i = 0 ; i < n ; ++i){
		rain[i] *= 2LL;
		printf("%lld ",rain[i]);
	}
	printf("\n");
	return;
}

int main(){
	int q = 1;
	//cin >> q;
	for(int i = 1; i <= q ; ++i){
		solve();
	}
	return 0;
}


Measured memory_bytes: 2816
#include <iostream>

using namespace std;;

int main() {
	long long int n,a[10000],j,i,p;
	p = 0;
	cin >> n;
	for  (i = 0; i < n; i++){
		cin >> a[i];
		for (j = 2; j*j <= a[i]; j++) {
			if(a[i]%j==0){
				p += 1;
				break;
			}
		}
	}
	
	cout << n-p << endl;
	return 0;
}

Measured memory_bytes: 3156
//05, 05, 2018, 09:03:08 Rafaelcs cpp
#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;
typedef long double ld;
typedef long long ll;

int main(){
    int v[3];

    for(int i = 0 ; i < 3 ; i++){
        cin >> v[i];
    }

    int k;
    cin >> k;

    sort(v, v + 3);

    v[2] = v[2] * (1 << k);

    cout << v[0] + v[1] + v[2] << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n, *a = map(int, read().split())
    a.sort()
    a = tuple(a)
    TorF = [0] * (a[-1] + 1)
    for ae in a:
        TorF[ae] = 1
    for i1 in range(n - 1):
        a1 = a[i1]
        if TorF[a1]:
            m = a[-1] // a1 + 1
            for i2 in range(2, m):
                TorF[a1 * i2] = 0
        if a[i1 + 1] == a[i1]:
            TorF[a[i1]] = 0
    r = sum(TorF)
    print(r)

if __name__ == '__main__':
    main()

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

int main(){
	int N;
	cin >> N;
	int A[N];
	int c[N];
	rep(i,N) c[i] = 0;
	rep(i,N) {
		int a;
		cin >> a;
		a--;
		A[i] = a;
		c[a]++;
	}
	ll tot = 0;
	rep(i,N) {
		tot += (ll)c[i]*(c[i]-1)/2;
	}
	rep(i,N) {
		int a = A[i];
		cout << tot - (c[a]-1) << endl; 
	}
	return 0;
}


Measured memory_bytes: 5160
import java.util.Scanner;

class Main{



	public static void main(String[] args) {



		Scanner sc = new Scanner(System.in);			//文字の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans = 0;
		for(int i = 1; i<= a ;i++){
			for(int j = 1;j < 31;j++){
				if(i == j){
					ans++;
				}
				if(i == a && j >= b){
					System.out.println(ans);
					return;
				}
			}
		}


	}






}




class Pair implements Comparable{
	String from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}





Measured memory_bytes: 21588
import sys
input = sys.stdin.readline

class UnionFind:
    def __init__(self, n):
        self.data = [0] * N
        for i in range(N):
            self.data[i] = i
            
    def get_root(self, x):
        r = self.data[x]
        if r == x:
            return r
        p = self.get_root(r)
        self.data[x] = p
        return p
    
    def unite(self, x, y):
        rx = self.get_root(x)
        ry = self.get_root(y)
        
        if rx != ry:
            self.data[rx] = ry
            
    def same(self, x, y):
        return self.get_root(x) == self.get_root(y)

N, M = map(int, input().split())
L = [int(v) - 1 for v in input().split()]

u = UnionFind(N)
for _ in range(M):
    x, y = map(int, input().split())
    u.unite(x - 1, y - 1)
    
c = 0
for i in range(N):
    if u.same(i, L[i]):
        c += 1
    
print(c)

Measured memory_bytes: 13876
N, M = map(int, input().split())
voyage = [[] for i in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    voyage[a-1].append(b-1)
    voyage[b-1].append(a-1)

flg = 0
for i in voyage[0]:
    if N-1 in voyage[i]:
        flg = 1

print('POSSIBLE' if flg == 1 else 'IMPOSSIBLE')


Measured memory_bytes: 38320
from heapq import*
(N,M),*t=[map(int,s.split())for s in open(0)]
q=[0]*99*M
v=[[]for _ in q]
z=0
for a,b in t:v[a-1]+=b,
for i in v[:M]:
	for j in i:heappush(q,-j)
	z-=heappop(q)
print(z)

Measured memory_bytes: 736532
import collections
n=int(input())
v=list(map(int,input().split()))

lis1 = [v[i] for i in range(n) if i%2==0]
lis2 = [v[i] for i in range(n) if i%2!=0]

c1 = collections.Counter(lis1).most_common()
c2 = collections.Counter(lis2).most_common()
c1.append((0,0)) #len(set(lis1))==1対策
c2.append((0,0)) #len(set(lis2))==1対策

m=n//2 #n:even
if c1[0][0]==c2[0][0]:#最頻値が異なる場合
    p1 = m-c1[0][1] + m-c2[1][1]
    p2 = m-c1[1][1] + m-c2[0][1]
    print(min(p1,p2))
else:#最頻値が同じである場合
    print(m-c1[0][1] + m-c2[0][1])

Measured memory_bytes: 66924
//Tanuj Khattar
#include<bits/stdc++.h>

using namespace std;

typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))

#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::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

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
const int N = int(1e5)+10;
const int M = int(2e5)+10;
const int MAX = 2*M + N;
const int INF = int(1e9);
int U[M],V[M],W[M],rev[MAX],d[MAX],vis[MAX];
VII g[MAX];
map<int,int> A[N];
int main()
{
  int n,m;
  si(n);si(m);
  for(int i=1;i<=m;i++){
    scanf("%d%d%d",U+i,V+i,W+i);
    A[U[i]][W[i]];
    A[V[i]][W[i]];
  }
  int len = n;
  for(int i=1;i<=n;i++)
    for(auto &it : A[i]){
      it.S = ++len;
      rev[len] = i;
      g[len].PB({i,0});
      g[i].PB({len,1});
    }
  for(int i=1;i<=m;i++){
    int a = A[U[i]][W[i]];
    int b = A[V[i]][W[i]];
    g[a].PB({b,0});
    g[b].PB({a,0});
  }
  for(int i=1;i<=len;i++)d[i]=INF;
  set<II> S;
  S.insert({0,1});d[1]=0;
  while(!S.empty()){
    auto top = *S.begin();
    S.erase(S.begin());
    int u = top.S;
    if(vis[u])continue;
    vis[u]=1;
    if(rev[u] == n){dout(d[u]);return 0;}
    for(auto it : g[u]){
      int w = it.F;
      int add = it.S;
      if(d[u]+add < d[w]){
        if(d[w]!=INF)S.erase({d[w],w});
        d[w] = d[u] + add;
        S.insert({d[w],w});
      }
    }
  }
  puts("-1");
	return 0;
}

Measured memory_bytes: 67316
#![allow(unused)]
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();

    let n: usize = iter.next().unwrap().parse().unwrap();
    let m: usize = iter.next().unwrap().parse().unwrap();

    let mut items = vec![];
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    for i in 0..n {
        let p: usize = iter.next().unwrap().parse().unwrap();
        items.push(p);
    }
    items.sort_by(|a, b| b.cmp(a));
    let total: usize = items.iter().sum();
    let min: f32 = total as f32 / (4 * m) as f32;

    let mut c = m;
    for item in items.iter() {
        if *item as f32 >= min {
            c -= 1;
        } else {
            break;
        }
        if c == 0 {
            break;
        }
    }
    if c == 0 {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
/*
struct Edge
{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
*/
using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<P> ans;
    if (N % 2 == 0)
    {
        for (int i = 1; i < N; i++)
        {
            for (int j = i + 1; j <= N; j++)
            {
                if (i + j != N + 1)
                    ans.push_back({i, j});
            }
        }
    }
    else
    {
        for (int i = 1; i < N; i++)
        {
            for (int j = i + 1; j <= N; j++)
            {
                if (i + j != N)
                    ans.push_back({i, j});
            }
        }
    }
    cout << ans.size() << endl;
    for (auto &it : ans) {
        cout << it.first << " " << it.second << endl;
    }
    return 0;
}

Measured memory_bytes: 3708
import math
from decimal import Decimal

a,b,h,m = map(Decimal,input().split())

a_deg = Decimal(30)*h+m/Decimal(2)
b_deg = Decimal(6)*m

delta_deg = abs(Decimal(a_deg-b_deg))%360
if delta_deg > 180:
    delta_deg = 360-delta_deg

theta = Decimal(delta_deg)*Decimal(math.pi)/Decimal(180)

c2 = a*a+b*b-2*a*b*Decimal(math.cos(theta))


print(c2**Decimal(0.5))

Measured memory_bytes: 10232
using System;
class Prpgram
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int ans = 0;
        string[] imp;
        for (int i = 0; i < n; i++)
        {
            imp = Console.ReadLine().Split(' ');
            ans += int.Parse(imp[1]) - int.Parse(imp[0]) + 1;
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13140
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int n,m;
    scanf("%d %d",&n,&m);
    
    int matrixA[n][m];
    int matrixB[m];
    
    int i,j;
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d",&matrixA[i][j]);
        }
    }
    
    for(i=0;i<m;i++){
        scanf("%d",&matrixB[i]);
    }
    
    for(i=0;i<n;i++){
        int sum = 0;
        for(j=0;j<m;j++){
            sum+= matrixA[i][j] * matrixB[j];
        }
        printf("%d\n",sum);
    }
    
    return 0;
}

Measured memory_bytes: 636
R(n,r){
	int p,c,t;
	if(r){
		scanf("%d%d",&p,&c);
		t=R(n,r-1);
		if(t<c)
			t+=p-1;
		else if(t<c+p-1)
			t-=c;
		return t;
	}else{
		return 0;
	}
}
main(){
	int n,r;
	for(;scanf("%d%d",&n,&r)*n;){
		printf("%d\n",n-R(n,r));
	}
}

Measured memory_bytes: 0
#include <vector>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <sstream>
#include <map>
#include <unordered_map>
#include <ctime>
#include <cassert>
#include <cstring>
#include <sys/time.h>
#include <stdlib.h>
using namespace std;

int main(int argc, char *argv[]){
  int n;
  cin >> n;
  bool c = false;
  for(int i=1;i<10;i++){
    int a = n%i;
    int b = n/i;
    if(a==0&&b>=1&&b<=9){
      c = true;
    }
  }
  if(c==true){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll A, B, C;
  cin >> A >> B >> C;
  ll K;
  cin >> K;
  for (ll i = 0; i < K; ++i) {
    if (A >= B) {
      B *= 2;
    }
    else {
      C *= 2;
    }
  }
  if (A < B && B < C) {
    cout << "Yes" << "\n";
  }
  else {
    cout << "No" << "\n";
  }
}


Measured memory_bytes: 3636
// Library
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

// MACRO

#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
#define ABS(X) (((X) > 0)? (X) : -(X))
#define YN(X) ((X)? "YES" : "NO")
#define SWAP(T, X, Y) {T t; t = X; X = Y; Y = t;}

// Global Tables

// Functions

void Print2DVector(vector<vector<int>>& v)
{
    int i, j;
    for(i = 0; i < v.size(); i++)
    {
        for(j = 0; j < v[i].size(); j++)
        {
            cout << v[i][j];
            if(j == v[i].size()-1)
            {
                cout << endl;
            }
            else
            {
                cout << " ";
            }
        }
    }
}

void PrintVector(vector<int>& v)
{
    int i;
    for(i = 0; i < v.size(); i++)
    {
        cout << v[i];
        if(i == v.size()-1)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }
}

void PrintArr(int* a, int N)
{
    int i;
    for(i = 0; i < N; i++)
    {
        cout << a[i];
        if(i == N-1)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }
}

void PreProcessTables()
{
}

void TC(int t)
{
    int R;
    cin >> R;
    float C = 2*M_PI*R;
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(6);
    cout << C << endl;
}

// Main

int main(void)
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    PreProcessTables();

    int T, t;
    T = 1;
    for(t = 1; t <= T; t++)
    {
        TC(t);
    }
    return 0;
}


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

using namespace std;
using Graph = vector<vector<int>>;
using Grid= vector<vector<char>>;
using vin= vector<int>;
using ll=long long;
using vll= vector<ll>;
using vbl=vector<bool>;
using vch=vector<char>;
using pnn=pair<int ,int>;

#define ft first
#define sd second
#define fn front
#define pb push_back
#define it insert
#define count ct
#define si(v) int((v).size())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rell(i,n) for (ll i=0; i< (ll)(n); i++)
#define sot(x) sort(x.begin(), x.end())
#define rese(x) reverse(x.begin(), x.end())
#define vnn(x,y,s,name) vector<vector<int>> name(x, vector<int>(y,s))
#define mse(x) memset(x, 0, sizeof(x))
#define mii(x,y,z) min(x,min(y,z))
#define maa(x,y,z) max(x,max(y,z))

string yes="Yes",no="No";

int main() {
    int n;
    cin>>n;
    vin a(n),oc(100100,0),ec(100100,0);
    rep(i,n){
        cin>>a[i];
        if(i%2==0) ec[a[i]]++;
        else oc[a[i]]++;
    }
    int omax=0,emax=0;
    int o2=0,e2=0;
    int oi,ei;
    rep(i,100100){
        if(omax<oc[i]){
            o2=omax;
            omax=max(omax,oc[i]);
            oi=i;
        }
        else{
            o2=max(oc[i],o2);
        }
        if(emax<ec[i]){
            e2=emax;
            emax=max(emax,ec[i]);
            ei=i;
        }
        else{
            e2=max(ec[i],e2);
        }
    }
    if(oi!=ei) cout<<n-omax-emax<<endl;
    else cout<<min(n-omax-e2,n-o2-emax)<<endl;
   
}


Measured memory_bytes: 4580
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

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

#処理内容
def main():
	N, K = getlist()
	P = getlist()
	P = sorted(P)
	ans = 0
	for i in range(K):
		ans += P[i]

	print(ans)

if __name__ == '__main__':
	main()

Measured memory_bytes: 65396
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        double a = sc.nextInt();
        double b = sc.nextInt();
        double c = sc.nextInt();
        double d = sc.nextInt();
        System.out.println(Math.ceil(c/b) <= Math.ceil(a/d) ? "Yes" : "No");
    }
}

Measured memory_bytes: 27040
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//using ll = long long;
using P = pair<int,int>;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

string field[310];

signed main(){
	int n,m,k,ans[310][310];
	cin >> n >> m >> k;
	for(int i = 0;i < n;i++) cin >> field[i];
	for(int i = 0;i < n;i++){
		for(int j = 0;j < m;j++) ans[i][j] = -1;
	}
	int cnt = 0;
	for(int i = 0;i < n;i++){
		for(int j = 0;j < m;j++){
			if(field[i][j] == '#') ans[i][j] = ++cnt;
			else if(j) ans[i][j] = ans[i][j - 1];
		}
		for(int j = m - 2;j >= 0;j--){
			if(ans[i][j] == -1) ans[i][j] = ans[i][j + 1];
		}
		for(int j = 0;j < m;j++){
			if(ans[i][j] == -1 && i) ans[i][j] = ans[i - 1][j];
		}
	}
	for(int i = n - 2;i >= 0;i--){
		for(int j = 0;j < m;j++){
			if(ans[i][j] == -1) ans[i][j] = ans[i + 1][j];
		}
	}
	for(int i = 0;i < n;i++){
		for(int j = 0;j < m;j++) cout << (j ? " " : "") << ans[i][j];
		cout << endl;
	}
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s,t;
  cin>>s>>t;
  int i,c=0;
  for(i=0;i<s.size();i++)
  {
    if(s[i]!=t[i])
    {
      c=1;
      break;
    }
  }
  if(c==1)
    cout<<"No"<<endl;
  else
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
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...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
int f(int x){
    //0^1^2^...^x
   
    if(!(x%2)){
        if((x/2)%2) return x+1;
        else return x;
    }
 
    else return ((x+1)/2)%2;
}
signed main(){
    int a,b;cin >> a >> b;
    printf("%lld\n",f(a-1)^f(b));
    return 0;
}

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

using namespace std;
#define int long long
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,k,s;
    cin>>n>>k>>s;
    int res[n];
    for(int i=0;i<k;++i)
    {
        res[i]=s;
    }
    if(s!=1e9)
    {
        for(int i=k;i<n;++i)
        {
            res[i]=(s+1);
        }
    }
    else
    {
        for(int i=k;i<n;++i)
        {
            res[i]=(1e9-1);
        }
    }
    for(int i=0;i<n;++i)
    {
        cout<<res[i]<<" ";
    }
    return 0;
}


Measured memory_bytes: 2176
n = int(input())
p = list(map(int, input().split()))

mins=[0]*n
mins[0]=p[0]
for i in range(1,n):
    mins[i] = min(mins[i-1], p[i])
ans=0
for i in range(0, n):
    if p[i] <= mins[i]:
        ans+=1

print(ans)

Measured memory_bytes: 26012
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/assoc_container.hpp> 
using namespace std; using namespace __gnu_pbds;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

template <class T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_mset;

#define FOR(i,a,b) for(int i = a; i < b; i++)
#define F0R(i,a) for(int i = 0; i < a; i++)
#define F0Rd(i,a) for (int i = a - 1; i >=0 ; i--)
#define FORd(i,a,b) for (int i = b - 1; i >= a; i--)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) int((x).size())
#define newl '\n'

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define print(x) cout << x << newl;
#define finish(x) return cout << x << "\n", 0;
#define bug(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " " << 

const int MXN = 2e5 + 5;
//const int MXN = 1e6 + 5;
const ll MOD = 998244353;
const ll INF = 1e9 + 7;



int N;
double p, dp[3000][3000];

int main(){ FAST
	//ifstream cin("/Users/konwoo/input.txt");
	//ofstream cout("/Users/konwoo/output.txt");

    cin >> N;
    dp[0][0] = 1.0;
    FOR(i,1,N+1){
        cin >> p;
        dp[i][0] = dp[i-1][0] * (1.0 - p);
        FOR(j,1,i) dp[i][j] = dp[i-1][j] * (1.0 - p) + dp[i-1][j-1] * p;
        dp[i][i] = dp[i-1][i-1] * p;
    }
    double ans = 0.0;
    FOR(i,N/2 + 1,N+1){
        ans += dp[N][i];
    }
    cout << setprecision(10) << ans << newl;



















	return 0;
}


Measured memory_bytes: 68864
N = int(input())

def rot(x, y):
    return (x - y, x + y)

UV = [rot(*map(int, input().split())) for _ in range(N)]

mxU = max(u for u, _ in UV)
miU = min(u for u, _ in UV)
mxV = max(v for _, v in UV)
miV = min(v for _, v in UV)

print(max(mxU - miU, mxV - miV))


Measured memory_bytes: 36104
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10 ;
int a[nax], b[nax], A, B ,m;

int main () {

    scanf("%d %d %d", &A, &B, &m);
    for (int i = 1 ; i <= A ; ++ i){
        scanf("%d", a + i);
    }
    for (int i = 1 ;i  <= B ; ++ i)
        scanf("%d", b + i);
    int ans = 1e9;
    for (int i = 1 ;i <= m ; ++ i) {
        int x, y, c;
        scanf("%d %d %d", &x, &y, &c);
        ans = min(ans, a[x] + b[y] - c);
    }
    ans = min(ans, *min_element(a + 1, a + 1 + A) + *min_element(b + 1,  b + 1 + B));
    printf("%d\n", ans);

}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f

using namespace std;
using namespace __gnu_pbds;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tree<int,null_type, less<int>,rb_tree_tag,tree_order_statistics_node_update>   ordered_set;
const int N=1e5+10, mod=1e9+7;

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	int n;
	cin>>n;
	int x=1<<n;
	int a[x];
	for(int i=0;i<x;i++){
		cin>>a[i];
	}
	sort(a,a+x,greater<int>());
	vector<int> v; v.pb(a[0]);
	multiset<int> ms;
	for(int i=1;i<x;i++)ms.insert(a[i]);
	
	for(int i=0;i<n;i++){
		vector<int> temp;
		for(int y:v){
			auto it= ms.lower_bound(y);
			if(it==ms.begin()){
				cout<<"No"; return 0;
			}
			--it;
			temp.pb(*it);
			ms.erase(it);
		}
		for(auto y:temp) v.pb(y);
	}
	cout<<"Yes";
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    ll X, K, D;
    cin >> X >> K >> D;

    X = abs(X);
    if (K <= X / D) cout << X - K * D << '\n';
    else if ((K - X / D) % 2 == 0) cout << X % D << '\n';
    else cout << abs(X % D - D) << '\n';
}

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

    solve();

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void yes(){
    cout << "Yes" << endl;
}

void no (){
    cout << "No" << endl;
}

ll cel (ll a, ll b){
    if (a % b == 0) return a / b;
    else return a / b + 1;
}

ll gcds(ll a, ll b){
    ll c = a % b;
    while (c != 0){
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

int main() {
    int n, m, x, y; cin >> n >> m >> x >> y;
    int xm = -200;
    rep(i,n){
        int a; cin >> a;
        xm = max(xm,a);
    }
    int ym = 200;
    rep(i,m){
        int b; cin >> b;
        ym = min(ym,b);
    }
    if (xm >= ym){
        cout << "War" << endl;
        return 0;
    }
    bool t = true;
    repp(i,ym+1,xm+1){
        if (x < i && i <= y){
            cout << "No War" << endl;
            t = false;
            return 0;
        }
    }
    if (t) cout << "War" << endl;
}

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

int main()
{
    int n;
    cin>>n;
    int p;
    int m=2000000000;
    int res=0;
    for(int i=0;i<n;++i){
        cin>>p;
        if(p<=m) res++;
        if(p<m) m=p;
    }
    cout<<res<<endl;
    return 0;
}


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

int main(void){
    int n, m;
    long long sum = 0;
    cin >> n >> m;
    for(int i = 0; i < m; ++i){
        int a;
        cin >> a;
        if(sum + a > n){
            cout << -1 << endl;
            return 0;
        }
        sum += a;
    }
    cout << n-sum << endl;
    return 0;
}


Measured memory_bytes: 3676
#include<stdio.h>

int main(void) {

	long long int i;

	long long int n;
	long long int power = 1;

	scanf("%lld", &n);

	for (i = 1; i <= n; i++) {
		power = power * i;
		power = power % 1000000007;
	}

	printf("%lld", power);

	return 0;
}

Measured memory_bytes: 128
//   ▄▄▄▄▄▄▄▄▄▄▄  ▄         ▄  ▄▄        ▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄         ▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄ 
//  ▐░░░░░░░░░░░▌▐░▌       ▐░▌▐░░▌      ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌       ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
//  ▐░█▀▀▀▀▀▀▀█░▌▐░▌       ▐░▌▐░▌░▌     ▐░▌ ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌       ▐░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌
//  ▐░▌       ▐░▌▐░▌       ▐░▌▐░▌▐░▌    ▐░▌     ▐░▌     ▐░▌          ▐░▌       ▐░▌▐░▌          ▐░▌       ▐░▌
//  ▐░█▄▄▄▄▄▄▄█░▌▐░▌       ▐░▌▐░▌ ▐░▌   ▐░▌     ▐░▌     ▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌
//  ▐░░░░░░░░░░░▌▐░▌       ▐░▌▐░▌  ▐░▌  ▐░▌     ▐░▌     ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
//  ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌       ▐░▌▐░▌   ▐░▌ ▐░▌     ▐░▌      ▀▀▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀█░█▀▀ 
//  ▐░▌          ▐░▌       ▐░▌▐░▌    ▐░▌▐░▌     ▐░▌               ▐░▌▐░▌       ▐░▌▐░▌          ▐░▌     ▐░▌  
//  ▐░▌          ▐░█▄▄▄▄▄▄▄█░▌▐░▌     ▐░▐░▌ ▄▄▄▄█░█▄▄▄▄  ▄▄▄▄▄▄▄▄▄█░▌▐░▌       ▐░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░▌      ▐░▌ 
//  ▐░▌          ▐░░░░░░░░░░░▌▐░▌      ▐░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌       ▐░▌▐░░░░░░░░░░░▌▐░▌       ▐░▌
//   ▀            ▀▀▀▀▀▀▀▀▀▀▀  ▀        ▀▀  ▀▀▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀▀▀▀  ▀         ▀  ▀▀▀▀▀▀▀▀▀▀▀  ▀         ▀ 
//                                                                                                          
                                                                    
#include<bits/stdc++.h>
#define int long long
#define fi first
#define sc second
#define pii pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define msi map<string,int>
#define si set<int>
#define all(v) v.begin(),v.end()
#define sz(v)  int((v).size())
#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 isinarr(i,n) ((i>=0)?((i<n)?1:0):0)
#define fastio  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define ppb pop_back
#define present(container, element) (container.find(element) != container.end())      //set,map etc.
#define cpresent(container, element) (find(all(container),element) != container.end())    //vector
#define hell 1000000007
#define PI 3.14159265
#define mp make_pair
#define inparr(a,n) rep(i,0,n)cin>>a[i];
#define strwspaces(s) getline(cin,s)
#define give(x,y) cout<<x<<" "<<y<<endl;
#define setp(n) cout<<fixed<<setprecision(n);
#define    endl '\n'
#define inp(n) int n;cin>>n;

using namespace std;

int i,j,k,l;

void solve()
{
    string s;
    cin>>s;
    int sum=0;
    rep(i,0,s.size())
    {
        sum+=s[i]-'0';
    }
    if(sum%9==0)
        cout<<"Yes\n";
    else
        cout<<"No\n";
    
} 



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

Measured memory_bytes: 3756
from heapq import heappop, heappush
def inpl(): return list(map(int, input().split()))

W, H = inpl()
INF = 10**6

while W:
    S = [[5]*(W+2)]
    for _ in range(H):
        S.append([5] + inpl() + [5])
    S.append([5]*(W+2))
    C = inpl()
    D = [[0, -1], [1, 0], [0, 1], [-1, 0]]
    E = [[[INF]*4 for _ in range(W+2)] for _ in range(H+2)]
    E[1][1][1] = 0
    Q = [[0, 1, (1, 1)]]
    while Q:
        e, d, (w, h) = heappop(Q)
        order = S[h][w]
        if e > E[h][w][d] or order == 5:
            continue

        dw, dh = D[d]
        ne = e + C[0]*(order != 0)
        if E[h+dh][w+dw][d] > ne:
            E[h+dh][w+dw][d] = ne
            heappush(Q, [ne, d, (w+dw, h+dh)])

        nd = (d+1)%4
        dw, dh = D[nd]
        ne = e + C[1]*(order != 1)
        if E[h+dh][w+dw][nd] > ne:
            E[h+dh][w+dw][nd] = ne
            heappush(Q, [ne, nd, (w+dw, h+dh)])

        nd = (d+2)%4
        dw, dh = D[nd]
        ne = e + C[2]*(order != 2)
        if E[h+dh][w+dw][nd] > ne:
            E[h+dh][w+dw][nd] = ne
            heappush(Q, [ne, nd, (w+dw, h+dh)])

        nd = (d+3)%4
        dw, dh = D[nd]
        ne = e + C[3]*(order != 3)
        if E[h+dh][w+dw][nd] > ne:
            E[h+dh][w+dw][nd] = ne
            heappush(Q, [ne, nd, (w+dw, h+dh)])

    print(min(E[H][W]))
    W, H = inpl()


Measured memory_bytes: 6212
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>

typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PRECISION std::cout << std::fixed << std::setprecision(20);
  
using namespace std;
 
const ll inf = 1e18;
const ll N = 3e5;
const ll bits = 20;
const ld pi = 3.14159265358979323846;
const ll mod = 1e9+7;
const ll p = 29;


int main(){

    FASTIO;
    PRECISION; 

    int n,k,c;
    cin>>n>>k>>c;
    string s;
    cin>>s;
    vector<int>l(k),r(k);
    int i = 0;
    int ptr = 0;
    while(i<n){
        while(i<n && s[i]=='x')i++;
        l[ptr] = i;
        i+=c+1;
        ptr++;
        if(ptr==k) break;
    }
    i = n-1;
    ptr = k-1;
    while(i>=0){
        while(i && s[i]=='x')i--;
        r[ptr] = i;
        i-=c+1;
        ptr--;
        if(ptr==-1) break;
    }

    for(int i=0;i<k;i++){
        if(l[i]==r[i]) cout<<l[i]+1<<"\n";
    }


}


Measured memory_bytes: 3348