akhauriyash/Code-Regression huggingface dataset:
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
import math
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

print(N ** 2)

Measured memory_bytes: 3316
#include <iostream>
#include <string>
using namespace std;
int main(void) {
	int N,M,mscore = 0;
	string s[ 110 ],t[ 110 ];
	cin >> N;
	for (int i = 0;i < N;i++) cin >> s[ i ];
	cin >> M;
	for (int i = 0;i < M;i++) cin >> t[ i ];
	for (int i = 0;i < N;i++) {
		int score = 0;
		string a = s[ i ];
		for (int j = 0;j < N;j++)
			if (a == s[ j ])
				score++;
		for (int j = 0;j < M;j++)
			if (a == t[ j ])
				score --;
		if (mscore <= score)
			mscore = score;
	}
	cout << mscore << endl;
}


Measured memory_bytes: 256
import numpy as np
N, M = map(int, input().split())

L = np.zeros(M)
R = np.zeros(M)
for j in range(M):
    L[j], R[j] = map(int, input().split())

if int(min(R) - max(L) + 1) < 0:
    print(0)
else:
    print(int(min(R) - max(L) + 1))

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

using namespace std;


void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (auto& x: a) {
        cin >> x;
    }
    int res = 0;
    for (int i = 1; i <= min(k,n); i++) {
        int rem = k-i;
        for (int j = 0; j <= i; j++) {
            int tmp = 0;
            priority_queue<int, vector<int>, greater<int>> pq;
            for (int x = 0; x < j; x++) {
                tmp+=a[x];
                pq.push(a[x]); 
            }
            int x = n-1, r = i-j;
            while (r--) {
                tmp+=a[x];
                pq.push(a[x--]);
            }
            r = rem;
            while (r-- && !pq.empty()) {
                if (pq.top() < 0) tmp-=pq.top(), pq.pop();
                else break;
            }
            res = max(res, tmp);
        }
    }
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        selectionSort(a);
    }

    private static void selectionSort(int[] a) {
        int n = a.length;
        int swaps = 0;
        for (int i = 0; i < n; i++) {
            int min = i;
            for (int j = i; j < n; j++) {
                if (a[j] < a[min]) {
                    min = j;
                }
            }
            if (i != min) {
                int swap = a[i];
                a[i] = a[min];
                a[min] = swap;
                swaps++;
            }
        }
        System.out.println(printArray(a));
        System.out.println(swaps);
    }

    private static String printArray(int[] a) {
        int length = a.length;
        String arrayString = "";
        for (int i = 0; i < length - 1; i++) {
            arrayString = arrayString + a[i] + " ";
        }
        arrayString = arrayString + a[length - 1];
        return arrayString;
    }
}


Measured memory_bytes: 26264
// f(N, (100011010..)2) 
//  = f(N-1, (mask) & (~(1<<j))

// f(0, mask == 0)
// 	return 1;
#include<iostream>
#include<algorithm>
#include<vector>
#define ll long long
#define mod (1000000007LL)
using namespace std;
ll dp[25][1<<23];
ll bitCount[1<<23];
ll a[25];
void fix(ll &v) {
	if( v >= mod)
		v-= mod;
	if(v < 0)
		v+=mod;
}
int unsetBit(int v, int j) {
	return (v & (~(1<<j)));
}
int main() {
	int n;
	cin>>n;
	for(int i=0;i<n;i++) {
		for(int j=0;j<n;j++) {
			int bit;
			cin>>bit;
			if(bit) 
				a[i] = a[i] | (1<<j);
		}
	}
	dp[0][0] = 1;
	bitCount[1] = 1;
	vector<ll> bucket[n+1];
	bucket[1].push_back(1);
	for (int i = 2; i < (1<<n); ++i) {
		bitCount[i] = bitCount[i/2] + (i&1);
		bucket[bitCount[i]].push_back(i);
	}
	for(int i=1; i <= n; i++) {
		for(int j=0; j< (int)bucket[i].size(); j++) {
			int mask = bucket[i][j];
			for(int k=0; k < n; k++) {
				if(a[i-1] & (1<<k) && (mask & (1<<k)) ) {
					dp[i][mask] += dp[i-1][unsetBit(mask,k)];
					fix(dp[i][mask]);
				}
			}
		}
	}
	int mask = 1<<n;
	mask--;
	if(dp[n][mask] < 0) dp[n][mask] += mod;
	cout<<dp[n][mask]<<endl;
	return 0;
}


Measured memory_bytes: 367264
#include <iostream>

int main() {
    int a , b , c ;
    int count = 0 ;
    std::cin >> a >> b >> c ;
    for( int i = a ; i <= b ; i++ ) {
        if( c % i == 0 ) {
            count++ ;
        }
    }
    std::cout << count << std::endl ;
} 



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

int main() {
   vector<vector<int>> data(3, vector<int>(3));

   for(int i=0; i<3; i++) {
       for(int j=0; j<3; j++) {
           cin >> data.at(i).at(j);
       }
   }
    int n, a;
    cin >> n;
    for(int k=0; k<n; k++) {
        cin >> a;
        for(int i=0; i<3; i++) {
            for(int j=0; j<3; j++) {
                if(a==data.at(i).at(j)) {
                    data.at(i).at(j)=0;
                }
            }
        }
    }
    bool flag=false;
    if(data.at(0).at(0)==data.at(0).at(1) && data.at(0).at(0)==data.at(0).at(2)) {
        flag=true;
    }
    else if(data.at(1).at(0)==data.at(1).at(1) && data.at(1).at(0)==data.at(1).at(2)) {
        flag=true;
    }
    else if(data.at(2).at(0)==data.at(2).at(1) && data.at(2).at(0)==data.at(2).at(2)) {
        flag=true;
    }
    else if(data.at(0).at(0)==data.at(1).at(0) && data.at(0).at(0)==data.at(2).at(0)) {
        flag=true;
    }
    else if(data.at(0).at(1)==data.at(1).at(1) && data.at(0).at(1)==data.at(2).at(1)) {
        flag=true;
    }
    else if(data.at(0).at(2)==data.at(1).at(2) && data.at(0).at(2)==data.at(2).at(2)) {
        flag=true;
    }
    else if(data.at(0).at(0)==data.at(1).at(1) && data.at(0).at(0)==data.at(2).at(2)) {
        flag=true;
    }
    else if(data.at(0).at(2)==data.at(1).at(1) && data.at(0).at(2)==data.at(2).at(0)) {
        flag=true;
    }
    if(flag) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			final int M = sc.nextInt();
			
			PriorityQueue<Long> queue = new PriorityQueue<Long>(Collections.reverseOrder());
			for(int i = 0; i < N; i++) {
				queue.add(sc.nextLong());
			}
			
			for(int k = 0; k < M; k++) {
				queue.add(queue.poll() / 2);
			}

			long sum = 0;
			while(!queue.isEmpty()) { sum += queue.poll(); }
			
			System.out.println(sum);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 45396
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#define N 100020
using namespace std;

int a[N];
bool o[N];

int main(void)
{
    int n, m, u, v;
    int i;

    scanf("%d %d", &n, &m);
    for(i = 1; i <= n; i ++)
    {
        scanf("%d", &a[i]);
        o[i] = true;
    }
    while(m --)
    {
        scanf("%d %d", &u, &v);
        o[u] &= a[u] > a[v];
        o[v] &= a[v] > a[u];
    }

    for(i = 1, v = 0; i <= n; i ++)
        v += o[i];
    printf("%d\n", v);

    return 0;
}


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

const int INF = 100000007;

int main(){

    while(1){
        int T; cin >> T;
        if(T == 0) break;
        vector<int> t(T);
        for(int i = 0; i < T; i++) cin >> t[i];
        vector<vector<int> > dp(101, vector<int> (T, INF));
        dp[0][0] = 0;
        vector<int> day(100, 23);
        int n; cin >> n;
        for(int i = 0; i < n; i++){
            int d, m; cin >> d >> m;
            d--;
            day[d] = min(day[d], m);
        }

        for(int i = 0; i < 100; i++){
            for(int j = 0; j < T; j++){
                //take
                dp[i + 1][1 % T] = min(dp[i + 1][1 % T], dp[i][j] + 1);
                //not
                if(day[i] >= t[j]){
                    dp[i + 1][(j + 1) % T] = min(dp[i + 1][(j + 1) % T], dp[i][j]);
                }
            }
        }

        int ans = INF;
        for(int j = 0; j < T; j++) ans = min(ans, dp[100][j]);
        cout << ans << endl;

        /*for(int i = 0; i <= 5; i++){
            for(int j = 0; j < T; j++){
                cout << dp[i][j] << " ";

            }
            cout << endl;
        }*/
    }
    return 0;
}


Measured memory_bytes: 3036
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
print('ABC'+S())

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

namespace ConsoleApplication1
{
    class Vector2D
    {
        internal double x, y;

        public Vector2D(double x, double y)
        {
            this.x = x;
            this.y = y;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            int q = int.Parse(Console.ReadLine());

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < q; i++)
            {
                double[] input = Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse);

                Vector2D a = new Vector2D(input[0] - input[2], input[1] - input[3]);
                Vector2D b = new Vector2D(input[4] - input[6], input[5] - input[7]);

                if (Dot(a, b) == 0.0) sb.AppendLine("1");
                else if (Cross(a, b) == 0.0) sb.AppendLine("2");
                else sb.AppendLine("0");
            }
            Console.Write(sb);
        }

        static double Dot(Vector2D a, Vector2D b)
        {
            return a.x * b.x + a.y * b.y;
        }

        static double Cross(Vector2D a, Vector2D b)
        {
            return a.x * b.y - a.y * b.x;
        }
    }
}

Measured memory_bytes: 9508
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>
#include <tuple>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

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

int main()
{
	int N;
	cin >> N;
	vector<ll> x(N);
	vector<ll> y(N);
	vector<ll> h(N);
	ll X = 0, Y = 0, H = 0;	
	rep(i, N) {
		cin >> x[i] >> y[i] >> h[i];
		if (h[i] > 0) {
			X = x[i];
			Y = y[i];
			H = h[i];
		}
	}
	for (ll Cx = 0; Cx < 101LL; Cx++) {
		for (ll Cy = 0; Cy < 101LL; Cy++) {
			ll Ch = max(abs(X - Cx) + abs(Y - Cy) + H, 0LL);
			rep(i, N) {
				//max(H - |X - C_X| - |Y - C_Y|, 0)
				ll h_ = max(Ch - abs(x[i] - Cx) - abs(y[i] - Cy), 0LL);
				if (h_ != h[i]) {
					Ch = 0;
					break;
				}
			}
			if (Ch > 0) {
				cout << Cx << " " << Cy << " " << Ch << endl;
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

int main(void) {
	int A, B;
    scanf("%d %d", &A, &B);
     int ans = max(A+B, A-B);
     ans = max(ans, A*B);
    
    printf("%d\n", ans);

	return 0;
}


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

template <typename T> class SegmentTree{
	public :
		int n;
		SegmentTree(int size,T o): out_of_range(o){
			for(n=1;n<size;n<<=1);
			data=vector<T>(2*n,out_of_range);
			lazy=vector<bool>(2*n,false);
		}

		void update(int a,int b,T x,int k,int l,int r){
			if(r<=a||b<=l) return;
			if(a<=l&&r<=b){data[k]=x,lazy[k]=true;return;}
			if(lazy[k]) lazy_evaluate(k);
			update(a,b,x,k*2+1,l,(l+r)/2);
			update(a,b,x,k*2+2,(l+r)/2,r);
			data[k]=max(data[k*2+1],data[k*2+2]);
		}

		T query(int a,int b,int k,int l,int r){
			if(r<=a||b<=l) return out_of_range;
			if(lazy[k]) return data[k];
			if(a<=l&&r<=b) return data[k];
			T vl = query(a,b,k*2+1,l,(l+r)/2);
			T vr = query(a,b,k*2+2,(l+r)/2,r);
			return max(vl,vr);
		}

		void show(){
			rep(i,n) cerr << "i=" << i << "  data: " << data[i] << " lazy: " << lazy[i] << endl;
		}


	private:
		vector<T> data;
		vector<bool> lazy;
		const T out_of_range;

		inline void lazy_evaluate(int k){
			data[k*2+1]=data[k];lazy[k*2+1]=true;
			data[k*2+2]=data[k];lazy[k*2+2]=true;
			lazy[k]=false;
		}
};

const int nmax=100010;
ll n;
int a[nmax];
int pos[nmax];
SegmentTree<ll> dp(nmax,0LL);


int main(void){
	cin >> n;
	rep(i,n) cin >> a[i];
	rep(i,n) pos[a[i]]=i;

	ll all=n*(n+1)/2;
	for(int i=n;i>=1;--i){
		ll cur=dp.query(pos[i]+1,n,0,0,dp.n);
		cur+=i;
		dp.update(pos[i],pos[i]+1,cur,0,0,dp.n);
		//dp.show();
	}
	cout << all-dp.query(0,n,0,0,dp.n) << endl;
	return 0;
}

Measured memory_bytes: 4068
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
#define pb push_back
const ll mod=1000000007;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

vec primefactorization(ll N){
  ll i=2;
  vec res;
  while(i*i<=N){
    while(!(N%i)){
      res.pb(i);
      N/=i;
    }
    i++;
  }
  if(N^1)res.pb(N);
  return res;
}

int main(){
  startupcpp();
  ll t,N,ans=0;
  cin>>N;
  map<ll,ll> amp;
  while(N--){
    map<ll,ll> mp;
    cin>>t;
    vec v=primefactorization(t);
    for(auto x:v)mp[x]++;
    for(auto x:mp)chmax(amp[x.first],x.second);
    ans+=modinv(t);
  }
  ans%=mod;
  for(auto x:amp){
    ans=ans*modpow(x.first,x.second)%mod;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 896
def MergeSort(arr):
    if len(arr) <= 1:
        return arr
    mid = len(arr) // 2
    left = arr[:mid]
    right = arr[mid:]
    left = MergeSort(left)
    right = MergeSort(right)
    return MergeArray(left, right)

def MergeArray(left, right):
    merged = []
    li, ri = 0, 0
    while li < len(left) and ri < len(right):
        if left[li] > right[ri]:
            merged.append(left[li])
            li += 1
        else:
            merged.append(right[ri])
            ri += 1
    if li < len(left):
        merged.extend(left[li:])
    elif ri < len(right):
        merged.extend(right[ri:])
    return merged

def solve():
    N = int(raw_input())
    A = [int(_) for _ in raw_input().split()]
    sortA = MergeSort(A)
    flag = True
    for i in range(N - 1):
        if sortA[i] == sortA[i+1]:
            flag = False
            break
    if flag:
        print 'YES'
    else:
        print 'NO'

if __name__ == '__main__':
    solve()


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

using namespace std;

int main ()
{
  int X,res=1;
  cin >> X;

  for (int b = 1; b <= X; b++)
    for (int p = 2; p <= X; p++)
      if (pow (b,p) <= X && pow (b,p) > res)
        res = pow (b,p);

  cout << res << endl;

  return 0;
}

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

using namespace std;
struct Node{
    int key;
    Node *parent, *left, *right;
};

Node *root=NULL, *NIL=NULL;

void Preorder(Node *root) {
    if ( root != NIL ) {
    cout << " " << root->key;
    Preorder(root->left);
    Preorder(root->right);
   }
}

void Inorder(Node *root) {
    if ( root != NIL ) {
       Inorder( root->left);
      cout << " " << root->key;
       Inorder( root->right);
     }
}

void Postorder(Node *root) {
    if ( root != NIL ) {
       Postorder( root->left);
       Postorder( root->right);
       cout << " " << root->key;
     }
}
void insert(int key) {
	Node *p=new Node;
	p->key=key;
	p->left=NIL;
	p->right=NIL;

	Node *x = root;
	Node *y = NIL;

	while(x != NIL ){
		y=x;
		if ( p->key > x->key ) x = x->right;
		else x = x->left;

	}
    
    p->parent = y;
    if( y == NIL ) root = p;
    else {
    	if ( p->key > y->key ) y->right = p;
    	else y->left = p;
    }

}

Node * find(int key) {
    Node *p = root;
    while ( p != NIL && p->key != key ) {
    	if ( p->key > key ) p = p->left;
    	else p = p->right;
    }
    return p;
}

Node * getSuccesor( Node *p ) {
	Node *y=p->right;
    while ( y->left !=NIL ) y = y->left;
    
	return y;
}
void deleteNode( Node *p ) {
 	Node *y, *x;  // y 为要删除的节点
    if ( p->left == NIL || p->right == NIL )
    	y = p;
    else
    	y = getSuccesor(p);

    if ( y->left != NIL ) 
     	x = y->left;
     else x = y->right;

     if( x!= NIL ) x->parent = y->parent;

     if( y->parent == NIL ) root = x;
     else if ( y == y->parent->left )
     	y->parent->left = x;
     else y->parent->right = x;

     if ( y != p ) 
     	p->key = y->key;

     delete y;

}

int main() {
    int n;
    string op;
    int key;

    cin >> n;
    while ( n-- ) {
    	cin >> op;
    	if ( op == "insert" ) {
    		cin >> key;
    		insert(key);
    	} else if ( op == "print" ){
    		Inorder(root);
    		cout << endl;
    		Preorder(root);
    		cout << endl;
    	} else if ( op == "find" ) {
    		cin>>key;
    		if ( find(key) != NIL ) cout << "yes" << endl;
    		else cout << "no" << endl;
    	} else if ( op == "delete" ) {
    		cin >> key;

    		deleteNode( find(key) );
    	}
    }
	return 0;
}


Measured memory_bytes: 21932
I=lambda:map(int,input().split());F=1e21;r=range;n,m=I();f=[-F,F];X=[0]+f;Y=X[:];R=[(f,F),(f,-F)];H=[(F,f),(-F,f)]
for i in r(n):a,b,c=I();R+=[((a,b),c)];Y+=[c];X+=[a,b]
for i in r(m):a,b,c=I();H+=[(a,(b,c))];X+=[a];Y+=[b,c]
def g(X):
 s=dict(enumerate(sorted(set(X))));K=len(s);h={s[i]:i for i in s}
 return s,K,h
s,K,h=g(X);t,L,w=g(Y);V=[[0]*-~K for i in r(L+1)];U=[i[:]for i in V];v=[i[:]for i in V]
for(a,b),c in R:U[w[c]][h[a]]+=1;U[w[c]][h[b]]+=-1
for d,(e,f)in H:V[w[e]][h[d]]+=1;V[w[f]][h[d]]+=-1
for i in r(L):
 for j in r(K):U[i][j+1]+=U[i][j];V[i+1][j]+=V[i][j]
q=[(h[0],w[0])];v[w[0]][h[0]]=1;a=0
while q:
 x,y=q.pop();a+=(s[x]-s[x+1])*(t[y]-t[y+1])
 for e,f in[(-1,0),(1,0),(0,1),(0,-1)]:
  c=x+e;d=y+f
  if(K>c>=0<=d<L)*v[d][c]==0:
   if U[(f>0)+y][x]|e==0 or V[y][(e>0)+x]|f==0:q+=[(c,d)];v[d][c]=1
if a>F:a='INF'
print(a)

Measured memory_bytes: 551464
class process:
    def __init__(self, name, time):
        self.name = name
        self.time = time

def queue(q, ps):
    time = 0
    while len(ps) != 0:
        p = ps.pop(0)
        if p.time > q:
            p.time -= q
            time += q
            ps.append(p)
        else:
            time += p.time
            print p.name + " " + str(time)

if __name__ == "__main__":
    L = map(int, raw_input().split())
    N = L[0]
    q = L[1]
    processes = []
    for i in range(N):
        L = raw_input().split()
        processes.append(process(L[0], int(L[1])))
    queue(q, processes)

Measured memory_bytes: 28320
#include <stdio.h>
int main(){
    int x,y;
    scanf("%d %d",&x,&y);
    if(x==2 || y==2){
        printf("No\n");
    }else if(x==4 || x==6 || x==9 || x==11){
        if(y==4 || y==6 || y==9 || y==11){
            printf("Yes\n");
        }else{
            printf("No\n");
        }
    }else{
        if(y==1 || y==3 || y==5 || y==7 || y==8 || y==10 ||y==12){
            printf("Yes\n");
        }else{
            printf("No\n");
        }

    }
}

Measured memory_bytes: 128
def f(s):
    if s==".":
        return 1
    else:
        return 0

N,M=map(int,input().split())
A=[]
for _ in range(N):
    A.append(list(map(f,input())))

B=[]
for _ in range(M):
    B.append(list(map(f,input())))

F=False
for i in range(N-M+1):
    for j in range(N-M+1):
        G=True
        for k in range(M):
            G=G and (A[j+k][i:i+M]==B[k])
        F=F|G
    
if F:
    print("Yes")
else:
    print("No")
        


Measured memory_bytes: 40048
from itertools import accumulate
n, k = map(int, input().split())
memo = [0] * (10 ** 5 + 1)
for _ in range(n):
    i, j = map(int, input().split())
    memo[i] += j
cnt = 0
for i, j in enumerate(memo):
    cnt += j
    if cnt >= k:
        print(i)
        exit()

Measured memory_bytes: 5860
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define SIZE(x) ((int)(x).size())
#define UQ(v) v.erase(unique(v,begin(),v,end()),v.end());
ll INF = 1LL <<30;
#define pb push_back 
int dxy4[5] = { 0,1,0,-1,0 };
int dxy8[9] = { 0,1,1,0,-1,1,-1,-1,0 };
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
ll mod7 = 1000000007;
ll mod9 = 1000000009;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define FOR(i,x,n) for(int i=x;i<n;++i)
//vector< vector<int> > v (max1, vector<in t>(max2) );

int a[100000];


int main() {
	int n,k;
	while (cin >> n >> k) {
		if (!n)break;
		rep(i, n)cin >> a[i];
		ll sum = 0 ,ans = 0;;
		rep(i, k)sum += a[i];
		FOR(i, k, n) {
			sum = sum + a[i] - a[i - k];
			ans = max(sum, ans);

		}
		cout << ans << endl;
	}
	cin >> n;
	
	return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll LINF = 1e18;
const int INF = 1e9;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    int N; cin>>N;
    int v[N];
    rep(i,N)cin>>v[i];
    sort(v,v+N);
    double ans=0.0;
    rep(i,N-2){
        ans+=v[N-1-i]/pow(2.0,i+1);
    }
    ans+=(v[0]+v[1])/pow(2.0,N-1);
    cout<<fixed<<setprecision(10)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4096
a=input()
if a=='RRR':
    print(3)
elif a[0:2]=='RR' or a[1:3]=='RR':
    print(2)
elif a[0:1]=='R' or a[1:2]=='R' or a[2:3]=='R':
    print(1)
else:
    print(0)

Measured memory_bytes: 9076
word=input()
cflg=True
if word[0]!='A':
  cflg=False
elif word[2:-1].count('C')!=1:
  cflg=False
cnt=0
for l in word[1:]:
  if l.isupper():
    cnt+=1
else:
  if cnt!=1:
    cflg=False
  
if cflg:
  print('AC')
else:
  print('WA')


Measured memory_bytes: 3060
#include<stdlib.h>
/*int int_cmp(const int *a, const int *b){
  if (*a < *b)
    return (-1);
  else if (*a > *b)
    return (1);
  return (0);} */
p(int*a,int*b){return*a-*b;}
int main () {
int f[1001];
int F[1001];
int N,i,V,d,count;
N=1001;
f[0]=2;
f[1]=3;
for(;~scanf("%d%d",&V,&d);){
  count = 1;
  for(i=2;i<1001;i++){f[i]=(f[i-1]+f[i-2])%N;}
  for(i=0;i<V;i++)F[i]=f[i];
  qsort(F,V,4,p);
  for(i=1;i<V;i++)
    if( F[ i] - F[ i - 1] > d - 1)
      count++;
  printf( "%d\n" , count);
 }
 return 0;
}

Measured memory_bytes: 648
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <string>

using namespace std;



int main()
{
    int N, K;
    string S;
    cin >> N;
    cin >> K;
    cin >> S;

    // 11101010110011 -> 3 1 1 2 2 / 1 1 1 2
    vector<int> one;
    vector<int> zero;
    char f = '1';
    int n = 0;
    S += '_';
    for (int i = 0; i < N + 1; i++) {
        if (S[i] == f) {
            n++;
        }
        else {
            if (f == '1') {
                one.push_back(n);
                f = '0';
            }
            else {
                zero.push_back(n);
                f = '1';
            }
            n = 1;
        }
    }
    one.push_back(0);
    if (zero.size() == 0) {
        zero.push_back(0);
    }

    /*for (int i = 0; i < one.size(); i++) {
        cout << one[i] << " ";
    }
    cout << endl;
    for (int i = 0; i < zero.size(); i++) {
        cout << zero[i] << " ";
    }
    cout << endl;*/

    int ans = 0;
    K = min(K, (int)zero.size());
    for (int i = 0; i < zero.size() - K + 1; i++) {
        int cur = 0;
        for (int j = 0; j < K; j++) {
            if (i + j < one.size())
                cur += one[i + j];
            if (i + j < zero.size())
                cur += zero[i + j];
        }
        if (i + K < one.size())
            cur += one[i + K];
        ans = max(ans, cur);
    }
    cout << ans;
    return 0;
}



Measured memory_bytes: 1020
//
// Created by kuroneko on 2019-07-06.
//

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>

typedef long long ll;
using namespace std;

int main() {
    int N, Q; cin >> N >> Q;
    string s; cin >> s;

    vector<pair<int, int>> v;
    for (int i = 0; i < Q; i++) {
        int a, b; cin >> a >> b;
        v.push_back(make_pair(a, b));
    }

    int dp[N+1];
    dp[0] = 0;
    dp[1] = 0;
    for (int i = 2; i < N+1; i++) {
        if (s[i-2] == 'A' && s[i-1] == 'C') dp[i] = dp[i-1] + 1;
        else dp[i] = dp[i-1];
    }

    for (int i = 0; i < Q; i++) {
        int a = v[i].first, b = v[i].second;
        cout << dp[b] - dp[a] << endl;
    }

    return 0;
}


Measured memory_bytes: 2228
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
ll mod;
ll inv(ll a){
    ll n=mod-2,ans=1;
    while(n>0){
        if(n&1) ans=ans*a%mod;
        n=n/2;
        a=a*a%mod;
    }
    return ans;
}
ll A[200001],B[200001];
void init(){
    A[0]=1,B[0]=1;
    rep(i,6000) A[i+1]=A[i]*(i+1)%mod,B[i+1]=B[i]*2%mod;
}
ll nCk(ll n,ll k){
    return A[n]*inv(A[k])%mod*inv(A[n-k])%mod;
}
int main(){
    ll n,m;
    cin>>n>>m;
    mod=m;
    ll ans=1;
    init();
    rep(i,n){
        ll a=1,p=3*n,I=i+1;
        rep(j,I) a=a*nCk(p,3)%mod,p-=3;
        rep(j,I+1) (ans+=a*inv(A[I-j])%mod*inv(A[j])%mod*B[I-j]%mod)%=mod,a=a*inv(p+j+1)%mod*3%mod;
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 384
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>

using namespace std;

typedef long long ll;

mt19937 rnd(228);

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll a, b, c;
    cin >> a >> b >> c;
    ll k;
    cin >> k;
    if (k % 2 == 0)
    {
        cout << a - b << '\n';
    }
    else
    {
        cout << b - a << '\n';
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] p = new int[n];
		
		for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}
		
		int a = p[0];
		int b = p[1];
		int c = 0;
		int ans = 0;
		
		for(int i = 2; i < n; i++) {
			c = p[i];
			if(a < b && b < c) {
				ans++;
			} else if(a > b && b > c) {
				ans++;
			}
			a = b;
			b = c;
		}
		
		System.out.println(ans);
	}
}


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

using namespace std;

#define int long long
#define fi first
#define se second
typedef pair<int, int> ii;

set<ii> sett;
long long ans[10], h, w, n;

signed main () {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> h >> w >> n;
    for (int i = 1; i <= n; ++i) {
        int x, y; cin >> x >> y;
        sett.insert(ii(x, y) );
    }

    for (auto i : sett) {
        int x = i.fi, y = i.se;
        int l, r, t, d;
        l = max(1LL, y - 2);
        t = max(1LL, x - 2);
        r = min(w, y + 2);
        d = min(h, x + 2);
        for (int j = t; j <= d - 2; ++j) {
            for (int k = l; k <= r - 2; ++k) {
                int cnt = 0;
                for (int _j = j; _j <= j + 2; ++_j) {
                    for (int _k = k; _k <= k + 2; ++_k) {
                        if(sett.count(ii(_j, _k) ) ) cnt ++;
                    }
                }
                ans[cnt] ++;
            }
        }
    }

    ans[0] = (h - 2) * (w - 2);
    for (int i = 1; i < 10; ++i) ans[i] /= i, ans[0] -= ans[i];
    for (int i = 0; i < 10; ++i) cout << ans[i] << '\n';

    return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define pb push_back 
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin >> s;
	for(int i = 0; i < s.length(); i++)
		cout << 'x';
	cout << '\n';
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>

using namespace std;

int main(){
   long long X,Y;
   cin >> X >> Y;
   int cnt = 0;
   while( X <= Y ){
      X*=2;
      cnt++;
   }
   cout << cnt<<endl;
   return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	vector<int>N(n+1);
	for(int i=0;i<m;++i){
		int a,b;
		cin>>a>>b;
		++N[a];
		++N[b];
	}
	for(int i=1;i<=n;++i){
		cout<<N[i]<<endl;
	}
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;


long long int N, M, K, H, W, L, R;

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

	cin >> N >> M;
	while (N) {
		vector<int>n(N + 1);
		for (int i = 1; i <= N; i++)cin >> n[i];
		vector<int>m(M + 1);
		for (int i = 1; i <= M; i++)cin >> m[i];
		for (int i = 1; i <= N; i++)n[i] += n[i - 1];
		for (int i = 1; i <= M; i++)m[i] += m[i - 1];
		map<int, int>nm;
		long long int ans = 0;
		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j <= N; j++) {
				nm[n[j] - n[i]]++;
			}
		}
		for (int i = 0; i < M; i++) {
			for (int j = i + 1; j <= M; j++) {
				ans += nm[m[j] - m[i]];
			}
		}
		cout << ans << endl;
		cin >> N >> M;
	}
	return 0;
}


Measured memory_bytes: 20988
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		BufferedReader br =
				new BufferedReader( new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

//		StringBuilder sb = new StringBuilder();

		for (int i=0; i < n; i++) {
			String[] inst = br.readLine().split(" ");

			if (inst[0].equals("insert")) {
				insert(inst[1]);
			} else {
				if (find(inst[1])) {
					System.out.println("yes");
				} else {
					System.out.println("no");
				}
			}
		}
	}

	static int[] pow4; // pow4[i]:4^i

	static int M; // A, C, G, T, ???????????§????????\??????????????\????????????????????????????????°

	static String[] H; // hash table

	static {
		pow4 = new int[13];
		for (int i=0; i < 13; i++) {
			pow4[i] = (int)Math.pow(4, i);
			M += pow4[i];
		}

		H = new String[M];
	}

	static int getChar(char ch) {
		switch (ch) {
		case 'A':
			return 0;
		case 'C':
			return 1;
		case 'G':
			return 2;
		case 'T':
			return 3;
		default :
			return -1;
		}
	}

	static int getKey(String str) {
		int key = 0;
		char[] chaa = str.toCharArray();

		for (int i=0; i < chaa.length; i++) {
			key += pow4[i];
		}

		for (int i=0; i < chaa.length; i++) {
			key += pow4[i] * getChar( chaa[i] );
		}

		return key;
	}

	static boolean find(String str) {
		int key = getKey(str);

		if (H[key] != null) return true;
		else return false;
	}

	static void insert(String str) {
		int key = getKey(str);
		H[key] = str;
	}
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;



int main() {
    map<string, li> cnt;
    li n;
    cin>>n;
    rin{
        string s;
        cin>>s;
        cnt[s]++;
    }
    li ma = 0;
    for(auto& kv : cnt){
        ma=max(ma, kv.S);
    }
    vector<string> res;
    for(auto& kv : cnt){
        if(kv.S==ma){
            res.pb(kv.F);
        }
    }
    sort(allof(res));
    for(auto& ss : res){
        cout<<ss<<endl;
    }
    return 0;
}

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

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

    vector<pair<long long int, long long int>> vec(N);
    for(int i=0; i<N; i++){
        cin >> vec[i].first >> vec[i].second;
    }
    sort(vec.begin(),vec.end());


    long long int cost=0;
    long long int bought = 0;

    for(int i=0; i<N; i++){
        if(bought + vec[i].second < M){
            bought += vec[i].second;
            cost += vec[i].first * vec[i].second;
        }
        else{
            cost += vec[i].first * (M - bought);
            bought += M - bought;
            break;
        }
    }

    cout << cost << endl;
}

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

set<char> s;

int main(){
  rep(i, 3){
    char tmp; cin >> tmp;
    s.insert(tmp);
  }
  if(s.size() == 1){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}


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

using namespace std;

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

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> p(N);
  rep(i,N) cin >> p[i];

  sort(p.begin(), p.end());
  int ans = 0;
  rep(i,K) ans += p[i];
  cout << ans << endl;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  repe(i,25) {
    repe(j,14) {
      if(i*4+j*7==N) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
function main(input) {
  var N = input[0]-0;
  var x = N;
  var a = "";
  while(x!=0){
    if(x%2==1 || x%2==-1){
      if(a.length%2==1) x++; else x--;
      a = "1"+a;
    }else{
      a = "0"+a;
    }
    x = x/2;
  }
  console.log(a||"0");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


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

struct edge{
  int to, cost;
  edge(int to,int cost): to(to), cost(cost){};
};
vector< edge > info[30];
int ticket[8];
int n, m, p, a, b;
bool used[1 << 8][30];
typedef pair< int, int > Pi;
typedef pair< double, Pi > Pii;
#define fr first
#define sc second
double Dijkstra() {
  priority_queue< Pii, vector< Pii >, greater< Pii > > que;
  que.push( Pii( 0.0, Pi( a, 0)));
  fill_n( *used, 30 * (1 << 8), false);
  while(!que.empty()){
    Pii p = que.top();
    que.pop();
    if(used[p.sc.sc][p.sc.fr]++) continue;
    if(p.sc.fr == b) return p.fr;
    for(int i = 0; i < info[p.sc.fr].size(); i++){
      edge e = info[p.sc.fr][i];
      for(int j = 0; j < n; j++){ //チケット
        if( p.sc.sc >> j & 1) continue;
        que.push( Pii( p.fr + (double)e.cost / ticket[j], Pi( e.to, p.sc.sc|1<<j)));
      }
    }
  }
  return -1;
}


int main(){

  while(cin >> n >> m >> p >> a >> b, n){
    a--, b--;
    for(int i = 0; i < n; i++){
      cin >> ticket[i];
    }
    for(int i = 0; i < p; i++){
      int x, y, z;
      cin >> x >> y >> z;
      x--, y--;
      info[x].push_back( edge( y, z));
      info[y].push_back( edge( x, z));
    }
    double ret = Dijkstra();
    if(ret == -1) cout << "Impossible" << endl;
    else cout << fixed << setprecision(5) << ret << endl;
    
    for(int i = 0; i < m; i++) info[i].clear();
  }
  return(0);
}

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

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

#define ll long long
#define vl vector<ll>
#define vll vector<vl>
#define P pair<ll, int>

const int INF = 1e9;
const long double pi=3.14159265358979323846;

#define E pair<int, ll>

#define pb push_back

ll gojo(ll a)
{
	return a*a*a*a*a;
}


int main() {
	ll x;
	cin >> x;
	for(ll a=-200; a<=200; a++)for(ll b=-200; b<=200; b++)
	{
		if(gojo(a)-gojo(b)==x)
		{
			cout << a << ' ' << b << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define INF (1<<31)
//#define int long long

using namespace std;

int n, t, s, a[3005], b[3005], dp[3005];

signed main() {
  cin >> n >> t >> s;

  for (int i = 1; i <= n; ++i)
    cin >> a[i] >> b[i];

  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = t; 0 <= j - b[i]; --j) {
      int nx = j - b[i];
      if ((s <= nx) || (j <= s))
	dp[j] = max(dp[j], dp[nx] + a[i]);
      ans = max(ans, dp[j]);
    }
  }

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

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

int main(void){
  int n;
  while(cin >> n && n != 0){
    int x, y, h, w, fee = 0;
    for(int i = 0; i < n; i++){
      cin >> x >> y >> h >> w;
      int size = x + y + h;
      if(size <= 60 && w <= 2) fee += 600;
      else if(size <= 80 && w <= 5) fee += 800;
      else if(size <= 100 && w <= 10) fee += 1000;
      else if(size <= 120 && w <= 15) fee += 1200;
      else if(size <= 140 && w <= 20) fee += 1400;
      else if(size <= 160 && w <= 25) fee += 1600;
    }
    cout << fee << endl;
  }
  return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int max_diff = a[0] + (k - a[n-1]);
    for (int i = 1; i < n; i++) {
        max_diff = max(max_diff, a[i] - a[i-1]);
    }
    cout << k - max_diff << endl;
    return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

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

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s) cout << fixed << setprecision(10) << s << endl;


int main()
{
	ll x, n;
	cin >> x >> n;

	vector<ll> a(110);
	for (ll i = 0; i < n; i++)
	{
		ll b;
		cin >> b;

		a[b]++;
	}

	if (n == 0)
	{
		println(x);
		return 0;
	}


	ll r0 = -1;
	for (ll i = x; i >= 0; i--)
	{
		if (a[i] == 0)
		{
			r0 = i;
			break;
		}
	}

	ll r1 = 101;
	for (ll i = x + 1; i < a.size(); i++)
	{
		if (a[i] == 0)
		{
			r1 = i;
			break;
		}
	}

	if (abs(r0 - x) > abs(r1 - x))
	{
		println(r1);
	}
	else
	{

		println(r0);
	}
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	std::string str;
	bool okada;
	int n,m,x,small=0,big=0;
	int num[100];
	std::cin >> n >> m >> x;
	for (int i = 0; i < m; i++) {
		std::cin >> num[i];
		if (num[i] < x) {
			small++;
		}
		if (num[i] > x) {
			big++;
		}
	}
	std::cout << min(small, big) << std::endl;;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
   int n;
   cin>>n;
   map<int,string> m;
   m[2]=m[5]=m[7]=m[9]=m[4]="hon";
   m[0]=m[1]=m[6]=m[8]="pon";
   m[3]="bon";
   int d=n%10;
   cout<<m[d];
}


Measured memory_bytes: 3608
#include <stdio.h>

int main(void){
    int cup[3]={1,0,0},tmp; 
    char c1,c2;
    
    int i,j;

    for(j=0;j<50;j++){
      if(scanf("%c,%c\n", &c1, &c2)==EOF){break;}
      for(i=0;i<3;i++)
      {
          tmp=cup[c1-'A']; 
          cup[c1-'A']=cup[c2-'A'];
          cup[c2-'A']=tmp;
          break;
      }
   }
     printf("%c\n", cup[0] * 'A' + cup[1] * 'B' + cup[2] * 'C');

    return 0;
}

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

int main(void) {
  int n; cin >> n;
  vector<int> s1, s2;

  int ans = 0;
  rep (i, n) {
    int s; cin >> s;
    ans += s;
    if (s % 10 == 0) s1.push_back(s);
    else s2.push_back(s);
  }
  if (s2.size() == 0) {
    cout << 0 << endl;
    return 0;
  }

  sort(s2.begin(), s2.end(), greater<int>());

  while (ans % 10 == 0) {
    ans -= s2[s2.size() - 1];
    s2.pop_back();
  }
  cout << ans << endl;
  return 0;
}


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

public class Main {
	Scanner in = new Scanner(System.in);
	int n, w, d;
	int[] W = new int[102];
	int[] D = new int[102];
	int[] area = new int[102];
	final int INF = 100001;

	public void run() {
		while (true) {
			n = in.nextInt();
			w = in.nextInt();
			d = in.nextInt();
			if ((n | w | d) == 0) break;

			Arrays.fill(W, INF);
			Arrays.fill(D, INF);
			Arrays.fill(area, INF);

			W[0] = w;
			D[0] = d;
			area[0] = w * d;

			int w1, w2, d1, d2;
			for (int i = 0; i < n; i++) {
				/*
				for (int j = 0; j < area.length; j++) {
					if (area[j] == INF) break;
					System.out.print(area[j] + " ");
				}
				System.out.println();
				for (int j = 0; j < area.length; j++) {
					if (area[j] == INF) break;
					System.out.print(W[j] + " ");
				}
				System.out.println();
				for (int j = 0; j < area.length; j++) {
					if (area[j] == INF) break;
					System.out.print(D[j] + " ");
				}
				System.out.println();
				*/
				int next = in.nextInt() - 1;
				int nw = W[next];
				int nd = D[next];
				for (int j = next; j < i; j++) {
					area[j] = area[j+1];
					D[j] = D[j+1];
					W[j] = W[j+1];
				}

				int pos = in.nextInt();
				for (; pos > (nw + nd) * 2; pos -= (nw + nd) * 2);

				if (pos < nw) {
					d1 = d2 = nd;
					w1 = pos;
					w2 = nw - pos;
				} else if (pos < nw + nd) {
					pos -= nw;
					w1 = w2 = nw;
					d1 = pos;
					d2 = nd - pos;
				} else if (pos < nw * 2 + nd) {
					pos -= (nd + nw);
					d1 = d2 = nd;
					w1 = pos;
					w2 = nw - pos;
				} else {
					pos -= (nd + nw * 2);
					w1 = w2 = nw;
					d1 = pos;
					d2 = nd - pos;
				}
				if (w1 * d1 > w2 * d2) {
					int temp = w1;
					w1 = w2;
					w2 = temp;
					temp = d1;
					d1 = d2;
					d2 = temp;
				}
				W[i] = w1; W[i + 1] = w2;
				D[i] = d1; D[i + 1] = d2;
				area[i] = w1 * d1; area[i + 1] = w2 * d2;							
			}
			Arrays.sort(area);
			System.out.print(area[0]);
			for (int i = 1; i < area.length; i++) {
				if (area[i] == INF) break;
				System.out.print(" " + area[i]);
			}
			System.out.println();
		}
	}
	
	public static void main(String args[]) {
		new Main().run();
	}
}

Measured memory_bytes: 35564
# coding: utf-8
# Your code here!

#coding:utf-8

elements = input().split()
w = int(elements[0])
h = int(elements[1])
x = int(elements[2])
y = int(elements[3])
r = int(elements[4])

if x<=0 or y<=0:
    print("No")

elif x>=r and y>=r and x+r<=w and y+r<=h:
        print("Yes")
else:
    print("No")



Measured memory_bytes: 5600