akhauriyash/Code-Regression huggingface dataset:
import java.util.*
import kotlin.*

import java.io.InputStream
import java.lang.NumberFormatException
import java.lang.StringBuilder


fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = FastScanner()
        val n = sc.nextInt()
        val ss = n.toString()
        val sum = ss.sumBy { it - '0' }
        val ans = if (n % sum == 0) "Yes" else "No"
        println(ans)
    }
}


class FastScanner {
    companion object {
        val input: InputStream = System.`in`
        val buffer = ByteArray(1024) { 0 }
        fun isPrintableChar(c: Int): Boolean = c in 33..126
    }

    var ptr = 0
    var buflen = 0
    private fun hasNextByte(): Boolean {
        if (ptr < buflen) {
            return true
        } else {
            ptr = 0
            buflen = input.read(buffer)
            if (buflen <= 0) {
                return false
            }
        }
        return true
    }

    private fun readByte(): Int = if (hasNextByte()) buffer[ptr++].toInt() else -1

    private fun skipUnprintable() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr].toInt())) ptr++
    }

    fun hasNext(): Boolean {
        skipUnprintable()
        return hasNextByte()
    }

    fun next(): String {
        if (!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b)
            b = readByte()
        }
        return sb.toString()
    }

    fun nextInt(): Int {
        if (!hasNext()) throw NoSuchElementException()
        var n = 0
        var b = readByte()
        // '-' = 45
        val minus = b == 45
        if (minus) {
            b = readByte()
        }

        // '0' = 48 '9' = 57
        if (b !in 48..57) {
            throw NumberFormatException()
        }

        while (true) {
            if (b in 48..57) {
                n *= 10
                n += b - 48
            } else if (b == -1 || !isPrintableChar(b)) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }

    fun nextLong(): Long {
        if (!hasNext()) throw NoSuchElementException()
        var n = 0L
        var b = readByte()
        // '-' = 45
        val minus = b == 45
        if (minus) {
            b = readByte()
        }

        // '0' = 48 '9' = 57
        if (b !in 48..57) {
            throw NumberFormatException()
        }

        while (true) {
            if (b in 48..57) {
                n *= 10
                n += b - 48
            } else if (b == -1 || !isPrintableChar(b)) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }

    fun nextDouble(): Double = next().toDouble()
}


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

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

    int now=0,max=0;

    rep(i,0,n){
        if(s[i]=='I'){
            now++;
        }
        else {
            now--;
        }
        if(now>max){
            max=now;
        }
    }
    cout<<max<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
using namespace std;
//#define int long long
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;
#define X first
#define Y second
#define all(o) o.begin(), o.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0), cin.tie(0)

int gcd(int x,int y){ return (!y ? x : gcd(y, x%y)); }
const int maxn = 1e6;
int a[maxn], f[maxn];
int32_t main(){
	IOS;
	int n;
	cin >> n;
	for(int i=0; i<n; i++)
		cin >> a[i];
	f[n - 1] = 1;
	int mx = 1;
	for(int i=n-2; i>=0; i--){
		if(a[i] >= a[i + 1])
			f[i] = f[i + 1] + 1;
		else
			f[i] = 1;
		mx = max(mx, f[i]);
	}
	cout << mx - 1 << endl;

}


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

using namespace std;
using ll = long long;

int main() {
    int X;
    cin >> X;
    int y500 = X / 500;
    int y5 = (X - (y500 * 500)) / 5;

    cout << (y500 * 1000) + (y5 * 5) << endl;

    return 0;
}

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

using ll = long long;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}

int main() {
  int N; cin >> N;
  vector<int> A(N); REP(i, N) cin >> A[i];

  ll all_num = 0;
  REP(k, N) {
    if(k == 0) {
      all_num += abs(A[0]);
      all_num += abs(A[0] - A[1]);
    } else if(k == N - 1) {
      all_num += abs(A[k]);
    } else {
      all_num += abs(A[k + 1] - A[k]);
    }
  }

  ll tmp = all_num;

  REP(i, N) {
    if(i == 0) {
      all_num = all_num - abs(A[i]) - abs(A[i + 1] - A[i]) + abs(A[i + 1]);
    } else if(i == N - 1) {
      all_num = all_num + abs(A[i - 1]) - abs(A[i] - A[i - 1]) - abs(A[i]);
    } else {
      all_num = all_num - abs(A[i] - A[i - 1]) - abs(A[i + 1] - A[i]) + abs(A[i + 1] - A[i - 1]);
    }

    // cout << A[i] << " " << all_num << endl;
    cout << all_num << endl;
    all_num = tmp;
  }
}

Measured memory_bytes: 1664
towns = []
for i in range(3):
    a, b = map(int, input().split())
    towns.append(a)
    towns.append(b)
nums = []
for i in range(4):
    nums.append(towns.count(i+1))

if nums.count(1) == 2:
    print("YES")
else:
    print("NO")
    

Measured memory_bytes: 2940
import sys
import unittest

class Solution(object):
	def __init__(self):
		self.n = 0
		self.k = 0
		self.a = []
		
	def readInput(self):
		a = sys.stdin.readline().split()
		self.n = int(a[0])
		self.k = int(a[1])
		a = sys.stdin.readline().split()
		for i in xrange(self.n):
			self.a.append(int(a[i]))
		
	def findWinner(self):
		dp = [False] * (self.k + 1)
		for i in xrange(self.k+1):
			for j in xrange(self.n):
				if i >= self.a[j] and not dp[i-self.a[j]]:
					dp[i] = True
		print "First" if dp[self.k] else "Second"
	
	
if __name__ == '__main__':
	s = Solution()
	s.readInput()
	s.findWinner()


Measured memory_bytes: 4280
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
using namespace std;


int main(){
  long h;
  long m_number = 1;
  long a_number = 0;

  cin >> h;

  bool undefeat = true;
  while(undefeat){
    a_number += m_number;
    h /= 2;
    m_number *= 2;

    if (h == 0) undefeat = false;
  }

  cout << a_number << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
#include <cmath>
#include<bits/stdc++.h>
using namespace std;
#define cinf(n,x) for(int i=0;i<n;i++) cin >> x[i];
#define pi pair<int,int> 
#define ll long long;
#define MAX 200005;
int main(){
    int n; cin >> n;
    double v[n]; 
    priority_queue<double,vector<double>,greater<double>> pq;
    for(int i=0;i<n;i++){
        cin >> v[i];
        pq.push(v[i]);
    }
    while(pq.size()!=1){
        double a = pq.top(); pq.pop();
        double b = pq.top(); pq.pop();
        double c = (a+b)/2;
        pq.push(c);
    }
    cout << setprecision(10) << pq.top();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define LLI long long int
#define fst first
#define snd second

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(x)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> T& chmin(T &a, const U &b){return a = (a<=b?a:b);}
template <typename T, typename U> T& chmax(T &a, const U &b){return a = (a>=b?a:b);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

const LLI mod = 1e9+7;

LLI power(LLI n, LLI p, LLI m){
  LLI ret = 1;
  while(p>0){
    if(p&1) (ret *= n) %= m;
    (n *= n) %= m;
    p /= 2;
  }
  return ret;
}

LLI mod_inv(LLI n, LLI p){return power(n,p-2,p);}


template <LLI mod> class Combination{
public:
  vector<LLI> facto = {1};
  vector<LLI> ifacto = {1};

  LLI factorial(LLI i){
    if(i < 0) throw exception();
    if(facto.size() <= i) facto.resize(i+1, -1);
    if(i == 0) return facto[0] = 1;
    LLI j = i;
    for(;j>=0;--j) if(facto[j] != -1) break;
    for(LLI k=j+1; k<=i; ++k) (facto[k] = facto[k-1] * k) %= mod;
    return facto[i];
  }

  LLI factorial_inverse(LLI i){
    if(i < 0) throw exception();
    if(ifacto.size() <= i) ifacto.resize(i+1, -1);
    if(ifacto[i] != -1) return ifacto[i];
    return ifacto[i] = mod_inv(factorial(i), mod);
  }

  LLI P(LLI n, LLI k){
    if(n < k or n < 0 or k < 0) return 0;
    return (factorial(n) * factorial_inverse(n-k)) % mod;
  }

  LLI C(LLI n, LLI k){
    if(n < k or n < 0 or k < 0) return 0;
    return (P(n,k) * factorial_inverse(k)) % mod;
  }

  LLI H(LLI n, LLI k){
    return C(n+k-1, k);
  }
};

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

  Combination<mod> com;
  

  int B,W;
  while(cin >> B >> W){

    vector<LLI> p(B+W), q(B+W);

    FOR(i,1,B+W){
      p[i] = (p[i-1] + com.C(i-1,B-1) * mod_inv(power(2,i,mod),mod) % mod) % mod;
      q[i] = (q[i-1] + com.C(i-1,W-1) * mod_inv(power(2,i,mod),mod) % mod) % mod;
    }

    FORE(i,1,B+W){
      LLI ans = (1-p[i-1]+q[i-1]+mod) % mod;

      (ans *= mod_inv(2,mod)) %= mod;
      
      cout << ans << endl;
    }
    cerr << endl;
  }
  
  return 0;
}


Measured memory_bytes: 8048
import java.util.*;

public class Main {

    private static int H;
    private static int W;
    private static int N;
    private static Cord[] C;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        H = sc.nextInt();
        W = sc.nextInt();
        N = sc.nextInt();
        C = new Cord[N];
        for (int i = 0; i < N; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            C[i] = new Cord(b, a);
        }

        long[] ans = solve();
        for (int i = 0; i < 10; i++) {
            System.out.println( ans[i] );
        }
    }


    private static long[] solve() {

        Map<Cord, Integer> counts = new HashMap<>();
        for (int i = 0; i < N; i++) {
            Cord target = C[i];
            count(target, counts);
        }

        long[] ans = new long[10];
        ans[0] = (long)(W-2) * (H-2);

        counts.forEach( (c, cnt) -> {
            ans[cnt]++;
            ans[0]--;
        });

        return ans;
    }

    private static void count(Cord target, Map<Cord, Integer> counts) {
        for (int x = target.x - 1; x <= target.x + 1 ; x++) {
            for (int y = target.y - 1; y <= target.y+ 1 ; y++) {
                if( x - 1 < 1 || x + 1 > W || y - 1 < 1 || y + 1 > H) continue;

                Cord c = new Cord(x, y);

                if( counts.containsKey(c) ) {
                    int cnt = counts.get(c);
                    counts.put(c, cnt+1);
                } else {
                    counts.put(c, 1);
                }
            }
        }
    }

    private static boolean xInRange(int x) {
        return 1 <= x && x <= W;
    }

    private static boolean yInRange(int y) {
        return 1 <= y && y <= H;
    }

    private static class Cord {

        private final int x;
        private final int y;

        public Cord(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Cord cord = (Cord) o;
            return x == cord.x &&
                    y == cord.y;
        }

        @Override
        public int hashCode() {
            return Objects.hash(x, y);
        }

        public String toString() {
            return "(" +x + "," + y + ")";
        }
    }
}

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

typedef long long LL;
typedef long double LD;

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

    int n, k;
    cin >> n >> k;
    vector<int> a(n, 0);
    for(int i = 0;i < k; i++){
        int d;
        cin >> d;
        for(int j = 0;j < d;j++){
            int tmp;
            cin >> tmp;
            a[tmp - 1]++;
        }
    }
    int ans = 0;
    for(int i = 0;i < n; i++){
        if(a[i] == 0)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612
import java.util.*;

public class Main {
    static final int MOD = 1000000007;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] aArr = new int[n];
        int[] bArr = new int[n];
        for (int i = 0; i < n; i++) {
            int p = sc.nextInt() - 1;
            aArr[p] = i + 1;
            bArr[p] = i + 1;
        }
        for (int i = n - 2; i >= 0; i--) {
            bArr[i] += bArr[i + 1] + 1;
        }
        StringBuilder sbA = new StringBuilder();
        StringBuilder sbB = new StringBuilder();
        sbA.append(aArr[0]);
        sbB.append(bArr[0]);
        for (int i = 1; i < n; i++) {
            aArr[i] += aArr[i - 1] + 1;
            sbA.append(" ").append(aArr[i]);
            sbB.append(" ").append(bArr[i]);
        }
       System.out.println(sbA);
       System.out.println(sbB);
    }
}


Measured memory_bytes: 43116
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextInt()
    val p = sc.nextInt()

    println(abc128a(a, p))
}

fun abc128a(a: Int, p: Int): Int {
    val sum = 3 * a + p

    return sum / 2
}


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

int main(){
  string s; cin >>s;
  int n = s.size()+1;
  vector<int> a(n);
  rep(i,n){
    if(s[i]=='<'){
      a[i+1] = max(a[i+1], a[i]+1);
    }
  }
  for(int i = n-1; 0<=i; i--){
    if(s[i]=='>'){
      a[i] = max(a[i], a[i+1]+1);
    }
  }
  ll ans = 0;
  for(auto x : a){
    ans += x;
  }
  cout << ans << endl;
  return 0; 
}

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

#define reint register int
#define coint const int

using namespace std;

int n, l;

int main(void) {
    scanf("%d%d", &n, &l);
    if (l >= 0) printf("%d\n", (l + (l + n - 1)) * n / 2 - l);
    else if (l + n - 1 >= 0) printf("%d\n", (l + (l + n - 1)) * n / 2);
    else printf("%d\n", (l + (l + n - 1)) * n / 2 - (l + n - 1));
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a < b) { a=b; return 1; }return 0;}
template<class T> inline bool chmin(T& a, T b){ if(a > b) { a=b; return 1; }return 0;}
const long long INF = 1LL << 60;
// spring s; cin >> s;
// cout << res << endl;
// --------write my code!!!!!----------//

int main(){
    string A; cin >> A;
    
    int countA = 0;
    int countB = 0;
    
    int dp_now=A[0];
    int first=dp_now;
    

    for(int i=0; i<A.length(); i++){
        if(dp_now==A[i]){
            countA++;
            if(dp_now==48) dp_now=49;
            else dp_now=48;
        }
        else dp_now = A[i];
    }
    
    if(first==48) dp_now=49;
    else dp_now=48;
    
    for(int i=0; i<A.length(); i++){
        if(dp_now==A[i]){
            countB++;
            if(dp_now==48) dp_now=49;
            else dp_now=48;
        }
        else dp_now = A[i];
    }
    

    cout << min(countA, countB) << endl;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(){
    int n;
    int p;
    int count = 0;

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

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

typedef long long lglg;
const int INF = 1 << 28;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int n; cin >> n;
	int adj[n][n];
	vector<pair<int,int>> edges;
	for (int i=0; i<n; ++i) {
		string x; cin >> x;
		for (int j=0; j<n; ++j) {
			if (i == j) adj[i][j] = 0;
			else if (x[j] == '1') {
				adj[i][j] = 1;
				if (i < j) edges.push_back({i, j});
			}
			else adj[i][j] = INF;
		}
	}

	for (int k=0; k<n; ++k)
		for (int i=0; i<n; ++i)
			for (int j=0; j<n; ++j)
				adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j]);
	
	bool failed = false;
	for (pair<int,int> pr : edges) {
		int x, y; tie(x, y) = pr;
		if (adj[0][x] == adj[0][y]) {
			failed = true;
			break;
		}
	}
	if (failed) cout << -1;
	else {
		int best = -1;
		for (int i=0; i<n; ++i) for (int j=0; j<n; ++j) best = max(best, adj[i][j]);
		cout << best+1;
	}
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define inf             LLONG_MAX
ll isPrime(int n) 
{ 
	// Corner cases 
	if (n <= 1) 
		return 1; 
	if (n <= 3) 
		return 2; 

	// This is checked so that we can skip 
	// middle five numbers in below loop 
	if (n % 2 == 0 || n % 3 == 0) 
		return 1; 

	for (int i = 5; i * i <= n; i = i + 6) 
		if (n % i == 0 || n % (i + 2) == 0) 
			return 1; 

	return 2; 
} 

ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i,res%=1000000007; 
    return res; } 
 
 int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
  
 
ll findlcm(ll arr[], int n) 
{ 
   
    ll ans = arr[0]; 
  
    
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (gcd(arr[i], ans))); 
  
    return ans; 
} 
bool sortbysec(const pair<pair<string,int>,int> &a, 
              const pair<pair<string,int>,int> &b) 
{ 
	if(a.first.first==b.first.first)
		return a.first.second > b.first.second;
    return (a.first.first < b.first.first); 
} 
bool checkValidity(ll a, ll b, ll c) 
{ 
    // check condition 
    if (a + b > c && a + c > b && b + c > a) 
        return false; 
    else
        return true; 
} 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        double x,n,t;
        cin>>n>>x>>t;
        cout<<(ll)(ceil(n/x)*t);
    } 
    return 0;
}


Measured memory_bytes: 3728
#include <iostream>
#include <string>
using namespace std;
int main(){
  int N;
  cin>>N;
  string s;
  cin>>s;
  int num=0;
  for(int i=0;i<N;i++) if(s[i]=='1') num++;
  int amari[200000][2];
  amari[0][0]=1; amari[0][1]=1;
  int judge[2]={0,0};
  for(int i=1;i<N;i++){
    if(num!=1) amari[i][0]=(amari[i-1][0]*2)%(num-1);
    amari[i][1]=(amari[i-1][1]*2)%(num+1);
  }
  for(int i=0;i<N;i++){
    if(s[N-i-1]=='1'){
      if(num!=1) judge[0]=(judge[0]+amari[i][0])%(num-1);
      judge[1]=(judge[1]+amari[i][1])%(num+1);
    }
  }
  for(int i=0;i<N;i++){
    int k;
    if(s[i]=='1'){
      if(num!=1) k=(judge[0]+num-1-amari[N-i-1][0])%(num-1);
      else k=-1;
    }
    else k=(judge[1]+amari[N-i-1][1])%(num+1);
    if(k!=-1){
    int answer=1;
    while(k>0){
      int l=0;
      long long zwei=1;
      while(zwei<=k){
        if((k%(zwei*2))/zwei==1) l++;
        zwei*=2;
      }
      k%=l;
      answer++;
    }
    cout<<answer<<endl;
    }
    if(k==-1) cout<<0<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 4876
import numpy as np


def calc(mat: np.array) -> int:
    count = 0
    for alpha in range(mat.shape[0] - 1):
        for beta in range(alpha + 1, mat.shape[0]):
            distance = np.linalg.norm(mat[alpha] - mat[beta])
            if np.abs(distance - int(distance)) < 0.001:
                count += 1
    return count


def load_input_as_int_array():
    return [int(v) for v in input().split(" ")]


n, d = load_input_as_int_array()
mat = []
for i in range(n):
    raw = load_input_as_int_array()
    mat.append(raw)

mat_array = np.asarray(mat)
print(calc(mat_array))

Measured memory_bytes: 12432
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def debug(table, *args):
    ret = []
    for name, val in table.items():
        if val in args:
            ret.append('{}: {}'.format(name, val))
    print(' | '.join(ret), file=sys.stderr)


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True

ans = []

def bfs(graph, initial, H):
    global ans
    n = len(graph) - 1
    dist = [-1] * (n + 1)
    q = deque([initial])
    visited = [False] * (n + 1)
    visited[initial] = True
    dist[initial] = 0

    while len(q) != 0:
        edge = q.popleft()
        nxt = graph[edge]

        for i, e in enumerate(nxt):
            if visited[e] is False:
                if H[initial] <= H[e]:
                    return 0
                q.append(e)
                dist[e] = dist[edge] + 1
                visited[e] = True

    return 1


def main():
    global ans
    N, M = MI()
    H = LI()
    graph = [[] for i in range(N+1)]

    for i in range(M):
        a, b = MI()
        graph[a-1].append(b-1)
        graph[b-1].append(a-1)

    ans = [-1] * N

    ret = 0
    for i in range(N):
        d = bfs(graph, i, H)
        print(i, d)
    print(ret)

def main():
    N, M = MI()
    H = LI()
    A = [0] * M
    B = [0] * M

    H_G = [-1 for i in range(N)]

    for i in range(M):
        A[i], B[i] = MI()

    for i in range(M):
        H_G[A[i]-1] = max(H_G[A[i]-1], H[B[i]-1])
        H_G[B[i]-1] = max(H_G[B[i]-1], H[A[i]-1])

    ans = 0

    for i in range(N):
        if H[i] > H_G[i]:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 87928
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long ll;

namespace io {
	const int maxb = 1 << 15;
	char b[maxb], *s = b, *t = b;
	
	bool getchar(char &ch) {
		return ch = s == t && (t = (s = b) + fread(b, 1, maxb, stdin)) == b ? 0 : *s++;
	}
	
	int getint() {
		char ch;
		while (getchar(ch) && (ch < '0' || ch > '9'));
		int s = ch - '0';
		while (getchar(ch) && ch >= '0' && ch <= '9') {
			s = s * 10 + ch - '0';
		}
		return s;
	}
}

using io::getint;

const int maxn = 2e5 + 10;

int main() {
	int n = getint(), X = getint();
	static ll s[maxn];
	for (int i = n; i; --i) s[i] = getint();
	for (int i = 1; i <= n; ++i) s[i] += s[i - 1];
	ll ans = s[n] * 5 + (ll)n * X;
	for (int k = 1; k < n; ++k) {
		ll sum = (ll)k * X;
		for (int i = 1; (i - 1) * k < n; ++i) {
			sum += (s[min(i * k, n)] - s[(i - 1) * k]) * (i == 1 ? 5 : i * 2 + 1);
			if (sum >= ans) break;
		}
		ans = min(ans, sum);
	}
	ans += (ll)n * X;
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
int main(void){
 int N=0;
 double a=0;
  scanf("%d",&N);
  a=N;
  if(N%2==0){
  printf("%11.10lf",(N/2)/a);
  }else{
  printf("%11.10lf",((N/2)+1)/a);
  }
  return 0;
}

Measured memory_bytes: 128
def solve(N, happiness):
  dp = [[0 for _ in range(3)] for _ in range(N)]
  dp[0][0] = happiness[0][0]
  dp[0][1] = happiness[0][1]
  dp[0][2] = happiness[0][2]

  for i in range(1, N):
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + happiness[i][0]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + happiness[i][1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + happiness[i][2]

  print(max(dp[N-1]))

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

N = iin()
happiness = []
for i in range(N):
  happiness.append(iln())
solve(N, happiness)

Measured memory_bytes: 47368
def factorize(x):
    f = set()
    if x%2==0: f.add(2)
    while x%2==0: x//=2
    
    p = 3
    while x>=p*p:
        if x%p==0: f.add(p)
        while x%p==0: x//=p
        p+=2
    if x>1: f.add(x)
    return f

N = int(input())
A = list(map(int, input().split()))

F = [0]*(10**6+5)

for a in A:
    for f in factorize(a):
        F[f] += 1

m = max(F)
if m<=1:
    print('pairwise coprime')
elif m<N:
    print('setwise coprime')
else:
    print('not coprime')


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

using ll = long long;
using P = pair<int, int>;

const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};

int main() {
  int h, w; cin >> h >> w;
  int si, sj; cin >> si >> sj;
  int ti, tj; cin >> ti >> tj;
  --si; --sj; --ti; --tj;
  vector<string> s(h);
  for (int i = 0; i < h; i++) cin >> s[i];
  
  const int INF = 1e9;
  vector<vector<int>> dist(h, vector<int>(w, INF));
  deque<P> q;
  dist[si][sj] = 0;
  q.emplace_back(si, sj);
  
  while (!q.empty()) {
    int i = q.front().first;
    int j = q.front().second;
    q.pop_front();
    int d = dist[i][j];
    for (int v = 0; v < 4; v++) {
      int ni = i+di[v], nj = j+dj[v];
      if (ni < 0 || h <= ni || nj < 0 || w <= nj) continue;
      if (s[ni][nj] == '#') continue;
      if (dist[ni][nj] <= d) continue;
      dist[ni][nj] = d;
      q.emplace_front(ni, nj);
    } 
    for (int ei = -2; ei <= 2; ei++) {
      for (int ej = -2; ej <= 2; ej++) {
        int ni = i+ei, nj = j+ej;
        if (ni < 0 || h <= ni || nj < 0 || w <= nj) continue;
        if (s[ni][nj] == '#') continue;
        if (dist[ni][nj] <= d+1) continue;
        dist[ni][nj] = d+1;
        q.emplace_back(ni, nj);
      }
    }
  }
  
  int ans = dist[ti][tj];
  if (ans == INF) ans = -1;
  cout << ans << endl;
}

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl

ostream& operator<<(ostream& o, vector<ll> &A){
    FOR(i, 0, A.size()){
        if(i){
            o << ' ';
        }
        o << A[i];
    }
    o << endl;
    return o;
}

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

    // input
    ll N;
    cin >> N;

    vector<ll> A(N);
    FOR(i, 0, N){
        cin >> A[i];
    }

    auto B = A;
    auto C = A;

    if(prev_permutation(ALL(A))){
        cout << A;
    }
    cout << B;
    if(next_permutation(ALL(C))){
        cout << C;
    }

    return 0;
}


Measured memory_bytes: 3228
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>

#define FOR(idx, begin, end) for(int idx = (int)(begin); idx < (int)(end); ++idx)
#define DBG(x) cerr << #x << ": " << x << "\n"

using namespace std;
typedef long long lint;
const int MOD = 1000000007;


int main() {

	cin.tie(0);
	
	string s;
	cin >> s;

	if (s.length() == 2) {

		if (s[0] == s[1]) cout << "1 2";
		else cout << "-1 -1";
		return 0;
	}

	FOR(i, 0, s.length() - 2) {
		string sub_s = s.substr(i, 3);
		if ((sub_s[0] == sub_s[1] || sub_s[1] == sub_s[2] || sub_s[2] == sub_s[0])) {

			cout << i + 1 << " " << i + 3;
			return 0;
		}
	}

	cout << "-1 -1";
	return 0;
}

Measured memory_bytes: 512
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto n = readln.chomp.to!size_t;
  auto t = readln.split.to!(int[]);
  auto v = readln.split.to!(int[]);

  ++n;
  t ~= 1;
  v ~= 0;

  foreach (i; 0..n) {
    t[i] *= 2;
    v[i] *= 2;
  }

  auto s = new int[](n+1);
  foreach (i; 1..n+1) s[i] = s[i-1] + t[i-1];

  auto k = new int[](n);
  foreach (i; 0..n) k[i] = v[i] + s[i];

  auto ans = real(0), u = 0, j = 0;
  foreach (i; 0..s[$-2]) {
    if (k[j+1..$].reduce!min < (i+1)+u) {
      ans += u - real(1)/2;
      --u;
    } else if (v[j] > u) {
      ans += u + real(1)/2;
      ++u;
    } else {
      ans += u;
    }
    if (i+2 > s[j+1]) ++j;
  }

  writefln("%.4f", ans/4);
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static int Mod(int a, int b)
        {
            return (a % b + b) % b;
        }
        static int[] Convert(string s)
        {
            return s.Select(c => (c == 'S') ? 1 : -1).ToArray();
        }
        static int[] Solve(int N, int[] S)
        {
            foreach (int[] t in new[] { new[] { -1, -1 }, new[] { -1, 1 },new[] { 1, -1 }, new[] { 1, 1 } })
            {
                int[] ans = new int[N];
                Array.Copy(t, ans, 2);
                for (int i = 2; i < N; ++i)
                {
                    int a0 = Mod(i - 2, N);
                    int a1 = Mod(i - 1, N);
                    int a2 = Mod(i - 0, N);
                    ans[a2] = ans[a0] * ans[a1] * S[a1];
                }
                if (Enumerable.Range(0, N).All(i =>
                {
                    int a0 = Mod(i - 1, N);
                    int a1 = Mod(i, N);
                    int a2 = Mod(i + 1, N);
                    return (ans[a0] * ans[a2] == ans[a1] * S[a1]);
                }))
                {
                    return ans;
                }
            }
            return null;
        }
        static void Main(string[] args)
        {
            int N = ReadInt();
            string s = Read();
            int[] ans = Solve(N, s.Select(c => (c == 'o') ? 1 : -1).ToArray());
            Console.WriteLine((ans != null) ? new string(Array.ConvertAll(ans, n => (n == 1) ? 'S' : 'W')) : "-1");
        }
    }
}


Measured memory_bytes: 14944
using System;
using System.Linq;
using System.Collections.Generic;

class Bmondai
{
    static void Main()
    {
        var nm = Console.ReadLine().Split(' ').Select(x => Int64.Parse(x)).ToArray(); ;
        var N=nm[0];
        var M = nm[1];
        var count = Math.Pow(2,M);
        var time = 1900 * M + 100 * (N - M);
        Console.WriteLine(count*time);
    }
}



Measured memory_bytes: 13268
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
    string S;
    int i, judge=1, n, count=0;

    cin >> S;

    n = S.size();

    if(S[0] != 'A'){
        judge = 0;
    }

    for(i=2; i<=n-2; i++){
        if(S[i] == 'C'){
            count++;
        }
    }

    if(count != 1){
        judge = 0;
    }

    for(i=0; i<n; i++){
        if((0<=S[i]-'a' && S[i]-'a'<=25) || (S[i]=='A'&&i==0) || (S[i]=='C'&&2<=i&&i<=n-2)){
            continue;
        }

        else{
            judge = 0;
        }
    }

    if(judge == 0){
        cout << "WA" << endl;
    }

    else{
        cout << "AC" << endl;
    }

    return 0;
}

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

#define PI 3.14159265359

#define INF 1000000;

using namespace std;


int main()
{
	int n, time[10000], wait_time;
	long long wait_sum;
	
	while (cin >> n)
	{
		if (n == 0) break;
		
		for (int i=0; i<n; i++) cin >> time[i];
		sort(time, time + n);
		
		wait_sum = 0;
		wait_time = 0;
		for (int i=0; i<n-1; i++)
		{
			wait_time += time[i];
			wait_sum += wait_time;
		}
		
		cout << wait_sum << endl;
	}
	
	
	return 0;
}

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

int main(void){
   char s[2][3];
   for(int i=0;i<2;i++){
      for(int j=0;j<3;j++){
         cin>>s[i][j];
      }
   }
   if(s[0][0]==s[1][2]&&s[0][1]==s[1][1]&&s[0][2]==s[1][0]){
      cout<<"YES"<<endl;
   }else{
      cout<<"NO"<<endl;
   }
   return 0;
}



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

#define mod 1000000007

using namespace std;
 
int main(void){
	
	int A, B, C, X, count=0;
	
	cin >> A >> B >> C >> X;
	
	for(int i=0; i<=A; i++){
		for(int j=0; j<=B; j++){
			if((X-500*i-100*j)%50 == 0 && (X-500*i-100*j)/50 <=C && X-500*i-100*j>=0){
				count++;
			}
		}
	}
	
	cout << count;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
//1803086
int main()
{
    int a,b,n,count = 0;
    scanf("%d %d %d",&a,&b,&n);
    int i;

    for (i=a;i<=b;i++){
        if (n%i==0){
                {
            count++;
        }
    }
    }
    printf("%d\n",count);
    return 0;
}



Measured memory_bytes: 2064
#include<iostream>
using namespace std;
static const int MAX=100;
static const int INFTY=(1<<21);
static const int white=0;
static const int gray=1;
static const int black=2;

int n,M[MAX][MAX];
void dijkstra(){
    int minv;
    int d[MAX],color[MAX];

    for(int i=0;i<n;i++){
	d[i]=INFTY;
	color[i]=white;
    }
    d[0]=0;
    color[0]=gray;
    while(1){
	minv=INFTY;
	int u=-1;
	for(int i=0;i<n;i++){
	    if(minv>d[i]&&color[i]!=black){
		u=i;
		minv=d[i];
	    }
	}
	if(u==-1)break;

	color[u]=black;
	for(int v=0;v<n;v++){
	    if(color[v]!=black&&M[u][v]!=INFTY){
		if(d[v]>d[u]+M[u][v]){
		    d[v]=d[u]+M[u][v];
		    color[v]=gray;
		}
	    }
	}
    }
    for(int i=0;i<n;i++){
	cout<<i<<" "<<(d[i]==INFTY?-1:d[i])<<endl;
    }
}
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
	for(int j=0;j<n;j++){
	    M[i][j]=INFTY;
	}
    }

    int k,c,u,v;
    for(int i=0;i<n;i++){
	cin>>u>>k;
	for(int j=0;j<k;j++){
	    cin>>v>>c;
	    M[u][v]=c;
	}
    }
    dijkstra();
    return 0;
}


Measured memory_bytes: 3128
import sys
sys. setrecursionlimit(100009)
n=int(input())
hr=list(map(int,input().split()))
dp=[-1]*(n+1)
def cost(i):
	if i>=n-1:
		return 0
	if dp[i]!=-1:
		return dp[i]
	if i<n-2:
		a=abs(hr[i]-hr[i+2])+cost(i+2)
	b=abs(hr[i]-hr[i+1])+cost(i+1)
	if i>=n-2:
		a=b
	x=min(a,b)
	dp[i]=x
	return x
print(cost(0))

Measured memory_bytes: 123068
#include <bits/stdc++.h>
#define SIZE 10
#define PI 3.141592653589793

using namespace std;
typedef long long ll;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N,K;
	int i,j,d;
	int tmp;
	int answer=0;
	int counter=0;
	vector<bool> given;

	cin >> N >> K;
	given.resize(N,true);


	for(i=0;i<K;i++){
		cin >> d;
		for(j=0;j<d;j++){
			cin >> tmp;
			given[tmp-1]=false;
		}
	}

	//sort(given.begin(),given.end());
	//sort(given.begin(),given.end(),greater<int>());
	
	for(i=0;i<N;i++) if(given[i]) counter++;

	answer=counter;
	cout << answer << endl;

	return 0;
}



Measured memory_bytes: 3612
#include<stdio.h>
int main(void){
char S[5];
scanf("%s", S);
if((S[0]==S[1] && S[1]==S[2] && S[2]==S[0]) || (S[0]!=S[1] && S[1]!=S[2] && S[2]!=S[0])){
    printf("No\n");
}else{
    printf("Yes\n");
return 0;
}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define maxn 16
using namespace std;
 
int arr[maxn][maxn] = {};
int dp[1 << maxn], sum[1 << maxn] = {};
int n;
 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            cin >> arr[i][j];
        }
    }

    //soma de todos os grupos possiveis
    for(int S = 0; S < (1 << n); S++) {
        for(int j = 0; j < n; j++) {
            if(!(S & (1 << j))) continue;
            for(int k = j + 1; k < n; k++) {
                if(S & (1 << k)) {
                    sum[S] += arr[j][k];
                }
            }
        }
    }
    for(int S = 0; S < (1 << n); S++) {
        int x = S;
        dp[x] = sum[x];
        while(x) {
            x = (x - 1) & S;

            /*
            dp[S] = soma de todos do grupo
            dp[S ^ x] + sum[x] = soma do grupo(S ^ x) e do grupo(x)
            ex: dp[S] = soma do 1,2;1,3;2,3
				mas a soma de S posso fazer tambem um grupo {2,3} + {1} ou {1,3} + {2} ou {1,2} + {3}
			*/
            dp[S] = max(dp[S], dp[S ^ x] + dp[x]);
            //dp[S] = max(dp[S], dp[S ^ x] + sum[x]); //x sempre sera um digito so
        }
    }
    cout << dp[(1 << n) - 1] << '\n';
    return 0;
}

Measured memory_bytes: 4644
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include<deque>
#include <regex>
#include <list> 
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll getDigit(ll n) {
	ll cnt = 0;
	while (n != 0) {
		n /= 10;
		cnt++;
	}
	return cnt;
}
typedef pair<double, long long> pair_t;
bool comp(const pair_t& a, const pair_t& b) {
	if (a.first == b.first)return  a.second > b.second;
	else {
		return a.first > b.first;
	}
}

int main() {
	ll n,cnt=0;
	cin >> n;
	vector<ll>a(n),b(n);
	rep(i, n)cin >> a[i] >> b[i];
	auto f = [&](ll a, ll b) {
		return (a % b == 0 ? 0 : b*(a/b+1) - a);
	};
	for (ll i = n-1; i >= 1; i--) {
		cnt += f(a[i], b[i]);
		a[i - 1] += cnt;
	}
	cout << cnt + f(a[0],b[0]) << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll n,a,b;
    cin>>a>>b;
    if(a*b%2==1)
        Yes
    else
        No
    

    
    
}
return 0;
}

Measured memory_bytes: 256
def resolve():
	h, w = map(int, input().split())
	img = []
	ex_img = [[False]*w for _ in range(h*2)]
	for i in range(h):
		r = list(input())
		img.append(r)
	for i in range(h*2):
		for j in range(w):
			ex_img[i][j] = img[i//2][j]
	for i in range(h*2):
		print("".join(ex_img[i]))
resolve()

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

int main(){
    string s;
    cin >> s;
    int num = s.size();

    for(int i = 0; i<num ; i += 2){
        if(s.at(i) == 'L'){
            cout << "No" << endl;
            return 0;
        }
    }

    for(int i = 1; i<num ; i += 2){
        if(s.at(i) == 'R'){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//const int mod = 1e9+7;
ll a,b,c,k;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main()
{
    quickread();
    cin >> a >> b >> c >> k;
    if(k < a) {
        cout << k << endl;
    } else if(k <= a + b) {
        cout << a << endl;
    } else {
        cout << a - (k - a - b) << endl;
    }
    return 0;
}


Measured memory_bytes: 3640
local function meld(a,b)
    if not a then
        return b
    elseif not b then
        return a
    elseif a[1]<b[1] then
        b[4]=a[3]
        a[3]=b
        return a
    else
        a[4]=b[3]
        b[3]=a
        return b
    end
end

local function pair(a)
    local b,c,d,e
    while a do
        c=false
        b=a
        a=a[4]
        b[4]=false
        if a then
            c=a
            a=a[4]   
            c[4]=false
        end
        b=meld(b,c)
        b[4]=d
        d=b
    end
    while d do
        e=d
        d=d[4]
        a=meld(a,e)
    end
    return a
end


local PairingHeap={}

PairingHeap.empty=function(self)
    return not self[1]
end

PairingHeap.push=function(self,key,value)
    self[1]=meld(self[1],{key,value,false,false})
end

PairingHeap.top=function(self)
    return self[1][2]
end

PairingHeap.pop=function(self)
    self[1]=pair(self[1][3])
end

PairingHeap.join=function(self,other)
    if self[1][1]<other[1][1]then
		other[1][4]=self[1][3]
        self[1][3]=other[1]
	else
		self[1][4]=other[1][3]
        other[1][3]=self[1]
        self[1]=other[1]
    end
    return self
end

PairingHeap.new=function(self)
    local obj={}
    setmetatable(obj,{__index=PairingHeap})
    return obj
end

----------

local n=io.read("n")
local a={}
for i=1,3*n do
    a[i]=io.read("n")
end

local lsum={[0]=0}
local minq=PairingHeap:new()
for i=1,n do
    local A=a[i]
    lsum[i]=lsum[i-1]+A
    minq:push(A,A)
end
for i=n+1,2*n do
    local P=minq:top()
    local A=a[i]
    if A>P then
        lsum[i]=lsum[i-1]+A-P
        minq:pop()
        minq:push(A,A)
    else
        lsum[i]=lsum[i-1]
    end
end

local rsum={[0]=0}
local maxq=PairingHeap:new()
for i=1,n do
    local A=a[3*n-i+1]
    rsum[i]=rsum[i-1]+A
    maxq:push(-A,A)
end
for i=n+1,2*n do
    local P=maxq:top()
    local A=a[3*n-i+1]
    if A<P then
        rsum[i]=rsum[i-1]+A-P
        maxq:pop()
        maxq:push(-A,A)
    else
        rsum[i]=rsum[i-1]
    end
end
local max=-10^16
for i=n,2*n do
    max=math.max(max,lsum[i]-rsum[3*n-i])
end
print(max)

Measured memory_bytes: 69520
//abc110_a.cpp
//Sat Sep 29 15:23:21 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int a[3];

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

	int ans = 0;
	for (int i=0;i<3;i++){
		int temp = total + 9*a[i];
		if (temp > ans){
			ans = temp;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            sum = 500 * int(i) + 100 * int(j) + 50 * int(k)
            if sum == X:
                count += 1

print(count)

Measured memory_bytes: 8916
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

typedef unsigned long long ULLONG;
typedef long long LLONG;

template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}
static const long long MOD_NUM = 1000000007LL;

static void C_task();

int main()
{
	C_task();
	fflush(stdout);
	return 0;
}

static void C_task()
{
	int N;
	get1int(N);

	std::vector<int> seq(N);
	for (int i = 0; i < N; i++) {
		int tmp;
		get1int(tmp);
		seq[i] = tmp;
	}
	int count = 1;
	int nowMin = seq[0];
	for (int i = 1; i < N; i++) {
		if (nowMin >= seq[i]) {
			nowMin = seq[i];
			count++;
		}
	}
	printf("%d\n", count);
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
typedef double db;
const db pi=acos(-1.);
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    db r;cin>>r;
    cout<<2*r*pi<<endl;
}

Measured memory_bytes: 3796