akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

void doRoutine() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    srand(322179);
#ifdef LOCAL
    freopen("/root/alg/clion_main/input.txt", "rt", stdin);
    freopen("/root/alg/clion_main/output.txt", "wt", stdout);
#endif
}

#define DBG(VAR) cerr << #VAR << ": " << VAR << endl

#define all(x) x.begin(), x.end()
#define last(x) (--x.end())
#define vb vector<bool>
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define fi first
#define se second
#define pb push_back
#define vc vector

#ifndef LOCAL
#define cerr if(0) cerr
#define DBG(...) (true)
#endif

#define D double
#define int long long

// ----------------------------- CODE NOW ------------------------


const int MOD = 998244353;
const int MAXN = 300005;
int fact[MAXN];

int fpow(int a, int n) {
    if (n == 0) {
        return 1;
    }
    else if (n % 2 == 1) {
        return (fpow(a, n - 1) * a) % MOD;
    }
    else {
        return fpow((a * a) % MOD, n / 2);
    }
}

int rev(int n) {
    return fpow(n, MOD - 2);
}

int C(int n, int k) {
    int res = fact[n];
    res *= rev(fact[k]);
    res %= MOD;
    res *= rev(fact[n - k]);
    res %= MOD;
    return res;
}

signed main() {
    doRoutine();

    int n, a, b, k;
    cin >> n >> a >> b >> k;

    fact[0] = 1;
    for (int i = 1; i < MAXN; ++i) {
        fact[i] = (fact[i - 1] * i) % MOD;
    }

    int ans = 0;
    for (int i = 0; i <= n; ++i) {
        int rest = k - i * a;
        if (rest >= 0 && rest % b == 0) {
            int j = rest / b;
            if (j <= n) {
                ans += C(n, i) * C(n, j);
                ans %= MOD;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[20];
    cin>>s;
    int i,flag;
    i=flag=0;
    while(s[i]!='\0')
    {
        if(s[i]=='h'&&s[i+1]=='i')
        {
            flag=1;
            i=i+2;
        }
        else
        {
            flag=0;
            break;
        }
    }
    if(flag==1)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N;
    cin >> N;
    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            if(N == i*j){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b;
    int N;
    int M;
    int arr[N];
    cin >> N >> M;
    for (int i = 0; i < N; ++i) {
        arr[i] = 0;
    }

    for (int i = 0; i < M; ++i) {
        cin >> a >> b;

        arr[a - 1] += 1;
        arr[b - 1] += 1;
    }
    for (int i = 0; i < N; ++i) {
        cout << arr[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def kawaiso(a, b, c):
  if (a == b and b != c) or (b == c and c != a) or (c == a and a != b):
    return 'Yes'
  else:
    return 'No'

a, b, c = input().split()
a = int(a)
b = int(b)
c = int(c)

print(kawaiso(a, b, c))

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

using namespace std;
#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline LL read(){
	LL x=0,f=1; char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const LL MAXN = 150010;
const LL INF = 1000000000;
#define pii pair<LL,LL>
#define fr first
#define sc second
LL N; vector<pii > f[MAXN+1]; LL mn[MAXN<<1];
LL Node[MAXN<<1],Next[MAXN<<1],Root[MAXN+1],Cost[MAXN<<1],cnt;
inline void insert(LL u,LL v,LL w){ Node[++cnt]=v; Next[cnt]=Root[u]; Root[u]=cnt; Cost[cnt]=w; }
bool cmpx(pii a,pii b){ return a.fr<b.fr; }
bool cmpy(pii a,pii b){ return a.sc<b.sc; }
inline void merge(LL al,LL k,LL ls,LL rs){
	if(f[ls].size()>f[rs].size()) swap(ls,rs);
	LL szl=f[ls].size(),szr=f[rs].size();
	sort(f[ls].begin(),f[ls].end(),cmpy);
	sort(f[rs].begin(),f[rs].end(),cmpx);
	for(LL i=0;i<szr;i++){
		if(i) mn[i]=min(f[rs][i].sc,mn[i-1]);
		else mn[i]=f[rs][i].sc;
	} LL nw=szr-1;
	for(LL i=0;i<szl;i++){
		while(nw>=0&&f[rs][nw].fr+f[ls][i].sc>al) --nw;
		if(nw>=0) f[k].push_back(make_pair(f[ls][i].fr,mn[nw]));
	}
	sort(f[ls].begin(),f[ls].end(),cmpx);
	sort(f[rs].begin(),f[rs].end(),cmpy);
	for(LL i=0;i<szr;i++){
		if(i) mn[i]=min(f[rs][i].fr,mn[i-1]);
		else mn[i]=f[rs][i].fr;
	} nw=szr-1;
	for(LL i=0;i<szl;i++){
		while(nw>=0&&f[rs][nw].sc+f[ls][i].fr>al) --nw;
		if(nw>=0) f[k].push_back(make_pair(mn[nw],f[ls][i].sc));
	} return ;
}
LL ch[MAXN+1][2];
inline void dfs(LL al,LL k,LL Fa){
	LL c=0; for(LL x=Root[k];x;x=Next[x]){
		LL v=Node[x]; if(v==Fa) continue;
		dfs(al,v,k); ch[k][c++]=v;
		for(LL i=0;i<(LL) f[v].size();i++){
			f[v][i].fr+=Cost[x];
			f[v][i].sc+=Cost[x];
		}
	} f[k].clear();
	if(!c){	f[k].push_back(make_pair(0,0)); return ; }
	merge(al,k,ch[k][0],ch[k][1]); return ;
}

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read();
	for(LL i=2;i<=N;i++){
		LL u=read(),w=read();
		insert(i,u,w);
		insert(u,i,w);
	} LL ans=0;
	LL l=0,r=100000000000LL;
	while(l<=r){
		LL mid=(l+r)>>1; dfs(mid,1,0);
		if(f[1].size()) ans=mid,r=mid-1;
		else l=mid+1;
	} cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 38772
import itertools
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
judge = all([abs(i1 - i2) <= k for (i1, i2) in list(itertools.combinations([a,b,c,d,e],2))])
if judge:
    print('Yay!')
else:
    print(':(')

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;

namespace MySample
{
    class Program
    {
        static void Main(string[] args)
        {
            string x = Console.ReadLine();
            if(x == "ABC")
                Console.WriteLine("ARC");
            else
            {
                Console.WriteLine("ABC");
            }
        }
    }

}

Measured memory_bytes: 25880
s = input()
n = len(s)
s1 = '1'
s0 = '0'
for x in range(n-1):
    if s1[x] == '1':
        s1 = s1 + '0'
        s0 = s0 + '1'
    else:
        s1 = s1 +'1'
        s0 = s0 +'0'
s11  =0
s00 = 0
for a in range(n):
    if s1[a] != s[a]:
        s11 += 1
    else:
        s00 += 1
print(min(s11,s00))
    

Measured memory_bytes: 3316
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n,m=LI()
  if n*2>m:
    return m//2
  return n+(m-2*n)//4

print(main())


Measured memory_bytes: 5416
#include<cstdio>
#include<iostream>
#include<cmath>
#include<complex>
#include<string>
#include<map>
using namespace std;
typedef complex<double> xy_t;
double X1,Y1,X2,Y2,XQ,YQ;

int main(){

  while(~scanf("%lf,%lf,%lf,%lf,%lf,%lf",&X1,&Y1,&X2,&Y2,&XQ,&YQ)){
    xy_t P1(X1,Y1),P2(X2-X1,Y2-Y1),Q(XQ-X1,YQ-Y1);
    xy_t T=(((conj(P2)*Q).real())/norm(P2))*P2;
    xy_t R=T+(T-Q)+P1;
    printf("%.6f %.6f\n",real(R),imag(R));
  }

  return 0;

}

Measured memory_bytes: 1260
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }

using ll = long long;
const ll mod = LLONG_MAX;


int ans=4*1e18;
int n,K;
int x[51],y[51];
inline int calc(int minx,int maxx,int miny,int maxy){
  int cnt=0;
  rep(i,n){
    if(x[i]>=minx && x[i]<=maxx && y[i]>= miny && y[i]<=maxy)cnt++;
  }
  return cnt;
}
signed main(){
  cin>>n>>K;
  rep(i,n){
    cin>>x[i]>>y[i];
  }

  rep(i,n){
    rep(j,n){
      rep(k,n){
        rep(l,n){
          if(calc(x[i],x[j],y[k],y[l])>=K){
            ans=min(ans,abs((x[j]-x[i])*(y[l]-y[k])));
          }
        }
      }
    }
  }
  cout<<ans<<endl;



}


Measured memory_bytes: 256
import java.util.*;

class Main {

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

        String w = sc.nextLine();
        String[] weather = {"Sunny", "Cloudy", "Rainy"};

        for (int i = 0; i < 3; i++) {
            if (w.equals(weather[i]))
                System.out.println(weather[(i + 1) % 3]);
        }


    }
}




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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define itrdebug(x) cerr << #x << " "; for (auto & el : (x)) {cerr << (el) << " ";} cerr << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define debug(x)
#define itrdebug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long N, std::vector<long long> A, long long Q, std::vector<long long> B, std::vector<long long> C){
    vector<int> cnt(1e5+1);
    ll sum = 0;
    rep(i,0,N) {
        cnt[A[i]]++;
        sum += A[i];
    }
    rep(i,0,Q) {
        sum -= B[i] * cnt[B[i]];
        sum += C[i] * cnt[B[i]];
        cnt[C[i]] += cnt[B[i]];
        cnt[B[i]] = 0;
        cout << sum << endl;
    }
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    long long Q;
    scanf("%lld",&Q);
    std::vector<long long> B(Q);
    std::vector<long long> C(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&B[i]);
        scanf("%lld",&C[i]);
    }
    solve(N, std::move(A), Q, std::move(B), std::move(C));
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<double>A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  double iwa = 0, ans;
  for (int i = 0; i < N; i++) {
    iwa = iwa + 1 / A.at(i);
  }
  ans = 1 / iwa;
  cout << ans;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <queue>
#include <utility>
#include <vector>
using namespace std;

typedef pair<int, int> P;

#define MAX_N (100010)

int n;

vector<P> G[MAX_N];
bool arrived[MAX_N];

int main()
{
    scanf("%d", &n);

    for ( int i = 0; i < n - 1; i++ ) {
	int s, t, w;
	
	scanf("%d %d %d", &s, &t, &w);

	G[s].push_back( make_pair( t, w ) );
	G[t].push_back( make_pair( s, w ) );
    }

    // for ( int i = 0; i < n; i++ ) {
    // 	for ( int j = 0; j < G[i].size(); j++ ) {
    // 	    printf("%d to %d: %d\n", i, G[i][j].first, G[i][j].second);
    // 	}
    // }

    int u, v;
    queue<P> Q;
    int max_dist = -1;
    memset( arrived, false, n + 1 );
    arrived[0] = true;

    Q.push( make_pair( 0, 0 ) );

    while ( !Q.empty() ) {

	P p = Q.front(); Q.pop();
	int cur = p.first;
	int sum_dist = p.second;

	if ( max_dist < sum_dist ) {
	    max_dist = sum_dist;
	    u = cur;
	}


	for ( int i = 0; i < G[cur].size(); i++ ) {
	    int next = G[cur][i].first;
	    int dist = G[cur][i].second;


	    if ( !arrived[next] ) {
		arrived[next] = true;
		Q.push( make_pair( next, sum_dist + dist ) );
	    }
	}
    }

    memset( arrived, false, n + 1 );

    max_dist = -1;
    arrived[u] = true;
    Q.push( make_pair( u, 0 ) );

    while ( !Q.empty() ) {
	P p = Q.front(); Q.pop();
	int cur = p.first;
	int sum_dist = p.second;

	if ( max_dist < sum_dist ) {
	    max_dist = sum_dist;
	    v = cur;
	}

	for ( int i = 0; i < G[cur].size(); i++ ) {
	    int next = G[cur][i].first;
	    int dist = G[cur][i].second;
	    
	    if ( !arrived[next] ) {
		arrived[next] = true;
		Q.push( make_pair( next, sum_dist + dist ) );
	    }
	}
    }

    printf("%d\n", max_dist);

    return 0;
}

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

int main() {
  string S, T;
  cin >> S;
  cin >> T;
  int COUNT = 0;
  for(int a = 0; a < S.size(); a++) {
    if( S.at(a) == T.at(a) ) {
      COUNT++;
    }
  }
  if( COUNT == S.size() ){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3624
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int[] nums = new int[n];
		for(int i=0;i<n;i++) nums[i]=sc.nextInt();
		
		int count = 0;
		for(int i=1;i<n-1;i++) {
			if((nums[i-1]<nums[i] && nums[i]<=nums[i+1]) || (nums[i+1]<nums[i] && nums[i]<=nums[i-1])) count++;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 23124
#include <iostream>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb emplace_back
#define mp make_pair
#define MOD (int) 1e9+7
#define for0(i, n) for (int i = 0; i < n; i++)
#define ff first
#define ss second
#define endl "\n"
#define bits(n) __builtin_popcount(n)
#define ini(a, i) memset(a, i, sizeof(a))

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t;
	// cin >> t;
	t  = 1;
	while (t--)
	{
		ll n;
		cin >> n;
		ll arr[n];
		for (ll i = 0; i < n; i++) cin >> arr[i];
		sort(arr, arr + n);
		ll ans = arr[n - 1];
		ll j = n - 2;
		ll k = 2;
		while (k < n)
		{
			ans += arr[j];
			k++;
			if (k < n)
			{
				ans += arr[j];
			}
			j--;
			k++;
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 5216
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        
        Scanner sc = new Scanner(System.in);
        long total = sc.nextLong();
        long minimum = sc.nextLong();
        for(int i = 0; i < 4; i++){
            long pathNum = sc.nextLong();
            if(minimum > pathNum){
                minimum = pathNum;
            }
        }
        long result = total / minimum;
        result -= minimum == 1 ? 1 : 0;
        System.out.println(result + 5);
    }
}


Measured memory_bytes: 23252
def resolve():
    N, M = map(int,input().split())
    S = tuple(map(int, input().split()))
    g = sum(S) * (1/(4*M))

    count = 0
    ans = 'No'
    for s in S:
        if s >= g:
            count += 1

        if count == M:
            ans = 'Yes'
            break

    print(ans)

if __name__ == '__main__':
    resolve()


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

using namespace std;

string s;

int main(void) {

	cin >> s;

	int N = s.size();

	long long int ans = 0;

	int BC_comp = 0;

	s += "D";

	int num = 0;
	string save;

	for (int i = N - 1; i >= 0; i--) {

		if (BC_comp==1) {
			if (s[i] == 'A') { ans += num; }
			else if (s[i] == 'B') { BC_comp = -1; save = "B"; num = 0; }
			else { BC_comp = -1; save = "C"; }
		}
		else {
			if (s[i] == 'A') { BC_comp = -1; save = "A"; num = 0; }
			else if (s[i] == 'B') {
				if (save == "C") { save = "B"; BC_comp = 1; num++; }
				else { BC_comp = -1; save = "B"; num = 0; }
			}
			else if (s[i] == 'C') {
				BC_comp = -1; save = "C"; num = 0;
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
import collections


def solve():

    K = int(input())
    q = collections.deque()

    for i in range(1, 10):
        q.append(i)

    lunlun = 0

    for i in range(K):
        lunlun = q.popleft()
        if lunlun % 10 != 0:
            q.append(lunlun*10+lunlun % 10-1)
        q.append(lunlun*10+lunlun % 10)
        if lunlun % 10 != 9:
            q.append(lunlun*10+lunlun % 10+1)

    print(lunlun)


if __name__ == "__main__":
    solve()


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

#include <boost/range/adaptors.hpp>
#include <boost/range/combine.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t l, r, d;
    cin >> l >> r >> d;

    int64_t ans = 0;
    for (auto i : irange(l, r + 1)) {
        ans += (i % d == 0 ? 1 : 0);
    }

    cout << ans << endl;
}

Measured memory_bytes: 3628
N, M = map(int, input().split())
constraints = []
num = [0] * N
flag = 0

for i in range(M):
    constraints.append(list(map(int, input().split())))

for k in range(M):
    if constraints[k][0] == 1 and constraints[k][1] == 0 and N != 1:  # N=2,3で最上位が0のケースは即アウト
        flag += 1
        print(-1)
        break
    if num[constraints[k][0] - 1] == 0:  # 位sが空っぽの場合、cを入れる
        num[constraints[k][0] - 1] = constraints[k][1]
    else:
        if num[constraints[k][0] - 1] != constraints[k][1]:  # 位sの条件について矛盾し、アウト
            flag += 1
            print(-1)

if flag != 1:  # 上で矛盾が生じなかった場合
    if num[0] == 0 and N != 1:
        num[0] = 1
    num = [str(a) for a in num]
    ans = ''.join(num)
    print(ans)


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

int main() {
 int N,M; cin >> N >> M;
 if(M!=100){
   if(N==0) cout << M << endl;
   else if(N==1) cout << M*100 << endl;
   else if(N==2) cout << M*10000 << endl;
 }
 else {
   if(N==0) cout << 101 << endl;
   else if(N==1) cout << 10100 << endl;
   else if(N==2) cout << 1010000 << endl;
 }
   
   
  
  return 0;
}







Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm> /*sort()を使用するのに必要*/

using namespace std;

int main(){
    int N;
    vector<int> L;

    cin >> N;
    for(int i=0; i<N; i++){
        int t;
        cin >> t;
        L.push_back(t);
    }

    sort(L.begin(), L.end());
    
    long sum = 0;
    for(int i=0; i<N-2; i++){
        for(int j=i+1; j<N-1; j++){
            auto r = lower_bound(L.begin(), L.end(), L[j]+L[i]);
            int n = (r - L.begin()) - 1;
            sum += n - (j+1) + 1;
        }
    }

    cout << sum;

    return 0;

}

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

using namespace std;

int N;
int scores[105];
int alice;
int bob;
int flag = 0;
int finalAns;

int main()
{
	flag = 0;
	scanf("%d", &N);

	for(int i = 0; i < N; i++)
	{
		scanf("%d", &scores[i]);
	}

	sort(scores, scores + N);

	for(int i = N - 1; i >= 0; i--)
	{
		if(!flag)
		{
			alice += scores[i];
			flag = 1;
		}
		else
		{
			bob += scores[i];
			flag = 0;
		}
	}
	finalAns = abs(bob - alice);

	printf("%d\n", finalAns);


	return 0;
}
/*
	Powered by Buggy Plugin
*/


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

int main()
{
  long long ans=1e15;
  int n,k;
  cin>>n>>k;
  vector<int> v(n);
  for(int &i:v) cin>>i;
  for(int i=0;i+k-1<n;i++)
  {
  	//cout<<i<<"\n";
    long long a1,a2;
    a1 = abs(v[i])+abs(v[i+k-1]-v[i]);
    a2 = abs(v[i+k-1])+abs(v[i+k-1]-v[i]);
    ans = min(ans,min(a1,a2));
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 640
import re
N,A,B,C,D = (int(x) for x in input().split())
S = input()
if re.search(r'##',S[A-1:max(C,D)]):
    print('No')
else:
    if D < C:
        if re.search(r'\.\.\.',S[B-2:D+1]):
            print('Yes')
        else:
            print('No')
    else:
        print('Yes')

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll A, B;
    cin >> A;
    string S;
    cin >> S;
    B = 0;
    B += (S[0] - '0') * 100;
    B += (S[2] - '0') * 10;
    B += (S[3] - '0');

    ll ans = A * B;
    cout << ans / 100 << "\n";
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep0(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<string, int, int> TU;
typedef tuple<int, int, int> TI;

int main()
{
    string s;
    cin >> s;
    int dp[3] = {};
    rep0(i,3){
        if(s[i]=='a'){
            dp[0]++;
        }else if (s[i]=='b')
        {
            dp[1]++;            
        }else{
            dp[2]++;
        }
        
    }
    rep0(i,3){
        if(dp[i]!=1){
            cout << "No" << endl;
            return 0 ;
        }
    }
    cout << "Yes" << endl;
}


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

#define PI 3.14159265358979323846264338327950288419

using namespace std;

int n;
int x[105], y[105];

double angs[105];
int p;

double find_angle(double dx, double dy){
	// [0, 2 * pi)
	if(dx > 0 && dy >= 0){
		return atan(dy / dx);
	}else if(dx <= 0 && dy > 0){
		return PI / 2 + atan(-dx / dy);
	}else if(dx < 0 && dy <= 0){
		return PI + atan(dy / dx);
	}else{
		return 3 * PI / 2 + atan(-dx / dy);
	}
}

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		scanf("%d %d", &x[i], &y[i]);
	}
	for(int i = 1; i <= n; i++){
		p = 0;
		for(int j = 1; j <= n; j++){
			if(i != j){
				angs[++p] = find_angle(x[j] - x[i], y[j] - y[i]);
			}
		}
		sort(angs + 1, angs + p + 1);
		double gap = 0;
		if(angs[p] - angs[1] < PI){
			gap = PI - (angs[p] - angs[1]);
		}else{
			for(int i = 2; i <= p; i++){
				if(angs[i] - angs[i - 1] > PI){
					gap = angs[i] - angs[i - 1] - PI;
					break;
				}
			}
		}
		printf("%.10lf\n", gap / (2 * PI));
	}
	return 0;
}

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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  // 正しい順番の時と、偶奇が一致していない奴を数えれば良い

  int N;
  cin >> N;
  vector<ll> v(N);
  map<ll,int> m;
  for(int i = 0; i < N; i++){
    ll tmp;
    cin >> tmp;
    v.at(i) = tmp;
    m[tmp] = i;
  }

  sort(v.begin(), v.end());
  int ans = 0;
  for(int i = 0; i < N; i+=2){
    if(i%2 != m[v[i]]%2) ans++;
  }
  cout << ans << endl;


}


Measured memory_bytes: 7296
using namespace std;
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>

typedef vector<int> VI;
typedef pair<int, int> PII;

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

int n, m, total;
VI v;

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

		v = VI(n);
		REP(i, n)
		{
			cin >> v[i];
		}
		
		sort(v.rbegin(), v.rend());
		total = 0;
		REP(i, n)
		{
			if(i%m!=m-1)
				total += v[i];
		}
		printf("%d\n", total);
	}
}

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

const double PI=3.141592653589793;
const ll MX = 1e18;


int main()
{
  int N;
  cin>>N;
  ll cnt = 1;
  bool ng = false;
  rep(i, N)
  {
    ll A;
    cin >> A;
    if(A==0){
      cout << "0" << endl;
      return 0;
    }
    if(ng || MX/cnt<A)
      ng = true;
    cnt *= A;
  }

  if (ng)
    cout << "-1" << endl;
  else
    cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 3584
#include <stdio.h>

typedef struct _tree_t {
	int p, l, r;
} tree_t;

void print_preorder(int depth, tree_t tree[], int id, int n) {
	printf(" %d", id);
	if(tree[id].l != -1) print_preorder(depth+1, tree, tree[id].l, n);
	if(tree[id].r != -1) print_preorder(depth+1, tree, tree[id].r, n);
}

void print_inorder(int depth, tree_t tree[], int id, int n) {
	if(tree[id].r == -1 && tree[id].l == -1) {
		printf(" %d", id);
	} else if(tree[id].r == -1) {
		print_inorder(depth+1, tree, tree[id].l, n);
		printf(" %d", id);
	} else if(tree[id].l == -1) {
		printf(" %d", id);
		print_inorder(depth+1, tree, tree[id].r, n);
	} else {
		print_inorder(depth+1, tree, tree[id].l, n);
		printf(" %d", id);
		print_inorder(depth+1, tree, tree[id].r, n);
	}
}

void print_postorder(int depth, tree_t tree[], int id, int n) {
	if(tree[id].r == -1 && tree[id].l == -1) {
		printf(" %d", id);
	} else if(tree[id].r == -1) {
		print_postorder(depth+1, tree, tree[id].l, n);
		printf(" %d", id);
	} else if(tree[id].l == -1) {
		print_postorder(depth+1, tree, tree[id].r, n);
		printf(" %d", id);
	} else {
		print_postorder(depth+1, tree, tree[id].l, n);
		print_postorder(depth+1, tree, tree[id].r, n);
		printf(" %d", id);
	}
}

int main(void) {
	tree_t tree[30];
	int i, n;
	int id, r, l, root;
	
	scanf("%d\n", &n);
	for(i=0;i<n;i++) {
		tree[i].p = -1;
		tree[i].r = -1;
		tree[i].l = -1;
	}
	
	for(i=0;i<n;i++) {
		scanf("%d %d %d\n", &id, &l, &r);
		tree[id].r = r;
		tree[id].l = l;
		if(r != -1) tree[r].p = id;
		if(l != -1) tree[l].p = id;
	}

	for(i=0;i<n;i++) {
		if(tree[i].p == -1) {
			root = i;
			break;
		}
	}

	printf("Preorder\n");
	print_preorder(0, tree, root, n);
	printf("\n");

	printf("Inorder\n");
	print_inorder(0, tree, root, n);
	printf("\n");

	printf("Postorder\n");
	print_postorder(0, tree, root, n);
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 620
N = int(input())
C = []
S = []
F = []
for i in range(N-1):
    c,s,f = map(int, input().split())
    C.append(c)
    S.append(s)
    F.append(f)
for i in range(N-1):
    now = S[i]
    for j in range(i,N-1):
        if now < S[j]:
            now = S[j]
        elif now % F[j] != 0:
            now += F[j] - (now % F[j])
        else:
            pass
        now += C[j]
    print(now)
print(0)


Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int count = 0;
        for(int i = a; i <= b; i++){
            if(c % i == 0){
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 26268
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

struct RollingHash {
  static constexpr size_t n = 2;
  const vl base = {1'007, 2'009};
  const vl mod = {1'000'000'007, 1'000'000'009};

  string s;
  size_t length;
  vector<vl> power, hashed;

  RollingHash(const string& s) : s(s), length(s.size()), power(n, vl(length+1, 1LL)), hashed(n, vl(length+1, 0LL)) {
    for (size_t i = 0; i < n; i++) {
      power[i][0] = 1;
      for (size_t j = 0; j < length; j++) {
        hashed[i][j+1] = (s[j] + hashed[i][j] * base[i]) % mod[i];
        power[i][j+1] = (power[i][j] * base[i]) % mod[i];
      }
    }
  }

  vl get(size_t l, size_t r) const {
    vl res(n);
    for (size_t i = 0; i < n; i++) {
      res[i] = (hashed[i][r] - hashed[i][l]*power[i][r-l]%mod[i]);
      if (res[i] < 0) res[i] += mod[i];
      res[i] %= mod[i];
    }
    return res;
  }

  bool same(vl l, vl r) const {
    for (size_t i = 0; i < n; i++) {
      if (l[i] != r[i]) return false;
    }
    return true;
  }

  size_t get_lcp(size_t i, size_t j) const {
    size_t l = 0, r = min(length-i, length-j)+1;
    while (l+1 < r) {
      size_t m = (l+r)/2;
      if (same(get(i, i+m), get(j, j+m))) l = m;
      else r = m;
    }
    return l;
  }
};

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

  string t, p;
  cin >> t >> p;
  ll n = t.size();
  ll m = p.size();

  RollingHash rt(t);
  RollingHash rp(p);
  rep(i, n-m+1) {
    if (rt.same(rt.get(i, i+m), rp.get(0, m))) {
      cout << i << "\n";
    }
  }
  cout << flush;
}



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

using namespace std;

int main() {

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

    priority_queue<int> da, db,dc;

    for (int i = 0; i < a; ++i) {
        int x;
        cin >> x;
        da.push(-x);
    }

    for (int i = 0; i < b; ++i) {
        int x;
        cin >> x;
        db.push(-x);
    }

    for (int i = 0; i < c; ++i) {
        int x;
        cin >> x;
        dc.push(-x);
    }

    while((int)da.size() > l) da.pop();
    while((int)db.size() > r) db.pop();

    while(!dc.empty()) {
        if(-dc.top() <= -db.top() and -dc.top() <= -da.top()) {
            dc.pop();
            continue;
        }

        if(-dc.top() > -db.top() and -dc.top() > -da.top()) {
            if(-db.top() < -da.top()) {
                db.pop();
                db.push(dc.top());
                dc.pop();
            } else {
                da.pop();
                da.push(dc.top());
                dc.pop();
            }
            continue;
        }

        if(-dc.top() > -db.top()) {
            db.pop();
            db.push(dc.top());
            dc.pop();
            continue;
        }

        if(-dc.top() > -da.top()) {
            da.pop();
            da.push(dc.top());
            dc.pop();
        }
    }

    long long ans = 0;

    while(!da.empty()) {
        ans += -da.top();
        da.pop();
    }

    while(!db.empty()) {
        ans += -db.top();
        db.pop();
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 1784
x = int(input())
if x >= 1800:
  print(1)
elif x >= 1600 and x <=1799:
  print(2)
elif x >= 1400 and x <=1599:
  print(3)
elif x >= 1200 and x <=1399:
  print(4)
elif x >= 1000 and x <=1199:
  print(5)
elif x >= 800 and x <=999:
  print(6)
elif x >= 600 and x <=799:
  print(7)
else:
  print(8)

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

int main() {
  string x;
  int ans=7;
  cin>>x;
  if(x=="MON")ans=6;
  if(x=="TUE")ans=5;
  if(x=="WED")ans=4;
  if(x=="THU")ans=3;
  if(x=="FRI")ans=2;
  if(x=="SAT")ans=1;
  cout << ans<< endl;
}


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

int main() {
  int abc[3],ans;
  for(int i=0;i<3;i++){
       cin>>abc[i];
   }
   sort(abc,abc+3);
   ans=abc[2]-abc[1];
   abc[0]=abc[0]+ans;
   if((abc[2]-abc[0])%2==0)
     ans+=(abc[2]-abc[0])/2;
   else
     ans+=(abc[2]-abc[0]+1)/2+1;
   cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){

	int W,H,x,y,r;
	cin>>W>>H>>x>>y>>r;
	if((x-r>=0&&x+r<=W)&&y-r>=0&&y+r<=H){
		cout<<"Yes"<<endl;
	}
	else if((x-r<0||x+r>W)||y-r<0||y+r>H){
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include <stdio.h>
#include <stdlib.h>
 
int main()
{
    int a, b, c;
    int d;
    int n;
 
    scanf("%d%d%d", &a, &b, &c);
    n = 0;
    for (d = a; d <= b; d++) {
        if (c % d == 0) n++;
    }
    printf("%d\n", n);
    return 0;
}


Measured memory_bytes: 1968
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll n; cin >> n;
    ll cnt = 0;
    rep(i, n){
        ll tmp; cin >> tmp;
        if(tmp%2 == 1) cnt++;
    }
    (cnt%2 == 0) ? YES() : NO();
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

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

    ll n = X.size();
    bool flagS = false, flagT = false;
    ll countS = 0, countT = 0;
    ll sumDelete = 0;
    REP(i, n)
    {
        if (X[i] == 'S')
        {
            if (flagS)
            {
                countS++;
            }
            else
            {
                flagS = true;
                if (flagT)
                {
                    flagT = false;
                    sumDelete += 2 * min(countS, countT);
                }
                countS = max(1ll, countS - countT + 1);
                countT = 0;
            }
        }
        else if (X[i] == 'T')
        {
            if (flagT)
            {
                countT++;
            }
            else
            {
                flagT = true;
                flagS = false;
                countT = 1;
            }
        }
    }
    sumDelete += 2 * min(countS, countT);

    ll ans = n - sumDelete;
    cout << ans << endl;
}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12

int main(void) {
  bool first = true;
  while (true) {
    int n, c[4], d[4], minret = INF, ret = 0, f[4] = {0};
    cin >> n;
    if (!n)
      break;
    else {
      if (first)
        first = false;
      else
        cout << endl;
    }
    cin >> c[0] >> c[1] >> c[2] >> c[3];
    int e = c[0] * 10 + c[1] * 50 + c[2] * 100 + c[3] * 500 - n;
    if (e > 0) {
      // cout << e << " ";
      while (e >= 500) {
        f[3]++;
        e -= 500;
      }
      while (e >= 100) {
        f[2]++;
        e -= 100;
      }
      while (e >= 50) {
        f[1]++;
        e -= 50;
      }
      while (e >= 10) {
        f[0]++;
        e -= 10;
      }
      // cout << i << " " << j << " " << k << " " << l << " " << ret << endl;
    }

    // cout << f[0] << " " << f[1] << " " << f[2] << " " << f[3] << endl;
    if (c[0] - f[0] > 0) {
      cout << "10 " << c[0] - f[0] << endl;
    }
    if (c[1] - f[1] > 0) {
      cout << "50 " << c[1] - f[1] << endl;
    }
    if (c[2] - f[2] > 0) {
      cout << "100 " << c[2] - f[2] << endl;
    }
    if (c[3] - f[3] > 0) {
      cout << "500 " << c[3] - f[3] << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 2948
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string a;
    cin>>a;
    int b=0;
    for(int i=0;i<3;i++){
        if(a.at(i)=='7'){
            b++;
        }
    }
    if(b>=1){
        cout<<"Yes"<<endl;

    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3624
import java.util.Scanner

import scala.io.StdIn._
object Main extends App {

  val n = scala.io.StdIn.readInt()

  def solve() = {
    n % 10 match {
      case 3 => "bon"
      case 0 | 1 | 6 | 8 => "pon"
      case _ => "hon"
    }
  }

  println(solve())

}



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

const int MAX = 310000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    COMinit();
    ll answer = 1;//kが2以上より移動が全くないケースを常に含むため1を追加(k=1の場合は存在しないため場合分けで0にしないといけない)
    ll maxZeroNum = min(n - 1, k);
    for(int i = 1; i <= maxZeroNum; i++)
    {
        answer = (answer + COM(n, i) * COM(n - 1, i)) % MOD;
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 7552
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;

int m, k;

int main() {
    cin >> m >> k;
    if (m == 1) {
        if (k == 0) cout << "0 0 1 1" << endl;
        else cout << -1 << endl;
        return 0;
    }
    if (k >= (1<<m)) {
        cout << -1 << endl;
        return 0;
    }
    cout << k;
    rep(i,(1<<m)) {
        if (i == k) continue;
        cout << " " << i;
    }
    cout << " " << k;
    for (int i = (1<<m)-1; i >= 0; i--) {
        if (i == k) continue;
        cout << " " << i;
    }
    cout << endl;

}


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

#define foreach(i,v) for(auto&& i: v)
#define all(x) (x).begin(), (x).end()

typedef std::vector< std::string > VS;
typedef std::vector<int> VI;
typedef long long ll;

template <class C> C& mini(C& a, C b) { if (b < a) a = b; return a; }
template <class C> C& maxi(C& a, C b) { if (a < b) a = b; return a; }

using namespace std;

template <typename T> void read(T& x) { x.read(); }
template <typename T> void read(vector<T>& v) { for (T& x: v) read(x); }
template <typename X, typename Y> void read(pair<X, Y>& p) { read(p.first); read(p.second); }
template <> void read(int& x) { scanf("%d", &x); }
template <> void read(unsigned int& x) { scanf("%u", &x); }
template <> void read(long long& x) { scanf("%lld", &x); }
template <> void read(unsigned long long& x) { scanf("%llu", &x); }
template <typename T> void readv(vector<T>& v) { int N; read(N); v.resize(N); read(v); }
template <typename T, typename ...Ts> void read(T& x, Ts&... args) { read(x); read(args...); }

static char can[100301];

int main(int argc, const char* argv[]) {
    int X;
    read(X);
    can[0] = 1;
    for (int i = 0; i <= X; i++)
        if (can[i])
            for (int j = 100; j < 106; j++)
                can[i+j] = 1;
    printf(can[X] ? "1\n" : "0\n");
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin >> s >> t;
  int len = s.size();
  int res = 0;
  for(int i=0;i<len;i++){
    if(s.at(i)!=t.at(i)){
      res++;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3852
#include <bits/stdc++.h>
using namespace std;
int64_t N, K, p, c;
vector<int64_t> to(5005), C(5005);

int64_t solve(int start)
{
  vector<bool> visited(N, false);
  int64_t k = K, score = 0, moves = 0, ret = -(1LL << 62), next = to[start];
  while (!visited[next])
  {
    visited[next] = true;
    moves++;
    score += C.at(next);
    ret = max(ret, score);
    if (moves == K)
    {
      return ret;
    }
    next = to[next];
  }
  if (score <= 0)
  {
    return ret;
  }
  if (k % moves == 0)
  {
    return score * (k / moves - 1) + ret;
  }
  ret = score = score * (k / moves), k %= moves;

  while (k > 0)
  {
    k--;
    score += C.at(next);
    ret = max(ret, score);
    next = to[next];
  }
  return ret;
}

int main()
{
  cin >> N >> K;
  for (int i = 0; i < N; i++)
  {
    cin >> to[i];
    to[i]--;
  }
  for (int i = 0; i < N; i++)
  {
    cin >> C.at(i);
  }
  int64_t ans = -(1LL << 62);
  for (int i = 0; i < N; i++)
  {
    ans = max(ans, solve(i));
  }
  cout << ans << endl;
}


Measured memory_bytes: 3708
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define ll long long

int compare(const void *a, const void *b)
{
  return strcmp((char *)a, (char *)b);
}

int main(void)
{
  int n, i, count = 1;
  char s[11];
  char S[200002][11];
  scanf("%d", &n);
  for (i = 0; i < n; i++)
  {
    scanf("%s", S[i]);
  }
  qsort(S, n, 11, compare);
  for (i = 0; i < n - 1; i++)
  {
    if (!(strcmp(S[i], S[i + 1]) == 0))
    {
      count++;
    }
  } /*
    int *result = (int *)bsearch(s, S, count, 11, compare);
    if (result == NULL)
    {
      strcpy(S[count], s);
      count++;
      qsort(S, count, 11, compare);
    }
  }*/
  printf("%d\n", count);
  return 0;
}

Measured memory_bytes: 5716
#include "bits/stdc++.h"
using namespace std;
#define LL long long

void solve() {
   LL a,b,c;
   cin>>a>>b>>c;
   int Ans  = 0, j = 1;
   for(int i = c;i<=b;i=c*j){
   	  if(i>=a and i<=b) Ans++;
   	  j++;
   }
   cout<<Ans<<"\n";
}

int main()
{
	//freopen("in.txt","r",stdin);
   // int tc;cin>>tc;
   // while(tc--){
    	solve();
//	}
    return 0;
}

Measured memory_bytes: 3568
#include<cstdio>
long long gcd(long long a,long long b){
	if(a<b)return gcd(b,a);
	else if(a%b==0)return b;
	else return gcd(b,a%b);
}
inline long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}
int main(){
    int n;
    long long t,ti;
    scanf("%d%lld",&n,&t);
    for(int i=1;i<n;i++){
        scanf("%lld",&ti);
        t=lcm(t,ti);
    }
    printf("%lld",t);
    return 0;
}

Measured memory_bytes: 128
// AtCoder Beginner Contest 149 D.cpp

#include <iostream>
#include <string>

using namespace std;

int main()
{
	int n,//じゃんけんの回数
		k,//k回目前と同じものは出せない
		rr,//グーに対して勝った時→パーで勝った時_6
		ss,//チョキに対して勝った時→グーで勝った時_8
		pp,//パーに対して勝った時→チョキで勝った時_7
		len,//sysの長さ
		an = 0;//答え
	string sys;

	cin >> n >> k >> ss >> pp >> rr >> sys;
	len = sys.length();

	for (int i = 0; i < len; i++){
		if (i >= k && sys[i] == sys[i - k]) {
			sys[i] = '!';
		}
		if (sys[i] == 'r') {
			an += rr;
		}
		if (sys[i] == 's') {
			an += ss;
		}
		if (sys[i] == 'p') {
			an += pp;
		}

	}
	cout << an << endl;
}

Measured memory_bytes: 512
int main() {

	char x[1000];
	int sum ,i;

	while (1) {
		scanf("%s", x);
		if (x[0] == '0') break;
		sum = 0;

		for (i = 0; i < strlen(x); i++) {
			sum += x[i] - 48;
		}
		printf("%d\n", sum);
		
	}
	
	return 0;

}


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

using namespace std;

template<typename T> class Arithmetic {
public:
  T operator+(const T& v) const {
    T res(static_cast<const T&>(*this));
    res += v;
    return res;
  }
  
  T operator-(const T& v) const {
    T res(static_cast<const T&>(*this));
    res -= v;
    return res;
  }
  
  T operator*(const T& v) const {
    T res(static_cast<const T&>(*this));
    res *= v;
    return res;
  }
  
  T operator/(const T& v) const {
    T res(static_cast<const T&>(*this));
    res /= v;
    return res;
  }
};

class Inverse {
private:
  long long mod;
	vector<long long> inv;
  
public:
  Inverse() {}
  
	Inverse(long long mod, long long n = 1000000) : mod(mod) {
    inv = vector<long long>(n, 1);
    for (int i = 2; i < n; ++i) inv[i] = inv[mod % i] * (mod - mod / i) % mod;
  }
  
	long long operator()(long long a) const {
		if (a < (int)inv.size()) return inv[a];
		long long b = mod, x = 1, y = 0;
		while (b) {
			long long t = a / b;
			swap(a -= t * b, b);
			swap(x -= t * y, y);
		}
		return (x %= mod) < 0 ? x + mod : x;
	}
};

class Mint : public Arithmetic<Mint> {
private:
  static long long mod;
  static Inverse inverse;
  long long val;
	
public:
	Mint() {}

	Mint(const long long& val) {
    this->val = val % mod;
    if (this->val < 0) this->val += mod;
  }

  static void setMod(const long long& m) {
    mod = m;
    inverse = Inverse(m);
  }
	
	Mint operator+=(const Mint& m) {
		val += m.val;
		if (val >= mod) val -= mod;
		return *this;
	}
  
	Mint operator-=(const Mint& m) {
		val -= m.val;
		if (val < 0) val += mod;
		return *this;
	}
  
	Mint operator*=(const Mint& m) {
		val *= m.val;
		val %= mod;
		return *this;
	}
  
	Mint operator/=(const Mint& m) {
		val *= inverse(m.val);
		val %= mod;
		return *this;
	}
	
	Mint operator++() {return val += 1;}
	
	operator long long() {
		return val;
	}

  Mint identity() const {
    return 1;
  }
};

long long Mint::mod = 1000000007;
Inverse Mint::inverse(1000000007);

ostream& operator<<(ostream& os, Mint a) {
	os << (long long)a;
	return os;
}

istream& operator>>(istream& is, Mint& a) {
	long long n;
	is >> n;
	a = n;
	return is;
}

template<typename T> T pow(T& m, long long n) {
  if (n == 0) {
    return m.identity();
  } else if (n < 0) {
    return m.identity() / pow(m, -n);
  }
  T mm = pow(m, n / 2);
  mm *= mm;
  if (n % 2) mm *= m;
  return mm;
}

int main() {
  Mint m;
  int n;
  cin >> m >> n;
  cout << pow(m, n) << endl;
}

Measured memory_bytes: 8980
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define gcd __gcd
#define all(x) (x).begin(), (x).end()
template<class T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<class T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
const int INF = 1e18, MOD = 1e9 + 7;
map<int, int> factorization(int n) {
    map<int, int> res;
    rep(i, 2, sqrt(n) + 1) {
        if(i > 3) i++;
        while(!(n%i)) res[i]++, n /= i;
    }
    if(n > 1) res[n]++;
    return res;
}
signed main() {
    INCANT;
    int a, b;
    cin>>a>>b;
    auto m = factorization(gcd(a, b));
    vector<int> v;
    each(p, m) {
        cerr<<p.first<<endl;
        bool flag = false;
        each(i, v) {
            if(gcd(p.first, i) != 1) {
                flag = true;
            }
        }
        if(!flag) v.push_back(p.first);
    }
    cout<<v.size() + 1<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if (a == b && b != c || b == c && c != a || c == a && a != b) {
            System.out.println("Yes");
            return;
        }
        System.out.println("No");
    }

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(ll i=0;i<N;i++)
typedef long long ll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int>p(n);
    for(int i=0;i<n;i++){
        cin>>p[i];
    }
    int count=0;
    for(int i=0;i<n-2;i++){
        int M=max({p[i],p[i+1],p[i+2]});
        int m=min({p[i],p[i+1],p[i+2]});
        if(m<p[i+1]&&p[i+1]<M){count++;}
    }
    cout<<count<<endl;
}

Measured memory_bytes: 256