akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main()
{
  int n, a, i, j, b[4][13];
  char m;

  scanf("%d", &n);

  for(i = 0; i < 4; i++){
    for(j = 0; j < 13; j++){
      b[i][j] = 0;
    }
  }

  for(i = 0; i < n; i++){
    scanf(" %c%d", &m, &a);
    if(m == 'S') b[0][a-1] = 1;
    else if(m == 'H') b[1][a-1] = 1;
    else if(m == 'C') b[2][a-1] = 1;
    else b[3][a-1] = 1;
  }

  for(i = 0; i < 4; i++){
    for(j = 0; j < 13; j++){
      if(i == 0 && b[i][j] == 0) printf("S %d\n", j+1);
      else if(i == 1 && b[i][j] == 0) printf("H %d\n", j+1);
      else if(i == 2 && b[i][j] == 0) printf("C %d\n", j+1);
      else if(i == 3 && b[i][j] == 0) printf("D %d\n", j+1);
    }
  }
  return 0;
}

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

int main(){
  
  
  int H, W;
  
  while(1){
    cin >>H >>W ;
    if(H ==0 && W == 0)break;
    
    for ( int i = 0; i < H; i++ ){
      for (int j = 0; j < W; j++ ){
	if(i >= 1 && i < H-1 && j >= 1 && j < W-1){ 
	  cout<<".";
	} else {
	  cout<<"#";
	}
      }
      cout<<"\n";
    }
      cout<<"\n";
  }
  return 0;
}

Measured memory_bytes: 1120
#include "bits/stdc++.h"
#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;

struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;

int main() {
    int N;
    cin >> N;
    ll A, B;
    cin >> A >> B;
    vector<ll> X(N);
    for(int i = 0; i < N; i++) cin >> X[i];
    ull sum = 0;
    for(int i = 0; i < N - 1; i++){
        if((X[i + 1] - X[i]) * A >= B){
            sum += B;
        }else{
            sum += (X[i + 1] - X[i]) * A;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int a,b,c,d,e,k;
    cin >> a>> b >> c>> d>> e >> k;
    int flag=0;
    if(e-a>k) flag=1;
    

    if(flag==1) cout << ":(" << endl;
    else cout << "Yay!" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int X,Y;
int main(){
    cin>>X>>Y;
    for(int t=0;t<=X;t++){
        int k=X-t;
        if(t*2+k*4==Y){cout<<"Yes"<<endl;return 0;}
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3620
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        char[][] field = new char[h][];
        int[][] map = new int[h * w][h * w];
        for(int i = 0; i < h * w; i++) {
            Arrays.fill(map[i], Integer.MAX_VALUE / 10);
            map[i][i] = 0;
        }
        for (int i = 0; i < h; i++) {
            field[i] = sc.next().toCharArray();
            for (int j = 0; j < w; j++) {
                if (j != 0 && field[i][j - 1] == '.' && field[i][j] == '.') {
                    map[i * w + j][i * w + j - 1] = 1;
                    map[i * w + j - 1][i * w + j] = 1;
                }
                if (i != 0 && field[i - 1][j] == '.' && field[i][j] == '.') {
                    map[(i - 1) * w + j][i * w + j] = 1;
                    map[i * w + j][(i - 1) * w + j] = 1;
                }
            }
        }
        for (int i = 0; i < h * w; i++) {
            for (int j = 0; j < h * w; j++) {
                for (int k = 0; k < h * w; k++) {
                    map[j][k] = Math.min(map[j][k], map[j][i] + map[i][k]);
                    map[k][j] = map[j][k];
                }
            }
        }
        int max = 0;
        for (int i = 0; i < h * w; i++) {
            for (int j = 0; j < h * w; j++) {
                if (map[i][j] < Integer.MAX_VALUE / 10) {
                    max = Math.max(max, map[i][j]);
                }
            }
        }
        System.out.println(max);
    }
}

Measured memory_bytes: 22484
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string.h>
using namespace std;
int main()
{
    int t,con=0,a[200100]= {0};
    scanf("%d",&t);
    for(int i=0; i<t; i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+t);
    for(int i=0; i<t-1; i++)
        if(a[i]==a[i+1])
        {
            printf("NO");
            return 0;
        }
    printf("YES");
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<string>
#include<cstring>
#include<vector>
#include<set>
#include<cmath>
using namespace std;
typedef vector<int> vi;
const int MAX_V=1e3+5;
const int INF=1e9;
vector< vector<int> > board(10,vector<int>(10,0) );
//vector< vector<bool> > same(10,vector<bool>(10,false) );
int w,h,c;
bool visited[10][10];
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int ans=0;
int tmpans=1;
bool outofrange(int y,int x,int pcolor,int ncolor,vector<vector<int> > &nowboard)
{
  if(y<0 || y>=h || x<0 || x>=w || visited[y][x]) return true;
  else if(nowboard[y][x]!=pcolor) return true;
  else return false;
}

void paintbfs(int y,int x,int pcolor,int ncolor,vector<vector<int> > &nowboard)
{
  visited[y][x]=true;
  if(y==0 && x==0) nowboard[y][x]=ncolor;
  for(int k=0;k<4;k++)
    {
      int ny=y+dy[k],nx=x+dx[k];
      if(!outofrange(ny,nx,pcolor,ncolor,nowboard))
	{
	  nowboard[ny][nx]=ncolor;
	  paintbfs(ny,nx,pcolor,ncolor,nowboard);	  
	}
    }
}

void countbfs(int y,int x,int color,vector<vector<int> > &nowboard)
{
  tmpans++;
  visited[y][x]=true;
  for(int k=0;k<4;k++)
    {
      int ny=y+dy[k],nx=x+dx[k];
      if(!outofrange(ny,nx,color,color,nowboard))
	{
	  countbfs(ny,nx,color,nowboard);	  
	}
    }
}

void shock(int num,vector< vector<int> > &nowboard)
{
  int pcolor;
  if(num>=6) return;
  vector< vector<int> > save;
  save=nowboard;
  if(num!=0)
    {
      for (int ncolor = 1; ncolor <= 6; ++ncolor)
	{
	  memset(visited,false,sizeof(visited));
	  tmpans=0;
	  nowboard=save;
	  pcolor=nowboard[0][0];
	  paintbfs(0,0,pcolor,ncolor,nowboard);
	  memset(visited,false,sizeof(visited));
	  countbfs(0,0,ncolor,nowboard);
	  if(num==5 && ncolor==c) ans=max(tmpans,ans);
	  shock(num+1,nowboard);
	}
    }
  else
    {
      tmpans=0;
      pcolor=nowboard[0][0];
      paintbfs(0,0,pcolor,pcolor,nowboard);
      memset(visited,false,sizeof(visited));
      countbfs(0,0,pcolor,nowboard);
      //if(pcolor==c) ans=max(tmpans,ans);
      shock(num+1,nowboard);
    }
  return;
}

int main(void)
{
  while(cin >> h >> w >> c && w)
    {
      ans=0;
      for (int i = 0; i < h; ++i)
	{
	  for (int j = 0; j < w; ++j)
	    {
	      cin >> board[i][j];
	    }
	}
      shock(0,board);
      //cout << sy << ' ' << sx << ' ' << gy << ' ' << gx << endl;
      cout << ans << endl;
    }
  return 0;
 
}



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

const int INF = 1001001001;
const int NV=100100;

int main() {
  int64_t a,b,c;
  cin>>a>>b;
  for(int64_t i=1;i<=b;i++){
    if(a*i%b==0){
      c=a*i;
      break;
    }
  }
  cout<<c<<endl;  
}

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

int main() {
  int n,a[200010],b[200010];
  scanf("%d", &n);
  for (int i=0;i<n;++i) {
    scanf("%d", a+i);
    b[i] = a[i];
  }
  sort(a, a+n);
  for (int i=0;i<n;++i) {
    if (b[i]<a[n/2]) printf("%d\n", a[n/2]);
    else printf("%d\n", a[n/2-1]);
  }
  return 0;
}

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

using namespace std;

typedef long long ll;

const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main()
{
	ll N;
	ll K;
	cin >> N >> K;
	ll L[K];
	ll R[K];
	for (int i = 0; i < K; i++) {
		cin >> L[i] >> R[i];
	}

	vector<mint> dp(N + 1, 0);
	vector<mint> acc_sum(N+1,0);


	dp[1] = 1;
	acc_sum[1] = 1;

	for (int i = 2 ; i <= N; ++i)
	{
		for (int j = 0; j < K; j++) {
			int rj = i - L[j];
			int lj = i - R[j];
			if (rj < 0)
				continue;
			lj = max(lj, 1);
			dp[i] += (acc_sum[rj] - acc_sum[lj - 1]);
			
		}
		acc_sum[i] = (acc_sum[i-1] + dp[i]);
	}
	cout << dp[N] << endl;
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int64_t> a(n+1);
    rep(i,n) {
        int x;
        cin >> x;
        a[i+1] += a[i] + x;
    }
    int64_t sum_a = a[n];
    int64_t ans = 1000000000000000000;
    for (int i = 1; i < n; i++) {
        ans = min(abs(sum_a - 2*a[i]), ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int a, c = 0, f = 0;
  cin >> a;
  vector<int> b(a);
  for (int i = 0; i<a; i++) cin >> b.at(i);
  
  while (b.at(0) > 1) {
    for (int i = 0; i<a; i++) {
      if (b.at(i)%2 == 1) f = 1;   //処理を抜ける
      b.at(i) = b.at(i)/2;
    }
    if (f == 1) break;
    c++;
  }
  cout << c << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <limits>
typedef long long ll;
#define REP(i,n)   for(int i=0; i<(int)(n); ++i)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); ++i)

#define in cin
#define out cout
#define pb push_back
using namespace std;

int main(){
	int a[10], b[10];
	REP(i, 10)in >> a[i];
	REP(i, 10)in >> b[i];
	sort(a, a + 10);
	sort(b, b + 10);
	int w = a[7] + a[8] + a[9];
	int k = b[7] + b[8] + b[9];
	out << w << " " << k << endl;
	return 0;
}

Measured memory_bytes: 3136
PROGRAM piyo
      IMPLICIT NONE
      integer :: n,i
      integer,allocatable :: d1(:),d2(:)
      character(3) :: ans = 'No '
      
      read*,n
      allocate( d1(n),d2(n) )
      do i = 1,n
        read*,d1(i),d2(i)
      end do
      
      
      do i = 2,n-1
        
        if( d1(i-1)/=d2(i-1) )cycle
        if( d1(i)/=d2(i) )cycle
        if( d1(i+1)/=d2(i+1) )cycle
        
        ans = 'Yes'
        
      end do
      
      
      print*,ans
      
      
      stop
      !debugg
      
      
      
      END PROGRAM

Measured memory_bytes: 2860
//code by parshuram_84
#include <bits/stdc++.h>
#define floop(i,a,n) for (int i=a;i<n;i++)
#define pii pair<int,int>
#define pll pair<long long,long long>
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define vvl vector<vector<long long> >
#define vp vector<pair<long long,long long>>
#define vpp vector<pair<pair<long long,long long>,long long>>
#define mp make_pair
#define all(c) c.begin(),c.end()
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin();it != container.end(); it++)
typedef std::numeric_limits< double > dbl;
using namespace std;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll ncr(ll n,ll r) { ll p=1,k=1; if(n-r<r) r=n-r; if(r!=0) {while(r!=0) {p*=n; k*=r; ll temp=gcd(p,k); p/=temp; k/=temp; n--; r--;} } else p=1; return p;}
ll pm(ll x,ll n) {ll result=1; while(n>0){if(n%2==1) result=((result%mod)*(x%mod))%mod; x=((x%mod)*(x%mod))%mod; n/=2;} return result;}
ll p(ll x,ll n) {ll result=1; while(n>0){if(n%2==1) result=result*x; x=x*x; n/=2;} return result;}
ll factorial[300000+1];
void fact(ll n) { factorial[0]=1; factorial[1]=1; floop(i,2,n+1) factorial[i] = (i * factorial[i-1]%mod) % mod; }

int32_t main() {
	IOS;
	ll t,i,j,k,n,x=-9e18,y=9e18,z=-9e18,w=9e18;
	string s;
	cin>>t;
	for(i=0;i<t;i++)
	{
		cin>>j>>k;
		x=max(j+k,x);
		y=min(j+k,y);
		z=max(j-k,z);
		w=min(j-k,w);
	}
	j=max(x-y,z-w);
	cout<<j;
	return 0;
}

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

int main(){
  int N,X;
  cin >> N >> X;
  int mi=1e8;
  int64_t sum=0;
  for(int i=0;i<N;i++){
    int m;
    cin >> m;
    sum+=m;
    if(mi>m){
      mi=m;
    }
  }
  int ans=N;
  X-=sum;
  ans+=X/mi;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
MOD = 10**9 + 7

fact = [1]*(N+10)
rfact = [1]*(N+10)
r = 1
for i in range(1, N+10):
  fact[i] = r = r * i % MOD
rfact[N] = r = pow(fact[N], MOD-2, MOD)
for i in range(N, 0, -1):
  rfact[i-1] = r = r * i % MOD

for i in range(1, K+1):
    if N-K-i+1 >= 0:
        v = fact[N-K+1] * rfact[N-K-i+1] * rfact[i] % MOD
        v = v * (fact[K-1] * rfact[i-1] * rfact[K-i] % MOD) % MOD
        print(v)
    else:
        print(0)

Measured memory_bytes: 41968
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod  1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  vector<int> order(n);
  int N = n - 1;
  for(int i = 0; 0 <= N; i++) {
    order[i] = N;
    N -= 2;
  }
  N = n - 2;
  for(int i = n - 1; 0 <= N; i--){
    order[i] = N;
    N -= 2;
  }

  for(int i = 0; i < n; i++){
    if(i == 0) cout << a[order[i]];
    else cout << " " << a[order[i]];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3712
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define pb push_back 
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ll long long
#define sc(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)

ll a[10000007];
int main(int argc, char** argv) {
	int n;
	sc(n);
	rep(i,1,n)
	{
		for(int j=i;j<=n;j+=i)
		{
			a[j]++;
		}
	}
	ll ans=0;
	rep(i,1,n)ans+=a[i]*i;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 81868
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

#define sc(x) cin >>x
#define sc2(x,y) cin >> x >> y ;
#define sc3(x,y,z) cin >> x >> y >> z ;
#define pb push_back
#define mp make_pair
#define fi first
#define se second 

#define M 1000000007
#define inf 99999999999999999LL	//long long inf

#define debug(x) cerr<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define debug4(x,y,z,a) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#a<<" :: "<<a<<"\n";

#define LIM 100020
int main()
{
	int i,j,t;
	int n,lim ;
	sc2(n,lim) ;
	vector< int >vv; 
	while(n--)
	{
		int x,y ;
		sc2(x,y) ;
		if(y<=lim)
			vv.pb(x);
	}
	sort(vv.begin(),vv.end());
	if(vv.size()>0)
		printf("%d\n",vv[0]) ;
	else
		printf("TLE\n");		

	return 0;
}

 


Measured memory_bytes: 256
#include <stdio.h>

int max(int a, int b)
{
   if(a>b) return a;
   else return b;
}
int min(int a, int b)
{
   if(a<b) return a;
   else return b;
}

int main(void)
{
   int q1, b, c1, c2, q2;
   int qa;
   int hi, lo, ce;

   while(scanf("%d", &q1)){
      if(q1==0) break;
      scanf("%d %d %d %d", &b, &c1, &c2, &q2);

      qa=0;
      hi=q2;
      lo=1;
      //while(hi>=lo){
         ce=(hi+lo)/2;
	 if(c1*ce+c2*max(q1-ce, 0)<=b){
	    //lo=ce+1;
	    //qa=ce;
            for(qa=q2; qa>=ce; qa--){
               if(c1*qa+c2*max(q1-qa, 0)<=b) break;
            }
	 }
	 else {
	    //if(c1>=c2) hi=ce-1;
	    //else lo=ce+1;
	    if(c1>=c2){
            for(qa=ce-1; qa>0; qa--){
               if(c1*qa+c2*max(q1-qa, 0)<=b) break;
            }}
	    else {
	       if(c1*ce>b){
               for(qa=ce-1; qa>0; qa--){
                  if(c1*qa+c2*max(q1-qa, 0)<=b) break;
               }
	       }
	       else {
	          qa=min(b/c1, q2);
		  if(c1*qa+c2*max(q1-qa, 0)>b) qa=0;
	       }
	    }
	 }
      //}
      if(qa==0) printf("NA\n");
      else printf("%d %d\n", qa, (b-c1*qa)/c2);
   }
   return 0;
}

Measured memory_bytes: 612
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
 
using namespace std;
 
 
int main()
{
	int n;
	cin >> n;
	while (n)
	{
		if (n % 10 == 7)
		{
			cout << "Yes";
			return 0;
		}
		n /= 10;
	}
	cout << "No";
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	string S;
	cin >> S;
	int cnt = 0;
	int N = S.size() + 1;
	VI ans(N,0);
	int i = 0;
	while (i < S.size()) {
		if (S[i] == '<') {
			ans[i] = cnt;
			cnt++;
		}
		else {
			ans[i] = cnt;
			ans[i + 1] = cnt + 1;
			cnt = 0;
		}
		i++;
	}
	
	ans[i] = cnt;
	cnt = 0;
	i = S.size();
	//REP(i, ans.size())cout << ans[i];
	//cout << endl;
	while (i >= 1) {
		if (S[i-1] == '>') {
			ans[i] = max(cnt, ans[i]);
			ans[i - 1] = max(cnt + 1, ans[i - 1]);
			cnt++;
		}
		else {
			cnt = 0;
		}
		i--;
	}
	//REP(i, ans.size())cout << ans[i];
	int sum = 0;
	REP(i, ans.size())sum+=ans[i];
	cout << sum << endl;
	return 0;
}



Measured memory_bytes: 4764
#include <stdio.h>

int main(void)
{
  int x1, x2, x3, x4, y1, y2, y3, y4;
  scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
  
  if (x2 >= x1 && y2 >= y1) {
    x3 = x2-y2+y1;
    y3 = y2+x2-x1;
    x4 = x3-x2+x1;
    y4 = y3-y2+y1;
  }
  else if (x2 >= x1 && y2 < y1) {
    x3 = x2-y2+y1;
    y3 = y2-x1+x2;
    x4 = x3-x2+x1;
    y4 = y3-y2+y1;
  }
  else if (x2 < x1 && y2 < y1) {
    x3 = x2-y2+y1;
    y3 = y2+x2-x1;
    x4 = x3-x2+x1;
    y4 = y3-y2+y1;
  }
  else {
    x3 = x2-y2+y1;
    y3 = y2+x2-x1;
    x4 = x3-x2+x1;
    y4 = y3-y2+y1;
  }
  printf("%d %d %d %d\n", x3, y3, x4, y4);
}


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

namespace Aizu {
    class OnlineJudge {
        static void Main() {
            var input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            var coin = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            var data = Enumerable.Repeat(int.MaxValue, input[0] + 1).ToArray();
            data[0] = 0;
            for (int i = 0; i < input[1]; ++i) {
                for (int j = coin[i]; j < input[0] + 1; ++j) {
                    data[j] = Math.Min(data[j], data[j - coin[i]] + 1);
                }
            }
            Console.WriteLine(data[input[0]]);
        }
    }
}

Measured memory_bytes: 10164
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
// #include "../debug/debug.cpp"
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

V<ll> visited(200, -1);
VV<ll> edges(200);
const ll inf = 5e15;

bool dfs(ll cur, bool even = true) {
    if(even) {
        if(visited[cur] == 1) return false;
        if(visited[cur] == 0) return true;
    } else {
        if(visited[cur] == 0) return false;
        if(visited[cur] == 1) return true;
    }
    visited[cur] = even ? 0 : 1;
    bool ret = true;
    for(ll nxt : edges[cur]) ret &= dfs(nxt, !even);
    return ret;
}

ll solve() {
    ll N;
    cin >> N;
    auto dists = make_v<ll>(inf, N, N);
    for(ll i = 0; i < N; i++) {
        for(ll j = 0; j < N; j++) {
            char c;
            cin >> c;
            if(c == '1') {
                dists[i][j] = 1;
                edges[i].push_back(j);
            }
            if(i == j) dists[i][j] = 0;
        }
    }
    
    for(ll i = 0; i < N; i++) {
        if(visited[i] != -1) continue;
        bool judge = dfs(i);
        if(!judge) return -1;
    }

    for(ll k = 0; k < N; k++) for(ll i = 0; i < N; i++) for(ll j = 0; j < N; j++) chmin(dists[i][j], dists[i][k] + dists[k][j]);
    ll ans = 0;
    for(auto &&v : dists) for(ll e : v) chmax(ans, e);
    return ans + 1;
}

int main() {
    cout << solve() << endl;
    return 0;
}


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

class Solve
{
	public:

		ll a, b, ans;

		void input()
		{
			cin >> a >> b;
		}

		void solve()
		{
			if(a % 2 != b % 2)
			{
				cout << "IMPOSSIBLE" << endl;
			}
			else
			{
				ans = (a + b) / 2;
				cout << ans << endl;
			}
			
		}

		void output()
		{
        }
};

Solve s;
int main()
{
    s.input();
	s.solve();
	s.output();
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
a_list.sort(reverse=True)
if k == 0:
    print(a_list[0])
else:
    start = 1
    end = a_list[0]
    x = (start + end) // 2 
    while True:
        k_count = 0
        flag = 1
        for a in a_list:
            temp_k = 0
            if a % x == 0:
                temp_k = a // x - 1
            else:
                temp_k = a // x
            if temp_k == 0:
                flag = 1
                break
            k_count += temp_k
            if k_count > k:
                flag = 0
                break
        if flag == 1:
            end = x
        if flag == 0:
            start = x
        next_x = (start + end) // 2
        if next_x == x:
            if flag == 1:
                print(x)
            if flag == 0:
                print(x + 1)
            break
        x = next_x



Measured memory_bytes: 31948
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var s = o.a(1);
  var n = s.length;
  var l = n + 1 >> 1, u, v = l;
  var f = s[l-1];
  if(n & 1)u = l-2;
  else u = l-1;
  for(; u >= 0; u--, v++){
    if(s[u] !== f || s[v] !== f)break;
    l++;
  }
  return l;
}

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    for(int i = 1; i <= 3; i++){
        int mul = a * b * i;
        if(mul % 2 != 0){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N,M;
double A[110];
  cin >> N >> M;
  double count = 0;
  double result = 0;
  for(int a = 0;a<N;a++){
    cin >> A[a];
    count += A[a];
  }
  for(int a = 0;a<N;a++){
    if(A[a] >= count / (4 * M))result += 1;
  }
  if(result >= M)cout<<"Yes"<<endl;
  if(result < M)cout<<"No"<<endl;
  
}

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

#define MAX_V 300
#define INF 1e9

long long int cost[MAX_V][MAX_V]; // cost[u][v]は辺e=(u,v)のコスト(存在しない場合はINF)
int V;

int main(){
    cin >> V;
    for(int i=0;i<V;++i){
        for(int j=0;j<V;++j){
            cin >> cost[i][j];
        }
    }

    bool flag = true;
    for (int k = 0; k < V; k++){
        for (int i = 0; i < V; i++){
            for (int j = 0; j < V; j++){
                long long int tmp = cost[i][j];
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
                if(tmp != cost[i][j]){
                    flag = false;
                    break;
                }
            }
            if(!flag)break;
        }
        if(!flag)break;
    }

    if(flag){
        long long int ans = 0;
        for (int i = 0; i < V; i++){
            for (int j = i+1; j < V; j++){
                bool exist = true;
                for(int k = 0; k < V; k++){
                    if(k != i && k != j && cost[i][k] + cost[k][j] == cost[i][j])
                        exist = false;
                }
                if(exist)ans += cost[i][j];
            }
        }
        cout << ans << endl;
    }else cout << "-1" << endl;
    return 0;
}


Measured memory_bytes: 896
#include <iostream>

using namespace std;

int calcGCD(int a, int b);

int main(void)
{
    int a,b;
    int GCD;
    int LCM;
    
    while (cin >> a >> b) {
        GCD = calcGCD(a, b);
        if (GCD == -1) {
            return -1;
        }
        
        LCM = a / GCD * b;
        cout << GCD << " " << LCM << endl;
    }
    
    return 0;
}

int calcGCD(int a, int b)
{
    while (a > 0 && b > 0) {
        if (a > b) {
            a %= b;
        } else {
            b %= a;
        }
    }
    
    if (a == 0) {
        return b;
    } else if (b == 0){
        return a;
    } else {
        return -1;
    }
}

Measured memory_bytes: 1160
s = input()
for i in range(len(s)):
    if i % 2:# 偶数番目
        if s[i] == 'R':
            print("No")
            exit(0)
    if i % 2 == 0:
        if s[i] == 'L':
            print("No")
            exit(0)
print('Yes')


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

int n,ans = 0;
int now = -2e9;
vector<pair<int,int>> v;

int main(){
    cin >> n;
    rep(i,n){
        ll x,l = 0; cin >> x >> l;
        v.push_back(make_pair(x+l,x-l));
    }
    sort(v.begin(),v.end());
    rep(i,n){
        if(v[i].second < now) continue;
        else{
            now = v[i].first;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1400
def submit():
    n = int(input())
    vlist = list(map(int, input().split()))
    
    curr_n = n
    while curr_n > 1:
        merge = (0, 0)
        max_sum = 0
        curr_sum = sum(vlist)
        for i in range(curr_n):
            for j in range(i + 1, curr_n):
                merge_sum = curr_sum - vlist[i] - vlist[j] + \
                            (vlist[i] + vlist[j]) / 2
                if max_sum < merge_sum:
                    max_sum = merge_sum
                    merge = (i, j)
                
        avg = (vlist[merge[0]] + vlist[merge[1]]) / 2
        vlist.pop(merge[0])
        vlist.pop(merge[1] - 1)
        vlist.append(avg)
        curr_n -= 1

    print(vlist[0])


if __name__ == "__main__":
    submit()

Measured memory_bytes: 3064
N = int(input())

ans = N-1

def get_steps(a, b):
    return (a-1) + (b-1)


for i in range(1, int(N**0.5)+1):
    if N % i == 0:
        d = N // i
        ans = min(ans, get_steps(i, d))

print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define INFTY (1<<30)
int a[2000001],m;
char s[100];
void charu1(int i,int k){
if(k<a[i])return ;
a[i]=k;
while(i>1&&a[i/2]<a[i]){
       int b=a[i];
       a[i]=a[i/2];
       a[i/2]=b;
       i=i/2;
}
}
void charu(int k){
m++;
a[m]= -INFTY;
charu1(m,k);
}
void dui(int i){
int big,l,r;
l=i*2;
r=i*2+1;
if(l<=m&&a[i]<a[l])big=l;
else big=i;
if(r<=m&&a[r]>a[big])big=r;
if(big!=i){
    int b=a[i];
    a[i]=a[big];
    a[big]=b;
    dui(big);
}
}
int shanchu(){
int zuida;
if(m<1)return -INFTY;
zuida=a[1];
a[1]=a[m--];
dui(1);
return zuida;
}
int main(){
int n;
while(1){
        scanf("%s",s);
    if(s[0]=='e'&&s[1]=='n')break;
    if(s[0]=='i'){
            scanf("%d",&n);
            charu(n);
    }
    else {
        printf("%d\n",shanchu());
    }
}
return 0;
}

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

using namespace std;

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


Measured memory_bytes: 3920
use num::Integer;
use proconio::input;

fn main() {
    input!(n: u64);

    let m = 2 * n;
    let div = divisors(m);
    let ks = div.iter().filter_map(|&a| {
        // m = ab
        let a = a as i64;
        let b = m as i64 / a;

        // k = -ax, k+1 = by
        // ax + by = 1
        let mut ext = a.extended_gcd(&b);
        if ext.gcd != 1 {
            return None;
        }
        if ext.x >= 0 {
            let dec = ext.x / b + 1;
            ext.x -= dec * b;
            // ext.y += dec * a;
        }

        Some(-a * ext.x)
    });
    let ans = ks.min().unwrap();

    println!("{}", ans);
}

fn divisors(n: u64) -> Vec<u64> {
    let mut ret = Vec::new();
    for x in 1.. {
        if x * x > n {
            break;
        }
        if n % x == 0 {
            ret.push(x);
            if x * x < n {
                ret.push(n / x)
            }
        }
    }
    ret
}


Measured memory_bytes: 2308
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define     PI                       acos(-1)
typedef  long long     ll ;
typedef  unsigned long long ull;
const double eps= (1e-9);
using namespace std;
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
void GO(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}
const int N=1000+5;
vector<int> v[2];
int main(){
    GO();

    int T;
    T=1;
   // cin>>T;
    while(T--){

        string st;
        int n;
        cin>>n>>st;
        for(int i=0;i<sz(st);i++){
            if(st[i]=='W'){
                v[0].pb(i);
            }
            else
                v[1].pb(i);
        }
        if(sz(v[0])==0||sz(v[1])==0){
            cout<<"0\n";
            return 0;
        }
        int id=0;
        int ans=0;
        while(id<sz(v[0])&&sz(v[1])>0&&v[0][id]<v[1].back()){

            ans++;
            v[1].pop_back();
            id++;
        }
        cout<<ans<<"\n";
    }
}


















































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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vvll = vector<vll>;
using vst = vector<st>;
using vch = vector<char>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
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;}
const ll mod = 1000000007;
const ll inf = 1LL << 60;
const db pi = acos(-1.0L);

int main(){
  ll n, k;
  cin >> n >> k;
  ll edge = (n - 2) * (n - 1) / 2;
  if(edge < k){
    cout << -1 << endl;
    return 0;
  }
  edge -= k;
  cout << edge + n - 1 << endl;
  rep(i, 2, n + 1) cout << 1 << " " <<  i << endl;
  ll cnt = n - 2;
  while(edge > 0){
    rep(i, 0, cnt){
      if(edge <= 0) break;
      edge--;
      cout << n - cnt << " " <<  n - i << endl;
    }
    cnt--;
    if(cnt <= 0) break;
  }
}

Measured memory_bytes: 256
a, b, c, d, e = input(). split()

a = int(a)
b = int(b)
c = int(c)
d = int(d)
e = int(e)
#x == y xとyの値が等しければTrue
#x != y xとyの値が等しくなければTrue

if a == 0:
    print(1)
if b == 0:
    print(2)
if c == 0:
    print(3)
if d == 0:
    print(4)
if e == 0:
    print(5)

Measured memory_bytes: 9180
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void Calc()
    {
        cin = new Scanner();

        string s = cin.next();
        int length = s.Length;

        char[] s_ = s.ToCharArray();

        int ans = 0;
        int j = length - 1;
        for (int i = 0; i < length / 2; ++i, --j)
        {
            if (s_[i] != s_[j])
            {
                ++ans;
            }
        }

        WriteLine(ans);
    }
}

public static class StringExtension
{
    public static char GetChar1(this string str, int indexOneBase)
    {
        return str[indexOneBase - 1];
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


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

int main (void) {
    long long a, b, k;
    scanf("%lld%lld%lld", &a, &b, &k);
    /* まず自分の手持ちを食べつくす */
    if ( a > k ) {
        a -= k;
        k = 0;
    }
    else {
        k -= a;
        a = 0;
    }
    /* 次に青木君の手持ちを食べつくす */
    if ( b > k ) {
        b -= k;
        k = 0;
    }
    else {
        k -= b;
        b = 0;
    }
    printf("%lld %lld\n", a, b);
    return EXIT_SUCCESS;
}


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

double abso(double x) {
	if (x < 0)x *= -1;
	return x;
}

int main() {
	int n = 0;
	scanf("%d", &n);
	int *A = (int*)calloc(n, sizeof(int));
	double accum = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &A[i]);
		accum += (double)A[i];
	}
	accum = accum / n;
	double dist = 100;
	double tmp = 0;
	for (int i = 0; i < n; i++) {
		tmp = abso(accum - (double)A[i]);
		if (tmp < dist)dist = tmp;
	}
	for (int i = 0; i < n; i++) {
		if (abso(accum - (double)A[i]) == dist) {
			printf("%d", i);
			return 0;
		}
	}
	return 0;
}

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

int main() {
unsigned long long S,ret,alpha,d;
  cin>>S ;
unsigned long long X1,X2,X3,Y1,Y2,Y3;
  X3=0;
  Y3=0;
  X1=0;
  Y2=0;
  X2=S;
  Y1=1;
  d=1000000000;
  if(S>d){
      alpha=d*d-S;
      if(alpha<=d){
        X2=d;
        Y1=d;
        X1=alpha;
        Y2=1;
      }else{
        ret=sqrt(S);
        if((ret+1)*ret>S){
        alpha=(ret+1)*(ret)-S;
          X2=ret+1;
          Y1=ret;
          X1=alpha;
          Y2=1;
        }else{
          alpha=(ret+1)*(ret+1)-S;
          X2=ret+1;
          Y1=ret+1;
          X1=alpha;
          Y2=1;        }
      }
    }
  cout<<X1<<" "<<Y1<<" "<<X2<<" "<<Y2<<" "<<X3<<" "<<Y3<<endl;
}


Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: i32 = input();
    let k: usize = input();
    let d: Vec<i32> = (0..k).map(|_| input()).collect();

    let mut ans = n;
    loop {
        let mut ok = true;
        let mut temp = ans;
        while temp > 0 {
            if d.contains(&(temp % 10)) {
                ok = false;
            }
            temp /= 10;
        }
        if ok {
            break;
        }
        ans += 1;
    }

    println!("{}", ans);
}


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

using namespace std;

int main()
{
	string s, t;
	cin >> s >> t;
	int a, b;
	cin >> a >> b;
	string u;
	cin >> u;

	if (s == u) {
		cout << a - 1 << " " << b << endl;
	}
	else {
		cout << a << " " << b - 1 << endl;
	}

	return 0;
}

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

int main() {
  int A, B, res=0;
  cin >> A >> B;
  
  for (int i=0; i<2; i++) {
    if(A<B) {
      res += B;
      B -= 1;
    }else {
      res += A;
      A -= 1;
    }
  }
  cout << res;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
PY = [list(map(int,input().split())) + [i] for i in range(M)]

PY.sort()

pnow = PY[0][0]
c = 1

ans = [-1 for i in range(M)]

for i in range(M):
    if pnow != PY[i][0]:
        c = 1
        pnow = PY[i][0]
    ans[PY[i][2]] = str(PY[i][0]).zfill(6) + str(c).zfill(6)
    c += 1

print('\n'.join(ans))


Measured memory_bytes: 103540
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string n , m;
    cin >> n >> m;
    int n1 = stoi(n);
    int m1 = stoi(m);
    if (n1 == 0){
        cout << "No" << endl;
    }
    int result = m1 / n1 ;
    if(result==1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
/**********************************************
 *Author*        :jxf378440404
 *Created Time*  : 2019/1/13 19:59:06

*********************************************/

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
using namespace std;
typedef long long LL;
const int MaxN = 1e5;
const int Inf = 1 << 30;

int main()
{
	int a,b,c,d;
	int p[20];
	while(~scanf("%d %d %d %d",&a,&b,&c,&d)){
		for(int i = 0;i <= 10;i++) p[i] = 0;
		p[a]++;
		p[b]++;
		p[c]++;
		p[d]++;
		if(p[1] && p[9] && p[7] && p[4]) printf("YES\n");
		else printf("NO\n");
	}
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

bool wins[100005];

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
  int n,k;cin>>n>>k;
  int pts[3];
  for(int i=0;i<3;i++)cin>>pts[i];
  string s;cin>>s;
  ll ans=0;
  for(int i=0;i<n;i++){
    int t=2;
    if(s[i]=='s')t=0;
    else if (s[i]=='p')t=1;
    if(i-k<0||s[i-k]!=s[i] || !wins[i-k]){
      wins[i]=1;ans+=pts[t];
    }
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 3768
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include<ctime>
#include<random>
#include<cstring>
#include<cstdlib>
#include<cstdint>
#include<fstream>
#include<strstream>
#include<vector>
#include<string>
#include<chrono>


//#include "D:\Code\C++\Headers\zle_STL.h"


#define ll long long

using namespace std;


int main() {
	
	char tar;
	cin >> tar;

	if (('A' <= tar) && (tar <= 'Z')) {
		cout << 'A';
	}
	else {
		cout << 'a';
	}


	return 0;
}

Measured memory_bytes: 3032
#!/usr/bin/env python3
import sys
from collections import deque
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return [LIST() for _ in range(n)]

def main():
    H, W, K = MAP()
    HH = max(H, W) + 2
    x1, y1, x2, y2 = LIST()
    c = [[-1] + [0 if c == "." else -1 for c in input()] + [-1]
         for i in range(H)]
    c = [[-1] * (W + 2)] + c + [[-1] * (W + 2)]

    # 0123: 上下左右
    stack = deque([((x1 * HH + y1) << 2) | 0, ((x1 * HH + y1) << 2) | 1,
                   ((x1 * HH + y1) << 2) | 2, ((x1 * HH + y1) << 2) | 3])
    append, popleft = stack.append, stack.popleft
    DX = (1, 0, -1, 0)
    DY = (0, 1, 0, -1)
    while stack:
        b = popleft()
        d = b % 4
        x, y = divmod(b >> 2, HH)
        flag = True
        a = c[x][y] + 1
        for k in range(1, K + 1):
            xx, yy = x + k * DX[d], y + k * DY[d]
            if c[xx][yy] == 0:
                b = c[xx + DX[(d - 1) % 4]][yy + DY[(d - 1) % 4]]
                if b == 0 or b == a + 1:
                    append(((xx * HH + yy) << 2) + (d - 1) % 4)
                b = c[xx + DX[(d + 1) % 4]][yy + DY[(d + 1) % 4]]
                if b == 0 or b == a + 1:
                    append(((xx * HH + yy) << 2) + (d + 1) % 4)
                c[xx][yy] = a
            elif c[xx][yy] != a:
                flag = False
                break
        if flag:
            append(((xx * HH + yy) << 2) + d)
        if c[x2][y2] > 0:
            print(c[x2][y2])
            return

    print(-1)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 147228
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    h, w, k = map(int, input().split())
    s = [[(c == "#") * 1 for c in input()] for _ in range(h)]
    # p2D(s)
    row_cnt1 = [0] * h
    for i, sr in enumerate(s):
        row_cnt1[i] = sum(sr)
    # print(row_cnt1)
    t = [[0] * w for _ in range(h)]
    no = 0
    for i in range(h):
        if row_cnt1[i] == 0: continue
        no += 1
        first = False
        for j in range(w):
            if s[i][j] == 1:
                if first:
                    no += 1
                else:
                    first = True
            t[i][j] = no
    #p2D(t)
    for i in range(1, h):
        if t[i][0] > 0: continue
        for j in range(w):
            t[i][j] = t[i - 1][j]
    for i in range(h - 2, -1, -1):
        if t[i][0] > 0: continue
        for j in range(w):
            t[i][j] = t[i + 1][j]

    for tr in t:
        print(*tr)

main()


Measured memory_bytes: 8144
#include <algorithm>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

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

using namespace std;

typedef long long ll;

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

  char x, y; cin >> x >> y;

  if (x == y) { cout << "=" << endl; }
  else if (x < y) { cout << "<" << endl; }
  else { cout << ">" << endl; }

  return 0;
}

Measured memory_bytes: 256