akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] vs = RArInt();
            Console.WriteLine(vs.OrderBy(x=>x).Take(2).Sum());

        }
        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}


Measured memory_bytes: 13396
#include<vector>
#include<iostream>
#include<algorithm>
#include<tuple>
#include<string>
#include<bits/stdc++.h>
using namespace std;
string s;
vector<string> n;

void printVec(vector<string> &vec) {
  cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    cout << *it << " ";
  }
  cout << endl;
}
void solve(){
    int a,b;
    cin>>a>>b;
    if(b>=a){
        cout<<a<<endl;

    }

    else cout<<a-1<<endl;
}

int main(){
    solve();
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i, n) for (int i = 0; i < int(n); i++)
#define FOR1(i, m, n) for (int i = int(m); i < int(n); i++)
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))

int main(int argc, char *argv[]) {
  int N, M, Q;
  //cin >> N >> M >> Q;
  scanf("%d%d%d", &N, &M, &Q);

  //boost::multi_array<int, 2> mat(boost::extents[N + 1][N + 1]);
  int mat[501][501] = {};

  FOR(i, M) {
    int L, R;
    // cin >> L >> R;
    scanf("%d%d", &L, &R);
    mat[L][R]++;
  }

  FOR(i, N + 1) {
    FOR(j, N) { mat[i][j + 1] += mat[i][j]; }
  }

  for (int i = N; i > 0; i--) {
    FOR(j, N + 1) { mat[i - 1][j] += mat[i][j]; }
  }

  while (Q--) {
    int p, q;
    // cin >> p >> q;
    scanf("%d%d", &p, &q);
    cout << mat[p][q] << "\n";
  }

  return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>  // ver2.3.0
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define COUNT(a,k) upper_bound(ALL(a),k)-lower_bound(ALL(a),k)
#define BIGGER(a,k) a.end()-upper_bound(ALL(a),k)
#define SMALLER(a,k) lower_bound(ALL(a),k)-a.begin()
#define Vi vector<int>
#define VVi vector<Vi>
#define Vs vector<string>
#define Pii pair<int,int>
#define VPii vector<Pii>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define itos to_string
#define stoi stoll
#define FI first
#define SE second
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define cyes cout<<"yes"<<endl
#define cno cout<<"no"<<endl
#define _ <<' '<<
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vin(a) rep(iI,0,a.size())cin>>a[iI]
#define Vout(a) rep(lZ,0,a.size()-1)cout<<a[lZ]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lY,0,a.size()){if(!a[lY].empty()){Vout(a[lY]);}else cout<<endl;}
#define VPout(a) rep(lX,0,a.size())cout<<a[lX].FI<<' '<<a[lX].SE<<endl
#define Verr(a) rep(iZ,0,a.size()-1)cerr<<a[iZ]<<' ';cerr<<a.back()<<endl
#define VVerr(a) rep(J,0,a.size()){if(!a[J].empty()){Verr(a[J]);}else cerr<<'.'<<endl;}
#define VPerr(a) rep(iX,0,a.size())cerr<<a[iX].FI<<' '<<a[iX].SE<<endl
#define INF 3000000000000000000  //  3.0*10^18(MAXの1/3くらい)
#define MAX LLONG_MAX
#define PI 3.14159265358979
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n)) ※nはMOD環境の数値ダメ！
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int scomb(int n, int r){if((n-r)<r)r=n-r;  //  nCr (小さい場合)
int a=1;for(int i=n;i>n-r;--i){a=a*i;}for(int i=1;i<r+1;++i){a=a/i;}return a;}
int comb(int n, int r){if((n-r)<r)r=n-r;  //  nCr (%MOD)
int a=1;for(int i=n;i>n-r;--i){a=a*i%MOD;}for(int i=1;
i<r+1;++i){a=a*mypow(i,MOD-2,MOD)%MOD;}return a%MOD;}
int stpow(int n){  //  階乗(%MOD)
if(n==0)return 1;int a=1;rep(i,1,n+1)a=a*i%MOD;return a;}
Vi stpowV(){Vi a(100001);  //  階乗配列(%MOD)
a[0]=1;repeq(i,1,100000)a[i]=a[i-1]*i%MOD;return a;}
void press(auto &v){v.erase(unique(ALL(v)),v.end());}  //  圧縮



signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);
  int n;
  cin >> n;
  
  Vi a(n);
  Vin(a);
  int maxx = *max_element(ALL(a));
  rep(i,0,n) a[i] = maxx-a[i];
  //Verr(a);
  
  Vi dp(100010,INF);
  dp[0] = -1;
  int qw;
  
  rep(i,0,n) {
    qw = SMALLER(dp,a[i]) + COUNT(dp,a[i]);
    dp[qw] = a[i];
  }
  
  
  
  cout << SMALLER(dp,INF-500)-1 << endl;
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "YES" : "NO");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  string S;
  cin >> S;
  int count = 0;
  rep(i, S.size())
  {
    if (S[i] == 'o')
      count++;
  }
  count += 15 - S.size();
  bool is_ok = count >= 8;
  printYesNo(is_ok);
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

long long syou(long long a,long long b){
  if(a < b){
    return a;
  }
  else{
    return b;
  }
}

int main(void){
  int a , b , c , x , y;
  scanf("%d %d %d %d %d",&a ,&b ,&c ,&x ,&y);

  long long ans1 , ans2 , ans3;

  ans1 = a * x + b * y;
  
  if(x < y){
    ans2 = 2 * c * x;
    ans2 += (y-x) * b;
    ans3 = 2 * c * y; 
  } 
  else{
    ans2 = 2 * c * y;
    ans2 += (x-y) * a;
    ans3 = 2 * c * x;
  }
  
  long long min = syou(ans1,syou(ans2,ans3));
  printf("%lld\n",min);
  return 0;
}

Measured memory_bytes: 1736
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
	int i, j;
	int *tmp1 = (int *)malloc(10000000);
	int *tmp2 = (int *)malloc(10000000);


	for (i = 0;;i++) {
		scanf("%d %d", &tmp1[i], &tmp2[i]);
		if (tmp1[i] == 0 && tmp2[i] == 0)
			break;
	}
	for (j = 0; j < i; j++)
		printf("%d %d\n", tmp1[j] < tmp2[j] ? tmp1[j] : tmp2[j], 
		tmp1[j] > tmp2[j] ? tmp1[j] : tmp2[j]);

	free(tmp1);
	free(tmp2);

	return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
using ll = long long;

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

int main()
{
	int A, B;
	cin >> A >> B;

	int x, y;
	if ((A + 1) % 2 == 0) {
		for (x = ceil(A / 0.08); x < (A + 1) / 0.08; ++x) {
			for (y = B / 0.1; y < (B + 1) / 0.1; ++y) {
				if (x == y) { cout << x << endl; goto pqr; }
			}
		}
		cout << -1 << endl;
	pqr:;
	}
	else {
		for (x = ceil(A / 0.08); x <= (A + 1) / 0.08; ++x) {
			for (y = B / 0.1; y < (B + 1) / 0.1; ++y) {
				if (x == y) { cout << x << endl; goto stu; }
			}
		}
		cout << -1 << endl;
	stu:;
	}
}

Measured memory_bytes: 256
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)
function moveup(x::Array{Int,1},n)
	k = length(x)
	for i in 1:k-1
		if x[k-i+1] > n-1
			x[k-i] += div(x[k-i+1],n)
			x[k-i+1] = x[k-i+1]%n
		end
	end
	if x[1] > n-1
		0
	else
		x
	end
end

function main()
	n,m = readline() |> split |> parseMap
	k = zeros(Int,m)
	a = [Int[] for i in 1:m]
	for i in 1:m
		x = readline() |> split |> parseMap
		k[i] = x[1]
		a[i] = x[2:x[1]+1]
	end
	p = readline() |> split |> parseMap
	on = zeros(Int,n)
	c = 0
	for i in 1:2^n
		flg = 0
		for i in 1:m
			z = 0
			for j in 1:k[i]
				if on[a[i][j]] == 1
					z += 1
				end
			end
			if z%2!=p[i]
				flg = 1
				break
			end
		end
		if flg == 0
			c += 1
		end
		on[n] += 1
		moveup(on,2)
	end
	println(c)
end

main()


Measured memory_bytes: 169748
n,t = map(int,input().split())
a = []
cnt = 0
for i in range(n):
  cost,time = map(int,input().split())
  if time<= t:
    cnt +=1
    a.append(cost)
  else:
    pass
if cnt > 0:
  print(min(a))
else:
  print("TLE")

Measured memory_bytes: 38256
import sys
input = sys.stdin.readline

n, k = map(int, input().split())

# h = [0]*n
# for i in range(n):
#     h[i] = int(input())

h = [int(input()) for _ in range(n)]

h.sort()

ans = 10**9
for i in range(n-k+1):
    temp = h[i+k-1] - h[i]
    ans = min(ans, temp)

print(ans)

Measured memory_bytes: 7384
#include<bits/stdc++.h>
#define pb(a) push_back(a)
#define ms(x,y) memset(x,y,sizeof(x))
#define sci(a) scanf("%d",&a) 
#define scl(a) scanf("%lld",&a)
#define scd(a) scanf("%lf",&a) 
#define ll unsigned long long 
using namespace std;
/* --------------- fast io --------------- */ // begin
namespace Fread{
const int SIZE=1<<20;
char buf[SIZE],*S,*T;
inline char getchar(){
	if(S==T){
		T=(S=buf)+fread(buf,1,SIZE,stdin);
		if(S==T)return EOF;
	}
	return *S++;
}
}//namespace Fread
namespace Fwrite{
const int SIZE=1<<20;
char buf[SIZE],*S=buf,*T=buf+SIZE;
inline void flush(){
	fwrite(buf,1,S-buf,stdout);
	S=buf;
}
inline void putchar(char c){
	*S++=c;
	if(S==T)flush();
}
struct _{
	~_(){flush();}
}__;
}//namespace Fwrite

#ifdef ONLINE_JUDGE
	#define getchar Fread::getchar
	#define putchar Fwrite::putchar
#endif

template<typename T>inline void read(T& x){
	x=0;int f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c))x=x*10+(c-'0'),c=getchar();
	x*=f;
}
template<typename T>inline void write(T x,bool _enter=0,bool _space=0){
	if (!x)putchar('0');else{
		if(x<0)putchar('-'),x=-x;
		static char dig[41];
		int top=0;
		while(x)dig[++top]=(x%10)+'0',x/=10;
		while(top)putchar(dig[top--]);
	}
	if(_enter)putchar('\n');
	if(_space)putchar(' ');
}

namespace Fastio{
struct reader{
	template<typename T>reader& operator>>(T& x){::read(x);return *this;}
	reader& operator>>(char& c){
		c=getchar();
		while(c=='\n'||c==' ')c=getchar();
		return *this;
	}
	reader& operator>>(char* str){
		int len=0;
		char c=getchar();
		while(c=='\n'||c==' ')c=getchar();
		while(c!='\n'&&c!=' ')str[len++]=c,c=getchar();
		str[len]='\0';
		return *this;
	}
}cin;
const char endl='\n';
struct writer{
	template<typename T>writer& operator<<(T x){::write(x,0,0);return *this;}
	writer& operator<<(char c){putchar(c);return *this;}
	writer& operator<<(const char* str){
		int cur=0;
		while(str[cur])putchar(str[cur++]);
		return *this;
	}
}cout;
}//namespace Fastio
//#define cin Fastio::cin
#define cout Fastio::cout
#define endl Fastio::endl
/* --------------- fast io --------------- */ // end

const int maxn=100005;
ll a[maxn];
ll an[maxn];
const ll m=1e9+7;
int main(){
	string s1,s2;
	cin>>s1>>s2;
		int n1=s1.length(),n2=s2.length();
		int ans=n2;
		for(int i=0;i<=n1-n2;++i){
			int t=0;
			for(int j=0;j<n2;++j)
				if(s1[i+j]!=s2[j])
					t++;
				ans=min(ans,t);
		}
			
		cout<<ans<<endl;	
	return 0;
} 

Measured memory_bytes: 3572
#include<stdio.h>
#include<math.h>
int isprime(int x){
  if(x == 2){
    return 1;
  }

  if(x < 2 || x % 2 == 0){
    return 0;
  }

  int i = 3;
  while(i <= sqrt(x)){
    if(x % i == 0){
      return 0;
    }
    i += 2;
  }

  return 1;
}
int main(){
  int n;
  scanf("%d",&n);
  int cnt = 0;
  for(int i = 0; i < n; i++){
    long long x;
    scanf("%lld",&x);
    if(isprime(x)){
      //printf("%dは素数です。",x);
      cnt++;
      //printf("%d\n",cnt);
    }
  }
  printf("%d\n",cnt);
}



Measured memory_bytes: 2048
#include<stdio.h>
#include<math.h>

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

 while(scanf("%d",&n)!=EOF){
    j=0;
    for(i=2;i<=sqrt(n);i++){
      if(n%i==0){
    j=1;
    break;
      }
    }
    if(j==0)sum++;
  }
  printf("%d\n",sum);
 
  return 0;
}



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

int main() {
	string S; cin >> S;
	int r = 0;
	for(int i = 0; i * 2 < S.size(); i++) if(S[i] != S[S.size() - i - 1]) r++;
	cout << r;
}


Measured memory_bytes: 256
import std.stdio,std.conv, std.algorithm, std.container,std.array,std.range,std.string,std.typecons;
const dx = [1,0,-1,0];
const dy = [0,1,0,-1];
void read(T...)(auto ref T args){ 
	auto line = readln().split(); 
	foreach(i,ref arg; args) arg = line[i].to!(typeof(arg));
}
int sum(int n){return n * (n + 1)/ 2;}
int tax(int per,int yen) {return yen * (100 +per) / 100;}
void main(){
	int x,y,s;
	while(read(x,y,s),x|y|s){
		int ans ;
		auto taxed = new int [s];
		foreach(int i,ref t;taxed)t = tax(x,i);
		foreach(i;1..s/2+1){
			foreach(j;i..s){
				if (taxed[i] + taxed[j] == s ){
					ans = max(ans,tax(y,i) + tax(y,j));break;
				}
			}
		}
		ans.writeln;
	}
}

Measured memory_bytes: 2904
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int N;
    int ans = 0;

    cin >> N;

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

    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < i; j++)
        {
            ans += d[i] * d[j];
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#![allow(unused_mut)]
#![allow(non_snake_case)]

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        C: [[i64; 3]; 3],
    }

    let mut ok = false;
    for a1 in 0..101 {
        let b1 = C[0][0] - a1;
        let b2 = C[0][1] - a1;
        let b3 = C[0][2] - a1;
        for  a2 in 0..101 {
            for  a3 in 0..101 {
                if
                    C[1][0] == a2 + b1 &&
                    C[1][1] == a2 + b2 &&
                    C[1][2] == a2 + b3 &&
                    C[2][0] == a3 + b1 &&
                    C[2][1] == a3 + b2 &&
                    C[2][2] == a3 + b3 {
                    ok = true;
                }
            }
        }
    }
    if ok {
        println!("Yes");
    } else {
        println!("No");
    }
}

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

string max(string a, string b)
{
    if(a.length()>b.length())
    return a;
    if(a.length()<b.length())
    return b;

    return a>b?a:b;    
}

string solve(int n, vector<pair<char,int> > const &characters)
{
    vector<string> dp(n+10," ");
    dp[0]="";
    for(int i=0 ; i<=n ; ++i)
    {
        if(dp[i]==" ")
        continue;
        for(auto j:characters)
        {
            dp[i+j.second]=max(dp[i+j.second],dp[i]+j.first);
        }
    }
    return dp[n];
}

int main(){
    vector<int> matches={0,2,5,5,4,5,6,3,7,6};
    int n,m;
    cin>>n>>m;
    vector<pair<char,int> > characters;
    for(int i=0 ; i<m ; ++i)
    {
        char x;
        cin>>x;
        characters.push_back({x,matches[x-'0']});
    }
    cout<<solve(n,characters)<<endl;
    return 0;
}


Measured memory_bytes: 43648
n = int(input())
cnt = 0
a = 0
b = 0
both = 0
for i in range(n):
    s = input()
    cnt += s.count('AB')
    if s[0] == 'B':
        b += 1
    if s[-1] == 'A':
        a += 1
    if s[0] == 'B' and s[-1] == 'A':
        both += 1
if both == a == b and both != 0:
    print(cnt+both-1)
else:
    print(cnt+min(a,b))

Measured memory_bytes: 3064
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll n;
  cin >> n;
  ll a[n];
  REP(i,n){
    cin >> a[i];
  }
  sort(a,a+n);
  vector<ll> left, right;
  ll ind_l = 0, ind_r = n-1;
  left.push_back(a[0]);
  ind_l++;
  right.push_back(a[n-1]);
  ind_r--;
  ll ans = abs(left.front()-right.front());
  for(ll rest = n-2; rest>0; rest--){
    ll x = a[ind_l];
    ll y = a[ind_r];
    ll x1 = abs(a[ind_l]-left.back());
    ll x2 = abs(a[ind_l]-right.back());
    ll y1 = abs(a[ind_r]-left.back());
    ll y2 = abs(a[ind_r]-right.back());
    ll maxabs = max(x1,max(x2,max(y1,y2)));
    if(maxabs==x1){
      left.push_back(x);
      ind_l++;
    }else if(maxabs==x2){
      right.push_back(x);
      ind_l++;
    }else if(maxabs==y1){
      left.push_back(y);
      ind_r--;
    }else if(maxabs==y2){
      right.push_back(y);
      ind_r--;
    }
    ans += maxabs;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2168
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

template<typename flow_t, typename cost_t>
struct MinimumCostFlow {
    struct Edge {
        int to, rev; flow_t cap; cost_t cost;
        Edge() = default; Edge(int to, int rev, flow_t cap, cost_t cost) : to(to), rev(rev), cap(cap), cost(cost) {}
    };
    vector<vector<Edge>> graph;
    vector<int> h, prev_v, prev_e;
    vector<cost_t> dist;
    void add_edge(int from, int to, flow_t cap, cost_t cost) {
        graph[from].emplace_back(to, graph[to].size(), cap, cost);
        graph[to].emplace_back(from, graph[from].size() - 1, 0, -cost);
    }
    bool bellman_ford(int s) {
        dist.assign(graph.size(), numeric_limits<cost_t>::max());
        dist[s] = 0;
        for (int i = 0; i < (int)graph.size(); ++i) {
            bool update = false;
            for (int v = 0; v < (int)graph.size(); ++v) {
                if (dist[v] == numeric_limits<cost_t>::max()) continue;
                for (int i = 0; i < (int)graph[v].size(); ++i) {
                    const auto& e = graph[v][i];
                    if (e.cap > 0 && dist[e.to] > dist[v] + e.cost) {
                        dist[e.to] = dist[v] + e.cost;
                        update = true;
                        prev_v[e.to] = v;
                        prev_e[e.to] = i;
                    }
                }
            }
            if (!update) return false;
        }
        return true;
    }
    cost_t min_cost_flow(int s, int t, flow_t f) {
        h.resize(graph.size(), 0);
        prev_v.resize(graph.size());
        prev_e.resize(graph.size());
        cost_t res = 0;

        //bool nega_cycle = bellman_ford(s);
        //if (nega_cycle) return -1;
        //if (dist[t] == numeric_limits<cost_t>::max()) return -1;
        //for (int i = 0; i < (int)graph.size(); ++i) h[i] = dist[i];

        while (f > 0) {
            bool nega_cycle = bellman_ford(s);
            if (nega_cycle) return -1;
            if (dist[t] == numeric_limits<cost_t>::max()) return -1;
            //for (int i = 0; i < (int)graph.size(); ++i) h[i] += dist[i];

            flow_t d = f;
            for (int v = t; v != s; v = prev_v[v]) {
                d = min(d, graph[prev_v[v]][prev_e[v]].cap);
            }
            f -= d;
            //res += d * h[t];
            res += d * dist[t];
            for (int v = t; v != s; v = prev_v[v]) {
                auto& e = graph[prev_v[v]][prev_e[v]];
                e.cap -= d;
                graph[v][e.rev].cap += d;
            }
        }
        return res;
    }
};

int main() {
    int V, E, F;
    cin >> V >> E >> F;
    MinimumCostFlow<int, int> mcf;
    mcf.graph.resize(V);
    for (int i = 0; i < E; ++i) {
        int u, v, c, d;
        cin >> u >> v >> c >> d;
        mcf.add_edge(u, v, c, d);
    }

    cout << mcf.min_cost_flow(0, V - 1, F) << endl;
}


Measured memory_bytes: 3196
#include "bits/stdc++.h"
using namespace std;


std::string Replace( std::string String1, std::string String2, std::string String3 )
{
    std::string::size_type  Pos( String1.find( String2 ) );

    while( Pos != std::string::npos )
    {
        String1.replace( Pos, String2.length(), String3 );
        Pos = String1.find( String2, Pos + String3.length() );
    }

    return String1;
}

int main() {
	string s,ss,sss,ssss;
	while(getline(cin,s)){
		//cout<<s<<endl;
	ss=Replace(s, "peach", "*****");
	sss=Replace(ss, "apple","peach");
	ssss=Replace(sss, "*****","apple");
	cout<<ssss<<endl;
	}
}

Measured memory_bytes: 3184
#[allow(unused_macros)]
macro_rules! input {
    ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } };
    ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ( $ next : expr ) => { };
    ( $ next : expr , ) => { };
    ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) };
    ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) };
    ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) };
    ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

#[allow(dead_code)]
pub const M: u64 = 1_000_000_007;

fn main() {
    input! {
        n: u64, m: u64, k: u64
    }

    let cb = comb(n*m-2,k-2,M);
    let mut xlen = 0u64;
    for d in 0..n {
        let ptn = (n - d) * m * m % M;
        xlen += d * ptn % M * cb % M;
        xlen %= M;
    }
    let mut ylen = 0u64;
    for d in 0..m {
        let ptn = (m - d) * n * n % M;
        ylen += d * ptn % M * cb % M;
        ylen %= M;
    }
    println!("{}", (xlen + ylen) % M);
}

#[doc = " a / b modulo m == a * modinv(b, m) % m"]
#[allow(dead_code)]
fn modinv(a_: u64, m_: u64) -> u64 {
    let m = m_ as i64;
    let mut a = a_ as i64;
    let mut b = m as i64;
    let mut u = 1;
    let mut v = 0;
    while b != 0 {
        let t = a / b;
        a -= t * b;
        std::mem::swap(&mut a, &mut b);
        u -= t * v;
        std::mem::swap(&mut u, &mut v);
    }
    u %= m;
    if u < 0 {
        u += m
    };
    u as u64
}
#[allow(dead_code)]
fn comb(n: u64, r: u64, m: u64) -> u64 {
    let mut ret = 1u64;
    for i in 0..r {
        ret *= n - i;
        ret %= m;
    }
    for i in 1..r + 1 {
        ret *= modinv(i, m);
        ret %= m;
    }
    ret
}
#[doc = " combination with repetition"]
#[allow(dead_code)]
fn comb_rep(n: u64, r: u64, m: u64) -> u64 {
    comb(n + r - 1, r, m)
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii; typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int k;
	cin >>k;
	ll ans = 0;
	rep(i, k) rep(j, k){
		int g = gcd(i+1, j+1);
		rep(s, k) ans  += gcd(g, s+1);
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>

char map[1001][1001];
char sign[2][2];

int main(){

	int max = 0;
	int res = 0;

	int m, n;
	std::cin >> m >> n;

	for (int i = 0; i < m; i++){
		for (int j = 0; j < n; j++){
			std::cin >> map[i][j];
		}
	}

	for (int i = 0; i < 2; i++){
		for (int j = 0; j < 2; j++){
			std::cin >> sign[i][j];
		}
	}

	for (int i = 0; i < m - 1; i++){
		for (int j = 0; j < n - 1; j++){
			bool flg = true;
			for (int k = 0; k < 2; k++){
				for (int l = 0; l < 2; l++){
					if (map[i + k][j + l] != sign[k][l])flg = false;
				}
			}
			if (flg)max++;
		}
	}

	for (int i = 0; i < m; i++){
		for (int j = 0; j < n; j++){
			int cnt = 0;
			int bnt = 0;
			char bef = map[i][j];
			for (int k = 0; k < 4; k++){
				if (k == 1)map[i][j] = 'J';
				if (k == 2)map[i][j] = 'O';
				if (k == 3)map[i][j] = 'I';

				int a = 0;
				for (int l = -1; l < 1; l++){
					for (int q = -1; q < 1; q++){
						if (i + l < 0 || i + l + 1 >= m)continue;
						if (j + q < 0 || j + q + 1 >= n)continue;

						bool flg = true;
						for (int o = 0; o < 2; o++){
							for (int p = 0; p < 2; p++){
								if (map[i + l + o][j + q + p] != sign[o][p])flg = false;
							}
						}
						if (flg)a++;
					}
				}

				if (k == 0)bnt = a;
				else cnt = std::max(cnt, a);

				map[i][j] = bef;
			}

			res = std::max(res, max + (cnt - bnt));
		}
	}

	std::cout << res << std::endl;

	return 0;
}

Measured memory_bytes: 2136
// Storange Bank
#include <iostream>
using namespace std;
int dp[100010];

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

    for (int i = 0; i < 100010; i++) dp[i] = N;
    dp[0] = 0;

    for (int i = 1; i <= N; i++) {
        for (int pow6 = 1; pow6 <= i; pow6 *= 6) {
            dp[i] = min(dp[i], dp[i - pow6] + 1);
        }
        for (int pow9 = 1; pow9 <= i; pow9 *= 9) {
            dp[i] = min(dp[i], dp[i - pow9] + 1);
        }
    }

    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<double,double> pdd;
typedef pair<long long,long long> pll;
// scanf("%d %d %d %d",&w,&b,&d,&s); %lld
// printf("%d\n" ,points);
// const double PI=acos(-1);

const int MAX=1e5+5;
int heights[MAX];
ll dp[MAX];
int n;

int main(){
    int k;
    cin >> n >> k;
    ll aux;
    for(int i=0;i<n;i++){
        cin >> heights[i];
    }
    for(int i=1;i<n;i++){
        dp[i]=dp[i-1]+abs(heights[i]-heights[i-1]);
        for(int j=2;j<=k;j++){
            if(i-j>-1){
                aux=dp[i-j]+abs(heights[i]-heights[i-j]);
                dp[i]=min(dp[i],aux);
            }
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}


Measured memory_bytes: 4764
if __name__ == "__main__":
  _n = input()
  a = _n[-1]
  if a == "2" or a == "4" or a == "5" or a == "7" or a == "9":
    print("hon")
    exit()
  elif a == "0" or a == "1" or a == "6" or a == "8":
    print("pon")
    exit()
  else:
    print("bon")


Measured memory_bytes: 9100
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main()
{
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a,a+3);

	int b[3];
	for(int i=0;i<3;i++)
		b[i]=a[i]%2;
	
	int ans=0;

	if(b[0]==b[1])
		ans=(a[2]-a[0]+a[2]-a[1])/2;
	else
		ans=(a[2]+1-a[0])/2+(a[2]+1-a[1])/2+1;

	cout << ans << endl;


	
}

Measured memory_bytes: 256
// Mon Sep 14 19:59:49 IST 2020  


#include <bits/stdc++.h>        
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(ii,a,b)       for(int64 ii = (int64)a ; ii < (int64)b  ; ii++ )
#define scan(any)          for(auto &i:any) cin>>i;
#define debug(x)           cerr << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define int64              long long   
#define all(x)             (x).begin(),(x).end() 
#define ff                 first
#define ss                 second
#define pppp               pair <int,int> 
#define flushOff           fflush(stdout) 
#define precise(x)         cout << fixed << setprecision(12) << x << '\n'; 
using namespace std ;    
// policy based   
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
 
const int MOD1 = 1e9+7;
const int MOD2 = 1e9+9;
const double pi = 3.141592653589793238;
const int INF = 2e9+7;
const int64 big = INT64_MAX;

const int N = 2e5+7;
struct compare{
    bool operator()(pair <int,int> A, pair <int,int> B){
        if(A.first == B.first)
            return A.second > B.second;
        return A.first > B.first;
    }
}; 
void print(vector <int>v){
    for(int t : v) 
        cout << t << ' ';
    cout << '\n';
    return;
}
void printSet(multiset <int>v){
    cout << "===\n";
    for(int t : v) 
        cout << t << ' ';
    cout << '\n';
    return;
}
  
int tests(){ 
    int n;
    cin >> n;
    vector <pair<int,int>> v(n);
    for(auto &p : v)
        cin >> p.ff >> p.ss;
    forn(i,2,n)
        if(v[i].ff == v[i].ss && v[i-1].ff == v[i-1].ss && v[i-2].ff == v[i-2].ss)
            return cout << "Yes\n",0;
    cout << "No\n";
    return 0;
}    
int main(){
    I__O ;      
    int cases = 1 ;  
    // cin >> cases ;
    while(cases--)
        tests(); 
    return 0 ; 
}
 


Measured memory_bytes: 3652
n = int(input())
h = list(map(int, input().split()))

cnt = 0
for i in range(len(h)):
    if i == 0:
        cnt += 1
    else:
        for j in range(i):
            if h[i] < h[j]:
                break
        else:
            cnt += 1

print(cnt)


Measured memory_bytes: 3060
// Etavioxy
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<cmath>
#define il inline
#define ll long long
#define rep(i,s,t) for(register int i=(s);i<=(t);i++)
#define rev_rep(i,s,t) for(register int i=(s);i>=(t);i--)
#define each(i,u) for(int i=head[u];i;i=bow[i].nxt)
#define file(s) freopen(s".in" ,"r",stdin),freopen(s".out","w",stdout)
#define pt(x) putchar(x)
using namespace std;
il int ci(){
	register char ch;int f=1;
	while(!isdigit(ch=getchar()))f=ch=='-'?-1:1;
	register int x=ch^'0';
	while(isdigit(ch=getchar()))x=(x*10)+(ch^'0');
	return f*x;
}

// 20:49

enum{N=100023};

ll a[N],w;
ll n,A,B;
il bool chk(){
	ll ans= 0;
	rep(i,1,n) if( a[i]>B*w ) ans+= (a[i]-B*w+A-B-1)/(A-B);
	return ans<=w;
}

int main(){
	n=ci(), A=ci(), B=ci();
	rep(i,1,n) a[i]=ci();
	int l=1, r=1e9;
	while( l<r ){
		w= (l+r)/2;
		if( chk() ) r=w;
		else l=w+1;
	}
	printf("%d\n",l);
	return 0;
}


Measured memory_bytes: 896
#include<iostream>
using namespace std;
int main(){
   string a,b;
   cin>>a>>b;
  if(a=="H" && b=="H"){
    cout<<"H";
  }
  else if(a=="D" && b=="H"){
    cout<<"D";
  }
else if(a=="H"&&b=="D"){
        cout<<"D";}
  else if(a=="D" && b=="D"){
    cout<<"H";
  }
   return 0 ;
}



Measured memory_bytes: 256
use std::io;

fn main() {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let mut iter = buf.split_whitespace();
	let n: i32 = match iter.next().unwrap().parse(){
		Ok(n) => n,
		Err(_) => panic!(""),
	};
	let r: i32 = match iter.next().unwrap().parse() {
		Ok(n) => n,
		Err(_) => panic!(""),
	};
	if n >= 10 {
		println!("{}", r);
	}else{
		let p = r+100*(10-n);
		println!("{}", p);
	}
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >>s;
  int count=0;
  int S=s.size();
  
   if (S%2 ==1) {
    for (int i=0; i<S/2; i++) {
      
     if (s.at(i) != s.at(S-1-i)) {
       count ++;
     }
    }
   }
  
     if (S%2 ==0) {
    for (int i=0; i<S/2; i++) {
      
     if (s.at(i) != s.at(S-1-i)) {
       count ++;
     }
    }
     }
  cout << count << endl;
  
      
      
      
  
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
#define all(v) v.begin(), v.end()
const int INF = 1<<30;
const long long LINF = 1LL << 60;
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

bool isPrime(ll x){
    if(x == 2)return 1;
    else if(x < 2 || x%2 == 0)return 0;
    else{
        double sq = sqrt(x);
        for(int i = 3;i<=sq;i+=2)if(x%i == 0)return 0;
        return 1;
    }
}

//ミョ(-ω- ?)
int main() {
    cin.tie(nullptr) ;
    ios::sync_with_stdio(false) ;

    ll n;
    cin >> n;

    ll res = 0;
    for (ll a = 1; a < n;a++){
        for (ll b = 1; a * b < n;b++){
            res++;
        }
    }
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 3692
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.*;

public class Main{
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		int count = 0;
		TreeSet<Integer> set = new TreeSet<>();
		for (int i = 0; i < n; i++) {
			int tmp = sc.nextInt();
			if (!set.contains(tmp)) {
				set.add(tmp);
			} else {
				count++;
			}
		}
		if (count % 2 == 0) {
			System.out.println(set.size());
		} else {
			System.out.println(set.size() - 1);
		}
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 26852
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7


int main(){
    int a, b;
    cin >> a >> b;
    if(a <= b){
        print(a);
    }else{
        print(a - 1);
    }
    return 0;
}


Measured memory_bytes: 256
from sys import stdin


# 最小化問題
def chmin(a,b):
    if a > b: return b
    else: return a


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    h_arr = list(map(int,_in[1].split(' ')))  # type:list(int)
    h_arr += [0]*2
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    # dp[i]:=カエルが足場iへと移動するのに必要な最小コスト
    dp = [float('inf')] * (N+2)  # 最小化問題
    dp[0] = 0                    # 初期条件
    
    # 貰うDP
    #for i in range(0,N):
    #    dp[i] = chmin(dp[i],dp[i-1]+abs(h_arr[i]-h_arr[i-1]))
    #    if i > 1:
    #        dp[i] = chmin(dp[i],dp[i-2]+abs(h_arr[i]-h_arr[i-2]))
    
    # 配るDP
    for i in range(0,N):
        dp[i+1] = chmin(dp[i+1],dp[i]+abs(h_arr[i]-h_arr[i+1]))
        dp[i+2] = chmin(dp[i+2],dp[i]+abs(h_arr[i]-h_arr[i+2]))
    
    cnt = dp[N-1]
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)

Measured memory_bytes: 54392
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        //MyDebugger.MakeTestCase("../TextFile2.txt"); return;
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }
    static XY[][] XYs;

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());

        XYs = new XY[n][];
        for(int i=0; i<n; i++) {
            var a = int.Parse(input.ReadLine());
            XYs[i] = new XY[a];
            for(int j=0; j<a; j++) {
                var spl   = input.ReadLine().Split(' ');
                XYs[i][j] = new XY(
                    int.Parse(spl[0])-1,
                    int.Parse(spl[1]));
            }
        }

        List<string> ptn = new List<string>();
        ptn.Add("0");
        ptn.Add("1");

        for (int i=1; i<n; i++) {
            var ptn2 = new List<string>();
            foreach(var x in ptn) {
                ptn2.Add(x + "0");
                ptn2.Add(x + "1");
                ptn = ptn2;
            }
        }

        int count = 0;
        foreach(var x in ptn) {
            var cs = x.ToCharArray();
            if(isOk(XYs, cs)) {
                var co = cs.Count(y => y == '1');
                count = Math.Max(count, co);
            }
        }

        return count;
    }

    static bool isOk(XY[][] XYs, char[] tbl) {
        for (int i=0; i<tbl.Length; i++) {
            if (tbl[i] == '1') {
                foreach(var xy in XYs[i]) {
                    if (xy.y == 1 && tbl[xy.x]=='0') return false;
                    if (xy.y == 0 && tbl[xy.x]=='1') return false;
                }
            }
        }
        return true;
    }
}

class XY
{
    public int x;
    public int y;

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


Measured memory_bytes: 23772
from math import gcd
n = int(input())
A = [0] + list(map(int, input().split())) + [0]
n += 2

L, R = [0]*n, [0]*n
gl, gr = 0, 0
for i in range(n):
    gl = gcd(gl, A[i])
    gr = gcd(gr, A[n-i-1])
    L[i] = gl
    R[n-i-1] = gr

ans = L[-1]
for i in range(n-2):
    ans = max(ans, gcd(L[i], R[i+2]))
print(ans)

Measured memory_bytes: 85828
## abc070c: Multiple Clocks

def gcm(q,r): ## 最大公約数
    if q<r: q, r = r, q
    while(r>0): q, r = r, q%r,
    return q

def lcm(a,b): ## 最小公倍数
    return a*b//gcm(a,b)

n = int(input())
ans = int(input())
for _ in range(n-1):
    a = int(input())
    ans = lcm(ans,a)
print(ans)

Measured memory_bytes: 3064
from collections import Counter

S = input()

def judge(S):
    if S[0] != 'A':
        return False
    elif Counter(S[2:-1])['C'] != 1:
        return False
    elif any(v != 'C' and not v.islower() for v in S[1:]) or not S[1].islower() or not S[-1].islower():
        return False
    return True

print('AC' if judge(S) else 'WA')

Measured memory_bytes: 9336
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <bitset>

using namespace std;

bool solve(vector<int> a, int x) {
  bitset<8080> dp;
  dp[0] = 1;
  int sum = 0;
  for (int e : a) {
    dp |= dp << e;
    sum += e;
  }
  for (int i = 0; i < 8080; i++) {
    if (dp[i] && i - (sum - i) == x) return true;
  }
  return false;
}

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

  int x, y;
  cin >> x >> y;

  int i = 0;
  while (i < s.size() && s[i] == 'F') {
    x--;
    i++;
  }
  i++;

  vector<int> xs, ys;

  int d = 1;
  while (i < s.size()) {
    int t = 0;
    while (i < s.size() && s[i] == 'F') {
      i++;
      t++;
    }
    i++;
    if (d % 2 == 0) {
      xs.push_back(t);
    } else {
      ys.push_back(t);
    }
    d ^= 1;
  }

  if (solve(xs, x) && solve(ys, y)) { 
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 384
N, K = map(int, input().split())
c = 0
for i in range(1,N+1):
    b = i*K
    if b <= N:
      c += 1
    else:
      break
e = 0
if K%2 ==0:
  for i in range(1,N+1):
    d = i*K/2
    if d <= N and d%K != 0:
      e += 1 
  print(c**3 + e**3)
else:
  print(c**3)

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

using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    int num = a * c;
    if (b >= num)
    {
        cout << c << endl;
    }
    else
    {    
        cout << b/a << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
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; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=998244353;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


int main(){
    int h,w;cin >> h >> w;
    vector<string> s(h);
    for (int i = 0; i < h; i++) {
        cin >> s[i];
    }
    vector<vector<int>> dp(h+1,vector<int> (w+1,INF));
    dp[0][0] = (s[0][0] == '#');
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if(i + 1 < h){
                if(s[i+1][j] == '#' && s[i][j] == '.') chmin(dp[i+1][j], dp[i][j]+1);
                else chmin(dp[i+1][j], dp[i][j]);
            }
            if(j + 1 < w){
                if(s[i][j+1] == '#' && s[i][j] == '.') chmin(dp[i][j+1], dp[i][j]+1);
                else chmin(dp[i][j+1], dp[i][j]);
            }
        }
    }
    cout << dp[h-1][w-1] << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
     Scanner input=new Scanner(System.in);
     int n=input.nextInt();
     if(n%4==0 || n%7==0){
         System.out.println("Yes");
         return;
     }
     else{
     for(int i=4;i<=n;i+=4){
      for(int j=i+7;j<=n;j+=7){
      if(j==n){    
      System.out.println("Yes");
      return;
      } 
      }
     }
     
     }
    
    System.out.println("No");
    }
}


Measured memory_bytes: 23892
nums = sorted(map(int, raw_input().strip().split()))

total = 0
diff = nums[2] - nums[1]
total += diff
nums[1] = nums[2]
nums[0] += diff

diff = nums[1] - nums[0]
if diff % 2 == 0:
    total += diff / 2
else:
    total += diff / 2 + 2

print total


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

typedef long long ll;

int main(){
  ll N,A,B,C,D,E;
  cin >> N >> A >> B >> C >> D >> E;
  ll  P = min({A,B,C,D,E});
  ll a = N / P;
  if(N % P != 0){
    a++;
  }
  cout << 4 + a << endl;
}

Measured memory_bytes: 256
import collections
N=int(input())
list1=[]
for i in range(N) :
  list1.append(input())
c=collections.Counter(list1)


key_list=list(c.keys())
value_list=list(c.values())
list2=[]

curerent=0
k=max(value_list)
for i,item in enumerate(key_list) :
  if value_list[i]==k :
    list2.append(item)
  

list2.sort()
for item in list2 :
  print(item)



Measured memory_bytes: 36464
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();

            out.println(a * b % 2 == 1 ? "Yes" : "No");
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

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

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

    }
}



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

bool compare_string(std::string A, std::string B, int A_start, int length)
{
  for(int i = 0; i < length; i++)
  {
    if(A[A_start + i] != B[i])
    {
      return false;
    }
  }
  return true;
}

int main()
{  
  int N, M;
  std::string A[50], B[50], result = "No";
  std::cin >> N >> M;
  
  for(int i = 0; i < N; i++)
  {
    std::cin >> A[i];
  }
  
  for(int i = 0; i < M; i++)
  {
    std::cin >> B[i]; 
  }

  for(int i = 0; i <= N - M; i++)
  {
    for(int j = 0; j <= N - M; j++)
    {
      for(int k = 0; k < M; k++)
      {
        if(compare_string(A[j + k], B[k], i, M) == false)
        {
          break;
        }
        else if(k == M - 1)
        {
          result = "Yes";
        }
      }
    }
  }
  
  std::cout << result;
  return 0;
}

Measured memory_bytes: 3040