akhauriyash/Code-Regression huggingface dataset:
#import <Foundation/Foundation.h>
#import <stdarg.h>

@interface StdIO : NSObject
+(NSString*)stringFromStdIn;
+(NSArray*)stringsFromStdInSeparatedByString:(NSString*)separator;
+(NSArray*)numbersFromStdInSeparatedByString:(NSString*)separator;
+(void)puts:(NSString*)format, ...;
@end

@interface NSString (Split)
-(NSArray*)splitCharacterEvery:(NSUInteger)number;
-(NSArray*)characters;
@end

@implementation NSString (Split)
-(NSArray*)splitCharacterEvery:(NSUInteger)number
{
	if ([self length] <= number) {
		return [NSArray arrayWithObject: self];
	}

	NSMutableArray  *mArray = [NSMutableArray array];
	NSMutableString *mStr   = [NSMutableString stringWithString: self];

	NSRange range = NSMakeRange(0, number);

	while ([mStr length] > 0) {
		if ([mStr length] < number) {
			[mArray addObject: [NSString stringWithString: mStr]];
			[mStr deleteCharactersInRange:NSMakeRange(0, [mStr length])];
		} else {
			[mArray addObject: [mStr substringWithRange: range]];
			[mStr deleteCharactersInRange: range];
		}
	}

	return mArray;
}

-(NSArray*)characters {
	return [self splitCharacterEvery:1];
}

@end

@implementation StdIO
+(NSString*)stringFromStdIn
{
	return [[NSString alloc] initWithData:[[NSFileHandle fileHandleWithStandardInput] availableData] encoding:NSUTF8StringEncoding];
}

+(NSArray*)stringsFromStdInSeparatedByString:(NSString*)separator
{
	return [[StdIO stringFromStdIn] componentsSeparatedByString:separator];
}

+(NSArray*)numbersFromStdInSeparatedByString:(NSString*)separator
{
	NSArray *strings = [StdIO stringsFromStdInSeparatedByString:separator];
	NSMutableArray *numbers = [NSMutableArray array];
	for (NSString *string in strings) {
		[numbers addObject: [NSNumber numberWithInteger: [string integerValue]]];
	}
	return numbers;
}

+(void)puts:(NSString*)format, ...
{
	va_list arguments;
	va_start(arguments, format);
	NSString *stdoutString = [[NSString alloc] initWithFormat:format arguments:arguments];
	
	NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardOutput];
	[fileHandle writeData:[stdoutString dataUsingEncoding: NSUTF8StringEncoding]];
	[fileHandle writeData:[@"\n" dataUsingEncoding: NSUTF8StringEncoding]];
	[fileHandle closeFile];	
	
	va_end(arguments);	
}
@end



int main(int argc, const char * argv[]) {
	@autoreleasepool {
		NSArray *characters = [[StdIO stringFromStdIn] characters];
		NSInteger count = 0;
		for (NSString *ch in characters) {
			if ([ch isEqualToString: @"1"]) {
				count++;
			}
		}
		[StdIO puts:@"%ld", count];
	}

	return 0;
}

Measured memory_bytes: 9624
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
// *st.find_by_order(index), 0-based
// order_of_key(e)

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int D,T,S; cin>>D>>T>>S;
	cout<<(D<=T*S ? "Yes" : "No")<<"\n";
	return 0;
}

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

#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define all(box) box.begin(), box.end()

using namespace std;

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

const long long INF = LLONG_MAX/3;

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; }

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[a]+=siz[b];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

const int MOD=1e9+7;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
bool COMinited=false;
long long COM(int n, int k){
	if(COMinited==false){
		fac[0] = fac[1] = 1;
    	finv[0] = finv[1] = 1;
    	inv[1] = 1;
    	for (int i = 2; i < MAX; i++){
        	fac[i] = fac[i - 1] * i % MOD;
        	inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        	finv[i] = finv[i - 1] * inv[i] % MOD;
    	}
		COMinited=true;
	}
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}
signed main(){
	int n;
	cin>>n;
	cout<<(n+1)/2<<endl;
}

Measured memory_bytes: 768
n = input()
chars = list(n)

f = True
for i in range(len(chars)):
  if i % 2 == 0 and chars[i] == 'L':
    f = False
    break
  elif i % 2 == 1 and chars[i] == 'R':
    f = False
    break

if f:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 38620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Map.Entry;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			TreeMap<Character, Integer> map = new TreeMap<>();
			for (char c = 'a'; c <= 'z'; c++) {
				map.merge(c, 1, Integer::sum);
			}

			char[] s = in.nextString().toCharArray();
			for (char c : s) {
				map.merge(c, 1, Integer::sum);
			}

			for (Entry<Character, Integer> e : map.entrySet()) {
				if (e.getValue() == 1) {
					out.println(e.getKey());
					return;
				}
			}

			out.println("None");

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 30804
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, m) for (int i = 0; i < (int)(m); i++)
const int inf = 1000000000; // 10^9 Ten to the power of nine.
/**** Type Define ****/
 
 
 
int main() {
    int N;
    cin >> N;
 
   ll ans = 0;
  for (ll int i = 1; i <= N; i++) {
    ll x = N / i;
      ans += i * x * (x + 1) / 2;
  }
  cout << ans << endl;
 
  return 0;
}

Measured memory_bytes: 3592
l,r = gets.chomp.split.collect{ |item| item.to_i}
result = 2018
imax = [l+2019,r].min
l.upto(imax) do |i|
  break if result == 0
  jmax = [i+2020,r].min
  (i+1).upto(jmax) do |j|
    ans = ((i*j) % 2019)
    result = [result,ans].min
  end
end

puts result

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 100000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;
const ll MAXN = 1e18;



int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	int a,b;
	cin >> a >> b;
	int l = b;
	int r = b+a-1;
	int eat = 0;
	if(r<=0){
		eat = r;
	}else if(l>=0){
		eat=l;
	}else{
		eat=0;
	}
	int ans = ((r+l)*(r-l+1)/2)-eat;
	cout << ans << endl;
	return 0;
}
//l,l+1,l+2 ... l+n-1
//^-^

Measured memory_bytes: 3576
import java.util.*;
public class Main{

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		char[] s = stdIn.next().toCharArray();
		char[] t = stdIn.next().toCharArray();
		
		int cnt = 0;
		
		for(int i = 0; i < s.length; i++) {
			if(s[i] != t[i]) {
				cnt++;
			}
		}
		
		System.out.println(cnt);
		
		
		
	}

}


Measured memory_bytes: 42008
color_str = input()
color_str_arr = list(color_str)

count_a = 0
count_b = 0

color_pattern = ['0', '1']

index_a = 0
index_b = 1

for color in color_str_arr:
    if color != color_pattern[index_a]:
        count_a += 1
    if color != color_pattern[index_b]:
        count_b += 1
    index_a = 1 - index_a
    index_b = 1 - index_b

min_count = count_a if count_a < count_b else count_b

print(min_count)

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

int main() {
    int N; cin >> N;
    vector<long long> A(N);
    for(int i=0; i<N; ++i) cin >> A[i];

    vector<int> cnt(60, 0);
    long long const MOD = 1000000007;
    long long res = 0;
    for(int i=0; i<N; ++i) {
        for(int j=0; j<60; ++j) {
            if((A[i] >> j) & 1) {
                res = (res + (i - cnt[j]) * ((1LL << j) % MOD) % MOD) % MOD;
                cnt[j] += 1;
            } else {
                res = (res + cnt[j] * ((1LL << j) % MOD) % MOD) % MOD;
            }
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cctype>
#define INF 10000000
using namespace std;
bool debug=false;

int main(){
  int h,w;
  int x[105][105];
  char c;
  cin>>h>>w;
  for(int i=0;i<105;i++)for(int j=0;j<105;j++)x[i][j]=INF;

  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>c;
      if(c=='c'){
	int cnt=0;
	for(int k=j;k<w;k++){
	  x[i][k]=cnt;
	  cnt++;
	}
      }
    }
  }
  
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(x[i][j]==INF) cout<<-1;
      else cout<<x[i][j];
      if(j!=w-1)cout<<" ";
    }
    cout<<endl;
  }

  return 0;
}

Measured memory_bytes: 3112
MOD=10**9+7
n=int(input())
x=[0 for i in range(60)]
a=list(map(int,input().split()))

for i in range(n):
    k=0
    while a[i]>0:
        if a[i]&1:
            x[k]+=1
        a[i]>>=1
        k+=1
ans=0
for i in range(60):
    ans+=x[i]*(n-x[i])*(2**i)
    ans%=MOD
print(ans)


Measured memory_bytes: 122808
n,m = map(int,input().split())
canred = set()
canred.add(1)
balls = [1 for i in range(n)]
for i in range(m):
    x,y = map(int,input().split())
    if x in canred:
        canred.add(y)
    balls[x-1]-=1
    balls[y-1] += 1
    if balls[x-1] == 0:
        canred.discard(x)


print(len(canred))

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

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rbf(i, v) for (auto& (i) : (v))
#define all(x) (x).begin(),(x).end()
#define cAll(x) (x).cbegin(),(x).cend()
#define COL(x) cout << x << endl
#define CO(x) cout << x
//#define int long long

template<typename T> constexpr auto square(T x) { return (x) * (x); }

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

const int MOD = 1000000007;
const int INF = INT_MAX;

signed main()
{
	int N;
	cin >> N;

	VI A(N);
	rbf(a, A) {
		cin >> a;
	}

	reverse(all(A));

	VI B(N+1, 0);
	int n = N, M = 0;
	rbf(a, A) {
		if (n > N / 2) {
			B[n] = a;
			M += a;
		}
		else {
			int bai = 2, sum = 0;
			while (n * bai <= N) {
				sum += B[n * bai];
				bai++;
			}

			if (sum % 2 == a) B[n] = 0;
			else {
				B[n] = 1;
				M++;
			}
		}
		n--;
	}

	COL(M);
	int i = 0;
	rbf(b, B) {
		if (b == 1) {
			CO(i);
			CO(' ');
		}
		i++;
	}

	CO(endl);

	return 0;
}


Measured memory_bytes: 2432
/* Filename: ABC042A.java
 * Author: Mushiyo
 */

import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);

		while (input.hasNext()) {
			String[] numberStr = input.nextLine().split(" ");
			int count5 = 0, count7 = 0;
			
			for(int i = 0; i < numberStr.length; ++i){
				if(Integer.valueOf(numberStr[i]) == 5){
					++count5;
				}
				
				if(Integer.valueOf(numberStr[i]) == 7){
					++count7;
				}
			}
			
			if(count5 == 2 && count7 == 1){
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}

}


Measured memory_bytes: 9420
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H, W; 
  cin >> H >> W;
char C[10][10] = {}; 
int count = 0; 
for(int i = 0; i < H; i++){
  for(int j = 0; j < W; j++){
cin >> C[i][j]; 
if(C[i][j] == '#'){
count ++; 
}
}
}
if(count == H + W - 1){
cout << "Possible" << endl; 
}
else{
cout << "Impossible" << endl; 
}
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <random>

using namespace std;

void pass(){
	return;
}

#define prev _prev
#define hash _hash;
#define rand() rand()<<15+rand()
typedef long long ll;
typedef unsigned long long ull;

mt19937 rnd(rand());
const int MOD = 1e9 + 7;
const ll BIG_MOD = 1e18 + 7;
const int MAXN = 1e5 + 7;
const int MAXV = 1e6;

int a[MAXN], d[MAXV];

signed main(){
	cout.tie(NULL);
	cout.precision(20);
	//freopen("input.txt", "r", stdin);
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i){
		cin >> a[i];
		d[a[i]]++;
	}

	int ans = 0;
	for (int i = 1; i < MAXV - 228; ++i){
		ans = max(ans, d[i] + d[i - 1] + d[i + 1]);
	}

	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 2944
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cinttypes>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int N;
  cin >> N;
  
  vector<int> A(N);
  for (int& a : A) {
    cin >> a;
  }
  
  vector<int> sorted = A;
  sort(sorted.begin(), sorted.end());
  int left = sorted[N / 2 - 1];
  int right = sorted[N / 2];
  
  for (int a : A) {
    if (a <= left) {
      cout << right << '\n';
    } else {
      cout << left << '\n';
    }
  }
  
  return 0;
}


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

int main(){
  int n,m,x;cin>>n>>m>>x;
  vector<int> c(n);
  Graph a(n,vector<ll>(m));
  for (int i = 0; i < n; i++)
  {
    cin >> c.at(i);
    for (int j = 0; j < m; j++)
    {
      cin >> a.at(i).at(j);
    }
    
  }

  ll ans = INT64_MAX;
  bool lastcheck = false;
  
  for (int bit = 0; bit < (1<<n); bit++)
  {
    vector<int> achieve(m,0);
    bool clear = true;
    ll tmp = 0;
    for (int i = 0; i < n; i++)
    {
      if(bit & (1<<i))
      {
        tmp += c.at(i);
        for (int j = 0; j < m; j++)
        {
          int plus = a.at(i).at(j);
          achieve.at(j) += plus;
        }
        
      }

    }
    for (auto &&i : achieve)
    {
      if (i < x) clear = false;
    }
    
    if(clear)
    {
      ans = min(ans, tmp);
      lastcheck = true;
    }    
  }
  
  if(lastcheck)cout << ans << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<string>
#include<cstdio>
#include<map>
#include<algorithm>

using namespace std;

int main(){
	int student[31]={};
	int num;
	for(int i=0;i<30;i++){
		cin>>num;
		student[num]=1;
 	}
	for(int i=1;i<=30;i++){
		if(student[i] == 0) cout<<i<<endl;
 	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define F first
#define S second
#define mod 1000000007
#define pb push_back
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define REV(i,a,n) for(int i=a;i>=n;i--)
#define all(a) a.begin(),a.end()
#define UB upper_bound
#define LB lower_bound
const int NUM = 2e5 + 5;

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int num_tests=1; 
    //cin >> num_tests;
    while(num_tests-->0){
        int n,k; cin >> n >> k;
        vector<int> a(n);
        FOR(i,0,n) cin >> a[i];
        vector<int> ans(n,1e18);
        ans[0] = 0;
        FOR(i,1,min(n,k)){
            FOR(j,0,i)
                ans[i] = min(ans[i],abs(a[i] - a[j]) + ans[j]);
        }
        FOR(i,k,n){
            FOR(j,i-k,i)
                ans[i] = min(ans[i],abs(a[j] - a[i]) + ans[j]);
        }
        cout << ans[n-1];
    }   
}

Measured memory_bytes: 4788
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using ll=long long;
int main(){
    long long a,b,n;
    cin>>a>>b>>n;
    ll s,t;
    if(n/b*b+b-1<=n)s=n/b*b+b-1;
    else s=n/b*b-1;
    if(s<0)s=0;
    t=n;
    cout<<max(a*t/b-a*(t/b),a*s/b-a*(s/b))<<endl;
}

Measured memory_bytes: 3636
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function main()
    n,m=parseMap(split(readline()))
    W=[0 for i in 1:n]
    AC,WA=0,0
    for i in 1:m
        p,s=split(chomp(readline()))
        p=parseInt(p)
        if s=="WA" && W[p]>=0
            W[p]+=1
        elseif s=="AC" && W[p]>=0
            AC+=1
            WA+=W[p]
            W[p]=-1
        end
    end
    println("$AC $WA")
end
main()

Measured memory_bytes: 154632
import fractions
n = int(input())
a = list(map(int,input().split()))
m = []
l = [0]
r = [0]
for i in range(n):
  l.append(fractions.gcd(l[i],a[i]))
  r.append(fractions.gcd(r[i],a[-i-1]))
r.reverse()
for i in range(n):
  m.append(fractions.gcd(l[i],r[i+1]))
print(max(m))

Measured memory_bytes: 99168
#include<bits/stdc++.h>
#define ll long long
#define rep(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
int main()
{
  int a,b,c,m;
  cin >> a >> b  >> c;
  printf("%d",max({a,b,c})-min({a,b,c}));
}

Measured memory_bytes: 256
from collections import Counter
from collections import defaultdict
H, W, M = [int(x) for x in input().split()]

ty = [0] * M
tx = [0] * M
target = defaultdict(bool)  # int/bool/list....
for i in range(M):
    ty[i], tx[i] = [int(x) for x in input().split()]
    target[(ty[i], tx[i])] = True

cntY = Counter(ty)
cntY = sorted(cntY.items(), key = lambda x:x[1], reverse = True)
ys = []
max_in_row = cntY[0][1]  # 出現回数max
for y, times in cntY:
    if times == max_in_row:
        ys.append(y)

cntX = Counter(tx)
cntX = sorted(cntX.items(), key = lambda x:x[1], reverse = True)
xs = []
max_in_col = cntX[0][1]  # 出現回数max
for x, times in cntX:
    if times == max_in_col:
        xs.append(x)

ans = max_in_row + max_in_col - 1
for y in ys:
    for x in xs:
        if target[(y, x)] == False:
            ans = max_in_row + max_in_col
            break

print(ans)

Measured memory_bytes: 229276
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;
using ll = long long int;
using ha = pair<ll, ll>;
struct RollingHash {
	static const ll mul0 = 10009, mul1 = 10007;
	static const ll add0 = 1000010007, add1 = 1003333331;
	size_t len;
	//vector<ll> hash_, hash2_;
	vector<ha>hash_;
	//static vector<ll> pmo_, pmo2_;
	static vector<ha>pmo_;
	void init(const vector<ll>& s) {
		len = s.size();
		hash_.resize(len + 1);
		hash_[0] = make_pair(0, 0);

		if (pmo_.empty()) {
			pmo_.push_back(make_pair(1, 1));
		}
		while (pmo_.size() <= len) {
			pmo_.push_back(make_pair(pmo_.back().first*mul0, pmo_.back().second*mul1));
		}
		for (unsigned int i = 0; i < len; ++i) {
			hash_[i + 1] = make_pair((hash_[i].first * mul0 + s[i]), (hash_[i].second*mul1 + s[i]));
		}
		return;
	}
	void init(const string& s) {
		vector<ll>v;
		for (char c : s) {
			v.push_back(c);
		}
		init(v);
	}
	ha hash(const int l, const int r)const { // s[l..r]
		return make_pair(hash_[r + 1].first - hash_[l].first * pmo_[r + 1 - l].first,
			hash_[r + 1].second - hash_[l].second * pmo_[r + 1 - l].second);
	}
	ha  hash()const { // s[all]
		return hash(0, len - 1);
	}

	//hashの結合　
	static ha concat(const ha L, const ha R, const int RLength) { // hash(L+R) 
		return make_pair((R.first + L.first*pmo_[RLength].first), (R.second + L.second*pmo_[RLength].second));
	}

	//indexの位置をfromからtoに変えたもののハッシュを返す。
	ha get_changed_hash(const int index, const ll from, const ll to)const {
		const ha p(hash());
		return make_pair(
			p.first + (to - from) * pmo_[len - index - 1].first,
			p.second + (to - from) * pmo_[len - index - 1].second);
	}
};
vector<ha> RollingHash::pmo_;

int getnum(const RollingHash&rh,const int num) {
	set<long long int>aset1,aset2;
	for (int i = 0; i <= rh.len - num; ++i) {
		auto p = rh.hash(i, i + num - 1);
		aset1.emplace(p.first*10423+p.second);
		//aset2.emplace(p.second);
	}
	return max(aset1.size(),aset2.size());
}

int main() {
	string st; cin >> st;
	RollingHash rh;
	rh.init(st);
	int amin = 1;
	int amax = st.size() + 1;
	while (amin + 2 < amax) {
		int amid1 = (amin * 2 + amax) / 3;
		int amid2 = (amin * 1 + amax * 2) / 3;
		int ans1 = getnum(rh, amid1);
		int ans2 = getnum(rh, amid2);
		if (ans1 < ans2) {
			amin = amid1;
		}
		else {
			amax = amid2;
		}
	}
	int ans = 0;
	for (int i = amin; i < amax; ++i) {
		ans = max(ans, getnum(rh,i));
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 8224
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    string s;
    cin>>s;
    int z=1;
    rep(i,3) if(s[i]==s[i+1]) z=0;
    if(z) cout<<"Good";
    else cout<<"Bad";
}

Measured memory_bytes: 256
n, k = map(int, input().split())
hs = sorted([int(input()) for _ in range(n)])

mh = int(1e9) + 1
for l_idx in range(len(hs) - k + 1):
    r_idx = l_idx + k - 1
    mh = min(mh, hs[r_idx] - hs[l_idx])
print(mh)

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

int N,R;
int D[2][55];
int main(){
  while( cin >> N >> R  && ( N|| R) ){
    for(int i=0;i<N;i++) D[0][i] = i+1;
    for(int i=0;i<R;i++){
      int P,C;
      cin >> P >> C;
      int in = N - (P-1) - C;
      for(int j=0;j<in;j++) D[1][j] = D[0][j];
      for(int j=0;j<C;j++){
	D[1][in+(P-1)+j] = D[0][in+j];
      }
      for(int j=0;j<P-1;j++){
	D[1][in+j] = D[0][in+C+j];
      }
      for(int j=0;j<N;j++){
	D[0][j] = D[1][j];
	//	cout << D[0][j] << " ";
      }
      //      cout << endl;
    }
    cout << D[0][N-1] << endl;
  }
}

Measured memory_bytes: 1160
N, Y = map(int, input().split())
Y //= 1000
for i in range(N+1):
  for j in range(N-i+1):
    if 0<=Y-10*i-5*j==N-i-j:
      print(i,j,N-i-j)
      exit()
print(-1, -1, -1)

Measured memory_bytes: 9068
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,l,n) for(int i=l; i<n; ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using mii = map<int,int>;
using pii = pair<int,int>;
using vpii = vector<pair<int,int>>;
using ti3 = tuple<int,int,int>;

int main(){
  ll s; cin>>s;
  vi a(1100000,0);
  REP(i,1100000){
    if(a[s]==0){
      a[s]=1;
      if(s%2==0) s=s/2;
      else s=3*s+1;
    } else{
      cout<<i+1<<endl;
      return 0;
    }
  }
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  string s,t; cin >> s >> t;
  int a,b; cin >> a >> b;
  string u; cin >> u;
  
  if(u==s) a--;
  else if(u==t) b--;

  cout << a << " " << b << endl;
  
  return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+1000;
int a[N],f[N],minx[N],maxn[N];
int b[N],c[N];
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    int ans=n-k+1;
    int cnt=0,sum1=0,sum2=0;
    a[0]=-1000;
    for(int i=1;i<=n;i++){
        if(a[i]>a[i-1])cnt++;
        else cnt=1;
        if(cnt>=k)sum1++,f[i-k]=1;
        //cout<<cnt<<" ";
    }
    if(sum1!=0)ans-=(sum1-1);
    //printf("%d\n",ans);
    int r=1,l=1;
    minx[0]=N+100;
    for(int i=1;i<=n;i++){
        while(minx[l]<=i-k&&l<r)l++;
        while(a[i]<a[minx[r]]&&r>=l)r--;
        //cout<<i<<" "<<l<<" "<<r<<endl;
        minx[++r]=i;
        if(minx[l]==i-k+1)b[i-k+1]=1;
    }
    //for(int i=1;i<=n;i++)cout<<b[i]<<" ";cout<<endl;
    r=1,l=1;maxn[1]=N+100;
    for(int i=n;i>=1;i--){
        while(maxn[l]>=i+k&&l<r)l++;
        while(a[i]>a[maxn[r]]&&r>=l)r--;
        maxn[++r]=i;
        //for(int j=l;j<=r;j++)cout<<maxn[j]<<" ";cout<<endl;
        if(maxn[l]==i+k-1)c[i+k-1]=1;
    }
    //for(int i=1;i<=n;i++)cout<<c[i]<<" ";cout<<endl;
    for(int i=1;i<=n-k+1;i++){
        if(f[i]==1)continue;
        if(b[i]==1&&c[i+k]==1)sum2++;
    }
    ans-=sum2;
    printf("%d\n",ans);
}

Measured memory_bytes: 19456
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int mod = 1E9 + 7;
const int inf = 1 << 29;

int main() {
  vector<int> x(5);
  rep(i, 5) cin >> x[i];
  rep(i, 5) {
    if (x[i] == 0) {
      cout << i + 1 << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3544
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define rep(i, n) for(int i=0;i<(int)(n);i++)

long lcm(long a, long b){
    long r, x, temp;
    x = a*b;
    if(a<b){
        temp = a;
        a = b;
        b = temp;
    }
    
    // Euclidean Algorithm 
    r = a%b;
    while(r != 0){
        a = b;
        b = r;
        r = a%b;
    }
    return x/b;
}

int main(void){
    long a, b, c;
    scanf("%ld%ld",&a,&b);
    c = lcm(a,b);
    printf("%ld\n",c);
    return 0; 
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;

int n, a, b, s;
pair <int, int> p[1000000];
bool ju = true;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		cin >> b;
		p[i] = make_pair (b, a);
	}
	sort(p, p + n);
	for (int i = 0; i < n; i++) {
		s += p[i].second;
		if (s > p[i].first) {
			ju = false;
				break;
		}
	}
	if (ju) cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,m,inf=1e9,a,b;cin>>n>>m;
  vector<lvector> G(n);
  lvector ans(n,inf);ans[0]=0;
  rep(i,m) {
    cin>>a>>b;a--,b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  lque que;que.push(0);
  while(que.size()) {
    lque que_new;
    while(que.size()) {
      ll from=que.front();que.pop();
      for(ll to:G[from]) {
        if(ans[to]!=inf) continue;
        ans[to]=from;
        que_new.push(to);
      }
    }
    que=que_new;
  }
  if(*max_element(ALL(ans))==inf) print("No");
  else {
    print("Yes");
    rep(i,n-1) print(ans[i+1]+1);
  }
  return 0;
}

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

#define int long long int
#define double long double
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define pq priority_queue<int>
#define test int tcase; cin>>tcase; for(int tc = 1; tc <= tcase; tc++)
#define inp(a,n,f) int a[n+f];for(int hh=f;hh<n+f;hh++)cin>>a[hh];
#define prdec(k) cout<<fixed<<setprecision(k);
#define ub upper_bound
#define lb lower_bound
#define mii map<int,int>
#define all(v) v.begin(),v.end()
#define qi queue<int>
#define si set<int>
#define inf LLONG_MAX


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

	int a,b,c,k,op=0;
	cin>>a>>b>>c>>k;
	while(b<=a)
		b*=2,op++;
	while(c<=b)
		c*=2,op++;
	if(op<=k)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
#define endl '\n'
#define pi 3.1415926535897932384626433832
#define ll long long
using namespace std;
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / __gcd(a, b); }
bool isPrime(int n) {if (n <= 1) return false;
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false;
    return true;}

void lok(){
    double d,k;
    cin>>d>>k;
    double xh=k;
    double dak=(1800-k)*(1800-k)/3600;
    xh+=dak+(1800-k/2)*k/1800;
    cout<<xh<<endl;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    double d;
    cin>>n>>d;
    vector<pair<double,double>> pak(n);
    double a,b;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        pak[i].first=a;
        pak[i].second=b;
    }
    int sum=0;
    for(int i=0;i<n;i++){
        if(sqrt(pak[i].first*pak[i].first+pak[i].second*pak[i].second)<=d){
            sum++;
        }
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 6436
using System;
public class A
{
    public static void Main()
    {
        int x = 0 ;
        string Line = Console.ReadLine();
        if (Line == "SUN")
        {
            x = 7;
        }
        else if (Line == "MON")
        {
            x = 6;
        }else if (Line == "TUE")
        {
            x = 5;
        }else if (Line == "WED")
        {
            x = 4;
        }else if (Line == "THU")
        {
            x = 3;
        }else if (Line == "FRI")
        {
            x = 2;
        }else if (Line == "SAT")
        {
            x = 1;
        }
        Console.WriteLine(x);
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <cmath>
#include <iomanip>
using namespace std; 
typedef long long ll; typedef string str;

const int mxn = (int)10e5;
int main ()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
	
	ll n;
	cin >> n;
	
	ll freq[mxn+1], sum = 0;
	
	for(ll i = 0 ; i < n ; i++)
	{
		ll a;
		cin >> a;
		freq[a]++;
		sum += a;
	}
	
	int q;
	cin >> q;
	
	for(ll i = 0 ; i < q; i++)
	{
		ll b,c;
		cin >> b >> c;
		
		sum = sum - freq[b]*b + freq[b]*c;
		freq[c] += freq[b];
		freq[b] = 0;
		cout << sum << "\n";
	}	
	
}

Measured memory_bytes: 3988
#include<bits/stdc++.h>
#define two(a) (1<<(a))
#define LINF (1ll<<61)
#define EPS (1e-14)
#define Lshift(a,b) (a<<b)
#define Rshift(a,b) (a>>b)
#define rep(a,b) for(a=0 ; a<b ; a++)
#define xrep(a,b,c) for(a=b ; a<c ; a++)
#define INF (1<<29)
#define GET(x) (mark[x>>5]>>(x&31)&1)
#define SET(x) (mark[x>>5]|=1<<(x&31))
#define maxL (10000000>>5)+1
#define mod 1000000007
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define si set<int>
#define pb push_back
typedef long long ll;
using namespace std;

template <std::int_fast64_t Modulus> class ModInt {
  using u64 = std::int_fast64_t;
public:
  u64 a;
  ModInt(const u64 x = 0) noexcept : a ((x>0?x:Modulus-((-x)%Modulus))%Modulus) {}
  u64 &value() noexcept { return a; }
  u64 &value() const noexcept { return a; }
  ModInt operator+(const ModInt rhs) const noexcept { return ModInt(*this) += rhs; }
  ModInt operator-(const ModInt rhs) const noexcept { return ModInt(*this) -= rhs; }
  ModInt operator*(const ModInt rhs) const noexcept { return ModInt(*this) *= rhs; }
  ModInt operator/(const ModInt rhs) const noexcept { return ModInt(*this) /= rhs; }
  ModInt &operator+=(const ModInt rhs) noexcept { a += rhs.a; if (a >= Modulus) { a -= Modulus; } return *this; }
  ModInt &operator-=(const ModInt rhs) noexcept { if (a < rhs.a) { a += Modulus; } a -= rhs.a; return *this; }
  ModInt &operator*=(const ModInt rhs) noexcept { a = a * rhs.a % Modulus; return *this; }
  ModInt &operator/=(ModInt rhs) noexcept { *this *= rhs.inverse(); return *this; }
  ModInt inverse() const noexcept { int_fast64_t x(a), y(Modulus), u(1), v(0), t; while (y) { t = x / y; swap(x -= t * y, y); swap(u -= t * v, v); } return ModInt(u); } 
  friend ostream &operator<<(ostream &os, const ModInt<Modulus> &p) { return os << p.a; }
};

using Mint = ModInt<mod>;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll n, a, b;
    cin >> n >> a >> b;
    ll x2 = 2;
    ll nn(n);
	auto ans = Mint(1);
    while (nn) {
        if (nn & 1) {
            ans *= x2;
        }
        x2 = x2 * x2 % mod;
        nn >>= 1;
    }
    int i;
    auto ma = Mint(1);
    xrep(i, 1, a + 1) {
        ma *= n - i + 1;
        ma /= i;
    }
    auto mb = Mint(1);
    xrep(i, 1, b + 1) {
        mb *= n - i + 1;
        mb /= i;
    }
    ans -= ma.value();
    ans -= mb.value();
    ans -= 1;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
ll minn(ll x, ll y){
    if(x<y)
        return x;
    return y;
}
ll maxx(ll x, ll y){
    if(x>y)
        return x;
    return y;
}
int n,m,a[1009][1009];
string s[1009];
int cal(int x, int y){
    if(x == n && y==m)
        return 1;
    if(x>n || y>m || s[x-1][y-1]=='#')
        return 0;
    if(a[x][y]==-1){
        a[x][y]=cal(x+1,y);
        a[x][y]+=cal(x,y+1);
    }
    return a[x][y]%mod;
}
int main() {
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            a[i][j]=-1;
    for(int i=0;i<n;i++)
        cin>>s[i];
    cal(1,1);
    cout<<a[1][1]%mod;

}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
double a[10005];
int main()
{
	int n,m;
	double sum=0;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	sum/=4.0*m;
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]>=sum)
			cnt++;
	}
	if(cnt>=m)
		cout<<"Yes";
	else
		cout<<"No";

	return 0;
}

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

#define M /* your task*/1000005
#define L 14
#define NIL -1

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return /* your task */key % M; }
int h2(int key){ return /* your task */1 + (key % (M - 1)); }

int find(char str[]){
  long long key, i, h;
  
  key = getKey(str);
  for(i = 0; ;i++){
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h], str) == 0) return 1;
    else if(strlen(H[h]) == 0) return 0;
  }
    /* your task */

}

int insert(char str[]){
  long long key, i, h;
  key = getKey(str);
  for(i = 0; ;i++){
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h], str) == 0) return 1;
    else if(strlen(H[h]) == 0){
      strcpy(H[h], str);
      return 0;
    }
  }
    /* your task */

}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}


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

#define rep(i, n) for(int i = 0;i < (n);i++)
#define all(c) (c).begin(),(c).end()
#define min(a, b) ((a) <= (b) ? (a) : (b))
#define max(a, b) ((a) >= (b) ? (a) : (b))

typedef unsigned int uint;

using namespace std;

typedef vector<uint> tray_set;

int n, m;

void print_tray(tray_set &trays) {
  for(uint& t : trays) {
    rep(i, 16) {
      if(t >> i & 1u) cout << i << ' ';
    }
    cout << endl;
  }
  cout << "---------------" << endl;
}

int top_cop(uint tray) {
  for(int i = 15;i >= 0;i--) {
    if(tray >> i & 1u) return i;
  }
  return -1;
}

void move_cop(uint *from, uint *to) {
  uint x = 1u << top_cop(*from);
  *from = x ^ *from;
  *to   = x | *to;
}

int count_cop(uint tray) {
  int count = 0;
  for(; tray != 0 ; tray &= tray - 1) count++;
  return count;
}

bool finished(tray_set &trays) {
  return count_cop(trays[0]) == n || count_cop(trays[2]) == n;
}

int solve(tray_set trays, tray_set prev) {
  tray_set temp(3);

  rep(count, m) {
    if(finished(trays)) return count + 1;

    //print_tray(trays);

    bool moved = false;

    rep(i, 3) {
      if(trays[i] == 0) continue;

      rep(j, 3) {
        if(abs(i - j) >= 2 || i == j) continue;

        if(trays[j] == 0 || top_cop(trays[i]) > top_cop(trays[j])) {
          temp = trays;

          move_cop(&temp[i], &temp[j]);
          if(temp != prev) {
            prev = trays;
            trays = temp;

            moved = true;
            break;
          }
        }
      }
      if(moved) break;
    }
    if(!moved) return -1;
  }

  return -1;
}

int main() {
  while(true) {
    cin >> n >> m;
    if(n == 0 && m == 0) break;

    tray_set trays(3, 0);
    rep(i, 3) {
      int a;
      cin >> a;
      rep(j, a) {
        int b;
        cin >> b;
        trays[i] |= 1u << b;
      }
    }

    if(finished(trays)) {
      cout << 0 << endl;
      continue;
    }

    vector<tray_set> sets;
    rep(i, 3) {
      if(trays[i] == 0) continue;

      rep(j, 3) {
        if(abs(i - j) >= 2 || i == j) continue;

        if(trays[j] == 0 || top_cop(trays[i]) > top_cop(trays[j])) {
          tray_set new_trays = trays;
          move_cop(&new_trays[i], &new_trays[j]);
          sets.push_back(new_trays);
        }
      }
    }

    int ans1 = solve(sets[0], trays), ans2 = -1;
    if(sets.size() > 1) ans2 = solve(sets[1], trays);

    //cout << ans1 << ' ' << ans2 << endl;

    if(ans1 == -1 && ans2 == -1) cout << -1 << endl;
    else if(ans1 != -1 && ans2 != -1) cout << min(ans1, ans2) << endl;
    else cout << max(ans1, ans2) << endl;
  }
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,c;
	cin >> a >> b >> c;
	if(c<=a+b) printf("No\n");
	else if(4*a*b<(c-a-b)*(c-a-b))
	printf("Yes\n");
	else
	printf("No\n");
	return 0;
} 

Measured memory_bytes: 256
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
const int INF = 1e9;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)

//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#pragma endregion RegionDefs

void solve()
{
    int a[9];
    rep(i, 9)
    {
        cin >> a[i];
    }
    IN(n);
    bool t[9];
    rep(i, 9)
    {
        t[i] = false;
    }
    rep(i, n)
    {
        IN(b);
        rep(j, 9)
        {
            if (a[j] == b) t[j] = true;
        }
    }
    bool s = false;
    rep(i, 3)
    {
        s = s || (t[i*3] && t[i*3+1] && t[i*3+2]);
    }
    rep(i, 3)
    {
        s = s || (t[i] && t[3+i] && t[6+i]);
    }
    s = s || (t[0] && t[4] && t[8]);
    s = s || (t[2] && t[4] && t[6]);
    cout << (s ? "Yes" : "No") << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef struct pair<int,int> P;
typedef struct pair<int,P> P2;

const ll INF=1000000000000000001;
int main() {

	ll q,h,s,d,n;
	cin>>q>>h>>s>>d>>n;

	ll p1=q*4;
	p1=min(p1,h*2);
	p1=min(p1,s);
	ll p2=d;
	p2=min(d,p1*2);
	cout<<(n/2)*p2+(n%2)*p1<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <string>
#include <utility>
#include <map> 
#include <queue>
#include <stack>
#include <iomanip>
#include <sstream>
#define MP make_pair
#define PB push_back
#define S size()
#define B begin()
#define E end()
#define ll long long
#define REP(i,a,n) for(ll i=a; i<n; ++i)
#define RED(i,n,a) for(ll i=n; i>=a; --i)
#define m9 1000000007
#define endl "\n"
#define F first
#define SE second
#define ld long double



using namespace std;

ll gcd(ll a, ll b){
    if(a%b==0){
        return b;
    }
    else{
        return gcd(b, a%b);
    }
}
ld area(ld x1, ld y1, ld x2, ld y2, ld x3, ld y3){
    return abs(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))/2;
}
 ld n;
ll cnt=0;
ld solve(ll a, ll b, ll c){
    ll rem=a+b/2 +c/3;
    
   ld ans=(ld)n/(ld)rem;
   cnt++;
   cout<<a<<" "<<b<<" "<<c<<" "<<ans<<endl;
    if(a>0){
        if(b>0){
            if(c>0){
                ans+=(solve(a-1,b,c)+solve(a+1,b-2,c)+solve(a,b+1,c-3));
            }
            else{
                ans+=(solve(a-1,b,c)+solve(a+1,b-2,c));
            }
        }
        else{
            if(c>0){
                ans+=(solve(a-1,b,c)+solve(a,b+2,c-3));
            }
            else{
                ans+=solve(a-1,b,c);
            }
        }
    }
    else{
        if(b>0){
            if(c>0){
                ans+=(solve(a+1,b-2,c)+solve(a,b+2,c-3));
            }
            else{
                ans+=solve(a+1,b-2,c);
            }
        }
        else{
            if(c>0){
                ans+=(solve(a,b+2,c-3));
            }
            else{
                return ans;
            }
        }
    }
    return ans;
}


int main(){
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    ll n;
    cin>>n;
    vector <ld> v(n);
    REP(i,0,n){
        cin>>v[i];
    }
    ld dp[n+1];
    REP(i,0,n+1){
        dp[i]=0;
    } // dp[i]=probability that there are i heads so far;
    dp[0]=1;
    REP(i,0,n){
        for(ll j=i+1; j>=0; --j){
            dp[j]=(j-1>=0?dp[j-1]*v[i]:0)+dp[j]*(1-v[i]);
        }
    }
    ld ans=0;
    REP(i,n/2+1,n+1){
        ans+=dp[i];
    }
    cout<<fixed<<setprecision(20)<<ans;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define P pair<int, int>
typedef long long ll;
const ll mod = 1e9+7;

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}

int f(string a, string b){
  int ans = 0;
  for(char i = 'a'; i <= 'z'; i++){
    bool founda = false;
    bool foundb = false;
    rep(j,a.size()){
      if(a[j] == i) founda = true;
    }
    rep(j, b.size()){
      if(b[j] == i) foundb = true;
    }
    if(founda && foundb) ans++;
  }
  return ans;
}


int main(){
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  rep(i, n+1){
    int tmp = f(s.substr(0, i), s.substr(i));
    ans = max(ans, tmp);
  }
  cout << ans << endl;
}



Measured memory_bytes: 256