akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Pattern;

public class Main {

  public static void main(String[] args) {
  
    new Main().run();
  }

  public void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      final Pattern delim = Pattern.compile(" ");
      int[] seq = delim.splitAsStream(br.readLine())
        .mapToInt(Integer::parseInt)
        .toArray();

      int q = partition(seq, 0, n-1);
      dispIntArrayPartition(seq, q);
    }
    catch(IOException e) {
      System.out.println("IOException!");
    }
  }

  public int partition(int[] seq, int p, int r) {

    int x = seq[r];
    int i = p-1;
    int t;

    for(int j=p; j<r; j++) {
      if(seq[j] <= x) {
        t = seq[++i]; seq[i] = seq[j]; seq[j] = t;
      }
    }
    t = seq[i+1]; seq[i+1] = seq[r]; seq[r] = t;

    return i+1;
  }

public void dispIntArrayPartition(int[] target, int q) {
  StringBuilder s = new StringBuilder();
  int l=target.length-1;

  for (int i=0; i<q; i++) { s.append(target[i]).append(" "); }
  s.append("[").append(target[q]).append("] ");
  for (int i=q+1; i<l; i++) { s.append(target[i]).append(" "); }
  s.append(target[l]);

  System.out.println(s);
  }
}


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


#define ll long long int
#define ld long double
#define mod 998244353
#define big 1e18+10
#define small -big
#define pb push_back
#define endl "\n"

template <typename T>

void prarr(T a)
{
     cerr << "[ ";
     
     for(auto i : a){
         cerr << i << " ";
     }
     
     cerr << "]" << endl;
}


#define trace(...) _er(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>

void _er(const char* name, Arg1&& arg1){
	cerr << "[" << name << " : " << arg1 << "]" << endl;
}

template <typename Arg1, typename... Args>

void _er(const char* names, Arg1&& arg1, Args&&... args){
    
	const char* comma = strchr(names + 1, ',');
	cerr << "[" ; cerr.write(names, comma - names) << " : " << arg1 << "] ";
	_er(comma+2, args...);
}



void solve() {
    
    int a, b;
    cin >> a >> b;
    
    cout << a * b << endl;
}



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

    ll t=1;
   // cin >> t;

    while(t--){  
        
        solve();
    }


    return 0;
        
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
long long a[100];
int main() {
	long long sum=0;
	a[1]=2;
	a[2]=1;
	int n;
	cin>>n;
	for(int i=3;i<=n+1;i++){
		a[i]=a[i-1]+a[i-2];
	}
	cout<<a[n+1];
	return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		Random r = new Random();
		
		long startMilli = System.currentTimeMillis();
		
		final int N = 26;

		int D = sc.nextInt();
		int[] c = new int[N];
		for(int i=0; i<N; i++)
			c[i] = sc.nextInt();
		
		int[][] s = new int[D][N];
		for(int i=0; i<D; i++)
			for(int j=0; j<N; j++)
				s[i][j] = sc.nextInt();
		
		int[] t = new int[D];
//		for(int i=0; i<D; i++)
//			t[i] = r.nextInt(N);

		int[] last = new int[N];
		for(int i=0; i<D; i++) {
			int bestIndex = -1;
			int bestScore = 0;
			for(int j=0; j<N; j++) {
				int score = s[i][j] + c[j]*(i+1-last[j]);
				if(bestIndex < 0 || score > bestScore) {
					bestIndex = j;
					bestScore = score;
				}
			}
			t[i] = bestIndex;
			last[bestIndex]=i+1;
		}
		
//		int score = 0;
//		int[] last = new int[N];
//		for(int i=0; i<D; i++) {
//			score += s[i][t[i]];
//			last[t[i]]=i+1;
//			for(int j=0; j<N; j++)
//				score -= c[j]*(i+1-last[j]);
//		}
		
		long currentMilli = System.currentTimeMillis();

		while(currentMilli - startMilli < 1850) {
			double p = Math.exp(-((double)currentMilli - startMilli)/1850*6);
			for(int i=0; i<1000; i++) {
				int d = r.nextInt(D)+1;
				int to = r.nextInt(N);
				int from = t[d-1];
				if(from==to)
					continue;
	
				int scoreDiff = s[d-1][to] + c[to]*(d-getIndex(t, to, d, false))*(getIndex(t, to, d, true)-d);
				scoreDiff -= s[d-1][from] + c[from]*(d-getIndex(t, from, d, false))*(getIndex(t, from, d, true)-d);
				if(scoreDiff>0 || p > r.nextDouble())
					t[d-1] = to;
			}
			currentMilli = System.currentTimeMillis();
		}
		for(int i=0; i<D; i++)
			pw.println(t[i]+1);

		sc.close();
		pw.close();
	}
	
	static int getIndex(int[] t, int type, int base, boolean isForward) {
		int ans = base;
		int diff = isForward ? 1 : -1;
		ans += diff;
		while(1 <= ans && ans <= t.length) {
			if(t[ans-1]==type)
				return ans;
			ans += diff;
		}
		return ans;
	}
}


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

#define int long long
#define pii pair<int,int>
#define vi vector<int>
#define pb push_back
#define f first
#define s second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

signed main()
{
	int n;

	int k;

	cin >> n >> k;

	if( k == 1 || n%k ==0)
	{
		cout << "0" << endl;
	}

	else if( n < k)
	{
		int x = n - k;

		int y = llabs(x) - k;

		cout << min(llabs(x), llabs(y));
		cout << endl;
	}

	else if( n > k)
	{
		int r = n % k;

		int x = r - k;

		int y = llabs(x) - k;

		cout << min(llabs(x), llabs(y)) << endl;


	}


	


		
	
	
	
	return 0;
}


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

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define mem(x,val) memset((x),(val),sizeof(x))
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define PI acos(-1.0) 

const int INF = 1 << 29 ;
typedef long long ll ;

int main() {
    int a , b ;
    scanf("%d %d" ,&a , &b) ;
    if(!((a+b)%3) || !(a%3) || !(b%3)) printf("Possible\n") ;
    else printf("Impossible\n") ;
    return 0 ;  
}

Measured memory_bytes: 256
def cmb(n, r, mod):#コンビネーションの高速計算　
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return (g1[n] * g2[r])%mod * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 4*10**6
g1 = [1]*(N+1) # 元テーブル
g2 = [1]*(N+1) #逆元テーブル
inverse = [1]*(N+1) #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1[i]=( ( g1[i-1] * i ) % mod )
    inverse[i]=( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2[i]=( (g2[i-1] * inverse[i]) % mod )

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

if K==1:
    print(1)
    exit()

dp=[0 for i in range(N+1)]
dp[N]=1

for i in range(N,-1,-1):
    for j in range(i-1,-1,-1):
        n=(N-(j+1))*(K-1)+N-i
        dp[j]+=(cmb(n+K-2,K-2,mod)*dp[j+1])%mod
        dp[j]%=mod

print((dp[0]*g1[N])%mod)


Measured memory_bytes: 162340
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define PER(i,a,n) for(int i=n;i>=a;--i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(a) ({REP(__i,1,n) cout<<a[__i]<<' ';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



const int N = 310;
int n, a[N], dp[2][N][N];
int sum1[N][N], sum2[N][N];
void add(int &a, int b) {a+=b;if (a>=P) a-=P;}

int main() {
	scanf("%d", &n);
	int m = 2*n-1;
	REP(i,1,m) scanf("%d", a+i);
	sort(a+1,a+1+m);
	dp[0][0][0] = 1;
	int cur = 0, ans = 0;
	PER(i,0,n-1) {
		REP(j,0,m) PER(k,1,m) { 
			add(sum1[k-1][j],sum1[k][j]);
			add(sum2[j][k-1],sum2[j][k]);
		}
		REP(j,0,m) REP(k,0,m) { 
			add(dp[cur][j][k],sum1[j][k]),sum1[j][k]=0;
			add(dp[cur][j][k],sum2[j][k]),sum2[j][k]=0;
			dp[!cur][j][k] = 0;
			if (!i) add(ans,dp[cur][j][k]);
		}
		if (!i) break;
		cur ^= 1;
		int l = a[i]!=a[i+1], r = a[2*n-i-1]!=a[2*n-i];
		REP(j,0,m) REP(k,0,m) {
			int &ret = dp[!cur][j][k];
			if (!ret) continue;
			//b[i]=b[i+1]
			add(dp[cur][j+l][k+r],ret);
			//b[i]<b[i+1]
			if (j+l-1>=0) add(sum1[j+l-1][k+r+1],ret);
			//b[i]>b[i+1]
			if (k+r-1>=0) add(sum2[j+l+1][k+r-1],ret);
		}
	}
	printf("%d\n", ans);
}








Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
const int p=1000000007,N=100005;
int n,a[N],x[N],fac=1,s;
int add(int a,int b){a+=b;if(p<=a)a-=p;return a;}
int sub(int a,int b){a-=b;if(a< 0)a+=p;return a;}
int mul(int a,int b){return (long long)a*b%p;}
int ksm(int a,int b){
    int c=1;
    while(b){
        if(b&1)c=mul(c,a);
        b>>=1,a=mul(a,a);
    }
    return c;
}
int chu(int a,int b){return mul(a,ksm(b,p-2));}
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]),a[i]=add(a[i],a[i-1]),fac=mul(fac,i);
    for(int i=1;i<=n;i++)x[i]=add(x[i-1],chu(mul(fac,2),mul(i,i-1)));
    for(int i=2;i<n;i++)s=add(s,mul(a[i],sub(x[i+1],x[2])));
    for(int i=2;i<n;i++)s=sub(s,mul(a[i-1],sub(x[n-i+2],x[2])));
    for(int i=1;i<n;i++)s=add(s,mul(a[i],chu(fac,i+1)));
    for(int i=2;i<=n;i++)s=add(s,mul(sub(a[n],a[i-1]),chu(fac,n-i+2)));
    printf("%d",add(s,mul(fac,a[n])));
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<math.h>
#include<stack>
int main(){
    using namespace std;
    stack <int>S;
    int a;
    while(~scanf("%d",&a)){
        if(a==0){
            printf("%d\n",S.top());
            S.pop();
        }
        else{
            S.push(a);
        }
    }
}


Measured memory_bytes: 2664
///A drunk man will find his way home, but a drunk bird may get lost forever...
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef double dd;
typedef pair <int, int> pii;
#define pb push_back
#define pf push_front
#define f first
#define s second
#define sz(x) (int)x.size()
#define smin(x , y) x = min(x , y)
#define smax(x , y) x = max(x , y)
#define mp make_pair
//const int mx = 1000 * 100 + 5;
int32_t main(){		
	ios_base::sync_with_stdio(false);
    cin.tie(0);	
	cout.tie(0);
	string a;
	int n;
	cin >> n >> a;
	int t = 0;
	for(int i = 0; i < n - 2; i++)
		if(a[i] == 'A' && a[i + 1] == 'B' && a[i + 2] == 'C')
			t++;
	cout << t << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{

	int a, b, c, d, e, f;

	cin >> a >> b >> c >> d >> e;

	if (a < 40) a = 40;
	if (b < 40) b = 40;
	if (c < 40) c = 40;
	if (d < 40) d = 40;
	if (e < 40) e = 40;

	f = (a + b + c + d + e) / 5;

	cout << f << endl;

}

Measured memory_bytes: 1164
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}

int main(){
  int n,t;
  cin >> n >> t;
  vector<pair<int,int> > ct(n);
  for(int i = 0; i < n; i++){
    cin >> ct[i].first >> ct[i].second ;
  }
  sort(ct.begin(),ct.end());
  for(int i = 0; i < n; i++){
    if(ct[i].second <= t){
      cout << ct[i].first << endl;
      return 0;
    }
  }
  cout << "TLE" << endl;
  return 0;
}


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

using namespace std;

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

	int A[200];
	for (int i = 0; i < M; i++)
		cin >> A[i];

	int count=0;
	int count2 = 0;

	for (int i = 0; i < M; i++)
	{
		if ((A[i] - X) > 0)
			count++;
		else 
			count2++;
	}
	
		cout << min(count,count2)<< endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=35;

int n, m, ans=0;
int f[N];

int32_t main()
{
	IOS;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		int k;
		cin>>k;
		for(int j=1;j<=k;j++)
		{
			int x;
			cin>>x;
			f[x]++;
		}
	}
	for(int i=1;i<=m;i++)
		ans+=(f[i]==n);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>

using namespace std;

int main()
{
	long long int a, b;

	scanf("%lld %lld", &a, &b);
	if (a > 0) puts("Positive");
	else if (a == 0) puts("Zero");
	else if (a < 0) {
		if (b >= 0) puts("Zero");
		else if (b < 0) {
			if ((a - b) % 2) puts("Positive");
			else puts("Negative");
		}
	}
	return 0;
}

Measured memory_bytes: 128
import numpy
n = int(input())
s = input()
a = [0]*n
ans = 10**6
for i in range(n):
    if s[i] == 'W':
        a[i] = 1
res = numpy.cumsum(a)
for i in range(n):
    x = res[i]-str(a[i]).count('1')
    y = n-i-1-(res[n-1]-res[i])
    ans = min(ans,x+y)
print(ans)

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

int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;

		if(s == "Y"){
			cout << "Four" << endl;
			break;
		}

		else if (i == N-1) {//こういうところが思いつくかどうか
			cout << "Three" << endl;
			break;
		}
	}
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int a,b,x,y;

int main(){
	cin>>a>>b>>x>>y;
	cout<<(ll)a*b/2<<(a%2==1&&b%2==1?".5 ":" ")<<(a%2==0&&b%2==0&&a/2==x&&b/2==y)<<endl;
}

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

int main(int argc, void **argv)
{
	long long x[5];
	long long c[6];
	long long n, min;
	unsigned long long total = 0;

	scanf("%lld", &n);
	min = 1000000000000001;
	for (int i = 0; i < 5; i++)
	{
		scanf("%lld", &x[i]);
		if( min > x[i] ) min = x[i];
	}

	total = (n+min-1) / min;
	total += 4;

	printf("%lld\n", total);

	return 0;
}

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

using namespace std;

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

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

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

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD
int n;

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin>>n;
    vi x(n);
    REP(i,n) cin>>x[i];

    ll ans=LONG_MAX;

    REP(i,101){
        ll tmp=0;
        REP(j,n){
            tmp += pow(x[j]-(i+1),2);
        }
        ans = min(ans,tmp);
    }

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

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

int main() {
  
  int n, a, b;
  cin >> n >> a >> b;
  
  if(n*a >= b) cout << b << endl;
  else cout << n*a << endl;
  
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>

#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}


int main(void) {

	int a, b, c;
	cin >> a >> b >> c;

	COUT(((a <= c && c <= b) || (b <= c && c <= a) ? "Yes" : "No"));


	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace hitachi2020_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var abm = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a = abm[0];
            var b = abm[1];
            var m = abm[2];

            var alist = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var blist = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var c = new Coupon[m];
            for (int i = 0; i < m; i++)
            {
                var line = Console.ReadLine().Split().Select(int.Parse).ToArray();
                c[i] = new Coupon() { x = line[0] - 1, y = line[1] - 1, c = line[2] };
            }

            var minA = alist.Min();
            var minB = blist.Min();
            var ans = minA + minB;

            foreach (var i in c)
            {
                ans = Math.Min(ans, alist[i.x] + blist[i.y] - i.c);
            }

            Console.WriteLine(ans);
        }
    }

    public class Coupon
    {
        public int x { get; set; }
        public int y { get; set; }
        public int c { get; set; }
    }
}


Measured memory_bytes: 36444
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] x = new int[n][3];
		for (int i = 0; i < n; i++) {
			x[i][0] = sc.nextInt();
			x[i][1] = sc.nextInt();
			x[i][2] = sc.nextInt();
		}
		long[][] dp = new long[n][3];
		dp[n-1][0] = x[n-1][0]; dp[n-1][1] = x[n-1][1]; dp[n-1][2] = x[n-1][2];
		for (int i = n - 2; i >= 0; i--) {
			dp[i][0] = Math.max(dp[i+1][1], dp[i+1][2]) + x[i][0];
			dp[i][1] = Math.max(dp[i+1][0], dp[i+1][2]) + x[i][1];
			dp[i][2] = Math.max(dp[i+1][1], dp[i+1][0]) + x[i][2];
		}
		System.out.println(Math.max(dp[0][0], Math.max(dp[0][1], dp[0][2])));
	}
}


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

int main(int argc, const char * argv[]) {

    cin.tie(0);
    ios::sync_with_stdio(false);

    int H;
    int W;

    cin >> H >> W;

    if (H == W) {
        cout << "Yes";
    } else {
        cout << "No";
    }

    return 0;
}


Measured memory_bytes: 888
import java.util.*;
    public class Main {
     
    	public static void main(String[] args) {
    		Scanner scan=new Scanner(System.in);
    		
    		int a=Integer.parseInt(scan.next());
    		int b=Integer.parseInt(scan.next());
    		
    		if (a==b) {
    			System.out.print("Draw");
    		}else if (a==1||b==1) {
    			System.out.print(a==1?"Alice":"Bob");
    		}else {
    			System.out.print(a>b?"Alice":"Bob");
    		}
    				
    	}
     
    }

Measured memory_bytes: 22356
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;
using pll=pair<ll,ll>;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
	string S,T;
	cin >> S >> T;
	map<char, int> mp1,mp2;
	rep(i,S.length()) {
		mp1[S[i]]++;
		mp2[T[i]]++;
	}
	int cnt1=0,cnt2=0;
	vector<int> a1,a2;
	vector<char> b1,b2;
	for(int j=0; j<26; j++) {
		char i = 'a' + j;
		if(mp1[i]) {
			b1.pb(i);
		}
		a1.pb(mp1[i]);
		if(mp2[i]) {
			b2.pb(i);
		}
		a2.pb(mp2[i]);
	}
	bool flag = false;
	/*rep(i,b1.size()) cout << b1[i] << " ";
	cout << endl;
	rep(i,b2.size()) cout << b2[i] << " ";
	cout << endl;

	/*if(b1.size() != b2.size()) {
		cout << "No" << endl;
		return 0;
	}
	sort(b1.begin(),b1.end());
	sort(b2.begin(),b2.end());
	rep(i, b1.size()) {
		if(b1[i] != b2[i]) {
			cout << "No" << endl;
			return 0;
		}
	}*/
	sort(a1.begin(), a1.end());
	sort(a2.begin(), a2.end());
	rep(i,26) {
		if(a1[i] != a2[i]) {
			flag = false;
			break;
		}
		if(i == 25) {flag = true;
		break;}
	}
	if(flag) cout << "Yes" << endl;
	else cout << "No" << endl;


  return 0;
}


Measured memory_bytes: 776
/* ex4_1.c Golden Apple
    dada__              */
#include<stdio.h>

int main(void){
    int tree_num, sight;

    scanf("%d %d", &tree_num, &sight); //木の本数，監視範囲の入力
    
    if(tree_num % (2*sight+1) == 0){ //木の本数と監視の範囲による場合分け
        printf("%d\n", tree_num / (2*sight +1));
    }else{printf("%d\n", tree_num / (2*sight +1) +1 );
    }

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define PI 3.14159265358979323846
const int MOD = 1e9 + 7 ;
const int EPS = 1e-9;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N=201010;

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

      int r,g,b,n;
      cin>>r>>g>>b>>n;
      int ans=0;
      for(int i=0;i<=3000;i++)
      {
            for(int j=0;j<=3000;j++)
            {
                  int o=n-(i*r+j*g);
                  if((o>0&&o%b==0)||o==0) ans++;
            }
      }
      cout<<ans;
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int                     long long   
#define double                  long double
#define endl                    "\n"
#define pb                      push_back
#define PI                      3.1415926535897932384626433832795l
#define F                       first
#define S                       second
#define mp                      make_pair
#define f(i,n)                  for(int i=0;i<n;i++)
#define fastio                  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)                  (v).begin(),(v).end()
#define rall(v)                 (v).rbegin(),(v).rend()
#define gcd(a,b)                __gcd((a),(b))
#define fill(a,value)           memset(a,value,sizeof(a));
#define minn(v)                 *min_element(v.begin(), v.end());
#define maxx(v)                 *max_element(v.begin(), v.end());
#define print(x)                cout<<(x)<<endl;
#define sum(v)+x                accumulate(v.begin(), v.end(),x);
#define debug(x)                cout<<#x<<'='<<(x)<<endl;
typedef pair<int,int>           pii;
typedef vector<int>             vi;
signed main() 
{
    fastio;
    cout << fixed << setprecision(12);
    int n;
    cin>>n;
    print((n*(n-1))/2)
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 3648
n = int(input())
c = 0
l = []
li = list(map(int, input().split()))
for i in range(1, n):
	if li[i-1] >= li[i]:
		c += 1
		#print('k', li[i])
	else:
		#print(li[i])
		l.append(c) 
		c = 0
l.append(c)
print(max(l))

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  ll n, k; cin >> n >> k;

  vll p(n);
  vector<double> e(n);
  for(int i=0;i<n;++i) {
    cin >> p[i];
    e[i] = (1+p[i]) / 2.0;
  }
//  sort(e.rbegin(), e.rend());
  
  vector<double> su(n+1);
  for(int i=0;i<n;++i) {
    su[i+1] = su[i] + e[i];
  }
  //printv(e);
  //printv(su);
  double ans = 0;
  for(int i=0;i<n-k+1;++i) {
    ans = max(ans, su[i+k] - su[i]);
  }
  cout << ans << endl;

  

}


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

using namespace std;
#define ff(i, a, b) for(int i = (a), _b = (b); i <= _b; ++i)
#define rep(i, a, b) for(int i = (a), _b = (b); i < _b; ++i)
#define fd(i, a, b) for(int i = (a), _b = (b); i >= _b; --i)
#define SZ(x) ((int)(x).size())
#define db(x) cout << #x << " == " << x << endl
#define _ << ", " << 
#define X first
#define Y second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
#define endl '\n'
#define pc putchar
#define gc getchar 
#define bit(i) (1<<(i))

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;

const int N=1e5+5;
int n;
int cnt[N];

void enter(){
	cin>>n;
	ff(i,1,n){
		int tmp;
		cin>>tmp;
		++cnt[tmp];
	}
}

void process(){
	int ans=0;
	ff(i,0,1e5){
		int cur=cnt[i];
		if (i>0) cur+=cnt[i-1];
		cur+=cnt[i+1];
		ans=max(ans,cur);
	}
	cout<<ans<<endl;
}

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

	enter();
	process();	

	return 0;
}

Measured memory_bytes: 640
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    public static void Main()
    {


        var s = Console.ReadLine().ToArray();


        if(s[0] == s[1] && s[2] == s[3] && s[0] != s[2]
            || s[0] == s[2] && s[1] == s[3] && s[0] != s[1]
            || s[0] == s[3] && s[1] == s[2] && s[0] != s[2]
            )
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }



    }
}

Measured memory_bytes: 13268
if __name__ == '__main__':
    s = input().rstrip().split(' ')
    N,K = int(s[0]), int(s[1])

    ret = 0

    for k in range(K,N+2):
        f = (k-1)*k/2
        t = N*k - k*(k-1)/2

        ret += t-f+1

    print(int(ret) % 1000000007)


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

int main(void) {
	int n, k;
	string s;
	cin >> n >> k >> s;
	if (s[k-1] == 'A') s[k-1] = 'a';
	else if (s[k-1] == 'B') s[k-1] = 'b';
	else s[k-1] = 'c';
	cout << s << endl;
	return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

struct Edge {
  int node;
  int index;
};

int main() {
  in(int, n);
  vector<vector<Edge>> edges(n + 1);
  rep(i, n) {
    in(int, a, b);
    edges[a].push_back({b, i});
    edges[b].push_back({a, i});
  }
  set<int> seen;
  seen.insert(1);
  queue<int> que;
  que.push(1);
  map<int, int> color;
  int max_color = 0;
  while (!que.empty()) {
    int here = que.front();
    que.pop();
    set<int> used;
    for (Edge e : edges[here]) used.insert(color[e.index]);
    int c = 1;
    for (Edge e : edges[here]) {
      if (seen.count(e.node)) continue;
      seen.insert(e.node);
      assert(color[e.index] == 0);
      while (used.count(c)) ++c;
      color[e.index] = c;
      max_color = max(max_color, c);
      ++c;
      que.push(e.node);
    }
  }
  out(max_color);
  rep(i, n - 1) out(color[i]);
}


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

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;


template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}

const int N=2e5+5;

struct node{
    pii a;
    pii b;
 
    void merge(node &n1,node &n2){
        this->a=min(n1.a,n2.a);
        this->b=max(n1.b,n2.b);
    }
};

template<typename node>
struct segtree{
  node t[4*N];
  int tl[4*N];
  int tr[4*N];
  node nul;
  void build(int v,int start,int end,vector<pii>&arr){
      tl[v]=start;
      tr[v]=end;
      if(start==end){
          t[v].a={arr[start].x,tl[v]};
          t[v].b={arr[start].x,tl[v]};
      }
      else{
          int m=(start+end)/2;
          build(2*v,start,m,arr);
          build(2*v+1,m+1,end,arr);
          t[v].merge(t[2*v],t[2*v+1]);
     }
  }
  pii query_min(int v,int l,int r){
  	if(r<tl[v] || tr[v]<l)return {1e18,0};
  	if(l<=tl[v] && tr[v]<=r){
  		return t[v].a;
  	}
  	pii a=query_min(2*v,l,r);
  	mins(a,query_min(2*v+1,l,r));
  	return a;

  };
  pii query_max(int v,int l,int r){
  	if(r<tl[v] || tr[v]<l)return {-1,-1};
  	if(l<=tl[v] && tr[v]<=r){
  		return t[v].b;
  	}
  	pii a=query_max(2*v,l,r);
  	maxs(a,query_max(2*v+1,l,r));
  	return a;

  };
    
};
segtree<node>seg;
int solve(){
 	int n;cin>>n;
 	vector<pii>vec(n+1);
 	rep(i,1,n+1){
 		int x,y;cin>>x>>y;
 		vec[x]={y,i};
 	}
 	seg.build(1,1,n,vec);
 	vector<int>ans(n+1);
 	function<int(int,int)>dfs=[&](int l,int r){
 		int mn=seg.query_min(1,l,r).x;
 		pii mx=seg.query_max(1,r+1,n);
 		if(mx.x<mn)return r;
 		return dfs(l,mx.y);
 	};
 	int i=1;
 	while(i<=n){
 		int j=dfs(i,i);
 		for(int k=i;k<=j;k++)ans[vec[k].y]=j-i+1;
 		i=j+1;
 	}
 	rep(i,1,n+1)cout<<ans[i]<<endl;
 return 0;
}
signed main(){
    //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
 

Measured memory_bytes: 41276
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i= a ; i < b ; ++i)
#define rep(i,n) fo(i,0,n)
#define pln(n) printf("%lld",n)
#define sll(n) scanf("%lld",&n)
#define ss(n) scanf("%s",n)
#define vi vector < int >
#define pii pair < int , int >
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define INF 0x3f3f3f3f
#define dbg(x) { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define dbg3(x,y,z) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) <<" , "<< #z <<": "<<(z)<<endl; }
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define vll vector<long long>
#define vvll vector<vector<long long>>
#define vvvll vector<vector<vector<ll>>>
#define si set<int>
#define tr(c, it) \
for(decltype(c.begin()) it = c.begin(); it!= c.end(); it++)
#define pis pair<int,string>
#define present(c, x) (c.find(x) != c.end())
#define cpresent(c, x) (find(all(c),x) != c.end())
#define  ones(x)  __builtin_popcount(x)
using namespace std;
int main(){
//freopen("input.txt", "r", stdin);
	string a = "ACL";
	int k;
	cin >> k;
	string ans = "";
	for(int i = 0; i < k; i++){
		ans += a;
	}
	cout << ans;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define pii pair<int,int>
#define ff first
#define ss second
#define frr(i,n) for(int i=0;i<n;i++)
#define td(v) v.begin(),v.end()
#define inf 1000000000 // 1e9
#define M   1000000007 // 1e9 + 7
using namespace std;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}
int32_t main(){
    fastio;
    int a,b;
    cin >> a >> b;
    cout << max(a+a-1,max(a+b,b+b-1)) << endl;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int MAXN = 5000 + 15;

ll p[MAXN], c[MAXN];
vector <ll> v;
int main() {

    ll n, k;
    scanf("%lld %lld", &n, &k);

    for(int i = 1; i <= n; i++) scanf("%lld", &p[i]);
    for(int i = 1; i <= n; i++) scanf("%lld", &c[i]);

    ll res = -1e18;
    for(int i = 1; i <= n; i++) {
        v.clear();
        ll sum = c[i];
        v.push_back(sum);

        int j = p[i];
        while(j != i) {
            sum += c[j];
            v.push_back(sum);
            j = p[j];
        }

        int len = (int)v.size();
        for(j = 0; j < len; j++) {
            ll rest = k - 1 - j;
            if(rest < 0) break;
            res = max(res, v[j] + (rest / len) * max(sum, 0ll));
        }
    }

    printf("%lld\n", res);

    return 0;
}


Measured memory_bytes: 3908
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var (
	N int
	A []int
)

func readVariables() {
	N = nextInt()
	A = make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = nextInt()
	}
}
func main() {
	readVariables()
	if judge(A) {
		fmt.Println("APPROVED")
	} else {
		fmt.Println("DENIED")
	}
}
func judge(a []int) bool {
	for _, v := range a {
		if !ok(v) {
			return false
		}
	}
	return true
}

func ok(x int) bool {
	if x%2 == 1 {
		return true
	}
	if x%3 == 0 {
		return true
	}
	if x%5 == 0 {
		return true
	}
	return false
}

/* 以下、テンプレート*/

var scanner *bufio.Scanner

func init() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 0, 1000000), 1000000)
	scanner.Split(bufio.ScanWords)
}

//nextInt converts next token from stdin and returns integer value.
//nextInt panics when conversion into an integer fails.
func nextInt() int {
	if !scanner.Scan() {
		panic("No more token.")
	}
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic("nextInt(): cannot convert to int: " + scanner.Text())
	}
	return num
}

func nextStr() string {
	if !scanner.Scan() {
		panic("No more token.")
	}
	return scanner.Text()
}

// MinInt は、2つの整数を受け取り、最小値を返します。
func MinInt(x, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

//MaxInt は、2つの整数を受け取り、最大値を返します。
func MaxInt(x, y int) int {
	if x < y {
		return y
	} else {
		return x
	}
}

//AbsInt は、整数の絶対値を返します。
func AbsInt(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//ModPow は整数の累乗関数で、剰余もサポートします。
//base^exponentの値をmoduleで割った余りを返します。
//moduloが1以下の場合には、剰余演算をしません。
//baseが負の値である場合には、返す値が負になることがあります。
func ModPow(base, exponent, modulo int) (result int) {
	result = 1
	for exponent > 0 {
		if exponent%2 == 1 {
			result *= base
			if modulo > 1 {
				result %= modulo
			}
		}
		base *= base
		if modulo > 1 {
			base %= modulo
		}
		exponent /= 2
	}
	return
}

//Gcd は、引数の整数全ての最大公約数を返します。
func Gcd(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = gcd(result, vals[i])
	}
	return
}

func gcd(x, y int) int {
	x, y = AbsInt(x), AbsInt(y)
	for y > 0 {
		x, y = y, x%y
	}
	return x
}

//Lcm は、与えられた整数の最小公倍数を返します。
func Lcm(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = lcm(result, vals[i])
	}
	return
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[4] = {
	{ -1 ,0 },{ 0 , 1 },{ 1 ,0 },{ 0 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)

struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}

};
signed main(void) {
	int n;
	cin >> n;
	vector<int> d(n);
	REP(i, n)
		cin >> d[i];

	int cou = 0;

	rep(i, 1,n - 1) {
		if (d[i] != min({ d[i - 1],d[i],d[i + 1] }) && d[i] != max({ d[i - 1],d[i],d[i + 1] })) {
			cou++;
		}
	}
	cout << cou << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int num;
  cin>>num;
  int n=num%10;
  if(n==3)cout<<"bon"<<endl;
  else if(n==0||n==1||n==6||n==8)cout<<"pon"<<endl;
  else cout<<"hon"<<endl;
}

Measured memory_bytes: 3624
/*
          ,     \    /      ,
         / \    )\__/(     / \
        /   \  (_\  /_)   /   \
   ____/_____\__\@  @/___/_____\____
  |             |\../|              |
  |              \VV/               |
  |        ------hoi-------         |
  |_________________________________|
   |    /\ /      \\       \ /\    |
   |  /   V        ))       V   \  |
   |/     `       //        '     \|
   `              V                '
*/

#include <bits/stdc++.h>

#define ld long double
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define f first
#define se second
#define Speedforce boost();
#define fop(s1, s2) freopen(s1, "r", stdin);freopen(s2, "w", stdout);

using namespace std;

void boost(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int N = 1e6;
const ll inf = 1e9 + 7;
const ld PI = acos(-1);

ll bin_pow(ll x, ll y){
    ll res = 1, base = x;
    while(y){
        if(y & 1){
            res *= base;
            res %= inf;
        }
        base *= base;
        base %= inf;
        y /= 2;
    }
    return res;
}

int n, x, y;
int ans[N];

int main(){
    Speedforce
    //fop("", "")
    cin >> n >> x >> y;
    for(int i = 1;i <= n;i ++){
        for(int j = i + 1;j <= n;j ++){
            if(i == j){
                continue;
            }
            int len = min(abs(i - j), min(abs(i - x) + abs(j - y) + 1, abs(i - y) + abs(j - x) + 1));
            ans[len]++;
        }
    }
    for(int i = 1;i < n;i ++){
        cout << ans[i] << "\n";
    }
}


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

int main()
{
    string s;
    int ans = 0;
    cin >> s;
    for(int i = 0; i < s.length(); i++)
    {
        if(s[i] == '+') ans++;
        else ans--;
    }

    cout << ans << endl;

    return 0;
}  

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <atcoder/all>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define PI 3.14159265359
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pai;
typedef pair<ll, ll> pal;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

int n, m;
int num[100][100];
char anss[100][100];

bool is_ok(int x, int y){
	if (0 <= x && x < n && 0 <= y && y < m) return true;
	return false;
}

int main(){
	cin >> n >> m;
	vector<string> s(n);
	vector<pai> vec1, vec2;
	for (int i = 0; i < n; i++) cin >> s[i];

	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			if (s[i][j] == '.'){
				if ((i+j)%2) vec1.push_back(make_pair(i, j));
				else vec2.push_back(make_pair(i, j));
			}
		}
	}

	for (int i = 0; i < vec1.size(); i++){
		num[vec1[i].first][vec1[i].second] = i;
	}
	for (int i = 0; i < vec2.size(); i++){
		num[vec2[i].first][vec2[i].second] = i + vec1.size();
	} 

	int siz = vec1.size() + vec2.size();
	mf_graph<int> graph(siz + 2);

	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			if (s[i][j] == '.' && (i+j)%2){
				int dis1[4] = {0, 1, 0, -1};
				int dis2[4] = {1, 0, -1, 0};
				for (int k = 0; k < 4; k++){
					if (is_ok(i+dis1[k], j+dis2[k]) && s[i+dis1[k]][j+dis2[k]] == '.'){
						graph.add_edge(num[i][j], num[i+dis1[k]][j+dis2[k]], 1);
					}
				}
			}
		}
	}
	for (auto x : vec1){
		graph.add_edge(siz, num[x.first][x.second], 1);
	}
	for (auto x : vec2){
		graph.add_edge(num[x.first][x.second], siz+1, 1);
	}

	int ans = graph.flow(siz, siz+1);
	cout << ans << endl;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			anss[i][j] = s[i][j];
		}
	}

	auto es = graph.edges();
	for (auto e : es){
		int num1 = e.from, num2 = e.to, fl = e.flow;
		if (num1 < vec1.size() && fl){
			int x1 = vec1[num1].first, y1 = vec1[num1].second;
			int x2 = vec2[num2-vec1.size()].first, y2 = vec2[num2-vec1.size()].second;
			if (x1 == x2){
				if (y1 < y2){
					anss[x1][y1] = '>';
					anss[x2][y2] = '<';
				}else{
					anss[x1][y1] = '<';
					anss[x2][y2] = '>';
				}
			}else{
				if (x1 < x2){
					anss[x1][y1] = 'v';
					anss[x2][y2] = '^';
				}else{
					anss[x1][y1] = '^';
					anss[x2][y2] = 'v';
				}
			}
		}
	}

	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			cout << anss[i][j];
		}
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 5920
from collections import defaultdict
from itertools import product

N, C = map(int, input().split())
D = [tuple(map(int, input().split())) for _ in range(C)]

colors = defaultdict(lambda : defaultdict(int))

for h in range(1, N + 1):
    for w, c in enumerate(map(int, input().split()), start=1):
        colors[(h + w) % 3][c] += 1

cost = [[None] * C for _ in range(3)]

for i in range(3):
    for color in range(1, C + 1):
        cnt = 0
        for c, k in colors[i].items():
            cnt += D[c - 1][color - 1] * k
        cost[i][color - 1] = cnt

ans = 10**10
for cs in product(range(C), repeat=3):
    if len(set(cs)) == 3:
        cnt = 0
        for i, c in enumerate(cs):
            cnt += cost[i][c]
        ans = min(ans, cnt)

print(ans)


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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

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

// 素集合データ構造(disjoint-set data structure)
struct UnionFind {
  // それぞれの親、根の場合はマイナスを付けたサイズ
  vector<int> d;

  explicit UnionFind(int n = 0) : d(n, -1) {}

  // 属する集合の代表(根)を返す
  int find(int x) {
    // 根
    if (d[x] < 0) {
      return x;
    }
    // 経路圧縮
    return d[x] = find(d[x]);
  }

  // 2つの集合を1つに併合する(大きい集合に小さい集合をくっつける)
  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) {
      return false;
    }
    // xを大きい方にする
    if (d[x] > d[y]) {
      swap(x, y);
    }
    // 併合先のサイズ更新して、併合元の親の変更
    d[x] += d[y];
    d[y] = x;
    return true;
  }

  bool same(int x, int y) {
    return find(x) == find(y);
  }

  int size(int x) {
    return -d[find(x)];
  }
};

int main() {
  int n, m;
  cin >> n >> m;
  vector<P> ab(m);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    ab.at(i) = make_pair(a, b);
  }
  // 最大の友達の塊の人数を求めれば良い
  UnionFind uf(n);
  rep(i, m) {
    int a = ab.at(i).first;
    int b = ab.at(i).second;
    uf.unite(a, b);
  }
  int res = 0;
  rep(i, uf.d.size()) {
    if (uf.d.at(i) < 0) {
      res = max(res, (-uf.d.at(i)));
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 5568
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main(){
    int n,m;
    cin>>n>>m;
    char g[n][m];
    int dp[n][m];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>g[i][j];
            dp[i][j] = 0;
        }
    }
    for(int i=n-1;i>=0;i--){
        for(int j=m-1;j>=0;j--){
            if(i==n-1&&j==m-1){
                dp[i][j] = 1;
            }
            else if(i==n-1&&g[i][j]=='.'){
                dp[i][j] = dp[i][j+1];
            }
            else if(j==m-1&&g[i][j]=='.'){
                dp[i][j] = dp[i+1][j];
            }
            else{
                if(g[i][j]=='.'){
                    dp[i][j] = (dp[i][j+1] + dp[i+1][j])%mod;
                }
            }
        }
    }
    cout<<dp[0][0]<<endl;
    return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

ll N;

int dfs(string s, bool has3, bool has5, bool has7) {
  if (s.size() != 0 and stoll(s) > N) {
    return 0;
  }

  int ret = (has3 and has5 and has7);
  ret += dfs(s+"3", true, has5, has7);
  ret += dfs(s+"5", has3, true, has7);
  ret += dfs(s+"7", has3, has5, true);

  return ret;
}

int main()
{
  cin >> N;
  int ans = dfs("", false, false, false);

  cout << ans << endl;
}

Measured memory_bytes: 256