akhauriyash/Code-Regression huggingface dataset:
#define DEBUG 0

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

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

char s[1000001];
int trie[1000001][26],leaf[1000001],num = 0;
int cc[1000001][26],seen[26];
vi v;
vector<pair<int,char> > vv;
int main() {
    int i,j;
    int N;
    scanf("%d",&N);
    for (i = 0; i < N; i++) {
        scanf("%s",s);
        int l = strlen(s),u = 0;
        v.pb(0);
        for (j = l-1; j >= 0; j--) {
            if (j == 0) vv.pb(mp(u,s[j]));
            if (trie[u][s[j]-'a'] == 0) trie[u][s[j]-'a'] = ++num;
            u = trie[u][s[j]-'a'];
            v.pb(u);
        }
        leaf[u] = 1;
        for (j = 0; j < l; j++) {
            if (!seen[s[j]-'a']) cc[v[l-j-1]][s[j]-'a']++,seen[s[j]-'a'] = 1;
        }
        v.clear(),memset(seen,0,sizeof(seen));
    }

    int k;
    num++;
    for (i = num-1; i >= 0; i--) {
        for (j = 0; j < 26; j++) {
            if (trie[i][j] != 0) {
                for (k = 0; k < 26; k++) cc[i][k] += cc[trie[i][j]][k];
            }
        }
    }
    LLI ans = 0;
    for (i = 0; i < vv.size(); i++) ans += cc[vv[i].first][vv[i].second-'a']-1;
    printf("%lld\n",ans);

    return 0;
}



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

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if      (A == B) cout << C << endl;
    else if (A == C) cout << B << endl;
    else if (B == C) cout << A << endl;
}

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

#define WHITE 0 
#define GRAY 1
#define BLACK 2
#define INFTY 10000000
int n,color[100],M[100][100],d[100],p[100];
int i,j,u,k,v,c;

void dijkstra(){
  for( i = 0; i < n; i++ ){
    color[i] = WHITE;
    d[i] = INFTY;
  }
  d[0] = 0;
  p[0] = -1;
  int cnt = 0;
  // color[0] = GRAY;
  while(1){
    cnt++;
    //cout << cnt << endl;
    int u = -1;
    int mincost = INFTY;
    for( i = 0; i < n; i++ ){
      if( color[i] != BLACK && d[i] < mincost ){
	mincost = d[i];
	u = i;
      }
    }
    if( u == -1 ) break;
    //    if( mincost == INFTY ) break;
    color[u] = BLACK;

    for( v = 0; v < n; v++ ){
      if( color[v] != BLACK && M[u][v] != INFTY ){
	if( d[u] + M[u][v] < d[v] ){
	  d[v] = d[u] + M[u][v];
	  p[v] = u;
	  color[v] = GRAY;
	}
      }
    }
  }

  for( i = 0; i < n; i++ ){
    cout << i << " ";
    if( d[i] == INFTY ) cout << -1;
    else cout << d[i];
    cout << endl;
  }
}

int main(){
 
  cin >> n;

  for( i = 0; i < n; i++ ){
    for( j = 0; j < n; j++ ){
      M[i][j] = INFTY;
    }
  }

  for( i = 0; i < n; i++ ){
    cin >> u >> k;
    for( j = 0; j < k; j++ ){
      cin >> v >> c;
      M[u][v] = c;
    }
  }
  
  dijkstra();

  return 0;
}

Measured memory_bytes: 1200
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int *arr, int size) {
    int i;
    for(i = 0; i < size; i++) {
        scanf("%d", &arr[i]);
    }
    return 0;
}

#define NUM_MAX 100000
#define INF ((1e+9)+1)

int main(void) {
    int num = get_int();
    static int arr[NUM_MAX];
    fget_array(arr, num);
    int i;
    int sign = 0;
    int smallest = INF;
    int64_t ans = 0;
    for(i = 0; i < num; i++) {
        if(arr[i] < 0) sign++;
        int n = abs(arr[i]);
        smallest = min(n, smallest);
        ans += n;
    }
    if(sign%2 == 1) {
        ans -= smallest*2;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 512
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val x = sc.nextInt()
    var ans = 1
    for (i in 2..x) {
        var p = i * i
        while (p <= x) {
            ans = Math.max(ans, p)
            p *= i
        }
    }
    println(ans)
}

Measured memory_bytes: 29464
#include<stdio.h>

int main(void)
{
   int n, q, l[100000], r[100000], i, f, x[100000]={0}, a;
   char s[100001];

   scanf("%d%d%s",&n,&q,s);
   for(i=0;i<q;i++)
      scanf("%d%d",&l[i],&r[i]);

   for(i=1;i<n;i++){
      if((s[i-1]=='A')&&(s[i]=='C'))
         x[i]=x[i-1]+1;
      else
         x[i]=x[i-1];
   }
   for(i=0;i<q;i++)
      printf("%d\n",x[r[i]-1]-x[l[i]-1]);

   return 0;
}

Measured memory_bytes: 2048
N = int(input())
x, u = [[], []]
for i in range(N):
    temp = input().split()
    u.append(temp[1])
    if temp[1] == "JPY":
        x.append(int(temp[0]))
    else:
        x.append(float(temp[0]))

btc = 380000.0
jpy = 1.0

result = 0
for i in range(N):
    if u[i] == "JPY":
        result += x[i] * jpy
    else:
        result += x[i] * btc
print(result)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int h,w,m,a[300001],b[300001],p1,p2;
typedef pair<int,int> pi;
set<pi>st;
int main(){
	int i,j,x,y;
	cin>>h>>w>>m;
	vector<int>l,r;
	for(i=1;i<=m;++i){
		cin>>x>>y;
		st.insert(make_pair(x,y));
		a[x]++;
		b[y]++;
		if(a[x]>p1){
			l.clear();
			p1=a[x];
		}
		if(a[x]==p1)l.push_back(x);
		if(b[y]>p2){
			r.clear();
			p2=b[y];
		}
		if(b[y]==p2)r.push_back(y);
	}
	for(i=0;i<l.size();++i){
		for(j=0;j<r.size();++j){
			if(st.find(make_pair(l[i],r[j]))==st.end()){
				cout<<p1+p2;
				return 0;
			}
		}
	}
	cout<<p1+p2-1;
}

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

namespace Sunuke
{
    class Program
    {
        static void Main(string[] args)
        {
            string n = Console.ReadLine();
            int N = int.Parse(n);

            int waru = 111;
            int amari = N % waru;

            if (amari == 0)
            {
                Console.WriteLine(N);
            }
            else
            {
                Console.WriteLine(waru + N - amari);
            }
        }
    }
}


Measured memory_bytes: 13140
#include<cstdio>
int n,f[11000],data[101][101][101];
void check(int x,int y,int z) {
	int tmp=x*x+y*y+z*z+x*y+y*z+z*x;
	if (tmp>n) return;
	data[x][y][z]=1;
	if (!data[x+1][y][z])check(x+1,y,z);
	if (!data[x][y+1][z])check(x,y+1,z);
	if (!data[x][y][z+1])check(x,y,z+1);
}
int main() {
	scanf("%d",&n);
	check(1,1,1);
	for(int i=1;i<=100;++i)
		for(int j=1;j<=100;++j)
			for (int k=1;k<=100;++k) if (data[i][j][k]) f[i*i+j*j+k*k+i*j+j*k+k*i]++;
	for (int i=1;i<=n;++i) printf("%d\n",f[i]);
	return 0;
} 

Measured memory_bytes: 4388
#include<bits/stdc++.h>
using namespace std;
#define THE using
#define DARK namespace
#define ONE std
#define dbg(x) cout << #x << " = " << x << endl

THE DARK ONE;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
//    freopen("out.txt", "w", stdout);
//    freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    switch(n){
        case 3: return cout << "YES", 0;
        case 5: return cout << "YES", 0;
        case 7: return cout << "YES", 0;
        default: return cout << "NO", 0;
    }
    return 0;
}



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

int main() {
    int N; cin >> N;
    int A[N];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    int ans = 0;
    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            ans = max(ans, abs(A[i] - A[j]));
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3600
#include "bits/stdc++.h"

using namespace std;

typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)

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


signed main(){

	int N, M;
	cin >> N >> M;
	int a[10], m[10] = { INF, 2, 5, 5, 4, 5, 6, 3, 7, 6 };
	vector<int> dp;
	dp.assign(12345, -INF);
	dp[0] = 0;

	for (int i = 0; i < M; i++){
		cin >> a[i];
	}
	sort(a, a + M, greater<>());

	for (int n = 0; n <= N; n++){
		for (int i = 0; i < M; i++){
			dp[n + m[a[i]]] = max(dp[n + m[a[i]]], dp[n] + 1);
		}
	}

	string s;
	while (N>0){
		for (int i = 0; i < M; i++){
			if (N - m[a[i]]>=0 && dp[N] == dp[N - m[a[i]]] + 1){
				s = s+ string(1,'0'+a[i]);
				N = N - m[a[i]];
				break;
			}
		}
	}
	cout << s << endl;

	return 0;
}

Measured memory_bytes: 384
<?php
    // get inputs from stdin
    $input = intval(fgets(STDIN));
    // when value is 1
    if($input === 1) {
        echo 1;

    }
    // when value is odd 
    else if($input % 2 === 1) {
        echo ((intval($input/2) + 1)/$input);
    }

    // when value is even
    else {
        echo 0.5;
    }

Measured memory_bytes: 4604
import math
import numpy as np
a0,b0 = (int(i) for i in input().split())
a = a0
b = b0
if a<b:
  tmp = a
  a = b
  b = tmp
r = a%b
while r != 0:
  a = b
  b = r
  r = a%b
ans = a0*b0//b
print(ans)

Measured memory_bytes: 20640
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define int long long int
const int mod = 1000000007;
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;


signed main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int a, b, c, d;
    cin>>a>>b>>c>>d;
    int mn1 = min(a,b);
    int mn2 = min(c,d);
    int mx1 = max(a, b);
    int mx2 = max(c, d);
    vector<int>arr;
    arr.push_back(mn1);
    arr.push_back(mn2);
    arr.push_back(mx1);
    arr.push_back(mx2);
    int ans = max(a*c, max(a*d, max(b*c, b*d)));
    // ans = max(mx1*mn1, mx1*mx2);
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> p;

const ll MOD = 1000000007;

int main() {
    int n; cin >> n;
    int t = 0; int f = 0;
    vector<ll> a(n);
    REP(i,n) {
        cin >> a[i];
        if(a[i]%4==0) f ++;
        else {
            if(a[i]%2==0) t ++;
            else continue;
        }
    }
    cout << (n-2*f <= 1 || n-2*f-t<=0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
 
int N, K, X, Y;
 
int main(void)
{
	scanf("%d %d %d %d", &N, &K, &X, &Y);
	printf("%d\n", (N - K >= 0) ? (K * X + (N - K) * Y) : (N * X));
 
	return 0;
}

Measured memory_bytes: 1712
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define pi 3.1415926535897932384626433832
double radian(double n)
{
    return (pi*(n/180.0));
}
int main()
{
    double a,b,h,m,minx,miny,hx,hy;
    scanf("%lf %lf %lf %lf",&a,&b,&h,&m);
    minx=b*cos(radian(m*(360.0/60.0)));
    miny=b*sin(radian(m*(360.0/60.0)));
    hx=a*cos(radian((h+(m/60.0))*30.0));
    hy=a*sin(radian((h+(m/60.0))*30.0));
    double ans=sqrt(((hx-minx)*(hx-minx))+((hy-miny)*(hy-miny)));
    printf("%.20lf",ans);
}


Measured memory_bytes: 2484
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,L;
  cin >> N >> L ;
  vector<string> data(N) ;
  for(int i=0; i<N ;i++){
    cin >> data.at(i);
  }
  sort(data.begin(),data.end());
  for(int i=0; i<N ;i++){
    cout << data.at(i);
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
const int INF=(1e9);
int n,m,dp[110][110];
char s[110][110];
int main() {
	//freopen("1.txt","r",stdin);
	read(n); read(m);
	for (int i=1;i<=n;i++) scanf("%s",s[i]+1);
	for (int i=1;i<=n;i++)
	for (int j=1;j<=m;j++) {
		if (i==1&&j==1) {
			if (s[i][j]=='#') dp[i][j]=1;
		} else {
			dp[i][j]=INF;
			if (i>1&&s[i-1][j]=='#') dp[i][j]=min(dp[i][j],dp[i-1][j]);
			else if (i>1) dp[i][j]=min(dp[i][j],dp[i-1][j]+(s[i][j]=='#'));
			if (j>1&&s[i][j-1]=='#') dp[i][j]=min(dp[i][j],dp[i][j-1]);
			else if (j>1) dp[i][j]=min(dp[i][j],dp[i][j-1]+(s[i][j]=='#'));
		}
	}
	printf("%d\n",dp[n][m]);
	return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Interger overflow?
  
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define in insert
#define PI 3.1415926535897932384626433832795
#define MOD 100000007
#define F first
#define S second
#define aLL(str) (str).begin(), (str).end()
#define IOS                  \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0)
#define ll long long
#define ld long double
#define lcm(a, b) (a * b) / __gcd(a, b)
#define tr(s)                                      \
	for (auto it = v.begin(); it != v.end(); it++) \
		cout << *it << " ";
#define pv(a)                         \
	for (ll i = 0; i < a.size(); i++) \
		cout << a[i] << " ";
#define flu(i, a, b) for (ll i = a; i < b; i++)
#define blu(i, a, b) for (ll i = a; i >= b; i--)
#define mod 1000000000
typedef vector<ll> vl;
typedef map<ll, ll> ml;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
char e = '\n';
ll i, j, le;
int main()
{
	IOS;
	int t;
t=1;


	while (t--)
	{
	ll n, k, fl,c;
	cin>>n>>k;
	vector<ll>v(n,0);
 flu(i,0,n)
  cin>>v[i];c=1;
  flu(i,0,k)
  c=(c*v[i])%mod;
  fl=c;
  flu(i,k,n)
  {
   if(v[i]>v[i-k])cout<<"Yes\n";
	else cout<<"No\n";

     c=fl;
  }
	}
	return 0;
}


Measured memory_bytes: 4784
#include <bits/stdc++.h>
using namespace std;
int main(){
  	int n,t=1,m;
  	cin>>n;
  	m=7%n;
  	while(m!=0){
  		t++;
  		m=((m<<3)+(m<<1))%n+7;
  		m%=n;
  		if(t>n){
  			cout<<-1;
  			return 0;
		  }
	}
  	cout<<t;
	return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<vector>
#include<utility>

using namespace std;

int main(){

	int n;
	string s;
	cin>>n>>s;


	int flag = 0;
	int ans=0;
	for(int i=0;i<n;i++){
		if(s[i]=='A')flag=1;
		else if(s[i]=='B' && flag==1)flag=2;
		else if(s[i]=='C' && flag==2){
			ans++;
			flag=0;
		}
		else flag = 0;
	}
	cout<<ans;



	cout<<endl;

	return 0;
}


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

int test(int N, int K, int X, int Y);
int main(void) {
    char *p;
    char str[8];
    int N,K,X,Y;

    p = fgets(str, 8, stdin);
    N = atoi(p);
    p = fgets(str, 8, stdin);
    K = atoi(p);
    p = fgets(str, 8, stdin);
    X = atoi(p);
    p = fgets(str, 8, stdin);
    Y = atoi(p);

    printf("%d\n", test(N,K,X,Y));

    return 0;
}

int test(int N, int K, int X, int Y) {
    if(K >= N){
        return N * X;
    } else {
        return (K * X) + ((N-K) * Y);
    }
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int k;
set<LL> V;

//void bfs(set<int> &V, int i){
////	V.(i);
//	queue<int> Q;
//	Q.push(i);
//	while(!Q.empty() && V.size()<k){
//		int top = Q.front();
//		Q.pop();
//		int left = i%10-1;
//		int right = top%10+1;
//		int curr = top%10;
//		if(left>=0 && top*10+left<=100000) V.insert(top*10+left), Q.push(top*10+left);
//		if(top*10+curr<=100000)
//		V.insert(top*10+curr), Q.push(top*10+curr);
//		if(top<=9 && top*10+right<=100000)
//		V.insert(top*10+right), Q.push(top*10+right);
//	}
//}

void dfs(LL i){
	if(i>=100000000000) return;
	V.insert(i);
	int left = i%10-1;
	int right = i%10+1;
	int curr = i%10;	
	if(left>=0 && i*10+left<=100000000000) dfs(i*10+left);
	if(right<=9 && i*10+right<=100000000000) dfs(i*10+right);
	if(i*10+curr<=100000000000) dfs(i*10+curr);
}


int main(){
	cin>>k;
//	for(int i=1;i<=9;i++) V.push_back(i);
	for(LL i=1;i<=9;i++)
		dfs(i);
//	for(auto x : V) cout<<x<<" ";
//	cout<<"\n";
	LL cnt = 0;
	for(auto x : V){
		cnt++;
		if(cnt==k){
			cout<<x;
			break;
		}
	}
//	cout<<x;
	return 0;
}

Measured memory_bytes: 27520
//vяпay
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define flash ios::sync_with_stdio(false);cin.tie(0);
const int mod = 1e9+7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    //string p = 'es';
    //string q = 's';
    if(s[s.size()-1] == 's'){
      cout << s << "es" << endl;
    }
    else
      cout << s << "s" << endl; 
    return 0;
}


Measured memory_bytes: 3604
def calc_vt(v,t):
    vt = [0]*(sum(t)*2+1)
    t_sum = 0
    for ti,vi in zip(t,v):
        for i in range(ti*2):
            vt[t_sum + 1 + i] = min(vt[t_sum + i] + 0.5,vi)
        t_sum += ti*2
    return vt

n = input().split()
tn = list(map(int,input().split()))
vn = list(map(int,input().split()))

vt_l = calc_vt(vn,tn)
vt_r = calc_vt(vn[::-1],tn[::-1])[::-1]

vt_lr = [min(vl,vr) for vl,vr in zip(vt_l,vt_r)]

print(sum((a+b)*0.5/2 for a,b in zip(vt_lr,vt_lr[1:])))


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

int is_prime[1000000];

int main() {
	memset(is_prime, 1, sizeof(is_prime));
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i < 1000000; i++) {
		if (is_prime[i]) {
			for (int j = i * 2; j < 1000000; j += i)is_prime[j] = false;
		}
	}
	int a, d, n;
	while (scanf("%d%d%d", &a, &d, &n), a) {
		int cnt = 0;
		for (int i = a;; i += d) {
			if (is_prime[i])cnt++;
			if (cnt == n) {
				printf("%d\n", i);
				break;
			}
		}
	}
}

Measured memory_bytes: 7024
s = list(input())
point = 0
for i in range(len(s)):
  if i % 2 == 0:
    if s[i] == "L":
      point += 1
      break
  else:
    if s[i] == "R":
      point += 1
      break
if point == 0:
  print("Yes")
else:
  print("No")

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

int gcd(int a, int b) {
  if(a % b == 0) {
    return b;
  } else {
    return gcd(b, a % b);
  }
}

int lcm(int a, int b){
   return a * b / gcd(a, b);
}

int main() {
  int x;
  int ans;
  cin >> x;

  cout << lcm(360, x) / x << endl;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<set>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<queue>
#define mem(x) memset(x,0,sizeof(x)) 
#define sca(x) scanf("%d",&x)
#define scaa(x,y) scanf("%d%d",&x,&y)
#define prt(x) printf("%d\n",x)
#define inf 0x7f7f7f7f
#define io ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#pragma GCC optimize(2)
using namespace std;
const double pi=acos(-1); 
const double eps=1e-2;
typedef pair<long,long> pll;
typedef pair<int,int> pii;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<string,string> pcc;
int main()
{
	int a,b,c,f=0;
	cin>>a>>b>>c;
	int k;
	cin>>k;
	while(b<=a)
	{
		if(k==0)
		{
			f=1;
			break;
		}
		b*=2;
		k--;
		
	}
	//cout<<b<<endl;
	if(f==0)
	{
		while(c<=b)
		{
			if(k==0)
			{
				f=1;
				break;
			}
			c*=2;
			k--;
			
		}
	}
	if(f==1)
	cout<<"No"<<endl;
	else
	cout<<"Yes"<<endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h1,h2,m1,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	int ans=0;
	ans+=(h2*60+m2)-(h1*60+m1)-k;
	cout<<ans;
	return 0;
}

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

using namespace std;

int main () {
	int N, X;
	cin >> N >> X;
	int l, d = 0, c = 1;
	for (int i = 1; i <= N; i++) {
		cin >> l;
		d += l;
		if (d <= X) c++;
	}
	cout << c << endl;
}


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

int main(){
  int x,n;
  bool check = true;
  cin>>x>>n;
  if (n==0){
    cout << x << endl;
  } else {
    int a[100] = {0};
    for (int i=0; i<n; i++){
      int number;
      cin>>number;
      a[number-1] = 1;
    }
    int i=0;
    while(check){
      if (x-1-i<0) {
        cout << x-i <<endl;
        break;
      }
      else {
        if (a[x-1-i] ==0){
          cout << x-i <<endl;
          break;
        }
      }
      if (x-1+i >99){
        cout << x+i <<endl;
        break;
      }
      else{
        if (a[x-1+i] ==0){
          cout << x+i << endl;
          break;
        }
      }
      i+=1;
    }
  }
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>

bool hasSnook[102] = {false};

int main() {
    int n, k, di, tmp;
    std::cin >> n >> k;

    int problematic = n;

    for (int i = 0; i < k; ++i) {
        std::cin >> di;
        for (int j = 0; j < di; ++j) {
            std::cin >> tmp;
            if (hasSnook[tmp] == false) {
                problematic -= 1;
                hasSnook[tmp] = true;
            }
        }
    }
    std::cout << problematic;
    return 0;
}

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

using namespace std;


#define mod        1000000007
#define ft         first
#define sd         second
#define pb         push_back
#define all(x)     x.begin(),x.end()
#define ll         long long int
#define db         long double
#define vbi        vector<bool> 
#define vlli       vector<long long int >
#define mp         make_pair
#define ms(x,v)    memset(x, v, sizeof x)
#define cnl        printf("\n");
#define fr(i,b)    for(ll i=0; i<=b; i++)
#define frr(i,b)   for(ll i=0;i<b;i++)
#define fb(i,b)    for(ll i=b-1; i>=0; i--)
#define PI         3.14159265
const int maxn=    100000;
ll i,j,k;
int main(){
    ll a,b,c; cin>>a>>b>>c;
    ll d=a-b;
     if(d>c) cout<<0<<endl;
     else cout<<(c-d)<<endl;
    


    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <cmath>

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

using namespace std;

ll f(ll n)
{
  ll sqn = sqrt(n);
  for(ll i = sqn; i > 1; --i)
  {
    if(n % i == 0)
      return (i - 1 + n/i - 1);
  }
  return n - 1;
}

int main()
{
  ll n;
  cin >> n;
  cout << f(n) << endl;

  return 0;
}


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

bool check(string S){
  if(S[0]!='A')
    return false;
  
  int count=0;
  for(int i=2;i<S.size()-1;++i){
    if(S[i]=='C')
      ++count;
  }
  if(count!=1)
    return false;
  
  int cnt=0;
  for(int i=0;i<S.size();++i){
    if('A'<=S[i] && S[i]<='Z')
      ++cnt;
  }
  
  if(cnt!=2)
    return false;
  
  return true;
}

int main() {
  string S;
  cin>>S;
  
  if(check(S))
    cout<<"AC"<<endl;
  else
    cout<<"WA"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
// #include <stdio.h>

using namespace std;

int main(void){

    // cout << "ldsfj" << endl;

    int num =0, i;
    string s;

    cin >> s;
    for(i =0;i<4;i++){
        if(s[i]=='+'){
            num++;
        }else{
            num--;
        }
    }

    cout << num;

    return 0;
}

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

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)
 
inline ll ii(){ ll x; cin >> x; return x; }
inline string is(){ string x; cin >> x; return x; }
inline ld id(){ ld x; cin >> x; return x; }
inline void oi(ll x){ cout << x; }
inline void od(ld x){ cout << fixed << setprecision(10) << x; }
inline void os(string x){ cout << x; }
inline void oe(){ cout << endl; }
inline void oie(ll x){ oi(x); oe(); }
inline void ode(ld x){ od(x); oe(); }
void ose(string x){ os(x); oe(); }

ll m[100];

int main(){
    ll N=ii();
    vector<ll> A;
    REP(i,0,N){
        A.push_back(ii());
    }
    REP(i,0,100){
        m[i]=1000;
    }
    REP(i,0,N-1){
        REP(j,i+1,N){
            m[j]=max(m[i],m[j]);
        }
        REP(j,i+1,N){
            ll b=m[i]/A[i];
            ll prof=A[j]*b-A[i]*b;
            m[j]=max(m[i]+prof,m[j]);
        }
    }
    oie(m[N-1]);
    return 0;
}


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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;

vector<int> E[200050];
vector<int> cost(200050);
void dfs(int u,int pre){
    for(auto v : E[u])if(pre != v){
        cost[v] += cost[u];
        dfs(v,u);
    }
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n,q;
    cin>>n>>q;
    for(int i=0;i<n-1;++i){
        int a,b;
        cin>>a>>b;
        a--;b--;
        E[a].push_back(b);
        E[b].push_back(a);
    }
    for(int i=0;i<q;++i){
        int qi,xi;
        cin>>qi>>xi;
        qi--;
        cost[qi] += xi;
    }
    dfs(0,-1);
    for(int i=0;i<n;++i){
        if(i)cout << " ";
        cout << cost[i];
    }
    return 0;
}

Measured memory_bytes: 23552
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define rep3(i, s, n) for (int i = s; i > (int)(n); i--)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define dbvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main() {
	string s; cin >> s;
	bool f = true;
	int N = s.size();
	if (N % 2 == 1) f = false;
	else {
		string t = "";
		rep(i, N / 2) t += "hi";
		if (s != t) f = false;
	}
	Yn(f);	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  while (true)
  {
    int h, w;
    cin >> h >> w;
    if (h == 0 && w == 0)
      break;

    string f, s;
    REP(i, w)
    {
      if (i % 2 == 0)
      {
        f += "#";
        s += ".";
      }
      else
      {
        f += ".";
        s += "#";
      }
    }

    REP(i, h)
    {
      if (i % 2 == 0)
      {
        cout << f << endl;
      }
      else
      {
        cout << s << endl;
      }
    }
    cout << endl;
  }
}



Measured memory_bytes: 3160
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
using namespace std;

int main()
{   
    int n;
    cin >> n;
    int cnt = 0;
    long long num = 1,sum = 0;
    while(num <= n){
        if(num % 3 != 0 && num % 5 != 0){
            sum += num;
            cnt++;
        }
        num++;
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3620
from heapq import heappop,heappush
def dijkstra(s,n,edge):
  inf=10**20
  ans=[inf]*n
  ans[s]=0
  h=[[0,s]]
  while h:
    c,v=heappop(h)
    if ans[v]<c:continue
    for u,t in edge[v]:
      if c+t<ans[u]:
        ans[u]=c+t
        heappush(h,[c+t,u])
  return ans
k=int(input())
edge=[[]for _ in range(k)]
for i in range(1,k):
    edge[i].append(((i*10)%k,0))
    edge[i].append(((i+1)%k,1))
ans=dijkstra(1,k,edge)
print(ans[0]+1)


Measured memory_bytes: 43180
#include <stdio.h>

int dp[50];

int fib(int n){
  if(n==0||n==1)return dp[n]=1;
  if(dp[n]!=-1)return dp[n];
  return dp[n]=fib(n-1)+fib(n-2);
}

int main(){
  int n,i;
  for(i=0;i<50;i++){
    if(i<50)break;
  }
  for(i=0;i<50;i++)dp[i]=-1;

  scanf("%d",&n);
  printf("%d\n",fib(n));

  return 0;
}



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

int main() {
  	long long int N;
  	cin >> N;
  	long long int res = 0;
  	if (N % 2 == 1) res = 0;
  	else {
      	N /= 2;
      	while (N > 0){
          	res += N / 5;
          	N /= 5;
        }
    }
  	cout << res << endl;
}

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

using namespace std;

int main(){
    
    string S;
    cin >> S;
    
    int ans = 0;
    int rb = 0;
    char rorb = S[0];
    
    for (int i = 0; i < S.length(); i++) {
        if (S[i] == rorb) {
            rb += 1;
        }else{
            rb -= 1;
            if (rb < 0) {
                rb = 1;
                rorb = S[i];
            }
        }
    }
    
    
    cout << S.length() - rb << endl;
}



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

int main(){
    string s, t;
    cin >> s >> t;
    int n = s.size();
    bool ok = false;
    for(int b=0;b<2;b++){
        int i=b;
        for(int j=0;j<n;j++){
            if(i<n && s[i]==t[j]) i+=2;
        }
        ok |= i>=n;
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}



Measured memory_bytes: 3216
#include <stdio.h>
int main(void)
{
	int inputdata[10];
	int i;
	for(i=0;i<10;i++)
		scanf("%d",&inputdata[i]);
	mysort(inputdata,3);
	return 0;
}
void mysort(int *data,int loop)
{
	int i=0;
	int bufindex=0;

	loop--;

	for(i=1;i<10;i++)
		if(data[i]>data[bufindex])
			bufindex=i;
	printf("%d\n",data[bufindex]);
	data[bufindex]=0;

	if(loop > 0)
		mysort(data,loop);
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;

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

void dfs(ll h,char Map[8][8],bool E[8][8],ll count){

  char mp[8][8];
  bool e[8][8];

  rep(i,0,8){
    rep(j,0,8){
      mp[i][j]=Map[i][j];
      e[i][j]=E[i][j];
    }
  }

  if(count==8){
    rep(i,0,8){
      rep(j,0,8)cout<<(mp[i][j]);
      cout<<endl;
    }
    return;
  }

  rep(i,h,8){
    // bool check=false;
    rep(j,0,8){
      if(E[i][j]){
        count++;
        mp[i][j]='Q';
        e[i][j]=false;
        rep(m,0,8){
          for(ll r=1;IN(0,8,j+r*dx[m])&&IN(0,8,i+r*dy[m]);r++)e[i+r*dy[m]][j+r*dx[m]]=false;
        }
        dfs(i+1,mp,e,count);
        count--;
        mp[i][j]='.';
        rep(i,0,8){
          rep(j,0,8){
            e[i][j]=E[i][j];
          }
        }
      }
    }
  }
}

int main(){

  ll k;cin>>k;
  char mmap[8][8];
  bool me[8][8];
  rep(i,0,8){rep(j,0,8){
    mmap[i][j]='.';
    me[i][j]=true;
    }

  }
  rep(ki,0,k){
    ll y,x;cin>>y>>x;
    mmap[y][x]='Q';
    me[y][x]=false;
    rep(m,0,8){
      for(ll i=1;IN(0,8,x+i*dx[m])&&IN(0,8,y+i*dy[m]);i++){
        me[y+i*dy[m]][x+i*dx[m]]=false;
      }
    }
  }

  dfs(0,mmap,me,k);

  return 0;
}



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

int main()
{
	string S, T; cin >> S >> T;
    ll slen = S.length();
    ll tlen = T.length();
    ll rnum = slen - tlen + 1;

    ll ans = -1;
    for (int i = 0; i < rnum; ++i) {

        ll tmp = 0;
        for (int j = 0; j < tlen; ++j) {
            if (T[j] != S[i+j]) {
                tmp++;
            }
        }
        if (ans == -1) {
            ans = tmp;
        }
        else if (ans > tmp) {
            ans = tmp;
        }


    }
    cout << ans << endl;




}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define CL(x) ((x) * (x))
#define CR(x) (((x) * (x)) + 1)
typedef long long cc;
typedef pair <int, int> pii;
string s;
int res;
int dp[70000007];
int n;

int main() {
    ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> s;
    n = s.size();
    for (int i = 1; i < (1 << 26); i++)
        dp[i] = n;
    for (int i = 0; i < n; i++) {
        res ^= (1 << (s[i] - 'a'));
        for (int j = 0; j < 26; j++)
            dp[res] = min(dp[res], dp[res^(1<<j)] + 1);
    }
    if (dp[res])
        cout << dp[res];
    else
        cout << 1;
    return 0;
}


Measured memory_bytes: 264784
#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>;
const int INF = 1001001001;

int main() {
  ll n;
  cin >> n;

  ll ans, l0 = 2, l1 = 1;
  for(int i = 0; i < n-1; i++){
    ans = l0 + l1;
    l0 = l1;
    l1 = ans;
  }

  if(n == 1){
    cout<<"1"<<endl;
  }else{
    cout<<ans<<endl;
  }

  return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())

ps = []
for _ in range(m):
	p,s = map(str,input().split())
	p = int(p)-1
	ps.append([p,s])

ac = [-1 for _ in range(n)]
wa = [0 for _ in range(n)]
ans_ac = 0
ans_wa = 0
for i in range(m):
	if ps[i][1] == 'WA':
		if ac[ps[i][0]] == -1:
			wa[ps[i][0]] += 1
	else:
		if ac[ps[i][0]] == -1:
			ac[ps[i][0]] = 1
			ans_ac += 1

for i in range(n):
	if ac[i] != -1:
		ans_wa += wa[i]
print(ans_ac,ans_wa)


Measured memory_bytes: 23604
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main(void){
	char s[51],t[51];
	scanf("%s%s",s,t);
	int i,len1 = strlen(s), len2 = strlen(t),j,k;
	
	for(i=len1-len2;i>=0;i--){
		for(j=0;j<len2;j++){
			if(s[i+j] != t[j] && s[i+j] != '?') break;
			else if (j == len2-1){
				for(k=0;k<len2;k++){
					s[i+k] = t[k];
				}
				for(k=0;k<len1;k++){
					if(s[k] == '?') s[k] = 'a';
				}
			printf("%s",s);
			return 0;
			}
		}	
	}

	printf("UNRESTORABLE");
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n; cin>>n;
    map<int, int> mp;
    for(int i=0; i<n; i++){
        int a; cin>>a;
        mp[a]++;
    }
    if(n%3!=0){
        if(mp[0]==n) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }else{
        if(mp.size()>3){
            cout<<"No"<<endl;
            return 0;
        }
        if(mp.size()==1){
            if((*mp.begin()).first!=0){
                cout<<"No"<<endl;
            }else{
                cout<<"Yes"<<endl;
            }
            return 0;
        }
        if(mp.size()==2){
            if(mp[0]!=n/3){
                cout<<"No"<<endl;
            }else{
                cout<<"Yes"<<endl;
            }
            return 0;
        }
        int x=0;
        for(auto p:mp){
            x^=p.first;
            if(p.second!=n/3){
                cout<<"No"<<endl;
                return 0;
            }
        }
        if(x==0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int t,t1=-1,i,s=1;
	for(i=1;i<=3;i++)
	{
		scanf("%d",&t); 
		if(t>=t1)
			t1=t;
		s*=t;
	}
	printf("%d",s/t1/2);
	return 0;
} 

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

ans = 'No'
z = 0
for i, j in d_l:
    if i == j:
        z+=1
    else:
        z=0
    if z == 3:
        ans = 'Yes'
        break
print(ans)

Measured memory_bytes: 9176
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 998244353;
template <typename Int, Int MOD, int N>
struct comb_util {
	std::array<Int, N + 1> fc, ifc;

	comb_util() {
		fc[0] = 1;
		for (int i = 1; i <= N; i++) fc[i] = fc[i - 1] * i % MOD;
		ifc[N] = inv(fc[N]);
		for (int i = N - 1; i >= 0; i--) ifc[i] = ifc[i + 1] * (i + 1) % MOD;
	}

	Int fact(Int n) { return fc[n]; }

	Int inv_fact(Int n) { return ifc[n]; }

	Int inv(Int n) { return pow(n, MOD - 2); }

	Int pow(Int n, Int a) {
		Int res = 1, exp = n;
		for (; a; a /= 2) {
			if (a & 1) res = res * exp % MOD;
			exp = exp * exp % MOD;
		}
		return res;
	}

	Int perm(Int n, Int r) {
		if (r < 0 || n < r)
			return 0;
		else
			return fc[n] * ifc[n - r] % MOD;
	}

	Int binom(Int n, Int r) {
		if (n < 0 || r < 0 || n < r) return 0;
		return fc[n] * ifc[r] % MOD * ifc[n - r] % MOD;
	}

	Int homo(Int n, Int r) {
		if (n < 0 || r < 0) return 0;
		return r == 0 ? 1 : binom(n + r - 1, r);
	}
};

using comb = comb_util<long long, 998244353, 400000>;
comb cb;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, A, B, K;
	cin >> N >> A >> B >> K;
	int res = 0;
	for (int a = 0; a <= N; a++) {
		if (K >= a*A) {
			if ((K - a*A) % B == 0) {
				int b = (K - a*A) / B;
				if (b <= N) {
					res = (res + ((cb.binom(N,a) * cb.binom(N, b) % MOD))) % MOD;
				}
			}
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 6528
#include <iostream>
#include <vector>
#include <algorithm>
#include <list>
#include <map>
#include <set>
#include <string>
#include <queue>

using namespace std;
typedef long long ll;

int main() {
    ll N,A,B,C,D;
    cin >> N >> A >> B >> C >> D;
    string s;
    cin >> s;
    A--;B--;C--;D--;
    vector<string> res;
    res.push_back(s);

        char c=s[B];
        ll ct=1;
        ll ma=0;
        if(C>D){
            for(int i=A;i<C;i++){
                if(s[i]=='#' && s[i+1]=='#'){
                    cout << "No" << endl;
                    return 0;
                }
            }
            for(int i=B;i<D;i++){
                if(s[i]=='#' && s[i+1]=='#'){
                    cout << "No" << endl;
                    return 0;
                }
            }
            for(int i=B;i<=D;i++){
                if(s[i-1]=='.' && s[i+1]=='.' && s[i]=='.'){
                    ma=3;
                }
            }
            cout << (ma>=3 ? "Yes" : "No")  << endl;
        }
        else if(C<D){
            c=s[A];
            for(int i=A;i<C;i++){
                if(s[i]=='#' && s[i+1]=='#'){
                    cout << "No" << endl;
                    return 0;
                }
            }
            for(int i=B;i<D;i++){
                if(s[i]=='#' && s[i+1]=='#'){
                    cout << "No" << endl;
                    return 0;
                }
            }
            cout << "Yes"  << endl;
        }
}

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

struct UnionFind
{
    vector<int> par;

    UnionFind(int N) : par(N)
    {
        for (int i = 0; i < N; i++)
            par[i] = i;
    }

    int root(int x)
    {
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {                     
        int rx = root(x);
        int ry = root(y);
        if (rx == ry)
            return;
        par[rx] = ry;
    }

    bool same(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main()
{
    int n, m;
    cin >> n >> m;

    UnionFind tree(n);

    for (int i = 0; i < m; ++i)
    {
        int x, y, z;
        cin >> x >> y >> z, --x, --y;
        tree.unite(x, y);
    }

    int ans = 0;
    rep(i, n) ans += (i == tree.root(i));

    cout << ans << endl;
}

Measured memory_bytes: 4372
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int solve() {
    string s;
    cin >> s;
    vector<string> t = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
    for (int i = 0; i < t.size(); i++) if (s == t[i]) return 7 - i;
}
int main() {
    cout << solve() << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
using std::endl;
using std::cin;
using std::cout;
using std::vector;
using std::pair;
using std::string;

//for(int32_t i = 0; i < N; i++)

int main(void)
{
    int64_t N, P;
    cin >> N >> P;
    //cout << "P:" << P << " ,N:" << N << endl;

    int64_t max_yakusu = 1;
    for (int64_t i = 2; i <= std::sqrt(P); i++) {
        int64_t count = 0;
        while (P % i == 0) {
            //cout << "P:" << P << " ,i:" << i << endl;
            P = P / i;
            count ++;
        }
        while (count >= N) {
            max_yakusu *= i;
            count -= N;
        }
    }

    if (P != 1 && N == 1) {
        max_yakusu *= P;
    }

    cout << max_yakusu << endl;

    return 0;
}



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

int main(){
	int n;
	scanf("%d", &n);
	for(int i=1; i <= n; i++) {
		if(i % 3 == 0) {
			printf(" %d", i);
			continue;
		}
		if(i % 10 == 3) {
			printf(" %d", i);
			continue;
		}
		int x = i / 10;
		while(x) {
			if(x % 10 == 3) {
				printf(" %d", i);
				break;
			}
			x /= 10;
		}
	}
	printf("\n");
}



Measured memory_bytes: 3224
#include<bits/stdc++.h>
using namespace std;
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define pb push_back
#define F first
#define S second

#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define int long long
#define ll long long
const int M=1e9+7;

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

int expo(int x, int y) {int res=1;x=x%M;while(y>0){if(y&1)res=(1ll*res*x)%M;
	y=y>>1;x=(1ll*x*x)%M;} return res;}
	

signed main(){
	gearup;
	int t = 1;
	//cin >> t;
	while(t--){
		int a, b, n;
		cin >> a >> b >> n;
		int x = min(b - 1, n);
		int ans = a * x / b;
		cout << ans;	
	}
	return 0;
}

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

using namespace std;

int main(int argc, char *argv[]) {
    int M, D;
    cin >> M >> D;

    int ans = 0;
    for (int i = 0; i < M; i++) {
        int m = i + 1;
        for (int j = 0; j < D; j++) {
            int d = j + 1;
            if (d > 10) {
                int d1 = d % 10;
                int d10 = d / 10;

                if (d1 >= 2 && d10 >= 2 && m == (d1 * d10)) {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

string m[8], n[8];


int main(){
    for (int i = 0; i < 8; i++)	cin >> m[i];
    
    for (int i = 1; i <= 3; i++){
	
	for (int j = 0; j < 8; j++) n[j] = m[j];
	
	for (int k = 0; k < 8; k++){
	    for (int l = 0; l < 8; l++){
		n[k][l] = m[7-l][k];
	    }
	}
	for (int k = 0; k < 8; k++){
	    for (int l = 0; l < 8; l++){
		m[k][l] = n[k][l];
	    }
	}
	
	cout << i * 90 << endl;
	for (int l = 0; l < 8; l++) cout << n[l] << endl;
    }
}

Measured memory_bytes: 0
#!/mnt/c/Users/moiki/bash/env/bin/python

H,W = map(int, input().split())
S   = [ input() for _ in range(H)]
inf = float("inf")
costmap = [ [inf] * W for _ in range(H)]


kuro_num = 0
for h in range(H):
    for w in range(W):
        if S[h][w] == "#":
            kuro_num += 1
shiro_num = H*W - kuro_num

from collections import deque
q = deque()

q.append( (0,0,0) )

shortest  = inf
while q:
    h,w,cost = q.popleft()
    if h == H-1 and w == W-1:
        shortest = cost
        break

    if w < W-1 and S[h][w+1] == "." and  costmap[h][w+1]==inf:
        q.append( (h, w+1, cost+1) )
        costmap[h][w+1] = cost+1

    if h < H-1 and S[h+1][w] == "." and  costmap[h+1][w] == inf:
        q.append( (h+1, w, cost+1) )
        costmap[h+1][w] = cost+1

    if 0< h and S[h-1][w] == "." and  costmap[h-1][w] == inf:
        q.append( (h-1, w, cost+1) )
        costmap[h-1][w] = cost+1
    if 0< w and S[h][w-1] == "." and  costmap[h][w-1] == inf:
        q.append( (h, w-1, cost+1) )
        costmap[h][w-1] = cost+1
if shortest == inf:
    ans = -1
else:
    ans  =  shiro_num - (shortest+1)
print(ans)
    


Measured memory_bytes: 40176
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	A, B := nextInt(), nextInt()
	fmt.Println(lcmof2numbers(A, B))
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
// const ll MOD=998244353;

int main(){
  ll N; cin>>N;
  ll ans=0;
  for(ll i=1;i*i<=N;i++){
    if((N%i==0LL)&&((N-i)%i==0LL)){
      ll x=(N-i)/i;
      if(x==0) continue;
      if(N/x==N%x){
        ans+=x;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N;

  std::cin >> N;

  for (int i = 1; i < 10; i ++)
    for (int j = 1; j < 10; j ++)
      if (i * j == N) {
        std::cout << "Yes" << std::endl;
        
        return 0;
      }

  std::cout << "No" << std::endl;

  return 0;
}


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

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

using namespace std;

int main(void)
{
	int N, M;
	while(cin >> N >> M, N > 0){
		long ans=0;
		vector<long> h(N+1);
		vector<long> w(M+1);
		vector<int> h_map(MAX_SIZE+1, 0);
		vector<int> w_map(MAX_SIZE+1, 0);
		//hに関する累積和配列を構成
		h[0] = 0;
		rep(i, N){
			cin >> h[i+1];
			h[i+1] += h[i];
		}
		//wに関する累積和配列を構成
		w[0] = 0;
		rep(i, M){
			cin >> w[i+1];
			w[i+1] += w[i];
		}
		//hに関するマッピング
		for(int i=0; i<N; i++){
			for(int j=i+1; j<N+1; j++){
				h_map[h[j]-h[i]]++;
			}
		}
		//wに関するマッピング
		for(int i=0; i<M; i++){
			for(int j=i+1; j<M+1; j++){
				w_map[w[j]-w[i]]++;
			}
		}
		//足し合わせ
		rep(i, MAX_SIZE+1){
			ans += h_map[i]*w_map[i];
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 14500