akhauriyash/Code-Regression huggingface dataset:
/*
created by: Son Dinh
*/
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sqr(X) ((X)*(X))
#define sz(x) ((int)(x).size())
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
string s;
int res;
bool ok(char x){
    return (x=='A'||x=='C'||x=='G'||x=='T');
}
int main(){
    cin>>s;
    int i=0;
    while(i<sz(s)){
        int j=i;
        while(j<sz(s)&&ok(s[j])) j++;
        res=max(res,j-i);
        if(j==i) i++;
        else i=j;
    }
    cout<<res;
}



Measured memory_bytes: 256
def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    step = [0 for i in range(N)]

    for i in range(N - 1):
        if A[i] > A[i + 1]:
            step[i + 1] = A[i] - A[i + 1]
            A[i + 1] = A[i]

    ans = sum(step)
    print(ans)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 32192
def r(a): #圧縮された要素を保持
    ll,l=[],1
    for i in range(len(a)-1):
        if a[i]==a[i+1]:
            l+=1
        else:
            ll.append([l,a[i]])
            l=1
    ll.append([l,a[-1]])
    return ll

n=int(input())
v=list(map(int,input().split()))
a,b=sorted(r(sorted(v[::2])),reverse=True),sorted(r(sorted(v[1::2])),reverse=True)
a.append([0,0])
b.append([0,0])
if a[0][1]!=b[0][1]:
    print(n-a[0][0]-b[0][0])
elif a[1][0]>=b[1][0]:
    print(n-a[1][0]-b[0][0])
elif a[1][0]<b[1][0]:
    print(n-a[0][0]-b[1][0])

Measured memory_bytes: 22120
import java.util.Scanner;

public class Main {
	final boolean DEBUG = false;
	class Node {
		int key;
		Node p, l, r;
		Node(int key) {
			this.key = key;
		}
		void insert(Node z) {
			Node y = null;
			Node x = this;
			while (x != null) {
				y = x;
				if (z.key < x.key)
					x = x.l;
				else
					x = x.r;
			}
			z.p = y;
			
			if (z.key < y.key)
				y.l = z;
			else
				y.r = z;
		}
		boolean find(int key) {
			Node x = this;
			while (x != null) {
				if (key == x.key)
					return true;
				else if (key < x.key)
					x = x.l;
				else
					x = x.r;
			}
			return false;
		}
		void print() {
			this.inorder();
			System.out.println();
			this.preorder();
			System.out.println();
		}
		void preorder() {
			System.out.print(" " + this.key);
			if (this.l != null)
				this.l.preorder();
			if (this.r != null)
				this.r.preorder();
		}
		void inorder() {
			if (this.l != null)
				this.l.inorder();
			System.out.print(" " + this.key);
			if (this.r != null)
				this.r.inorder();
		}
	}
	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		Node t = null;
		for (int i = 0; i < n; i++) {
			String inst = scan.next();
			// set a root node
			if (i == 0) {
				int key = scan.nextInt();
				t = new Node(key);
				continue;
			}
			
			switch(inst) {
			case "insert":
				int key = scan.nextInt();
				if (DEBUG)
					System.out.println("insert: " + key);
				t.insert(new Node(key));
				break;
			case "find":
				int findKey = scan.nextInt();
				if (DEBUG)
					System.out.println("find: " + findKey);
				System.out.println(t.find(findKey) ? "yes" : "no");
				break;
			case "print":
				if (DEBUG)
					System.out.println("print");
				t.print();
				break;
			}
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}
}



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

int main(){
   int t, n, s, f, sum;
   while(1){
   sum = 0;
   cin >> t;
   if(t == 0) break;
   cin >> n;
   for(int i = 0;i < n;++i){
     cin >> s >> f;   
     sum += f - s;
    }
   if(sum >= t) cout << "OK" << endl;
   else cout << t - sum << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
def main():
    h,w = map(int,input().split())
    a = []
    for i in range(h):
        a.append(input())

    used = [True]*(h*w)

    p = []
    for i in range(h):
        for j in range(w):
            if a[i][j] == '#':
                p.append(i*w+j)
                used[i*w+j] = False


    
    res = 0
    while p:
        tank = []
        for e in p:
            if e>w-1 and used[e-w]:
                tank.append(e-w)
                used[e-w] = False
            if e%w > 0 and used[e-1]:
                tank.append(e-1)
                used[e-1] = False
            if e<(h-1)*w and used[e+w]:
                tank.append(e+w)
                used[e+w] = False
            if e%w<w-1 and used[e+1]:
                tank.append(e+1)
                used[e+1] =  False
        p = tank
        res += 1
    print(res-1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 51584
/**
 *    author:  FromDihPout
 *    created: 2020-07-31
**/

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


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    int start = n / 2, dist = 0;
    vector<int> ans(n);
    if (n % 2 == 0) {
        for (int i = 0; i < n; i++) {
            if (i % 2 == 0) {
                ans[start + dist] = a[i];
                dist++;
            }
            else {
                ans[start - dist] = a[i];
            }
        }
    }
    else {
        for (int i = 0; i < n; i++) {
            if (i % 2 == 0) {
                ans[start - dist] = a[i];
                dist++;
            }
            else {
                ans[start + dist] = a[i];
            }
        }
    }
    
    for (int i = 0; i < n; i++) {
        cout << ans[i] << ' ';
    }
    cout << '\n';
    return 0;
}


Measured memory_bytes: 4756
ABC = list(map(int, input().split()))
cnt = 0
while all(map(lambda x: x % 2 == 0, ABC)) == True:
  ABC = [(ABC[1] + ABC[2]) // 2, (ABC[2] + ABC[0]) // 2, (ABC[0] + ABC[1]) // 2]
  cnt += 1
  if len(set(ABC)) == 1:
    print(-1)
    exit()
print(cnt)


Measured memory_bytes: 38640
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,cos,radians,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7



def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
n=I()
bekit=[0 for i in range(n+1)]
bekit[0]=1
for i in range(n):
    bekit[i+1]=(bekit[i]*2)%mod
#print(bekit)
countz=0
countx=0
county=0
nump=[]
numm=[]
for i in range(n):
    a,b=MI()
    if a==0 and b==0:
        countz+=1
    elif a==0:
        if b<0:
            b*=(-1)
        countx+=1
    elif b==0:
        if a<0:
            a*=(-1)
        county+=1
    elif (a>0 and b<0) or (a<0 and b>0):
        #print(a,b)
        if b<0:
            a*=(-1)
            b*=(-1)
        g=gcd(abs(a),b)
        a=a//g
        b=b//g
        #print(a,b)
        numm.append([a,b])
    else:
        g=gcd(abs(a),abs(b))
        a//=g
        b//=g
        nump.append([abs(a),abs(b)])
#print(nump)
#print(numm)
nump=list(map(tuple,nump))
numm=list(map(tuple,numm))
u=Counter(nump)
v=Counter(numm)
#print(u)
#print(v)
nums=[]
pairs=[]
for k in u.keys():
    vz=((-1)*k[1],k[0])
    s=u[k]
    t=v[vz]
    #print(vz)
    #print(s)
    #print(t)
    if t>0:
        nums.append([s,t])
        pairs.append(s+t)
#print(nums)
#print(nums)
#print(n-sum(pairs)-countx-county-countz)
#print(pairs)
#print(n-sum(pairs)-countx-county-countz)
if countx>0 and county>0:
    cou=countx+county
else:
    cou=0
ans=bekit[n-sum(pairs)-cou-countz]
#print(ans)
for j in range(len(nums)):
    q=bekit[nums[j][0]]
    p=bekit[nums[j][1]]
    #print(q)
    #print(p)
    ans=(ans*(q+p-1))%mod
if countx>0 and county>0:
    ans=(ans*(bekit[countx]+bekit[county]-1))%mod
ans-=1
if countz>0:
    ans+=countz%mod
print(ans%mod)

Measured memory_bytes: 68472
import sys
sys.setrecursionlimit(200000)

lis = [1,1,2]
def num(n):
    if len(lis) >= n+1:
        return lis[n]
    else:
        res = num(n-2) + num(n-1)
        lis.append(res)
        return res

N,M = map(int,input().split())
count = 1
pre = 0
for i in range(M+1):
    if i == M:
        cur = N+1
    else:
        cur = int(input())
    number = cur-1-pre
    if number >= 0:
        count = count * num(number) % 1000000007
    else:
        count = 0
        break
    pre = cur + 1
print(count%1000000007)    

Measured memory_bytes: 476888
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int H,N;cin>>H>>N;
  int sum=0;
  vector<int> A(N);
  for(int i=0;i<N;i++)
  {
  cin>>A[i];
    sum=sum+A[i];
  }
  if(sum>=H){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
  
}

Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>

int main(int argc, const char * argv[]) {
    int n, taro = 0, hanako = 0;
    char Taro[101], Hanako[101];
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%s%s", Taro, Hanako);
        if(strcmp(Taro, Hanako) == 0){
            taro += 1;
            hanako += 1;
        }else if(strcmp(Taro, Hanako) > 0){
            taro += 3;
        }else if(strcmp(Taro, Hanako) < 0){
            hanako += 3;
        }
    }
    printf("%d %d\n", taro, hanako);
    return 0;
}



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

using namespace std;

constexpr int MAX_H = 2000;
constexpr int MAX_W = 2000;

int h, w;
string grid[MAX_H];
int N[MAX_H][MAX_W];
int S[MAX_H][MAX_W];
int W[MAX_H][MAX_W];
int E[MAX_H][MAX_W];

int CN(int i, int j)
{
	if (i < 0) {
		return 0;
	}
	if (grid[i][j] == '#') {
		return 0;
	}
	if (N[i][j] == 0) {
		N[i][j] = 1 + CN(i - 1, j);
	}
	return N[i][j];
}

int CS(int i, int j)
{
	if (i >= h) {
		return 0;
	}
	if (grid[i][j] == '#') {
		return 0;
	}	
	if (S[i][j] == 0) {
		S[i][j] = 1 + CS(i + 1, j);
	}
	return S[i][j];
}

int CW(int i, int j)
{
	if (j < 0) {
		return 0;
	}
	if (grid[i][j] == '#') {
		return 0;
	}
	if (W[i][j] == 0) {
		W[i][j] = 1 + CW(i, j - 1);
	}
	return W[i][j];
}

int CE(int i, int j)
{
	if (j >= w) {
		return 0;
	}
	if (grid[i][j] == '#') {
		return 0;
	}
	if (E[i][j] == 0) {
		E[i][j] = 1 + CE(i, j + 1);
	}
	return E[i][j];
}

int main()
{
	ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);

	cin >> h >> w;
	for (int i = 0; i < h; ++i) {
		cin >> grid[i];
	}
	int ans = 1;
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			if (grid[i][j] == '.') {
				ans = max(ans, 1 + CN(i - 1, j) + CS(i + 1, j) + CW(i, j - 1) + CE(i, j + 1));
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 67072
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()

ll mc[2][1000010];

int main() {
	string S;
	cin >> S;
	int ss = S.size();
	mc[0][ss] = 0;
	mc[1][ss] = INT32_MAX;
	for (int i = ss - 1;i >= 0;i--) {
		mc[0][i] = min(mc[0][i + 1] + (ll)(S[i] - 48), mc[1][i + 1] + (ll)(S[i] - 48) + 1);

		mc[1][i] = min(mc[0][i + 1] + 10 - (ll)(S[i] - 48), mc[1][i + 1] + 9 - (ll)(S[i] - 48));
	}
	cout << min(mc[0][0], mc[1][0] + 1) << endl;
}

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

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> c(h);
  rep(i, h) cin >> c[i];
  int ans = 0;
  rep(ib, 1 << h) rep(jb, 1 << w) {
    int cnt = 0;
    rep(i, h) rep(j, w) {
      if (ib & (1 << i)) continue;
      if (jb & (1 << j)) continue;
      if (c[i][j] == '#') cnt++;
    }
    if (cnt == k) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3620
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>

using namespace std;

typedef pair<int,int> ii;
typedef vector<int> vi;
#define REP(i, a, b) for(int i = int(a); i <= int(b); i++)
#define LOOP(i, v) for(int i = 0; i < v.size(); i++)
#define EPS 1e-9
#define INF 1e12
#define debug(x) cerr << "DEBUG : " << (#x) << " => " << (x) << endl

int absolu(int x)
{
  return max(x,-x);
}

int main()
{
  int N;
  vi a;
  int maxi = -1;
  
  scanf("%d", &N);
  
  a.resize(N);
  
  REP(i, 0, N-1)
  {
    scanf("%d", &a[i]);
    maxi = max(maxi, a[i]);
  }
  
  int best = -1; // Entre maxi/2 et a[i]
  int qui = -1;
  
  REP(i, 0, N-1)
  {
    int poss = absolu(maxi - 2*a[i]);
    if((best == -1 || poss < best) && a[i] != maxi)
    {
      best = poss;
      qui = a[i];
    }
  }
  
  printf("%d %d\n", maxi, qui);
    
  return 0;
}

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

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

    sort(a, a+N);

    int even_sum =0, odd_sum =0;
    for(int i=0; i<N; i++){
        if(i % 2 == 0) odd_sum += a[i];
        else even_sum += a[i];
    }
    int max_difference;
    if(N % 2 == 0) max_difference = even_sum - odd_sum;
    else max_difference = odd_sum - even_sum;
    
    cout << max_difference << endl;
    return 0;
}

Measured memory_bytes: 256
/// Bismillahir Rahmanir Rahim
//Author: Tanvir Hussain
//ICE,NSTU
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

using namespace std;

const long long MOD = 1000000007;
#define SET(x) memset(x, 0, sizeof(x))
#define SET2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define SETBOOL(x) memset(x,false,sizeof(x))
#define CLR(x) memset(x, -1, sizeof(x))
#define mp make_pair
#define PII pair<int, int>
#define pf printf

#define sf scanf

#define ALL(x) x.begin(),x.end()
#define pb push_back

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define no1 __builtin_popcount
#define BOUNDARY(i, j) ((i >= 0 && i < row) && (j >= 0 && j < column))
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define sz(a) int(a.size())
#define ff first
#define ss second
#define endl "\n"
#define forch(it,s) for(auto it:s)
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}
double sq(double x) {return x*x;}
int ext_gcd(int a, int b, int & x, int & y) {
    //for finding modular inverse
    //if its return 1 ,then a has a mod inverse x mod b.
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }
    int x1, y1;
    int d = ext_gcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}

int main()

{
    IOS;
    //freopen("input.txt", "r", stdin);
     //freopen("output.txt", "w", stdout);
     ll n,a,b;
     cin>>n>>a>>b;
     ll jog=a+b;
     if(n>=jog){
     ll ans=min(a,n%jog);
     ans+=((n/jog)*a);
     cout<<ans<<endl;
     }
     else {
        cout<<min(n,a)<<endl;
     }

     return 0;

}
///Alhamdulillah


Measured memory_bytes: 256
/*@author hussein zayed ;
    ___  ___
   |\  \|\  \
   \ \  \_\  \
    \ \   ___ \USSEIN
     \ \  \\ \ \
      \ \__\\ \_\
       \|__| \|__|
****************************************
*///

#include <bits/stdc++.h>
using namespace std;
#define fr for(int i=0;i<n;++i)
#define fr1 for(int i=1;i<=n;++i)
#define cinA for(int i=0;i<n;++i){cin>>arr[i];}
#define cinA1 for(int i=1;i<=n;++i){cin>>arr[i];}
#define coutA for(int i=0;i<n;++i){cout<<arr[i]<<" ";}
#define ll long long
#define lnarray sizeof(arr)/sizeof(*arr)
#define vi vector<int>
#define vs vector<string>
void Fast()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
inline int RD()
{
    int i ;
    cin>>i;
    return i;
}

inline float RF()
{
    float i ;
    cin>>i;
    return i;
}

inline double RDO()
{
    double i ;
    cin>>i;
    return i;
}

inline string RS()
{
    string i ;
    cin>>i;
    return i;
}

inline ll RLL()
{
    ll i ;
    cin>>i;
    return i;
}

ll sumSet(ll n)
{
    return (1ll*n*(n+1))/2;
}


bool isPrime(int n)
{
    if(n==1)
        return false;
    for(int i=2; i*i<=n; ++i)
    {
        if(n%i==0)
            return false;
    }
    return true;
}
int sumDigit(int n){
int sum =0;
  while (n != 0)
    {
        sum+= + n % 10;
        n = n / 10;
    }
    return sum;
}

ll power2(int n){
  ll ans=(1<<n);
  return ans;
}

ll sumpow2(ll n){
 ll sum=(n*(n+1)*(2*n-1))/6;
 return sum;
}

int main(){
    Fast();
//freopen("output.txt" , "w" , stdout);
//freopen("wall.in" , "r" , stdin);

int n=RD(),arr[n+2],mx=0,id;
fr{
cin>>arr[i];
if(mx<arr[i]){
mx=arr[i];
id=i;}
}
sort(arr,arr+n);
fr{
if(id==i)
cout<<arr[n-2]<<"\n";
else
cout<<arr[n-1]<<"\n";
}
 }


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  ll a, b, c, d;
  cin>>a>>b>>c>>d;
  cout<<max({a*c, a*d, b*c, b*d})<<'\n';
  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	double a, b, x;
	cin >> a >> b >> x;
	double rad;
	if(a * a * b > 2 * x)
		rad = atan((a * b * b) / ((double)2 * x));
	else {
		x = a * a * b - x;
		rad = atan(((double)2 * x) / (a * a * a));
	}
	double k = (double)180 / (double)3.14159265358979;
	cout << setprecision(10) << rad * k;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())

signed main(){

	lli n,m;
	cin>>n>>m;

	if(abs(n-m)>1){
		cout<<0<<endl;
		return 0;
	}

	lli sum=1;

	for(lli i=1;i<=n;i++){
		sum *= i;
		sum %= MOD;
	}
	for(lli j=1;j<=m;j++){
		sum *= j;
		sum %= MOD;
	}
	if(n==m){
		sum*=2;
		sum %= MOD;
	}

	cout<<sum<<endl;

	return 0;
}

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

typedef pair<int, int> P;

int main() {
	int n;
	vector<P>r, b;
	cin >> n;
	r.resize(n);
	b.resize(n);
	for (int i = 0;i < n;i++) {
		cin >> r[i].first >> r[i].second;
	}
	for (int i = 0;i < n;i++) {
		cin >> b[i].first >> b[i].second;
	}
	sort(b.begin(), b.end());
	
	int cnt = 0;
	bool used[100] = {};
	for (int i = 0;i < n;i++) {
		int maxy = -1, use = -1;
		for (int j = 0;j < n;j++) {
			if (!used[j] && b[i].first > r[j].first&&b[i].second > r[j].second) {
				if (r[j].second > maxy) {
					maxy = r[j].second;
					use = j;
				}
			}
		}
		if (use != -1) {
			used[use] = true;
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, k;
    cin >> n >> k;
    vector<ll> a(n), b(n+1, 0);
    rep(i, n)cin >> a[i];
    rep(i, n)b[i+1] = b[i] + a[i];
    rep(i, n+1){
        b[i] -= i;
        b[i] %= k;
        if(b[i] < 0)(b[i] += k) %= k;
    }
    map<ll, vector<int>> mp;
    rep(i, n+1)mp[b[i]].push_back(i);
    ll ans = 0;
    for(auto& p : mp){
        vector<int> c = p.second;
        if(p.first != 0 && c.size() == 1)continue;
        int sum = 0;
        int idx = 0;
        rep(i, c.size()){
            while(c[i] - c[idx] >= k){
                idx++;
                sum--;
            }
            ans += sum;
            sum++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
 
int N;
int A[20];
int x[20][20];
int y[20][20];
 
int counter(int x) {
    if(x == 0) return 0;
    return counter(x >> 1) + (x & 1);
}
 
int main() {
    cin >> N;
    for(int i = 1; i <= N; i++) {
        cin >> A[i];
        for(int j = 1; j <= A[i]; j++) {
            cin >> x[i][j] >> y[i][j];
        }
    }
    int ans = 0;
    for(int bits = 1; bits < (1 << N); bits++) {
        bool ok = true;
        for(int i = 1; i <= N; i++) {
            if(!(bits & (1 << (i-1)))) continue;
            for(int j = 1; j <= A[i]; j++) {
                if(((bits >> (x[i][j]-1)) & 1) ^ y[i][j]) ok = false;
            }
        }
        if(ok) ans = max(ans, counter(bits));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
S = input()
months = [
    '01', '02', '03',
    '04', '05', '06',
    '07', '08', '09',
    '10', '11', '12']
if S[:2] in months and S[2:] in months:
    print('AMBIGUOUS')
elif S[:2] in months:
    print('MMYY')
elif S[2:] in months:
    print('YYMM')
else:
    print('NA')


Measured memory_bytes: 2940
/* ex4_2
   Acro  */

#include <stdio.h> 
#include <math.h>
#include <stdlib.h>
int main(){
    int length_h,length_m,hour,minute;
    long double ans,theta;
    scanf("%d %d %d %d",&length_h,&length_m,&hour,&minute);
    /* 角度を求める */
    theta = 2*M_PI * ((minute/(long double)60) - (hour/(long double)12 + minute/(long double)(12*60)));
    /* 余弦定理 */
    ans = sqrt((long double)length_h*length_h + (long double)length_m*length_m - (long double)2*length_h*length_m*cos(theta));
    printf("%20.20Lf\n",ans);
    return 0;
}

Measured memory_bytes: 2556
#include <iostream>
#include <vector>
#include <set>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
 
int main() {
    long long N;
    cin >> N;
    string S;
    cin >> S;
    long long ans = 3000000;
    vector<long long> WCL(N+1);
    vector<long long> ECL(N+1);
    WCL[0] = 0;
    ECL[0] = 0;
    rep(i, 1, N+1){
        ECL[i]=ECL[i-1];
        WCL[i]=WCL[i-1];
        if(S[i-1]=='E') ECL[i]++;
        else WCL[i]++;
    }
    for(int i=1;i<=N;i++){
      ans=min(ans,WCL[i-1]+(ECL[N]-ECL[i]));
    }
       cout<<ans<<endl;
}


Measured memory_bytes: 5380
#include <stdio.h>
#include <string.h>
#define N 1000

int max(int a, int b){
  if(a>=b) return a;
  if(b>=a) return b;
}

int lcs(char A[] ,char B[]){

  int m, n, i, j, maxans=0;
  int c[N+1][N+1];
  
  m = strlen(A);
  n = strlen(B);
  
  for(i=1; i<=m; i++){
    c[i][0] = 0;
  }
  for(j=1; j<=n; j++){
    c[0][j] = 0;
  }
  
  for(i=1; i<=m; i++){
    for(j=1; j<=n; j++){
      if(A[i-1] == B[j-1]){
	c[i][j] = c[i-1][j-1]+1;
      }
      else if(c[i-1][j] >= c[i][j-1]){
	c[i][j] = c[i-1][j];
      }
      else{
	c[i][j] = c[i][j-1];
      }
      maxans = max(maxans, c[i][j]);
    }
  }
  
  return maxans;
}

int main(){

  int n, i;
  char A[N+2], B[N+1];
  
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%s", A);
    scanf("%s", B);
    printf("%d\n", lcs(A, B));
  }
  
  return 0;
}

Measured memory_bytes: 4524
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#define int long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
const int maxn=200010;
int n,ans=1000;
int a[maxn];
signed main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=2;i<=n;i++){
		if(a[i]>a[i-1])ans+=ans/a[i-1]*(a[i]-a[i-1]);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3192
n = int(input())

list = []
for x in range(3, n + 1):
    if x % 3 == 0:
        list.append(x)
    else:
        y = x
        while(y > 0):
            if(y % 10 == 3):
                list.append(x)
                break
            y //= 10

ans = ""
for x in list:
    ans += " " + str(x)
print(ans)


Measured memory_bytes: 5720
//C
#include <cassert>
//#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//ここまで標準include

using namespace std;

long aCb(long a, long b) {
	long out = 1;
	for (long i = 1; i <= b; i++) {
		out = out * (a + 1 - i) / i;
	}
	return out;
}

int main() {
	char c;
	cin >> c;
	cout << c;
	for (int i = 0; i < 4; i++) {
		cin >> c;
	}
	cout << c;
	for (int i = 0; i < 4; i++) {
		cin >> c;
	}
	cout << c << endl;
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int H, W; cin >> H >> W;
    vector<vector<char>> grid(H, vector<char>(W)); REP(i, H) REP(j, W) cin >> grid[i][j];

    // 行成分を取り除く
    int i = 0;
    while(i < grid.size())
    {
        bool isAllWhite = true;
        REP(j, W)
        {
            if(grid[i][j] == '#')
            {
                isAllWhite = false;
                break;
            }
        }
        if(isAllWhite)
        {
            grid.erase(grid.begin()+i);
        }
        else i++;
    }

    H = grid.size();
    vector<vector<char>> ans(W, vector<char>(H));
    REP(i, H) REP(j, W) ans[j][i] = grid[i][j];

    i = 0;
    while(i < ans.size())
    {
        bool isAllWhite = true;
        REP(j, H)
        {
            if(ans[i][j] == '#') 
            {
                isAllWhite = false;
                break;
            }
        }
        if(isAllWhite)
        {
            ans.erase(ans.begin()+i);
        }
        else i++;
    }

    W = ans.size();

    REP(i, H)
    {
        REP(j, W)
        {
            cout << ans[j][i];
        }
        cout << endl;
    }
}

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

    solve();

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int A = Integer.parseInt(sc.next());
    PrintWriter out = new PrintWriter(System.out);
    out.print((int)(A + Math.pow(A,2)+ Math.pow(A,3)));
    out.flush();
  }
}

Measured memory_bytes: 35768
import java.util.*;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		double a = 0;
		
		for(int i = 0; i < n; i++) a += 1.0 / sc.nextInt();

		System.out.println(1 / a);
	}
}

Measured memory_bytes: 35960
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vp;
typedef pair<ll,int> lp;
ll fimoney=1e15;
const ll inf=1e16;
struct Edge
{
  int to;
  ll acost;
  ll bcost;
  Edge(int _to,ll _acost,ll _bcost) :to(_to),acost(_acost),bcost(_bcost){}
};
vector<Edge> edge[100005]; 
bool visited[100005];
ll d[2][100005];
ll res[100005];
void dijkstra(int start)
{
  memset(visited,false,sizeof(visited));
  priority_queue<lp,vector<lp>,greater<lp> > pq;
  pq.push(lp(0,start));
  d[0][start]=0;
  while(!pq.empty())
    {
      lp p=pq.top();pq.pop();
      int v=p.second;
      if(d[0][v]<p.first) continue;
      for(int j=0;j<edge[v].size();j++)
	{
	  Edge e=edge[v][j];
	  if(d[0][e.to]>d[0][v]+e.acost)
	    {
	      d[0][e.to]=d[0][v]+e.acost;
	      pq.push(lp(d[0][e.to],e.to));
	    }
	}
    }
}

void dijkstra2(int start)
{
  memset(visited,false,sizeof(visited));
  priority_queue<lp,vector<lp>,greater<lp> > pq;
  pq.push(lp(0,start));
  d[1][start]=0;
  while(!pq.empty())
    {
      lp p=pq.top();pq.pop();
      int v=p.second;
      if(d[1][v]<p.first) continue;
      for(int j=0;j<edge[v].size();j++)
	{
	  Edge e=edge[v][j];
	  if(d[1][e.to]>d[1][v]+e.bcost)
	    {
	      d[1][e.to]=d[1][v]+e.bcost;
	      pq.push(lp(d[1][e.to],e.to));
	    }
	}
    }
}

void init()
{
  for(int i=0;i<100005;i++)
    {
      d[0][i]=inf;
      d[1][i]=inf;
    }
}
int main(int argc,char const* argv[])
{
  int n,m,s,t;
  cin >> n >> m >> s >> t;
  for(int i=0;i<m;i++)
    {
      int u,v,a,b;
      cin >> u >> v >> a >> b;
      edge[u].push_back(Edge(v,a,b));
      edge[v].push_back(Edge(u,a,b));
    }
  init();
  dijkstra(s);
  dijkstra2(t);
  res[n]=1e15-(d[0][n]+d[1][n]);
  for(int i=n;i>=1;i--)
    {
      res[i-1]=max(res[i],1000000000000000-(d[0][i-1]+d[1][i-1]));
    }
  for(int i=1;i<=n;i++)
    {
      cout << res[i] << endl;
    }
  return 0;
}


Measured memory_bytes: 13252
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
bool check(vector<vector<int>>& ptr, int x, int y, int h) {
    for(auto& v: ptr) {
        if (max(h - (abs(v[0]-x) + abs(v[1]-y)), 0) != v[2])
            return false;
    }
    return true;
}
int main() {
    int n, x, y, h;
    cin >> n;
    vector<vector<int>> pts;
    int lower = 0;
    for(int i = 0; i < n; i++) {
        cin >> x >> y >> h;
        pts.push_back({x, y, h});
        lower = max(lower, h);
    }
    for(int h = lower + 200; h >= lower; h--)
        for(int i = 0; i <= 100; i++) {
            for(int j = 0; j <= 100; j++) {
                if (check(pts, i, j, h) == true) {
                    cout << i << " " << j << " " << h << endl;
                    return 0;
                }
            }
        }
    return 0;
}




Measured memory_bytes: 384
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a[100],b,c,d,x,flag=0,count=0;
  string s,s2;
  s="CODEFESTIVAL2016";
  cin>>s2;
  rep(i,16){
    if(s[i]!=s2[i]){
      count++;
    }
  }
  cout<<count<<'\n';
  
  return(0);
}


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

int parent(int i)
{
    return i / 2;
}
int left (int i)
{
    return 2 * i;
}
int right(int i)
{
    return 2 * i + 1;
}

int main()
{
    int H, i, A[MAX + 1];  // 1-オリジンのため +1 する

    cin >> H;
    for (i = 1; i <= H; i++) {
        cin >> A[i];
    }

    for (i = 1; i <= H; i++) {
        cout << "node " << i << ": key = " << A[i] << ", ";
        if (parent(i) >= 1) {
            cout << "parent key = " << A[parent(i)] << ", ";
        }
        if (left(i) <= H) {
            cout << "left key = " << A[left(i)] << ", ";
        }
        if (right(i) <= H) {
            cout << "right key = " << A[right(i)] << ", ";
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3104
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

s = arr_data[0][0]


print(s[0:len(s)-8])

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  int l = a + b;
  int r = c + d;

  if (l > r) cout << "Left" << endl;
  
  else if (l < r) cout << "Right" << endl;
    
  else cout << "Balanced" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * 
 */

/**
 * @author kawakami
 */
class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner as = new Scanner(System.in);
		
		int H,W;
		int count1=0;
		int count2=0;
		int count3=0;
		
		
		while(true){
			H = as.nextInt();
			W = as.nextInt();
			
			if(H==0 && W==0){
				
				break;
				
			}
			
			for(int i=0;i<H;i++){
				
				if(i==2*count1){
					
					for(int j=0;j<W;j++){
						
						if(j==2*count2){
							
							System.out.print("#");
							
						}
						
						else{
							
							System.out.print(".");
							count2++;
							
						}
					}
					count2=0;
				}
				
				else{
					
					for(int j=0;j<W;j++){
					
						if(j==2*count2){
							
							System.out.print(".");
							
						}
						
						else{
							
							System.out.print("#");
							count2++;
							
						}
						
					}
					count2=0;
					count1++;
				}
				
				System.out.println();
				
				
			}
			
			System.out.println();
			count1=0;
		}
		
		

	}

}

Measured memory_bytes: 35432
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#define ll long long
#define INF 1e+18
#define MOD 998244353
using namespace std;
ll gcd(ll a, ll b){
    ll q=a/b,r=a%b;
    if(r==0){
        return b;
    }else{
        return gcd(b,r);
    }
}

int main(){
    int N;
    ll X;
    cin >> N >> X;
    
    ll x[N];
    for(int i=0; i<N; i++){
        cin >> x[i];
        x[i]-=X;
        x[i]=abs(x[i]);
    }
    
    
    ll ans=x[0];
    for(int i=1; i<N; i++){
        ans=gcd(ans,x[i]);
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <deque>
#include <tuple>

using namespace std;

using lint = long long;
using ldouble = long double;

const int INF = 1 << 30;

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

int main() {
    int sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;

    int N;
    cin >> N;
    vector<int> ox(N), oy(N);
    for (int i = 0; i < N; ++i) {
        cin >> ox[i] >> oy[i];
    }

    int lx, ly;
    cin >> lx >> ly;

    // 全体をlx, lyだけずらして非負整数座標にする
    sx += lx, sy += ly, gx += lx, gy += ly;
    int H = lx * 2, W = ly * 2;
    vector<vector<bool>> obj(H + 1, vector<bool>(W + 1, false));
    for (int i = 0; i < N; ++i) {
        obj[ox[i] + lx][oy[i] + ly] = true;
    }

    // お姉さんの指示に逆らった回数 with 時刻
    vector<vector<vector<int>>> dist(H + 1, vector<vector<int>>(W + 1, vector<int>(6, INF)));
    dist[sx][sy][0] = 0;

    deque<tuple<int, int, int, int>> que;
    que.emplace_front(sx, sy, 0, 0);

    // 01BFS
    while (!que.empty()) {
        int x, y, t, d;
        tie(x, y, t, d) = que.front();
        que.pop_front();

        // Dijkstraと同じくこのfilterが必要なので注意
        if (d > dist[x][y][t]) continue;

        int dir = abs((x - lx) * (y - ly) * t) % 6;  // お姉さんの指示
        int nt = (t + 1) % 6;

        for (int i = 0; i < 7; ++i) {
            int nx = x + dx[i];
            int ny = y + dy[abs(x - lx) % 2][i];

            if (nx < 0 || H < nx || ny < 0 || W < ny ||
                obj[nx][ny] || dist[nx][ny][nt] <= dist[x][y][t] + (i != dir)) continue;

            if (i == dir) {
                // 指示に従うなら距離は増えない
                dist[nx][ny][nt] = dist[x][y][t];
                que.emplace_front(nx, ny, nt, dist[nx][ny][nt]);
            } else {
                dist[nx][ny][nt] = dist[x][y][t] + 1;
                que.emplace_back(nx, ny, nt, dist[nx][ny][nt]);
            }
        }
    }

    int ans = INF;
    for (int t = 0; t < 6; ++t) {
        ans = min(ans, dist[gx][gy][t]);
    }
    cout << (ans == INF ? -1 : ans) << endl;
    return 0;
}



Measured memory_bytes: 5464
def z_algo(S):
    N = len(S)
    A = [0]*N
    i = 1; j = 0
    A[0] = l = len(S)
    while i < l:
        while i+j < l and S[j] == S[i+j]:
            j += 1
        if not j:
            i += 1
            continue
        A[i] = j
        k = 1
        while l-i > k < j - A[k]:
            A[i+k] = A[k]
            k += 1
        i += k; j -= k
    return A

N = int(input())
S = input()
MAX = 0

for i in range(N-1):
    A = z_algo(S[i:])
    for j in range(len(A)):
        if MAX < A[j] and A[j] <= j:
            MAX = A[j]

print(MAX)

Measured memory_bytes: 47580
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
typedef long long ll;
using namespace std;
int main()
{
  int n, a, b;
  cin >> n;
  if(n == 1){
	cout << "Hello World" << endl;
  }else{
    cin >> a >> b;
	cout << a + b << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	long long sum = 0, min, max;
	int i, n, x;
	min = 1000000;
	max = -1000000;

	scanf("%d", &x);

	for (i = 0; i < x; i++)
	{
		scanf("%d", &n);
		if (max <= n)
		{
			max = n;
		}
		if (min >= n)
		{
			min = n;
		}
		sum = sum + n;
	}

	printf("%lld %lld %lld\n", min, max, sum);

	return 0;
}


Measured memory_bytes: 2116
#include <bits/stdc++.h>
#define int long long
using namespace std;

double a,b,x,y;

bool judge(double k)
{
	if ((int)(k)!=k)  return false;
	else if (!(k>=0))  return false;
	
	return true;
}

signed main()
{
	cin>>a>>b;
	x=(4*a-b)/2.00;
	y=(b-2*a)/2.00;
	
	if (judge(x)&&judge(y))  cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	return 0;
}

Measured memory_bytes: 3708
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        var s = Console.ReadLine().Split();
        string a = s[0];
        string b = s[1];
        string c = s[2];
        if (a[a.Length - 1] == b[0] && b[b.Length - 1] == c[0])
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }
    }
}

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

const long long mod = 1e9 + 7;
long long fact[200013];

long long add_mod (long long a, long long b) {
	return (a + b) % mod;
}

long long sub_mod (long long a, long long b) {
	return (a - b + mod) % mod;
}

long long mul_mod (long long a, long long b) {
	return (a * b) % mod;
}

long long pow_mod (long long a, long long b) {
	long long res = 1, t = a;
	while (b) {
		if (b & 1)
			res = mul_mod(res, t);
		b >>= 1;
		t = mul_mod(t, t);
	}
	return res;
}

long long div_mod (long long a, long long b) {
	return mul_mod(a, pow_mod(b, mod - 2));
}

signed main () {
	long long n;
	cin >> n;
	vector < long long > a(n);
	for (long long &x: a)
		cin >> x;
	sort(a.begin(), a.end());
	long long ans = 0;
	for (long long i = 0; i < n; ++i) 
		ans = add_mod(ans, add_mod(mul_mod(a[i], pow_mod(2LL, 2LL * n - 1LL)), mul_mod(mul_mod(a[i], n - i - 1LL), pow_mod(2LL, 2LL * n - 2LL))));
	cout << ans << '\n';
}


Measured memory_bytes: 1792
#include <iostream>
#include <numeric>
#include <bits/stdc++.h>
using namespace std;
// long long -> lint
using lint = long long;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

int main(){
    // input
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    // calc
    bool ans = true;
    while( 1 ){
        C -= B;
        if( C <= 0 ){
            break;
        }
        A -= D;
        if( A <= 0 ){
            ans = false;
            break;
        }
    }

    // out
    printf( ans ? "Yes" : "No" );
} 

Measured memory_bytes: 3704
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>

#define size_t int

using namespace std;
typedef unsigned long ul;
typedef unsigned long long ull;

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

  int n;
  std::cin >> n;

  vector<int> a(n,0);

  for (size_t i = 0; i < n; i++) {
    std::cin >> a[i];
  }

  int c = accumulate(a.begin(),a.end(), 0);

  int c2 = 0;
  for (size_t i = 0; i < n; i++) {
    /* code */
    c2 += a[i]*a[i];
  }
  int alpha = c / n;
  int beta = alpha + 1;
  int ans = min(c2 - 2 * alpha * c + n * alpha * alpha,c2 - 2 * beta * c + n * beta * beta);

  std::cout << ans << '\n';

  return 0;
}


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();
		sc.close();
		int target = 111;
		while (target < 1000){
			if(N <= target){
				break;
			}
			target = target + 111;
		}
		System.out.println(target);
	}
}


Measured memory_bytes: 21716
#include<stdio.h>
int main(void){
    int a, b;
    scanf("%d %d", &a, &b);
    if (a < b) {
        printf("a < b\n");
    } else if (a > b) {
        printf("a > b\n");
    } else {
        printf("a == b\n");
    }
    return 0;
}


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

int main() {
  long n;
  cin >> n;
  vector<long> ansa,ansb;
  if(n%2==0) {
    for(long i=1;i<=n;i++) {
      for(long j=i+1;j<=n;j++) {
        if(i!=j&&i+j!=n+1) {
          ansa.push_back(i);
          ansb.push_back(j);
        }
      }
    }
  } else {
    for(long i=1;i<=n-1;i++) {
      for(long j=i+1;j<=n-1;j++) {
        if(i!=j&&i+j!=n) {
          ansa.push_back(i);
          ansb.push_back(j);
        }
      }
      ansa.push_back(i);
      ansb.push_back(n);
    }
  }
  cout << ansa.size() << endl;
  for(long i=0;i<ansa.size();i++) cout << ansa[i] << " " << ansb[i] << endl;
}

Measured memory_bytes: 3652
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 1005;
const int mod = 1000000007;



int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int x,y;
  cin>>x>>y;
  cout<<x*y<<endl;
  return 0;
}

Measured memory_bytes: 3648
a,b,h,m=map(int,input().split())
import math
hd = ((h%12)/12)*360 + 360/12 * m/60
md = ((m%60)/60)*360

c2 = a**2 + b**2 - 2*a*b*math.cos(2*math.pi * (abs(hd-md)/360))
# print(abs(hd-md))
# print(a**2 + b**2, math.cos(2*math.pi * (abs(hd-md)/360)))
# print(c2)
print(c2**0.5)

Measured memory_bytes: 9516
<?php
list($N, $K) = ints();
$A = ints();
$mi = $pl = [];
$zero = 0;
foreach($A as $a){
  if($a < 0){
    $mi[] = $a;
  }elseif($a > 0){
    $pl[] = $a;
  }else{
    $zero++;
  }
}
$minusCount = count($mi)*count($pl);
$zeroCount = $zero*(count($pl)+count($mi)) + intdiv($zero*($zero-1), 2);
rsort($mi);
sort($pl);
$micount = count($mi);
$plcount = count($pl);

$min = (int)-10**18;
$max = (int)10**18;
while($max>$min){
  $mid = $min + intdiv($max-$min+1,2);
  if(countLT($mid)>=$K){
    $max = $mid-1;
  }else{
    $min = $mid;
  }
}
echo $min;

function countLT($t){
  global $mi, $pl, $zero, $minusCount, $zeroCount, $micount,$plcount;
  if($t==0){
    return $minusCount;
  }elseif($t > 0){
    $count = $minusCount + $zeroCount;
    //pl*pl
    $i = $plcount-1;
    foreach($pl as $j => $p){
      while(($pl[$i]??0) * $p >= $t)--$i;
      if($i > $j)$count+=$i-$j;
    }
    //mi*mi
    $i = $micount-1;
    foreach($mi as $j => $m){
      while(($mi[$i]??0) * $m >= $t)--$i;
      if($i > $j)$count+=$i-$j;
    }
  }else{
    $count = ($micount-1) * $plcount;
    $i = $micount-1;
    foreach($pl as $p){
      while(($mi[$i]??0) * $p < $t)--$i;
      $count-=$i;
    }
  }
  return $count;
}

function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}


Measured memory_bytes: 29172
#D問題
K=int(input())
keta=1
now=1
count=0

def sunuke(n):
    a=0
    for i in str(n):
        a+=int(i)
    return(n/a)

while count < K:
    if sunuke(now) <= sunuke(now+keta):
        print(now)
        now+=keta
        count+=1
    else:
        now+=9*keta
        keta*=10



Measured memory_bytes: 3188
#include<iostream>
using namespace std;
int main() {
  int n;
  while(cin>>n) {
  if(n>37)
    cout<<0<<endl;
  else {
    int count=0;
    for(int a=0;a<=9;a++) {
      for(int b=0;b<=9;b++) {
	for(int c=0;c<=9;c++) {
	  for(int d=0;d<=9;d++) {
	    if((a+b+c+d)==n) count++;
	  }
	}
      }
    }
    cout<<count<<endl;;
  }
  }
  return 0;
}


Measured memory_bytes: 3072