akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef struct node
{
	int x,y,colour;
}POINT,*PPOINT;
POINT arr[200];
bool cmpwithx(const POINT & a,const POINT & b)
{
	return a.x<b.x;
}
bool cmpwithy(const POINT & a,const POINT & b)
{
	return a.y<b.y;
}
vector<POINT> vec;
int main()
{
	int n,i,ans=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %d",&arr[i].x,&arr[i].y);
		arr[i].colour=0;
	}
	for(i=n;i<n*2;i++)
	{
		scanf("%d %d",&arr[i].x,&arr[i].y);
		arr[i].colour=1;
	}
	sort(arr,arr+2*n,cmpwithx);
	for(i=0;i<n*2;i++)
	{
		if(arr[i].colour==0)
		{
			vec.insert(lower_bound(vec.begin(),vec.end(),arr[i],cmpwithy),arr[i]);
		}
		else
		{
			if(vec.empty())
				continue;
			vector<POINT>::iterator it;
			it= lower_bound(vec.begin(),vec.end(),arr[i],cmpwithy);
			if(it!=vec.begin())
			{
				ans++;
				vec.erase(--it);
			}
		}
	}
	printf("%d",ans);
	return 0;
}

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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = input[0];
            var M = input[1];
            var X = input[2];

            var CA = new int[N][];
            for (int i = 0; i < N; i++)
            {
                CA[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            }

            var ans = Min(0, CA, new int[M + 1], a => a.Skip(1).All(s => s >= X));

            Console.WriteLine(ans == int.MaxValue ? -1 : ans);
        }

        static int Min(int n, int[][] CA, int[] ans, Func<int[], bool> judge)
        {
            if (n == CA.Length)
            {
                return judge(ans) ? ans[0] : int.MaxValue;
            }

            return Math.Min(Min(n + 1, CA, Plus(CA[n], ans), judge), Min(n + 1, CA, ans, judge));
        }

        static int[] Plus(int[] a1, int[] a2)
        {
            return a1.Zip(a2, (s, t) => s + t).ToArray();
        }
    }
}


Measured memory_bytes: 30124
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n-1);0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define DUMP(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<": "<<(x)<< " (L"<<__LINE__<<")"<<endl;
using namespace std;
using vint = vector<int>;
using vdouble = vector<double>;
using vstring = vector<string>;
using ll = long long;

int main() {
    int maxi = -1;
    int n; cin >> n;
    vint a(n);
    rep(i, n) {
        cin >> a[i];
        maxi = max(maxi, a[i]);
    }
    maxi++;
    vint cnt(maxi, 0);
    rep(i, n) {
        cnt[a[i]]++;
    }
    int cnt1 = 0;
    int cnt2 = 0;
    FOR(i, 1, maxi) {
        if(cnt[i] == 0) continue;
        cnt1++;
        if(cnt[i] % 2 == 0) cnt2++;
    }
    if(cnt2 % 2 == 1) cnt1--;
    cout << cnt1 << endl;
    return 0;
}


Measured memory_bytes: 1152
// Problem : B - Robot Arms
// Contest : AtCoder - Keyence Programming Contest 2020
// URL : https://atcoder.jp/contests/keyence2020/tasks/keyence2020_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 100005

//Solution

void solve(){
    int n;
    cin>>n;
    vi x(n),l(n);
    vii p(n);
    for(int i=0;i<n;i++) cin>>x[i]>>l[i];
    for(int i=0;i<n;i++) p[i] = {x[i]+l[i],x[i]-l[i]};
    sort(all(p));
    int cur = -inf;
    int ans = 0;
    for(int i=0;i<n;i++){
        if(cur <= p[i].se){
            ans++;
            cur = p[i].fi;
        }
    }
    cout<<ans<<endl;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 6356
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] head = br.readLine().split(" ");
    int r = Integer.parseInt(head[0]);
    int c = Integer.parseInt(head[1]);
    int k = Integer.parseInt(head[2]);
    long[][] item_map = new long[r + 1][c + 1];
    for(int i = 0; i < k; i++){
      String[] data = br.readLine().split(" ");
      int ri = Integer.parseInt(data[0]);
      int ci = Integer.parseInt(data[1]);
      long vi = Long.parseLong(data[2]);
      item_map[ri][ci] = vi;
    }
    br.close();

    long[][][] dp = new long[r + 1][c + 1][4];
    for(int r_pos = 1; r_pos <= r; r_pos++){
      for(int c_pos = 1; c_pos <= c; c_pos++){
        //同一行0個の最大値
        dp[r_pos][c_pos][0] = dp[r_pos][c_pos - 1][0];
        dp[r_pos][c_pos][0] = Math.max(dp[r_pos][c_pos][0], dp[r_pos - 1][c_pos][0]);
        dp[r_pos][c_pos][0] = Math.max(dp[r_pos][c_pos][0], dp[r_pos - 1][c_pos][1]);
        dp[r_pos][c_pos][0] = Math.max(dp[r_pos][c_pos][0], dp[r_pos - 1][c_pos][2]);
        dp[r_pos][c_pos][0] = Math.max(dp[r_pos][c_pos][0], dp[r_pos - 1][c_pos][3]);

        //同一行1個の最大値
        dp[r_pos][c_pos][1] = dp[r_pos][c_pos - 1][1];
        dp[r_pos][c_pos][1] = Math.max(dp[r_pos][c_pos][1], dp[r_pos][c_pos][0] + item_map[r_pos][c_pos]);

        //同一行2個の最大値
        dp[r_pos][c_pos][2] = dp[r_pos][c_pos - 1][2];
        dp[r_pos][c_pos][2] = Math.max(dp[r_pos][c_pos][2], dp[r_pos][c_pos - 1][1] + item_map[r_pos][c_pos]);

        //同一行3個の最大値
        dp[r_pos][c_pos][3] = dp[r_pos][c_pos - 1][3];
        dp[r_pos][c_pos][3] = Math.max(dp[r_pos][c_pos][3], dp[r_pos][c_pos - 1][2] + item_map[r_pos][c_pos]);
      }
    }

    long ans = 0;
    for(int i = 0; i < 4; i++){
      ans = Math.max(ans, dp[r][c][i]);
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 735828
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
int a,b,c,d;
int num[4];
char hoge[2] = {'+','-'};
int calc(int i,int j,int k){
    int p[3] = {i,j,k};
    int res = a;
    
    rep(x,3){
        if(p[x] == 0){
            res += num[x+1];


        }
        else {
            res -= num[x+1];

        }
        
    }
    return res;
}
signed main(){
    string s;cin >> s;
    
    a = s[0] - '0';
    b = s[1] - '0';
    c = s[2] - '0';
    d = s[3] - '0';
    num[0] = a;
    num[1] = b;
    num[2] = c;
    num[3] = d;
    rep(i,2)rep(j,2)rep(k,2){
        
        if(calc(i,j,k) == 7){
            cout << a << hoge[i] << b << hoge[j] << c << hoge[k] << d << "=7" << endl;
            return 0;

        }
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            string[] strs = line.Split(' ');
            int A = int.Parse(strs[0]);
            int B = int.Parse(strs[1]);
            int H = int.Parse(strs[2]);
            int M = int.Parse(strs[3]);
            // 三角関数必要あり
 
            double 時針角度 = (H * 60 + M) / 2.0;
            double 分針角度 = M * 6;
            double 角度 = Math.Abs(時針角度 - 分針角度);
            if (角度 > 180.0) 角度 = 360 - 角度;
            double 長さ = Math.Sqrt(A*A+B * B - 2 * A * B * Math.Cos(角度 * Math.PI / 180.0));
 
            Console.WriteLine(長さ);
        }
    }
}

Measured memory_bytes: 27936
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1000000000000000000

using namespace std;

int main(void){
  ll n, x;
  cin >> n >> x;
  
  vector<ll> a(n);
  for (int i = 0; i < n; i++){
    cin >> a[i];
  }
  ll ans = 0;
  for (int i = 0; i < n-1; i++){
    if (a[i] + a[i+1] > x){
      if (a[i] > x){
        ans += a[i]-x;
        ans += a[i+1];
        a[i] = x;
        a[i+1] = 0;
      }
      else {
        ans += a[i+1] + a[i] - x;
        a[i+1] = x-a[i];
      }
    }
  }
  cout << ans << endl;
  
  

  return 0;
}


Measured memory_bytes: 4032
//
//  main.cpp
//  Study
//
//  Created by 佐々木勇星 on 2020/03/12.
//  Copyright © 2020 佐々木勇星. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <algorithm>

using namespace std;

long long cutting (long long n)
{
    if(n == 1) return 1;
    else return 2 * cutting((n / 2)) + 1;
}


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

    long long h, ans = 0, cut = 0;
    
    cin >> h;
//
//    while(1)
//    {
//        if (h == 1) break;
//
//        h = h / 2;
//        cut++;
//
//    }
//
//    for(long long i=cut; i>=0; i--)
//    {
//        ans += pow(2, i);
//    }
    
    ans = cutting(h);
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
/* C program for Merge Sort */
#include<bits/stdc++.h>
using namespace std;
int dp[100001][4];
int a[100001],b[100001],c[100001];
int n;
long long int mod=1000000007;
int max_q(int i, int flag){
    //cout<<"Function enters"<<endl;
    if(i>=n){
        return 0;
    }
    int m=INT_MAX;
    if( dp[i][flag]!=-1){
        return dp[i][flag];
    } 
    if(flag==0){
        m=max(a[i]+max_q(i+1,1),b[i]+max_q(i+1,2));
        m=max(m,c[i]+max_q(i+1,3));
        dp[i][flag]=m;
    }
    if(flag==1){
        m=max(b[i]+max_q(i+1,2),c[i]+max_q(i+1,3));
        dp[i][flag]=m;
    }
    if(flag==2){
        m=max(a[i]+max_q(i+1,1),c[i]+max_q(i+1,3));
        dp[i][flag]=m;
    }
    if(flag==3){
        m=max(a[i]+max_q(i+1,1),b[i]+max_q(i+1,2));
        dp[i][flag]=m;
    }
    return dp[i][flag];
    
}
int main() 
{ 
    for(int i=0;i<=100000;i++){
        for(int j=0;j<4;j++){
        dp[i][j]=-1;
        }
    }
    cin>>n;
    for(int i =0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
    }
    cout<<max_q(0,0);
	return 0; 
} 


Measured memory_bytes: 7680
#include<stdio.h>

struct Card{
	char suit;
	char value;
};

typedef struct Card Card;

void swap(Card *a, Card *b){
	Card t;
	t = *b;
	*b = *a;
	*a = t;
}

void BubbleSort(Card *C, int n){
	int i, j;
	for (i = 0; i <= n - 1; i++){
		for (j = n - 1; j >= i + 1; j--){
			if (C[j].value < C[j - 1].value){
				swap(&C[j], &C[j - 1]);
			}
		}
	}
}

void SelectionSort(Card *C, int n){
	int i, j, mini;
	for (i = 0; i<n - 1; i++){
		mini = i;
		for (j = i; j <= n - 1; j++){
			if (C[j].value < C[mini].value){
				mini = j;
			}
		}
		swap(&C[i], &C[mini]);
	}
}

int check(Card *C1, Card *C2, int n){
	int i, j, k;
	for (i = 0; i < n; i++){
		if (C2[i].suit != C1[i].suit){ return 0; }
	}
	return 1;
}

int main(){
	struct Card C1[101], C2[101];
	int n, i;
	char ch;

	scanf("%d%c", &n, &ch);
	for (i = 0; i < n; i++){
		scanf("%c%c%c", &C1[i].suit, &C1[i].value, &ch);
	}

	for (i = 0; i < n; i++){
		C2[i] = C1[i];
	}
	BubbleSort(C2, n);
	for (i = 0; i < n; i++){
		printf("%c%c", C2[i].suit, C2[i].value);
		if (i < n - 1){ printf(" "); }
	}
	printf("\n");
	printf("Stable\n");


	SelectionSort(C1, n);
	for (i = 0; i < n; i++){
		printf("%c%c", C1[i].suit, C1[i].value);
		if (i < n - 1){ printf(" "); }
	}
	printf("\n");
	printf("%s", check(C1, C2, n) ? "Stable\n" : "Not stable\n");
	return 0;
}

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

using namespace std;

int f(int n) {
	int sum = 0;
	while (n) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

int main() {
	int n, a, b, sum = 0;
	cin >> n >> a >> b;
	while (n) {
		int t = f(n);
		if (a <= t && t <= b)
			sum += n;
		n--;
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b) - 1; (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    double n,a;
    cin >> n;
    for (ll i = floor(sqrt(n)) + 1; i > 0; --i) {
        a = n / i;
        if (a == (ll)a) {
            cout << (ll)(a - 1 + i - 1) << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String ans = "NO";
        for(int i = 0; i < s.length(); i++){
        	for(int j = i; j < s.length(); j++){
            	String ans1 = s.substring(0, i);
                String ans2 = s.substring(j, s.length());
                String ans3 = ans1 + ans2;
                if(ans1.equals("keyence") || ans2.equals("keyence") || ans3.equals("keyence")){
                	ans = "YES";
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 40464
#N = int(input())
#h = list(map(int, input().split()))
#print(sum(h) - sum([min(h[i + 1], h[i]) for i in range(N - 1)]))



N = int(input())
h = list(map(int, input().split()))

res = 0
while True:
    if max(h) == 0: break

    i = 0
    while i < N:
        if h[i] == 0: i += 1
        else:
            res += 1
            while i < N and h[i] > 0:
                h[i] -= 1
                i += 1
print(res)


Measured memory_bytes: 3060
import sys
input = sys.stdin.readline
from collections import deque
from itertools import product
import heapq


def read():
    H, W = map(int, input().strip().split())
    CH, CW = map(int, input().strip().split())
    DH, DW = map(int, input().strip().split())
    S = [[0 for j in range(W)] for i in range(H)]
    for i in range(H):
        s = list(input().strip())
        for j in range(W):
            if s[j] == "#":
                S[i][j] = -2
            else:
                S[i][j] = -1
    return H, W, CH, CW, DH, DW, S


def solve(H, W, CH, CW, DH, DW, S):
    DIR0 = [(0, 1), (1, 0), (0, -1), (-1, 0)]
    DIR1 = [(y, x) for y, x in product(range(-2, 3), range(-2, 3))]
    S[CH-1][CW-1] = 0
    q = deque()
    q.append((CH-1, CW-1))
    while q:
        y0, x0 = q.popleft()
        d0 = S[y0][x0]
        # 距離0で到達可能な場所をBFS
        T = []
        r = deque()
        T.append((y0, x0))
        r.append((y0, x0))
        while r:
            y, x = r.popleft()
            for dy, dx in DIR0:
                ny, nx = y + dy, x + dx
                if 0 <= ny < H and 0 <= nx < W and (S[ny][nx] == -1 or S[ny][nx] > d0):
                    r.append((ny, nx))
                    T.append((ny, nx))
                    S[ny][nx] = d0
        # 距離1で到達可能な場所をBFS
        for y, x in T:
            for dy, dx in DIR1:
                ny, nx = y + dy, x + dx
                if 0 <= ny < H and 0 <= nx < W and S[ny][nx] == -1:
                    q.append((ny, nx))
                    S[ny][nx] = d0+1
    return S[DH-1][DW-1]


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Measured memory_bytes: 88740
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
 
int main() {
    int r;
    cin >> r;
    printf("%.12f\n",2*M_PI*r);
}

Measured memory_bytes: 3760
n = int(input())
flag = False
num = 0
for i in range(n):
    d1, d2 = list(map(int, input().split()))
    if d1 == d2:
        num += 1
        if num == 3:
            flag = True
            break
    else:
        num = 0
if flag == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  int t; cin >> t; double x,ans=0;
  while(t--){
    cin >> x;
    ans += 1/x;
  }
  cout << 1/ans << "\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int i = 0;
  for (; i < N;) {
    string S;
    cin >> S;
    if (S == "Y") {
      cout << "Four" << endl;  
      break;
    }
    else
    i++;
  } 
  if (i == N)
    cout << "Three" << endl;
}

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

using namespace std;

#define ll long long
constexpr ll inf = 1e9+7;

ll A[301][301];
ll B[301][301];

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

    ll N;
    cin>>N;
    for (ll i = 0; i < N; i++)
        for (ll j = 0; j < N; j++) { cin>>A[i][j]; B[i][j] = A[i][j]; }

    for (ll k = 0; k < N; k++)
        for (ll i = 0; i < N; i++)
            for (ll j = 0; j < N; j++) B[i][j] = min(B[i][j], B[i][k] + B[k][j]);

    for (ll i = 0; i < N; i++)
        for (ll j = 0; j < N; j++) if (B[i][j] < A[i][j]) { cout<<-1<<endl; return 0; }

    ll ans = 0;
    for (ll i = 0; i < N-1; i++)
        for (ll j = i+1; j < N; j++) {
            bool flag = false;
            for (ll k = 0; k < N; k++)
                if (k != i && k != j && B[i][j] == B[i][k] + B[k][j]) { flag = true; break;}

            if (!flag) ans += B[i][j];
        }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main (){
  int n;
  cin >> n;
  vector<ll> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=1;i<n;i++){
    a[i]=a[i]+a[i-1];
  }
  ll ans=100000000000;
  for(int i=0;i<n-1;i++){
    ans=min(ans,abs(a[i]-(a[n-1]-a[i])));
  }
  cout<<ans<<endl;
  return 0;
}


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

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

  if (1 + k <= a) {
    cout << k + 1 << endl;
    return 0;
  }

  long long sum;

  if (a + 2 < b) {
    int x = k - (a - 1);
    int c = max(0, x / 2);
    sum = a + (long long)(b - a) * c + (x % 2);
  } else {
    sum = k + 1;
  }

  cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(void){
	int n;
	cin >> n;
	string str[n];
	string cmp[100];
	string ans = "Yes";
	for (int i = 0; i < n; i++) {
		cin >> str[i];
		cmp[i] = str[i];
		for (int j = 0; j < i; j++) {
			if (str[i] == cmp[j]) {
				ans = "No";
			}
		}
		
		
		if (i >= 1) {
			if (str[i][0] != str[i - 1][str[i - 1].size()-1]) ans = "No";
		}
	}



	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  int ans;
  
  if(s=="SUN")
      ans = 7;
   if(s=="MON")
      ans=6;
    if(s=="TUE")
      ans=5;
    if(s=="WED")
      ans = 4;
     if(s=="THU")
      ans = 3;
    if(s=="FRI")
      ans = 2;
      if(s=="SAT")
      ans = 1;
      
 
  cout << ans<<endl;
  return 0;
}


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

int main()
{
	int a = 0, b = 0;
	int d = 0, r = 0;
	double f = 0.0;

	cin >> a >> b;
	d = (a / b);
	r = (a % b);
	f = ((double)a / b);

	cout << d << " " << r << " ";
	cout << fixed;
	cout << setprecision(8) << f << endl;

	return 0;
}


Measured memory_bytes: 3280
#include <stdio.h>

int main(void)
{
    int L,R,d,i,n;
    double x;
    n=0;

    scanf("%d %d %d",&L,&R,&d);
    
    if( L>=1 && L<=100 && R>=1 && R<=100 && L<=R && d>=1 && d<=100){
            for(i=L;i<=R;i++){
                x = i%d;
                if(x==0){
                    n++;
                }
        }
    }


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


    return 0;
}

Measured memory_bytes: 1708
/*#include<iostream>
using namespace std;
int main() {
int a, sum = 0;
for (int i = 0; i < 4; i++) {
cin >> a;
sum += a;
}
cout << sum / 60 << endl << sum % 60 << endl;
}*/
#include<iostream>
using namespace std;
int main() {
int min1 = 2000, min2 = 2000, a;
for (int i = 0; i < 3; i++) {
cin >> a;
if (min1 > a)min1 = a;
}
for (int i = 0; i < 2; i++) {
cin >> a;
if (min2 > a)min2 = a;
}
cout << min1 + min2-50 << endl;
}
/*#include<iostream>
using namespace std;
int main() {
int a[5], b[2] = {1}, sum = 0;
for (int i = 0; i < 5; i++) {
cin >> a[i];
}
while (a[1] > a[3]*b[0]) {
b[0]++;
//cout << "bakatoy" << endl;
}
while (a[2] > a[4]*b[1]) {
b[1]++;
//cout << "bakatoy" << endl;
}
if (b[0] > b[1]) {
cout << a[0]-b[0] << endl;
}
else {
cout << a[0]-b[1] << endl;
}
}*/
/*#include<iostream>
using namespace std;
int main() {
	int a, sum=0;
	for (int i = 0; i<5; i++) {
		cin >> a;
		if (a < 40)a = 40;
		sum += a;
	}
	cout << sum / 5 << endl;
}*/

Measured memory_bytes: 3048
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define range(a,b)		substr(a,b-a+1)
#define w(x)            int x; cin>>x; while(x--)
#define trace(x) 		cerr<<#x<<": "<<x<<" "<<endl;
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main()
{
	FIO;
	int n, d; cin >> n >> d;

	int ans = 0;

	while (n--)
	{
		int x, y; cin >> x >> y;

		if (x * x + y * y <= d * d)
			ans++;
	}
	cout << ans << '\n';
}

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

int main(void) {
  int W,H,N,lx, ly, rx, ry;
  cin >> W >> H >> N;
  
  vector<vector<int>> m(H, vector<int>(W, 0));
  int x, y , a;
  while(N--){
    cin >> x >> y >> a;
    for ( int i = 0 ; i < H; i++){
      for ( int j = 0; j < W; j++){
        if( a == 1 && j < x ) m.at(i).at(j) = 1;
        else if ( a == 2 && x < j + 1) m.at(i).at(j) = 1;
        else if ( a == 3 && i < y) m.at(i).at(j) = 1;
        else if ( a == 4 && i + 1 > y) m.at(i).at(j) = 1;
      }
    }
   }
    
    int  res = 0;
    for ( int i = 0; i < H ; i++){
      for ( int j = 0; j < W; j++){
       if ( m.at(i).at(j) == 0) res++;  
      }  
    }
    
    cout << res << endl;
    
  
}

Measured memory_bytes: 256
def expired(X: int, A: int, B: int)->str:
    if (B-A) <= 0:
        return 'delicious'
    if (B-A) <= X:
        return 'safe'
    return 'dangerous'


if __name__ == "__main__":
    X, A, B = map(int, input().split())
    ans = expired(X, A, B)
    print(ans)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pi pair<int, int>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define deb(x) cout << #x << ":" << x << endl;
/* freopen("input.txt", "r", stdin); */
/* freopen("output.txt", "w", stdout); */
const ll inf = 1e17 + 7, MOD = 1e7 + 9;


int main() {
	fastio();
	int n;
	cin >> n;
	ll prod = 1;
	ll a[n];
	bool zero = false;
	for(int i=0;i<n;i++) {
		cin >> a[i];
		if(a[i] == 0)
			zero = true;
	}
	if(zero) {
		cout << 0 << "\n";
		return 0;
	}
	int i;
	for(i=0;i<n;i++) {
		if(prod * a[i] < prod || prod * a[i] > 1000000000000000000)
			break;
		prod *= a[i];
		/* deb(prod); */
	}
	if(i==n)
		cout << prod << "\n";
	else
		cout << -1 << "\n";
	return 0;
}



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

int main()
{
    int N;
    string S;
    cin >> N >> S;
    if (N % 2 != 0)
    {
        cout << "No" << endl;
        return 0;
    }
    else
    {
        rep(i, N / 2)
        {
            if (S.at(i) != S.at(N / 2 + i))
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector <int> vi;
typedef vector < vector <int> > vvi;

int main(void) {
    ll x;
    ll y = 100;
    cin >> x;
    for (int i = 1; i < 99999999; ++i) {
        y = ll(y * 1.01);
        if (y >= x) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3600
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n,m;
	int input;
	long long int answer=0;
	cin >> n >> m;
	vector <long long int> a(n+1,0);
	a[0]=0;
	for(int i=1;i<=n;i++){
		cin >> input;
		a[i]=a[i-1]+input;
		a[i]%=m;
	}
	sort(a.begin(),a.end());
	long long int cnt = 1;
	for(int i=1;i<n+1;i++){
		if(a[i]==a[i-1]){
			cnt++;
		}
		else{
			answer+=cnt*(cnt-1)/2;
			cnt=1;
		}
	}
	answer+=cnt*(cnt-1)/2;
	cout << answer << endl;
	return 0;
}

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

int main() {
    string s;
    cin >> s;
    int memoh = 0;
    int memot = 0;
    int max = 0;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] == 'A') {
            memoh = i;
            break;
        }
    }
    for(int j = s.size() - 1; j >= 0; j--) {
        if(s[j] == 'Z') {
            memot = j;
            break;
        }
    }
    max = memot - memoh + 1;
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main(){
    vector<ll> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(),a.end());
    cout << a[2]-a[0] << endl;
    return 0;
}


Measured memory_bytes: 256
# 初期入力
import sys
input = sys.stdin.readline  #文字列では使わない
A,B,C = map(int, input().split())
K = int(input())

count =0
for i in range(20):
    if count >=K:
        break
    else:
        if A >=B:
            B *=2
            count +=1
            continue
        if B >=C:
            C *=2
            count +=1
        if A < B <C:
            print("Yes")
            sys.exit()
        
print("No")

Measured memory_bytes: 9196
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
using namespace std;
char a; 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>a;
	cout<<char(int(a)+1);
	return 0;
}


Measured memory_bytes: 3644
x = int(input())
for b in range(1000):
    for a in range(1000):
        if a ** 5 - b ** 5 == x:
            print('{} {}'.format(a, b))
            exit()
        if (-a) ** 5 - b ** 5 == x:
            print('{} {}'.format(-a, b))
            exit()
        if a ** 5 - (-b) ** 5 == x:
            print('{} {}'.format(a, -b))
            exit()
        if (-a) ** 5 - (-b) ** 5 == x:
            print('{} {}'.format(-a, -b))
            exit()


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

ll pla(ll n,ll i)
{
  ll x = pow(2,i + 1),y = pow(2,i);
  return n % x / y;
}

int main() 
{
  char a; cin>>a;
  ll A=a-'0';
  char b; cin>>b;
  ll B=b-'0';
  char c; cin>>c;
  ll C=c-'0';
  char d; cin>>d;
  ll D=d-'0';
  rep(i,8)
  {
    ll sum=A;
    rep(j,3)
    {
      if(pla(i,j)==0)
      {
        if(j==0) {sum+=B; continue;}
        if(j==1) {sum+=C; continue;}
        sum+=D;
      }
      if(pla(i,j)==1)
      {
        if(j==0) {sum-=B; continue;}
        if(j==1) {sum-=C; continue;}
        sum-=D;
      }
    }
    if(sum==7)
    {
      cout<<A;
      if(pla(i,0)==0) {cout<<"+";}
      else {cout<<"-";}
      cout<<B;
      if(pla(i,1)==0) {cout<<"+";}
      else {cout<<"-";}
      cout<<C;
      if(pla(i,2)==0) {cout<<"+";}
      else {cout<<"-";}
      cout<<D<<"=7"<<endl;
      return 0;
    }
  }
  return 0;
}

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

using namespace std;

int main(){
  int n;
  vector<int> vec(222);
  cin >> n;
  
  int count = 0;
  for (int i = 0; i < n; i++){
    cin >> vec.at(i);
  }
  while (true){
    bool existOdd = false;
    for (int i = 0; i < n; i++){
    	if (vec.at(i) % 2 != 0){
          existOdd = true;
        }
  	}
    if (existOdd){
      break;
    }
    for (int i = 0; i < n; i++){
    	vec.at(i) /= 2;
    }
    count++; 
  }
 
  cout << count << endl;
  
}



Measured memory_bytes: 3584
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <iostream>

using namespace boost::multiprecision;
using namespace std;

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

    cpp_dec_float_100 A = a;
    cpp_dec_float_100 B = b;
    cpp_dec_float_100 C = c;

    if (sqrt(A) + sqrt(B) < sqrt(C)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define vsort(v) sort(v.begin(), v.end())
#define ll long long
#define rep(i, s, g) for (ll i = (s); i < (g); i++)
#define MOD 1000000007
using namespace std;

int main ()
{
	ll N, sum; cin >> N;
  	char c;
  	vector<ll> R, G, B;
  	rep(i, 0, N) {
    	cin >> c;
      	if (c == 'R') R.push_back(i);
      	if (c == 'G') G.push_back(i);
      	if (c == 'B') B.push_back(i);
    }
  	sum = R.size() * G.size() * B.size();
  	rep(i, 0, R.size()) {
    	rep(j, 0, G.size()) {
        	ll large = max(R[i], G[j]), small = min(R[i], G[j]);
          	if (find(B.begin(), B.end(), large * 2 - small) != B.end()) {
             	sum--;
            }
          	if (small * 2 - large >= 0) {
          		if (find(B.begin(), B.end(), small * 2 - large) != B.end()) {
            	 	sum--;
            	}
            }
          	if ((large - small) % 2 == 0) {
              if (find(B.begin(), B.end(), (large + small) / 2) != B.end()) {
             		sum--;
              }	
            }
          	
        }
    }
  	cout << sum << endl;
}

Measured memory_bytes: 3672
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <tuple>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <tuple>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <sys/time.h>

using namespace std;

void solve(long long N, long long H, long long W){
  std::cout << (N-H+1)*(N-W+1) << std::endl;
}

int main(){
  long long H;
  long long W;
  long long N;
  scanf("%lld",&N);
  scanf("%lld",&H);
  scanf("%lld",&W);
  solve(N, H, W);
  return 0;
}


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

typedef long long ll;

int main(void) {
	int A, B, C;
	ll K;
	cin >> A >> B >> C >> K;

	int d = A - B;
	int ans;
	if (K % (ll)2 == (ll)0)
		ans = d;
	else
		ans = -d;

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
//
//  header_useful.h
//  c++_acm
//
//  Created by 李弘辰 on 2019/7/23.
//  Copyright  2019 李弘辰. All rights reserved.
//

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <list>
#include <set>
#include <utility> // pair
#include <map>
#include <iostream>
#include <sstream>
#include <algorithm> // sort
#include <string>
#include <stack>
#include <queue>
#include <fstream>
#include <bitset>

using namespace std;

#define ll long long
#define uchar unsigned char
#define ushort unsigned short
#define uint unsigned int
#define ulong unsigned long
#define ull unsigned long long

#define INT_INF 0x7fffffff

#define pi acos(-1)

#define mx(a,b) (a) > (b) ? (a) : (b)
#define mn(a,b) (a) < (b) ? (a) : (b)
#define mem(a,b) memset(a,b,sizeof(a))
#define fre(a) freopen(a,"r",stdin)

#define cio ios::sync_with_stdio(false); // Do not use it with "scanf" and other c input!

#define itn int
#define nit int
#define inr int
#define mian main
#define ednl endl
#define fro for
#define fir for
#define reutrn return
#define retunr return
#define reutnr return


/* header_useful_h */
int main()
{
    int n,m,x;
    scanf("%d%d%d",&n,&m,&x);
    int c[20];
    int k[20][20];
    for (int i = 0;i < n;i ++) {
        scanf("%d",c + i);
        for (int j = 0;j < m;j ++) {
            scanf("%d",&k[i][j]);
        }
    }
    int u = 1 << n;
    int y,ss[100];
    ll mm;
    ll kk;
    
        kk = -1;
        for (int j = 0;j < u;j ++) {
            y = j;
            mem(ss,0);
            mm = 0;
            for (int v = 0;v < n;v ++) {
                if (y & 1)
                {
                    for (int i = 0;i < m;i ++)
                        ss[i] += k[v][i];
                    mm += c[v];
                }
                if (y != 0) y >>= 1;
            }
            int ok = 1;
            for (int i = 0;i < m;i ++) {
                if (ss[i] < x) {
                    ok = 0;
                    break;
                }
            }
            if (ok) {
                if (kk == -1) kk = mm;
                kk = min(kk,mm);
            }
        }
        printf("%lld\n",kk);
    return 0;
}

Measured memory_bytes: 3816
N, K = map(int, input().split())
A = list(map(int, input().split()))
mod = 10**9+7
counter1 = [0] * N
counter2 = [0] * N
for i in range(N):
    p, q = 0, 0
    for j in range(i+1, N):
        if A[i] > A[j]:
            counter1[i] += 1
    
    for j in range(N):
        if A[i] > A[j]:
            counter2[i] += 1

ans = 0
for i in range(N):
    c1 = counter1[i]
    c2 = counter2[i]
    ans = (ans + (c1 * K + c2 * K * (K - 1) // 2)) % mod
print(ans)

Measured memory_bytes: 42348
N,x = map(int,input().split())
a = sorted(list(map(int,input().split())))
s = [sum(a[:i+1]) for i in range(N)]

if s[-1] == x:
  print(N)
  exit()
else:
  for i in range(N-1):
    if s[i] > x:
      print(i)
      exit()
      
  print(N-1)

Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
    int i,N;
    unsigned long long int fact=1;

    scanf("%d",&N);
    if(N<=20)
    {
        for(i=1;i<=N;i++)
    {
        fact*=i;
    }
    printf("%llu\n",fact);
    }


    return 0;
}

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

int main()
{
    int w, h, x, y;
    cin >> w >> h >> x >> y;

    double area = double(w)*double(h)/2;
    int canSplit;
    if(w == 2*x && h == 2*y) canSplit = 1;
    else canSplit = 0;
    cout << area << " " << canSplit << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np
A=[]
for i in range(3):
    arr=list(map(int,input().split()))
    A.append(arr)
B=np.ones((3,3))

A=np.array(A)
N=int(input())

for i in range(N):
    b=int(input())
    for j in range(3):
        for k in range(3):
            if A[j][k]!=b:
                continue
            B[j][k]=0

if 0 in np.sum(B,axis=0) or 0 in np.sum(B,axis=1) or B[0][0]+B[1][1]+B[2][2] == 0 or B[0][2]+B[1][1]+B[2][0] == 0:
    print("Yes")
else:
    print("No")
    

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

int main()
{
  int N;
  cin >> N;
  
  int a[N];
  rep(i,N) cin >> a[i];
  
  int ans=0;
  bool flag=true;
  
  while(true)
  {
    rep(i,N)
    {
      if(a[i]%2==1)
        flag = false;
    }
    if(flag)
    {
      ans++;
      rep(i,N) a[i]/=2;
    }
    else
      break;
  }
  cout << ans <<endl;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (){
  int i;
  int n;
  cin>>n;
  string a,b;
  cin>>a>>b;
  for(i=0;i<n;i++){
    cout<<a[i]<<b[i];
  }
  
  return 0;
}

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define IOS             ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define read            freopen("in.txt","r",stdin)
#define write           freopen("out.txt","w",stdout)
#define ms(a,x)         memset(a,x,sizeof a)
#define ll              long long int
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rall(a)         a.rbegin(),a.rend()
#define pb              push_back
#define nl              cout<<"\n"
#define gcd(a,b)        __gcd((a),(b))
#define lcm(a,b)        ((a)*(b))/(gcd(a,b))
#define sq(a)           (a)*(a)
#define loop(i,a,b)     for (ll i = a; i <= b; i++)
#define rloop(i,a,b)    for (ll i = a; i >= b; i--)
#define sz(a)           a.size()
#define mod             1000000007
#define PI              2*acos(0.0)
ll r[300005],c[300005];
int main()
{
    IOS
    int T=1;
    //cin>>T;
    while(T--)
    {
        ll h,w,m;
        cin>>h>>w>>m;
        map<pair<ll,ll>,ll>v;
        ll r1=0,c1=0;
        loop(i,1,m)
        {
            ll x,y;
            cin>>x>>y;
            v[{x,y}]++;
            r[x]++;
            c[y]++;
            r1=max(r1,r[x]);
            c1=max(c1,c[y]);
        }
        vector<ll>rr,cc;
        loop(i,1,300000)
        {
            if(r[i]==r1)
            {
                rr.pb(i);
            }
        }
        loop(i,1,300000)
        {
            if(c[i]==c1)
            {
                cc.pb(i);
            }
        }
        //debug(r1,c1,x,y);
        bool f=true;
        ll p=sz(rr)-1,q=sz(cc)-1;
            loop(j,0,p)
            {
                loop(k,0,q)
                {
                    if(v[{rr[j],cc[k]}]==0)
                        {
                            f=false;
                            break;
                        }
                }
                if(f==false) break;
            }

        if(f)
        {
            cout<<r1+c1-1;
        }
        else cout<<r1+c1;
    }
    return 0;
}


Measured memory_bytes: 35036
a=list(input())
if a[0]=="R":
  if a[1]=="S":
    print(1)
  else:
    if a[2]=="R":
      print(3)
    else:
      print(2)
else:
  if a[1]=="R" and a[2]=="R":
    print(2)
  elif a[1]=="S" and a[2]=="S":
    print(0)
  else:
    print(1)

Measured memory_bytes: 8984
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
char a[N];
int main() {
  ios::sync_with_stdio(false);
  cin>>a+1;int l=0,r=0;
  for(int i=1;i<=3;i++){
    if(a[i]=='A')l++;
    else r++;
  }
  if(l && r)cout<<"Yes\n";
  else cout<<"No\n";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define N 200000
#define mod1 1000000007
#define mod2 1000000009
#define mod3 998244353
#define endl '\n'
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
void Google(ll tt){
    cout<<"Case #"<<tt<<": ";
}

int main()
{
    IO
    clock_t begin = clock();
    ll n,a,b;
    cin>>a>>b>>n;
    ll ans=(b/n)-((a-1)/n);
    cout<<ans<<endl;
    // cout<<double(clock() - begin)/CLOCKS_PER_SEC<<endl;
    return 0;
}

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

int a[1000];
void pre(){
    a[1] = 1;
    for(int i=2; i<1000; i++)
        a[i] += a[i-1] + i;
}

int main(){
    pre();
    int x, y; cin >> x >> y;
    int ans = -1;
    for(int i=2; i<1000; i++){
        if(a[i-1]-x == a[i]-y && (a[i]-y)>0)
            ans = a[i-1]-x;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  constexpr mint inv() const { return pow(mod - 2); }
  constexpr mint &operator/=(const mint &a) { return (*this) *= a.inv(); }
  constexpr mint operator/(const mint &a) const {
    mint res(*this);
    return res /= a;
  }
};
ostream &operator<<(ostream &os, const mint &m) {
  os << m.x;
  return os;
}

mint comb(ll n, ll r) {
  mint res = 1;
  for (int i = 1; i <= r; i++) {
    res *= n;
    res /= i;
    n--;
  }
  return res;
}

mint factorial(int k) {
  mint sum = 1;
  for (int i = 1; i <= k; ++i) {
    sum *= i;
  }
  return sum;
}

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

  int n, k;
  cin >> n >> k;
  int red = n - k;

  rep(i, 1, k + 1) {
    mint mul = comb(k - 1, i - 1);
    if (i == 1 || i == k)
      mul = 1;
    mint ans = comb(red + 1, i) * mul;
    cout << ans.x << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
//#include<ctime>

namespace fuck
{
	inline int abs(int x){return x<0?-x:x;}
	template<typename T>inline bool check_min(T a,T &b){return a<b?b=a,1:0;}
	template<typename T>inline bool check_max(T a,T &b){return a>b?b=a,1:0;}
	typedef std::vector<int>::iterator vit;

	struct node
	{
		int x,id;
		node (int a=0,int b=0){x=a,id=b;}
		bool operator < (const node &h) const {return x<h.x;}
	};

	const int N=10010,M=N*2;

	std::vector<int> G[M];
	node s[M];

	int n,m,lim;
	inline void add(int x,int y){G[x].push_back(y);}

#define id(i) (n+i)
#define dec(i) (i>n?i-n:i+n)

	int ins[M],stk[M];
	int col[M],dfn[M];
	int clk,tot,top;

	int tarjan(int p)
	{
		stk[++top]=p,ins[p]=1;
		int lowp=dfn[p]=++clk,lowq;
		for(vit it=G[p].begin();it!=G[p].end();it++)
		{
			int q=*it;
			if(dfn[q])
			{
				if(ins[q])check_min(dfn[q],lowp);
				continue;
			}
			check_min(lowq=tarjan(q),lowp);
		}

		if(lowp==dfn[p])
		{
			tot++;
			for(int x;;)
			{
				x=stk[top--];
				ins[x]=0;
				col[x]=tot;
				if(x==p)break;
			}
		}

		return lowp;
	}

	bool check()
	{
		static bool sel[M];
		static int his[M],cnt;

		for(int i=1;i<=n;i++)G[i].clear(),G[i+n].clear();

		memset(sel,0,sizeof(sel));
		for(int i=1;i<=m;i++)
		{
			cnt=0;
			int L=i-1,R=i+1,p=s[i].id,q;
			while(R<=m && s[R].x-s[i].x<lim)
			{
				if(R-i>200)break;
				q=dec(s[R].id);
				add(p,q);

				sel[q]=1;
				his[++cnt]=q;
				R++;
			}
			while(L>=1 && s[i].x-s[L].x<lim)
			{
				if(i-L>200)break;
				q=dec(s[L].id);
				add(p,q);

				sel[q]=1;
				his[++cnt]=q;
				L--;
			}
			for(int j=1;j<=cnt;j++)
				sel[his[j]]=0;

			cnt=0;
		}

		for(int i=1;i<=m;i++)
			ins[i]=col[i]=dfn[i]=0;
		top=clk=tot=0;
		
		for(int i=1;i<=m;i++)
			if(!dfn[i])tarjan(i);

		for(int i=1;i<=n;i++)
			if(col[i]==col[id(i)])return 0;
		return 1;
	}

	void initialize()
	{
		scanf("%d",&n),m=0;
		for(int i=1,x,y;i<=n;i++)
		{
			scanf("%d%d",&x,&y);
			s[++m]=node(x,i);
			s[++m]=node(y,id(i));
		}
		std::sort(s+1,s+m+1);
	}
	void solve()
	{
		initialize();
		int u=1000000000,d=0;
		while(u>d)
		{
//			fprintf(stderr,"%d--%d\n",d,u);
			lim=(u+d+1)>>1;
			if(check())d=lim;
			else u=lim-1;
		}
		printf("%d\n",d);
	}
}

int main()
{
	fuck::solve();

//	fprintf(stderr,"my time = %lf\n",(double)clock()/CLOCKS_PER_SEC);
	return 0;
}


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

long long n, dp[3004][3004], a[3004];
vector<long long> stones;

int main() {
    cin>>n;
    for(long long i = 0; i < n; i++){
        cin>>a[i];
    }
    for(long long L = n-1; L >= 0; --L){
        for(long long R = L; R < n; ++R){
            dp[L][R] = L == R ? a[L] : max(a[L] - dp[L+1][R], a[R] - dp[L][R-1]); 
        }
    }
    cout<<dp[0][n-1];
	return 0;
}

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


int main(void) {
  int w, h, x, y;
  cin >> w >> h >> x >> y;
  double ans = (double)w*h/2;
  int num = (w==x*2 && h==y*2) ? 1 : 0;
  printf("%.10f %d\n", ans, num);

  return 0;
}

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

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;

return 0;
}

Measured memory_bytes: 256
//#include <GOD>

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

typedef long long ll;
#define si size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define E end()
#define B begin()
#define pi pair<int, int>
#define en cout << endl
#define cn const
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

cn int maxn = 3 * 1e3 + 10;
double dp[maxn][maxn];
double p[maxn];

int main(){
	fast_io;
	int n;
	cin >> n;
	for(int i = 0; i < n; i ++)
		cin >> p[i];
	
	dp[0][0] = 1 - p[0];
	dp[0][1] = p[0];
	for(int i = 1; i < n; i ++){
		for(int j = 0; j <= i + 1; j ++){
			if(i > 0){
				dp[i][j] += dp[i - 1][j] * (1 - p[i]); 
			}
			if(i > 0 && j > 0){
				dp[i][j] += dp[i - 1][j - 1] * p[i];
			}
//			cout << dp[i][j] << endl;
		}
	}
	double ans = 0;
	for(int i = n / 2 + 1; i <= n; i ++){
		ans += dp[n - 1][i];
	}
	cout << fixed << setprecision(10) << ans << endl;
		
	return 0;
}



Measured memory_bytes: 69120