akhauriyash/Code-Regression huggingface dataset:
#include<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#include<utility>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define fori(i,k,n) for(int i=k;i<(int)n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
/*
(char)'1' - (int)48 = (int)1;


*/


int main()
{
	int n, q;
	cin >> n >> q;
	for (; n != 0 || q != 0; cin >> n >> q)
	{
		int a[110] = {};
		for (int l = 0; l < n; l++)
		{
			int c;
			cin >> c;
			for (int i = 0; i < c; i++)
			{
				int j;
				cin >> j;
				a[j]++;
			}
		}
		int m = 0; int z=-1;
		for (int i = 1; i < 101; i++)
		{
			if (a[i]>m)
			{
				m = a[i];
				z = i;
			}
		}
		if (z != -1&&a[z]>=q)cout << z << endl;
		else cout << 0 << endl;


	}
}

Measured memory_bytes: 1160
//#include <algorithm>
//#include <cstdio>
//#include <functional>
#include <iostream>
//#include <cfloat>
//#include <climits>
//#include <cstdlib>
//#include <cstring>
#include <cmath>
//#include <map>
//#include <queue>
//#include <set>
//#include <sstream>
//#include <stack>
//#include <string>
//#include <time.h>
//#include <vector>
//#include <random>
//#include <unordered_set>
//#include <complex>
#define WAIT system ("pause")
#define rt0 return 0
using namespace std;
int main()
{
	int A,B,x,y;
	char grid[100][100];
	cin>>A>>B;
	
	for(int y=0;y<50;y++){
		for(int x=0;x<100;x++){
			grid[y][x]='.';
			grid[y+50][x]='#';
		}
	}
	
	A--;
	B--;
	 
	x=1;
	y=0;
	while(B>0){
		grid[y][x]='#';
		x+=2;
		if(x>99){
			y+=2;
			x%=99;
		}
		B--;
	}

	x=1;
	y=51;
	while(A>0){
		grid[y][x]='.';
		x+=2;
		if(x>99){
			y+=2;
			x%=99;
		}
		A--;
	}	

	cout<<100<<" "<<100;	
	for(y=0;y<100;y++){
		cout<<endl;
		for(x=0;x<100;x++) cout<<grid[y][x];
	}
	
    rt0;
}


Measured memory_bytes: 256
import Data.List
import Data.Maybe

main :: IO()
main = getContents >>= putStr.format.(\xs-> (solve ([],xs), sort xs)).map read.words.(!!1).lines

format :: (([Int],[a]),[Int]) -> String
format ((ns, _), xs) = unlines [unwords $map show xs, show $sum ns] 

solve    :: ([Int],[Int]) -> ([Int], [Int])
solve (n, []) = (n, [])
solve (n, xs) = let s = minimum xs in solve ((fromJust $elemIndex s xs):n, delete s xs)

Measured memory_bytes: 4164
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		LinkedList<Integer> list = new LinkedList<>();
		ListIterator<Integer> it = list.listIterator();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
		    int type = sc.nextInt();
		    if (type == 0) {
		        it.add(sc.nextInt());
		        it.previous();
		    } else if (type == 1) {
		        int x = sc.nextInt();
		        if (x > 0) {
		            while(x > 0) {
		                it.next();
		                x--;
		            }
		        } else {
		            while (x < 0) {
		                it.previous();
		                x++;
		            }
		        }
		    } else {
		        it.next();
		        it.remove();
		    }
		}
		for (int x : list) {
		    sb.append(x).append("\n");
		}
		System.out.print(sb);
	}
}



Measured memory_bytes: 272736
/*
    In the name of
        "ALLAH"
    And say "AL-HAMD-U-LILLAH"
*/

#include<bits/stdc++.h>
#define   ll   long long
#define   llu  unsigned long long
#define   _    printf("\n")
int      take() {
    int n;
    scanf("%d",&n);
    return n;

}
double  ttake() {
    double n;
    scanf("%lf",&n);
    return n;
}
ll     takes() {
    ll n;
    scanf("%lld",&n);
    return n;

}

#define  Int            take()
#define  Dnt            ttake()
#define  LL             takes()
#define  done           {return 0;}
#define  fr(i,x,n,a)    for(int i=x;i<=n;i+=a)
#define  FR(a,b,x)      for(int i=(a);i<=(b);i+=(x))
#define  rfr(i,x,n,a)   for(int i=x;i>=n;i--)
int      cas;
#define  print          printf("Case %d:",++cas)
#define  vi             vector<int>
#define  vl              vector<ll>
#define  pb              push_back
#define  pii             pair<int,int>
#define  vii             vector<pii>
#define  pll             pair<ll,ll>
#define  pil             pair<int,ll>
#define  pli             pair<ll,int>
#define  mk              make_pair
#define  fill(x,v)       memset(x,v,sizeof x)

using    namespace      std;

bool     approximatelyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool     essentiallyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) > fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool     definitelyGreaterThan(float a, float b, float epsilon) {
    return (a - b) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool     definitelyLessThan(float a, float b, float epsilon) {
    return (b - a) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
#define  STR            {struct info}
#define  dbg(x)         {cout<<"ekhane"<<x<<endl;}
#define  SS             second
#define  FF             first
#define  PQ             priority_queue
#define  great          greatest
#define  less           lesser
#define  mii            map<int,int>
#define  mil            map<int,ll>
#define  mll            map<ll,ll>
#define  msb            map<string,bool>
#define  V              vector
#define  M              100005
#define  pf             printf
//////////////////////////////////////////


int main(){

   int a = Int , b = Int , x = Int ;
   if( x < a || x > ( a + b ) ) pf("NO\n") ;
   else pf("YES\n") ;

    done;
}




Measured memory_bytes: 256
class UnionFind
  attr_accessor :group
  def initialize(size)
    @rank = Array.new(size, 0)
    @parent = Array.new(size, &:itself)
    @group = size
  end

  def unite(id_x, id_y)
    id_x-=1
    id_y-=1
    x_parent = get_parent(id_x)
    y_parent = get_parent(id_y)
    return if x_parent == y_parent
    @group-=1
    if @rank[x_parent] > @rank[y_parent]
      @parent[y_parent] = x_parent
    else
      @parent[x_parent] = y_parent
      @rank[y_parent] += 1 if @rank[x_parent] == @rank[y_parent]
    end
  end

  def get_parent(id_x)
    @parent[id_x] == id_x ? id_x : (@parent[id_x] = get_parent(@parent[id_x]))
  end

  def same_parent?(id_x, id_y)
    get_parent(id_x) == get_parent(id_y)
  end
end

n,m=gets.split.map(&:to_i)
u=UnionFind.new(n)
m.times do
  x,y=gets.split.map(&:to_i)
  u.unite(x,y)
end
p u.group-1


Measured memory_bytes: 15916
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n, ans = 0;
	cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	vector<int> c(n-1);

	for(int i=0;i<n;i++) cin>>a.at(i);
	for(int i=0;i<n;i++) cin>>b.at(i);
	for(int i=0;i<n-1;i++) cin>>c.at(i);

	for(int i=0;i<n;i++){
		ans += b.at(a.at(i)-1);
		if(i!=0 && a.at(i-1)==a.at(i)-1)
			ans += c.at(a.at(i)-2);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
N,A,B=$<.read.split.map(&:to_i)
MOD=10**9+7

def pow(a,b,mod)
    res = 1
    while 0 < b
        res = res * a % mod if b & 1 == 1
        a = a * a % mod
        b >>= 1
    end
    res
end

def f(a,b,mod)
    i = a
    n = 1
    while i <= b
        n = n*i % mod
        i += 1
    end
    n
end

def inv(a,mod)
    pow(a,mod-2,mod)
end

def comb(a,b,mod)
    x = (a-b+1..a).inject(1) {|n,x| n*x%mod }
    y = (1..b).inject(1) {|n,x| n*x%mod }
    x * inv(y,mod) % mod
    # (f(a-b+1,a,mod) * inv(f(1,b,mod),mod)) % mod
end

ret = (pow(2,N,MOD) - 1 - comb(N,A,MOD) - comb(N,B,MOD)) % MOD
puts ret

Measured memory_bytes: 3836
#include <iostream>
#include <vector>
using namespace std;
int const MAX = 100003;
volatile bool not_prime[MAX + 1];

int main(){
  int x;
  cin >> x;
  
  vector<int> unko;
  for (int i = 2; i <= MAX; ++i) {
    if (!not_prime[i]) {
      unko.push_back(i);
      for (int j = 1; j <= MAX / i; ++j) not_prime[i * j] = true;
    }
  }
  cout << *lower_bound(unko.begin(), unko.end(), x);
  return 0;
}


Measured memory_bytes: 3776
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main() {
  string s;
  cin >> s;
  int l = s.size();
  vector<int> v(10,0);
  int cnt1 = 0;
  int cnt2 = 0;
  rep(i,l){
    if(s.at(i) == 'A' || s.at(i) == 'T' || s.at(i) == 'G' || s.at(i) == 'C'){
      cnt1++;
    	if(i == l-1){
        v[cnt2] = cnt1;
        }
    }
    else{
      v[cnt2] = cnt1;
      cnt1 = 0;
      cnt2++;
    }
  }
  int ans = 0;
  rep(i,10){
    ans = max(v[i],ans);
  }
  cout << ans << endl;
}
  

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


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

    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    cout << (a + b + c + d) - min({a, b, c, d}) + max(e, f) << '\n';
    return 0;
}


Measured memory_bytes: 3172
from collections import deque
n = int(input())
A = [input() for i in range(n)]

cnt = 0
dd = [[-1, 0], [0, -1], [1, 0], [0, 1]]
used = {}
for i in range(n):
    for j in range(n):
        if A[i][j] == 'x' or (i, j) in used:
            continue
        deq = deque([(j, i)])
        used[i, j] = 1
        cnt += 1
        while deq:
            x, y = deq.popleft()
            for dx, dy in dd:
                nx = x + dx; ny = y + dy
                if 0 <= nx < n and 0 <= ny < n:
                    if A[ny][nx] == 'o' and (ny, nx) not in used:
                        used[ny, nx] = 1
                        deq.append((nx, ny))
print(cnt//3)

Measured memory_bytes: 9008
import heapq


def qqq(path, par, reached):
    queue = []
    heapq.heappush(queue, 0)
    reached[0] = True

    while queue:
        queue_next = []
        for _ in range(len(queue)):
            p = heapq.heappop(queue)

            for i in path[p]:
                if reached[i] is False:
                    reached[i] = True
                    par[i] = p
                    heapq.heappush(queue_next, i)
        queue = queue_next

        if all(reached):
            break


def main():
    N, M = map(int, input().split())
    AB = [sorted(list(map(int, input().split()))) for _ in range(M)]

    path = [[] for _ in range(N)]

    for a, b in AB:
        path[a - 1].append(b - 1)
        path[b - 1].append(a - 1)

    par = [-1 for _ in range(N)]
    reached = [False for _ in range(N)]

    qqq(path, par, reached)

    if all(reached):
        print('Yes')
        for i in par[1:]:
            print(i + 1)
    else:
        print('No')


main()


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

int main(){
	string str;
	int cnt = 0;
	while(cin >> str){
		bool flag = false;
		for(int i=0;i<str.size()/2;i++){
			if(str[i]!=str[str.size()-i-1]) flag = true;		
		}
		if(!flag) cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 0
def resolve():
    O = input()
    E = input()
    ans = ""
    if len(O) == len(E):
        for i in range(len(O)):
            ans += O[i]
            ans += E[i]
    else:
        for i in range(len(E)):
            ans += O[i]
            ans += E[i]
        ans += O[-1]
    print(ans)
resolve()

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;

namespace ALDS1_3
{
    class Program
    {
        static void Main(string[] args)
        {
            var stack = new Stack<int>();
            foreach (var op in Console.ReadLine().Split())
            {
                int num;
                if (int.TryParse(op, out num))
                {
                    stack.Push(num);
                }
                else
                {
                    stack.Push(Calc(op, stack.Pop(), stack.Pop()));
                }
            }

            Console.WriteLine(stack.Pop());
        }

        private static int Calc(string operat, int operand1, int operand2)
        {
            switch (operat)
            {
                case "+":
                    return operand2 + operand1;
                case "-":
                    return operand2 - operand1;
                case "*":
                    return operand2 * operand1;
                default:
                    throw new ArgumentException();
            }
        }

    }
}

Measured memory_bytes: 20336
N=int(input())
F=[int(input().replace(' ',''),2) for i in range(N)]
#上記で2進数01を10進数化
P=[list(map(int,input().split())) for i in range(N)]
#print(max(sum([p[bin(f&i).count('1')] for f,p in zip(F,P)]) for i in range(1,2**10)))
ans = float('-inf')
for i in range(1, 2**10):
    sum=0#収益の初期値
    for f, p in zip(F,P):
        tmp2=bin(f & i).count('1')
        #他店ｆも自店ｇもオープンしてる時間帯数、共にビットが立っている
        sum+=p[tmp2]#オープン時間帯数を基にした収益を加算
    ans = max(ans, sum)#収益が最大なら更新
print(ans)

Measured memory_bytes: 3064
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 N1 = sc.nextInt();
			final int N2 = sc.nextInt();
			final int N3 = sc.nextInt();
			
			System.out.println(N1 + N2 + N3 >= 22 ? "bust" : "win");
		}
	}

	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: 22996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n) for (int i = n; 0<i;i--)
#define print(out) cout<< out  << "\n";
#define mod 1000000007
const int INF = 1e9;

int N,K;
string S;

int main(){
  vector<int> v{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cin>>K;
  print(v[K-1])
  
}


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

constexpr int SINT_MAX = std::numeric_limits<int>::max();
constexpr int SINT_MIN = std::numeric_limits<int>::min();

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;


template<class T>
T choose(bool b, T t, T f)
{
    if (b) return t;
    else return f;    
}

const char *YesNo(bool b)
{
    return choose(b, "Yes", "No");
}

const char *YESNO(bool b)
{
    return choose(b, "YES", "NO");
}

template<class NumT>
NumT diffabs(NumT l, NumT r)
{
    if (l < r) return r-l;
    else return l-r;    
}

struct myinout_t {} io;

template<class T>
myinout_t &operator >>(myinout_t &my, T &i)
{
    cin >> i;
    return my;
}

myinout_t &operator >>(myinout_t &my, int &i)
{
    int r = scanf("%d", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

myinout_t &operator >>(myinout_t &my, ll &i)
{
    int r = scanf("%lld", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

template<class T>
myinout_t &operator <<(myinout_t &my, const T &i)
{
    cout << i;
    return my;
}

myinout_t &operator <<(myinout_t &my, int i)
{
    printf("%d", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, ll i)
{
    printf("%lld", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, double i)
{
    printf("%.20f", i);
    return my;
}

constexpr char BR = '\n';


///////////////////////////////////////////////////

int main()
{
    int R, C, K;
    io >> R >> C >> K;

    vvi V(R, vi(C, 0));
    for (int i = 0; i < K; i++)
    {
        int r, c, v;
        io >> r >> c >> v;
        V[r-1][c-1] = v;
    }

    vvvll dp(R, vvll(C, vll(4, 0)));
    dp[0][0][1] = V[0][0];

    for (int i = 0; i < R; i++)
    {
        for (int j = 0; j < C; j++)
        {
            if (i > 0)
            {
                ll local_max = 0;
                for (int k = 0; k <= 3; k++)
                    local_max = max(local_max, dp[i-1][j][k]);
                dp[i][j][0] = local_max;
                dp[i][j][1] = local_max + V[i][j];
            }
            if (j > 0)
            {
                for (int k = 1; k <= 3; k++)
                {
                    dp[i][j][k] = max({dp[i][j][k], dp[i][j-1][k], dp[i][j-1][k-1] + V[i][j]});
                }
            }
        }
    }

    ll ans = 0;
    for (int k = 0; k <= 3; k++)
    {
        ans = max(ans, dp[R-1][C-1][k]);
    }
    io << ans << BR;
}

Measured memory_bytes: 671020
#include<bits/stdc++.h>
using namespace std;
int s[1000050];
int main()
{
    int n;
    while(cin>>n)
    {
        int flag = 0;
        for(int i=0;i<n;i++)
            cin>>s[i];
        for(int i=n-2;i>0;i--)
        {
            if(s[i]>s[i+1])
            {
                s[i]--;
                if(s[i]>s[i+1])
                    flag = 1;
            }
        }
        printf(flag?"No\n":"Yes\n");

    }
    return 0;
}


Measured memory_bytes: 640
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int n,k; cin >> n >> k;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  vector<ll> s(n+1);
  rep(i,n) s[i+1]=s[i]+a[i];
  vector<ll> b(0);
  rep(i,n){
    for(int j=i+1;j<=n;j++){
      b.push_back(s[j]-s[i]);
    }
  }
  ll x=0;
  for(int j=40;j>=0;j--){
    int cnt=0;
    rep(i,b.size()){
      if((b[i]&((1ll<<j)+x))==(1ll<<j)+x) cnt++;
    }
    if(cnt>=k) x+=1ll<<j;
  }
  cout << x << endl;
}

Measured memory_bytes: 6516
def ordinary_number(p)
  f = ->(a, b, c) {
    a, c = c, a if a > c
    a < b && b < c
  }

  ans = 0
  1.upto(p.size - 2) do |i|
    ans += 1 if f.call(p[i - 1], p[i], p[i + 1])
  end
  ans
end

n = gets
p = gets.split.map(&:to_i)
puts ordinary_number(p)


Measured memory_bytes: 1916
#include <iostream>

int main() {
	int map[100][100];
	int a, b;
	int max = 0;
	int sum;
	bool flg;
	
	// Create a map. If Input( 0, 0), check the map.
	while(std::cin >> a >> b) {
		if(!a && !b) {
			// see if We can do one-stroke sketch in the map.
			flg = false;
			for( int i=0; i<max; i++) {
				sum = 0;
				for( int j=0; j<max; j++) sum += map[i][j];
				// If a point is 'Odd Point', we can't do one-stroke sketch in this map.
				if( (sum%2==1 && i>=2) || ( i<2 && sum>1) ) {flg=true; break;}
			}
			std::cout << ( flg ? "NG" : "OK" ) << std::endl;
			// Clear the map.
			for( int i=0; i<10000; i++) map[i/100][i%100] = 0;
			max = 0;
		}else {
			// Connect between two points.
			map[a-1][b-1] ++; map[b-1][a-1] ++;
			if(max<a) max = a; if(max<b) max = b;
		}
	}
}

Measured memory_bytes: 1192
#include <iostream>
#include <math.h>
#include <vector>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

typedef long long ll;

using namespace std;

bool check(int n,const vector<int> &D){
  while(n>0){
    if(find(D.begin(),D.end(),n%10)!=D.end()){
      return false;
    }else{
      n/=10;
    }
  }
  return true;
}

int main(){
  int N,K;
  cin>>N>>K;
  vector<int> D(K);
  for(int i=0;i<K;i++)cin>>D[i];
  for(int i=N;i<=10*N;i++){
    if(check(i,D)){
      cout<<i<<endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2

using namespace std;
int MOD = 1000000007;

signed main(){
    int n,k;
    cin >> n >> k;
    int ans = 0;
    int used[100010] = {0};
    vector<pair<int,int>> p;
    vector<pair<int,int>> q;
    rep(i,n){
        int t,d;
        cin >> t >> d;
        //p.pb(MP(t,d));
        q.pb(MP(d,t));
    }
    //SORT(p);
    sort(q.begin(),q.end(),greater<pair<int,int>>());
    rep(i,n){
        cerr << q[i].fi << " " << q[i].se << endl;
    }
    int cnt = 0;
    rep(i,k){
        ans += q[i].fi;
        if(used[q[i].se] == 0) cnt++;
        used[q[i].se]++;
    }
    ans += cnt*cnt;
    if(k == n){
        cout << ans << endl;
        return 0;
    }
    int low = k-1;
    int high = k;
    int res = ans;
    while(1){
        int mi = -1;
        int plus = -1;
        while(1){
            if(low == -1)break;
            if(used[q[low].se] == 1){
                low--;
            }else{
                mi = q[low].fi;
                used[q[low].se]--;
                low--;
                break;
            }
        }
        while(1){
            if(high == n)break;
            if(used[q[high].se] == 0){
                plus = q[high].fi;
                used[q[high].se]++;
                high++;
                break;
            }else{
                high++;
            }
        }
        if(mi == -1 || plus == -1){
            cout << ans << endl;
            return 0;
        }
        res = res + plus - mi - cnt*cnt + (cnt+1)*(cnt+1);
        ans = max(ans,res);
        cnt++;
        cerr << ans << " " << cnt << endl;
        if(low == -1 || high == n){
            cout << ans << endl;
            return 0;
        }
    }
    


    cout << ans << endl;
    return 0;   
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://ddcc2019-final.contest.atcoder.jp/tasks/ddcc2019_final_a
// rm -r -f test;oj dl http://arc060.contest.atcoder.jp/tasks/arc060_a

Measured memory_bytes: 4212
#include<stdio.h>
int main(void)
{
	int number1, number2, number3,mini;
	scanf("%d%d%d", &number1, &number2, &number3);
	if (number1 > number2)
	{
		mini = number1;
		number1 = number2;
		number2 = mini;
	}
	if (number2 > number3)
	{
		mini = number2;
		number2 = number3;
		number3 = mini;
	}
	if (number1 > number2)
	{
		mini = number1;
		number1 = number2;
		number2 = mini;
	}
	printf("%d %d %d\n", number1, number2, number3);

	return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};

int main(){
    int k,x;cin >> k >> x;
    for (int i = x-k+1; i < x+k; i++) {
        cout << i << (i==x+k-1?"\n":" ");
    }
    return 0;
}


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

int main() {
    int N;
    cin >> N;
    string w[101];
    rep(i, N) {
        cin >> w[i];
    }
    bool ans = true;

    rep(i, N-1) {
        if(w[i+1][0] != w[i][w[i].length()-1]) {
            ans = false;
        }
    }

    rep(i, N) {
        rep(j, i) {
            if(w[i] == w[j]) {
                ans = false;
            }
        }
    }

    if(ans) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }

    cout << endl;
    return 0;
}

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

namespace A
{
	class Program
	{
		static void Main()
		{
			var c = char.Parse(Console.ReadLine());

			switch (c)
			{
				case 'A':
					Console.WriteLine("T");
					break;
				case 'C':
					Console.WriteLine("G");
					break;
				case 'G':
					Console.WriteLine("C");
					break;
				case 'T':
					Console.WriteLine("A");
					break;
				default:
					break;
			}
		}
	}
}


Measured memory_bytes: 11092
import java.util.*;
public class Main { 
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		MyComp comp = new MyComp();
		while(true) {
			int n = stdIn.nextInt();
			int m = stdIn.nextInt();
			if(n == 0 && m == 0) break;
			PriorityQueue<Data> list = new PriorityQueue<Data>(m+1,comp);
			boolean[] infected = new boolean[n+1];
			infected[1] = true;
			for(int i = 0; i < m; i++) {
				int t = stdIn.nextInt();
				int s = stdIn.nextInt();
				int d = stdIn.nextInt();
				list.add(new Data(t,s,d));
			}
			int ans = 1;
			for(int i = 0; i < m; i++) {
				Data tmp = list.poll();
				if(infected[tmp.s] && !infected[tmp.d]) {
					infected[tmp.d] = true;
					ans++;
				}
			}
			
			System.out.println(ans);
		}
	}
}

class Data {
	int time;
	int s;
	int d;
	Data(int t, int a, int b) {
		time = t;
		s = a;
		d = b;
	}
}

class MyComp implements Comparator<Data> {
	public int compare(Data o1, Data o2) {
		if(o1.time < o2.time)
			return -1;
		if(o1.time > o2.time)
			return 1;
		return 0;
	}
	
}

	

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

using namespace std;

#define il inline
#define Rep(i, s, e) for (int i = s; i <= e; ++i)
#define Dep(i, s, e) for (int i = s; i >= e; --i)
#define file(a) freopen(#a".in", "r", stdin), freopen(#a".out", "w", stdout)

const int N = 200010;

il int read() {
    int x = 0; bool f = true; char c = getchar();
    while (!isdigit(c)) {if (c == '-') f = false; c = getchar();}
    while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}

int n;
char s[N];

int main() {
    n = read(), scanf("%s", s + 1);
    int cnt = 0;
    Rep(i, 1, n) {
        if (s[i] == 'R') ++cnt;
    }
    int ans = 0;
    Rep(i, cnt + 1, n) {
        if (s[i] == 'R') ++ans;
    }
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 4000
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fir first
#define sec second
#define MOD 1000000007
#define vvi vector<vector<int> >
#define vvs vector<vector<string> >
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define pb push_back
#define vi vector<int>
#define test(t) int t; cin>>t; while(t--)
#define vl vector<ll>
#define vb vector<bool>
#define vs vector<string>
#define vvl vector<vl>
#define loopin(i, n) for(int i = 0; i < (n); i++)
#define loopdec(i, n) for(int i = n-1; i >= 0; i--)
const int mod=1e9+7;
void solve(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll maxi1=max(a*c,a*d);
    ll maxi2=max(b*c,b*d);
    cout<<max(maxi1,maxi2)<<endl;               
}           

int main(){
ios_base ::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
  solve();
  
return 0;
}



Measured memory_bytes: 3644
/*
 * zyrch - Rupanshu Yadav
 */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <utility>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <cassert>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

#define forn(i,a,b) for (int i = (a); i < ll(b); ++i)
#define fo(i,a) forn(i,0,ll(a))
#define rforn(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define ro(i,a) rforn(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define rsz resize
#define ins insert

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define f first
//#define s second
ll mod = 1000000007;
inline int fast_expo(int base,int power,int modulo=mod){
    base%=modulo;
    if (base<0) base+=modulo;
    ll x=base,cnt=power,ans=1;
    while(cnt){
        if (cnt&1) ans=(ans*x)%modulo;
        x=(x*x)%modulo;
        cnt>>=1;
    }
    return ans;
}

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

const int INF = (int)1e9;
//=========================CODE STARTS HERE=============================//

int main() {

	fast_cin();

	ll n;
	cin >> n;
	ll k;
	cin >> k;
	vl arr(n);
	
	fo(i, n) {
		cin >> arr[i];
	}
	
	ll dp[n];
	dp[0] = 0;
	
	
	forn(i, 1, n) {
		ll Min = INF;
		fo(j, k) {
			if (i - j - 1 < 0) continue;
			Min = min(Min, dp[i - j - 1] + abs(arr[i] - arr[i - j - 1]));
		}
		dp[i] = Min;
	}
	//fo(i, n) {
		//cout << dp[i] << " ";
	//}cout << endl;
	cout << dp[n - 1] << endl;

    return 0;
}


Measured memory_bytes: 1792
from itertools import groupby

[N, K] = map(int, input().split())

num_of_perms = [1] * (K-1)
for i in range(1, K-1):
    num_of_perms[i] = num_of_perms[i-1] * ((K - 2) - i + 1) % 1000000007

Es = []
for _ in range(0, N-1):
    [a, b] = input().split()
    Es.append(int(a))
    Es.append(int(b))

if N == 1:
    res = K
else:
    res = K * (K-1)
    res %= 1000000007
    for g in groupby(sorted(Es)):
        c = len(list(g[1]))
        if c > K-1:
            res = 0
            break
        res *= num_of_perms[c-1]
        res %= 1000000007

print(res)


Measured memory_bytes: 18004
#include <iostream>

using namespace std;

typedef long long ll;

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

int main() {
  ll x, a, b;
  cin >> x;
  
  rep(i,200) rep(j,400) {
    ll k = 200 - j;
    if(x == i*i*i*i*i - k*k*k*k*k) {
      a = i;
      b = k;
    }
  }
  
  cout << a << " " << b << endl;
  return 0;
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;

int main(){
    ll a, b, k;
    cin >> a >> b >> k;
    cout << max((ll)0, a-k) << " " << max((ll)0, min(b, b-k+a)) << "\n";
    return 0;
}

Measured memory_bytes: 256
s=input()   
l=[0 for _ in range(len(s)-1)]
ans=[0 for _ in range(len(s))]
for i in range(len(s)-1):
    if s[i]==s[i+1]:
        l[i]=0
    else: l[i]=1

flag="R"
last=0
for i in range(len(s)-1):
    if l[i]==1 and flag=="R":
        if (i+1-last)%2==0:
            ans[i+1]+=int((i+1-last)/2)
            ans[i]+=int((i+1-last)/2)
        elif (i+1-last)%2==1:
            ans[i]+=(i+1-last)//2+1
            ans[i+1]+=(i+1-last)//2
        last=i+1
        flag="L"
    elif l[i]==1 and flag=="L":
        if (i+1-last)%2==0:
            ans[last-1]+=int((i+1-last)/2)
            ans[last]+=int((i+1-last)/2)
        elif (i+1-last)%2==1:
            ans[last]+=(i+1-last)//2+1
            ans[last-1]+=(i+1-last)//2
        last=i+1
        flag="R"
    else: pass
        
if (len(l)-last)==0:
    ans[-1]+=1
elif (len(l)-last)%2==0:
    ans[last-1]+=(len(l)-last+1)//2
    ans[last]+=(len(l)-last+1)//2+1
else:
    ans[last-1]+=int((len(l)-last+1)/2)
    ans[last]+=int((len(l)-last+1)/2)

string=""
for i in range(len(ans)):    
    string+=str(ans[i])+" "
print(string)

Measured memory_bytes: 5748
n,m=gets.split.map(&:to_i)

dsarray=[]

m.times{
    dsarray<<gets.split.map(&:to_i)
}
parray=gets.split.map(&:to_i)


answer=0

(2**n).times{|i|

    nisin=i.to_s(2).rjust(n, '0').split('')
    lightcount=0

    m.times{|j|
        ll=dsarray[j].length
        k=1
        switchcount=0
        (ll-1).times{
            switch=dsarray[j][k]
            if nisin[switch-1]=="1"
                switchcount+=1
            end
            k+=1
        }
        
        if switchcount%2==parray[j]
            lightcount+=1
        end
        
    }
    
    if lightcount==m
        answer+=1
    end
    
}


puts answer

Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
 
int main() {
long long int n,a,b;cin>>n;
  
  float root=sqrt(n);
  
  for(long long int i=1;i<=root;i++){
    if(n%i==0){a=n/i;b=i;}
  }
  
  cout<<a+b-2;
}
  
  

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

int main() {
    string s, t; cin >> s >> t;
    if (s == t.substr(0,s.size())) cout << "Yes" << endl;
    else cout << "No" <<endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn=1e5+1000;
ll t;
int main(){
    //freopen("in.txt","r",stdin);
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin>>t;
    ll res=1;
    for(;;res++){
        if(res*360%t==0) break;
    }res=res*360/t;
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
 
signed main(){
 int a;
 cin>>a;
 int b[3];
 for(int d=0;d<a;d++){
     for(int c=0;c<3;c++)scanf("%d",&b[c]);
 sort(b,b+3);
 if(b[0]*b[0]+b[1]*b[1]==b[2]*b[2])printf("YES\n");
 else printf("NO\n");
     }
}

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

using namespace std;

int main(int argc, char** argv)
{
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        int ans = 0;
        if(a != b) ans++;
        if(a != c) ans++;
        if(b != c) ans++;
        if(ans == 0) ans = 1;
        printf("%d\n", ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iterator>
#include <set>
#include <functional>

using namespace std;

#define DT long long
#define forn(i,n)for(i=0;i<n;i++)
#define forc(i,c,n)for(i=c;i<=n;i++)

int main() {
	ifstream fin("Text.txt");
	int i, j, q;
	DT a, b, c, d,p, n, m, k, s,t, d1,d2,d3,d4,d5,d6;
	//scanf("%I64d", &n);
	//scanf_s("%d", &n);
	cin >> n >> m;
	vector<DT>vc(n+1);
	forn(i, m) {
		cin >> a >> b;
		if (a == 1) {
			if (vc[b] == 0)
				vc[b] = 1;
			else if (vc[b] == 2)
				vc[b] = 3;
		}
		if (a == n) {
			if (vc[b] == 0)
				vc[b] = 2;
			else if (vc[b] == 1)
				vc[b] = 3;
		}
		if (b == 1) {
			if (vc[a] == 0)
				vc[a] = 1;
			else if (vc[a] == 2)
				vc[a] = 3;
		}
		if (b == n) {
			if (vc[a] == 0)
				vc[a] = 2;
			else if (vc[a] == 1)
				vc[a] = 3;
		}
	}
	forn(i, n) {
		if (vc[i + 1] == 3)
		{
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}
	cout << "IMPOSSIBLE" << endl;
	return 0;
}

Measured memory_bytes: 1792
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
//---------------------------------------------------------------
#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 rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
#define all(x) x.begin(),x.end()
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

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

    ll x;cin>>x;
    ll num=100;
    ll cnt = 0;

    while(num<x){
      num = num+num/100;
      cnt++;
    }

    cout<<cnt<<endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<complex>
#include<cstdio>
#include<queue>

using namespace std;

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

#define X real()
#define Y imag()

typedef long double D;
typedef complex<D> P;
struct L{P a, b;};
typedef vector<P> Pol;
struct C{P c; D r;};

const D EPS = 1e-8;
const D PI = acos(-1);

int sig(D a, D b = 0) {return a < b - EPS ? -1 : a > b + EPS ? 1 : 0;}
bool near(P a, P b) {return !sig(norm(a - b));}
namespace std{
  bool operator<(P a, P b) {return sig(a.X, b.X) ? a.X < b.X : a.Y < b.Y;}
}

D sr(D a) {return sqrt(max(a, (D)0));}

D dot(P a, P b) {return a.X * b.X + a.Y * b.Y;}
D det(P a, P b) {return a.X * b.Y - a.Y * b.X;}

P vec(L a) {return a.b - a.a;}

D arg(P base, P a, P b) {return arg((b - base) / (a - base));}

P proj(P a, P b) {return a * dot(a, b) / norm(a);}
P perp(L l, P p) {return l.a + proj(vec(l), p - l.a);}

pair<P, P> pCL(C c, L l) {
  P x = perp(l, c.c);
  P y = vec(l) / abs(vec(l)) * sr(c.r * c.r - norm(x - c.c));
  return make_pair(x - y, x + y);
}

D aCTnc(D r, P p1, P p2) {return sig(abs((p1 + p2) / (D)2), r) <= 0 ? det(p1, p2) / 2 : r * r * arg(0, p1, p2) / 2;}
D aCT(D r, P p1, P p2) {
  if (!sig(r) || near(0, p1) || near(0, p2) || near(p1, p2)) return 0;
  pair<P, P> pp = pCL((C){0, r}, (L){p1, p2});
  if ((p1 < pp.first) != (pp.first < p2) && (p1 < pp.second) != (pp.second < p2)) return aCTnc(r, p1, p2);
  return aCTnc(r, p1, pp.first) + aCTnc(r, pp.first, pp.second) + aCTnc(r, pp.second, p2);
}
D aCPol(C c, Pol pol) {D res = 0; rep (i, pol.size()) res += aCT(c.r, pol[i] - c.c, pol[(i + 1) % pol.size()] - c.c); return res;}

int main() {
  int n, r;
  cin >> n >> r;
  Pol pol(n);
  rep (i, n) cin >> pol[i].X >> pol[i].Y;
  D res = 0;
  rep (i, r) {
    if (i % 2) res += (i * 2 + 1) * PI - aCPol((C){0, (D)(i + 1)}, pol) + aCPol((C){0, (D)i}, pol);
    else res += aCPol((C){0, (D)(i + 1)}, pol) - aCPol((C){0, (D)i}, pol);
  }
  printf("%.12Lf\n", res);
  return 0;
}

Measured memory_bytes: 1288
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
struct kkk
{
	int sc,s;
}ans[1010];
int comp(kkk a,kkk b)
{
	if(a.sc>b.sc)return 1;
	if(a.sc<b.sc)return 0;
	if(a.sc==b.sc)
	{
		if(a.s<b.s)return 1;
		else return 0;
	}
}
int main()
{
	int i,j,n,m,k;
	while(scanf("%d%d",&n,&m)&&n!=0&&m!=0)
	{
		memset(ans,0,sizeof(ans));
	for(i=1;i<=m;i++)
	{
		ans[i].s=i;
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			cin>>k;
			ans[j].sc+=k;
		}
	}
	sort(ans+1,ans+1+m,comp);
	cout<<ans[1].s;
	for(i=2;i<=m;i++)
	{
		cout<<" "<<ans[i].s;
	}
	cout<<endl;
    }
	return 0;
}


Measured memory_bytes: 3212
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

A = list(input())
B = list(input())
B.reverse()


def ok():
    for a, b in zip(A, B):
        if a != b:
            return False

    return True

print("YES" if ok() else "NO")

Measured memory_bytes: 9632
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define db long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator

#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define EB emplace_back
#define fi first
#define se second

#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));

#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2

#define INF ((1ll<<60)-233)
#define sqr(x) ((x)*(x))
#define debug puts("wzpkking")
using namespace std;

const int N=505;
const int LIM=8000;
int fl[LIM],pri[LIM],n;
void initprime(){
	For(i,2,LIM-1) For(j,2,(LIM-1)/i) fl[i*j]=1;
	For(i,2,LIM-1) if (!fl[i]) pri[++*pri]=i;
}
map<int,int> mp1,mp2;
map<ll,int> mp3;
ll ans[N][N];
ll gcd(ll x,ll y){
	return y?gcd(y,x%y):x;
}
void work(){
	int l=1;
	For(i,1,n) For(j,1,n) if ((i+j)&1){
		if (!mp1[i+j]) mp1[i+j]=pri[l++]; ans[i][j]=mp1[i+j];
		mp3[ans[i][j]]=1;
	}
	For(i,1,n) For(j,1,n) if ((i+j)&1){
		if (!mp2[i-j]) mp2[i-j]=pri[l++]; ans[i][j]*=mp2[i-j];
	}
	ll mx=0;
	For(i,1,n) For(j,1,n) if (!ans[i][j]){
		ll lcm=1;
		if (i!=1) lcm*=ans[i-1][j]/gcd(ans[i-1][j],lcm);
		if (i!=n) lcm*=ans[i+1][j]/gcd(ans[i+1][j],lcm);
		if (j!=1) lcm*=ans[i][j-1]/gcd(ans[i][j-1],lcm);
		if (j!=n) lcm*=ans[i][j+1]/gcd(ans[i][j+1],lcm);
		ans[i][j]=lcm+1;
		for (;mp3[ans[i][j]];ans[i][j]+=lcm);
		mp3[ans[i][j]]=1;
		//if (ans[i])
		mx=max(mx,ans[i][j]);
	}
	For(i,1,n){
		For(j,1,n) printf("%lld ",ans[i][j]);
		puts("");
	}
}

int main(){
	scanf("%d",&n);
	initprime();
	work();
}

Measured memory_bytes: 13056
N = int(input())
abc = [tuple(map(int, input().split())) for _ in range(N)]
dp = [[0] * 3 for _ in range(N+1)]
for i in range(N):
    dp[i+1][0] = max(dp[i][1], dp[i][2]) + abc[i][0]
    dp[i+1][1] = max(dp[i][0], dp[i][2]) + abc[i][1]
    dp[i+1][2] = max(dp[i][0], dp[i][1]) + abc[i][2]
print(max(dp[N]))

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

int main() {
  int r;
  cin >> r;
  int ans = 3 * r * r;
  cout << ans << endl;
  return 0;
}

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

int main (void) {
  
  string s, t;
  cin >> s >> t;
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i]) {
      ans++;
    }
  }
  
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    vector<vector<ll>> cake(n, vector<ll>(3));
    for (ll i = 0; i < n; i++)
    {
        cin >> cake[i][0] >> cake[i][1] >> cake[i][2];
    }
    ll ans = -LLINF;
    for (int bit = 0; bit < (1 << 3); bit++)
    {
        vector<ll> rec;
        for (int i = 0; i < n; i++)
        {
            ll tmp = 0;
            for (int j = 0; j < 3; j++)
            {
                if (bit & (1 << j))
                {
                    tmp += cake[i][j];
                }
                else
                {
                    tmp -= cake[i][j];
                }
            }
            rec.push_back(tmp);
        }
        sort(RALL(rec));
        ll res = 0;
        for (ll i = 0; i < m; i++)
        {
            res += rec[i];
        }
        chmax(ans, res);
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
import java.util.Scanner;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long y = sc.nextLong();
        long count = 0;
        while (x <= y){
            x = x*2;
            count++;
        }
        System.out.println(count);
    }
}

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

int main(void){
    int n,i,ans;
    ans = 0;

    cin >> n;
    vector<int>  a(n);
    for(i=0; i<n; i++){
        cin >> a.at(i);
        ans += a.at(i) - 1;
    }

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

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

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

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

/*==================================================*/
/*variable*/
int A, B, C;

/*==================================================*/
/*function*/

/*==================================================*/

int main() {
    cin>>A>>B>>C;
    if(A + B >= C) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 888