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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    map<int, int, greater<int>> mp;
    FOR (i, 1, sqrt(m + 1) + 1) {
        if (m % i == 0) {
            mp[i]++;
            mp[m / i]++;
        }
    }
    double base = m / n;
    for (auto const& entry: mp) {
        if (entry.first <= base) {
            cout << entry.first << endl;
            return 0;
        }
    }
    
    return 0;
}



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

using namespace std;

template <typename T>
using TABLE = vector<vector<T>>;

long long PRIME = 1e9 + 7;
long long PRIME2 = 998244353;


int main(){
    long long N, K;
    cin >> N >> K;

    long long d;
    long long A;

    vector<int> count(N, 0);

    for(int i = 0; i < K; ++i){
        cin >> d;
        for(int j = 0; j < d; ++j){
            cin >> A;
            ++count[A - 1];
        }
    }

    int ret = 0;
    for(int i = 0; i < N; ++i){
        if(count[i] == 0){
            ++ret;
        }
    }

    cout << ret;
}


Measured memory_bytes: 3628
n = int((input()))
a = [str(input()) for _ in range(n)]

ans = "Yes"
b = []
c = a[0][0]
for i in a:
    if c == i[0] and i not in b:
        c = i[-1]
        b.append(i)
    else:
        ans = "No"
        break

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
bool dp[100100];
 
 
int main () {
    string S;
    cin >> S;

    if(S[4] == S[5] && S[2] == S[3])cout <<"Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 256
#include<iostream>
int main() {
	int n;
	std::cin >> n;
	int *a = new int[n];
	for (int i = 0; i < n; i++)std::cin >> a[i];
	for (int i = 1; i < n; i++) {
		int t[2] = { a[i],0 };
		while (t[0] != 0) {
			t[1] = a[0] % t[0];
			a[0] = t[0];
			t[0] = t[1];
		}
	}
	printf("%d\n", a[0]);
}

Measured memory_bytes: 640
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))

using lint = long long;
using pii = pair< int, int >;

template< typename T > using Vec = vector< T >;

template< typename T > bool in_range(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool in_range(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }

template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }

int bitCount(int x) { return __builtin_popcount(x); }
int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double EPS = 1e-9;
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//



int main() {
	int N, K;
	cin >> N >> K;
	cout << ((N + 1) / 2 >= K ? "YES" : "NO") << endl;
}
//--------------8---------------->> coding space <<-----------------8-------------//

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

using namespace std;

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

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

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

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

  int n, m; cin >> n >> m;
  string s; cin >> s;
  reverse(s.begin(), s.end());
  vi ma(n+m+1);
  ma[0] = 0;
  int now = 0;
  for(int i=1;i<=n;++i) {
    if(s[i] == '0') {
      now = i;
    }
    ma[i] = now;
  }
  for(int i=n;i<=n+m;++i) {
    ma[i] = n;
  }

  now = 0;
  vi ans;
  while(now != n) {
    if(ma[now+m] <= now) {
      cout << -1 << endl;
      return 0;
    }
    ans.push_back(ma[now+m] - now);
    now = ma[now + m];
  }
  for(int i=SZ(ans)-1;i >= 0;--i) {
    cout << ans[i];
    if(i == 0) cout << endl;
    else cout << " ";
  }



}


Measured memory_bytes: 1480
#include <iostream>
#include <vector>
#include <map>
using namespace std;

const int divisor = 1000000007;

int main(){
	vector<int> ansvec;

	// 100000!までの数をdivisorで割った余りを格納しておく
	long long* factmodary = new long long[100001];
	long long fact = 1;
	for (int i = 1; i <= 100000; i++){
		fact *= i;
		fact %= divisor;
		factmodary[i] = fact;
	}

	int* word = new int[100000] {0};

	for (;;){
		int N, R;
		cin >> N;
		if (N == 0) break;
		cin >> R;
		
		//まず0番目の単語を入れておく
		for (int i = 0; i < N; i++) word[i] = i + 1;

		for (int i = 0; i < R; i++){
			int s, t;
			cin >> s >> t;
			/* swap */
			int tmp = word[s - 1]; word[s - 1] = word[t - 1]; word[t - 1] = tmp;
		}

		//word[i]をkey, word[i]より小さい数がそれ以前にいくつ使われていたかをvalueとして格納するmap
		map<int, int> bubblehist;
		bubblehist[word[0]] = 0;

		long long ans = factmodary[N-1] * (word[0] - 1);

		for (int i = 1; i < N; i++){
			int facttime = word[i] - 1;
			int bubblenum;
			map<int, int>::iterator it = bubblehist.lower_bound(word[i]);

			if (it != bubblehist.end()){
				bubblenum = it->second;
				--it;
			}
			else {
				bubblenum = (--it)->second + 1;
			}
			pair<int, int> p;
			p.first = word[i];
			p.second = bubblenum;
			bubblehist.insert(it, p);
			//word[i]より大きい数はすべてvalueが1増える
			for (map<int, int>::iterator it2 = bubblehist.upper_bound(word[i]); it2 != bubblehist.end(); it2++) ++(it2->second);

			facttime -= bubblenum;
			ans += factmodary[N - (i + 1)] * facttime;
			ans %= divisor;
		}
		ansvec.push_back((int)ans);
	}

	for (vector<int>::iterator it = ansvec.begin(); it != ansvec.end(); it++) cout << *it << "\n";

	delete[] word;
	delete[] factmodary;
	return 0;
}

Measured memory_bytes: 6816
import java.util.ArrayList;
import java.util.Scanner;




class Main{


	static	ArrayList<Integer> one ;
	static	ArrayList<Integer> two ;
	static	ArrayList<Integer> three ;
	static	ArrayList<Integer> four ;
	static long pow = 1000000007;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);			//文字の入力
		int a =sc.nextInt();
		int b =sc.nextInt();

		if(a > b){
			if(b != 1){
				System.out.println("Alice");
			}else{
				System.out.println("Bob");

			}
		}else if(a < b){
			if(a != 1){
				System.out.println("Bob");
			}else{
				System.out.println("Alice");
			}

		}else{
			System.out.println("Draw");

		}


	}



}

class Pair implements Comparable{
	Character from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}




Measured memory_bytes: 21716
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <limits>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <iterator>
#include <functional>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef unsigned                    ui;
typedef int                         si;
typedef long                        sl;
typedef long long                   ll;
typedef unsigned long long          ull;

// ----------------

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// ----------------

ll solve(ll x) {
    if (x == 0) {
        return 0;
    } else if (x == 1) {
        return 1;
    } else {
        return solve(x / 2) * 2 + 1;
    }
}

int main(int argc, char *argv[])
{
    std::ios_base::sync_with_stdio(false);

    ll n;
    cin >> n;

    ll answer = solve(n);
    cout << answer << endl;

    return 0;
}


Measured memory_bytes: 256
#B
NM = input().split(' ')
N = int(NM[0]) ; M = int(NM[1])
Ai = input().split(' ')
sum_Ai = 0
for k in Ai:
    k = int(k)
    sum_Ai += k
if sum_Ai > N:
    print(-1)
else:
    print(N - sum_Ai)

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

int main(void){
    int n, p;
    int cand[51];
    while(cin >> n >> p && n && p) {
        int now = 0;
        rep(i, 51) cand[i] = 0;
        while(true) {
            if(p == 1) {
                bool end = true;
                rep(i, n) {
                    if(i != now && cand[i] != 0) {
                        end = false;
                        break;
                    }
                }
                if(end) break;
            }
            if(p > 0) {
                cand[now]++;
                p--;
            } else {
                p = cand[now];
                cand[now] = 0;
            }
            now = (now == n-1 ? 0 : now+1);
        }
        cout << now << endl;
    }
}

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


int main() {
    int n, m;
    cin >> n >> m;
    ll a[n], b[n], c[m], d[m];
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> c[i] >> d[i];
    }

    for (int i = 0; i < n; i++) {
        pair<ll, int> ans = pair<ll, int>(1e18, -1);
        for (int j = 0; j < m; j++) {
            ll dis = labs(a[i] - c[j]) + labs(b[i] - d[j]);
            if (ans.first > dis) {
                ans.first = dis;
                ans.second = j;
            }
        }
        cout << (ans.second + 1) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int num;
    int i, j, k, l;
    char snake[200];
    int bodyacnt = 0;
    int bodybcnt = 0;
    int midcnt = 0;
    int endacnt = 0;
    int endbcnt = 0;
    int nacnt = 0;
    
    scanf("%d", &num);
    for (l = 0; l < num + 1; l++) {
        bodyacnt = 0;
        bodybcnt = 0;
        midcnt = 0;
        endacnt = 0;
        endbcnt = 0;
        nacnt = 0;
        for (i = 0; i < 200; i++) {
            scanf("%c", &snake[i]);
            if (snake[i] == '\n') {
                //printf("%d\n", i);
                break;
            }
        }
        if (snake[0] == '>') {
            if (snake[1] == '\'' && i % 2 == 0) {
                for (j = 2; j < i / 2 + 1; j++) {
                    if (snake[j] == '=') {
                        bodyacnt++;
                    }
                    else if (snake[j] == '#'){
                        break;
                    }
                    else if (snake[j] != '=' && snake[j] != '#') nacnt++;
                }
                
                for (k = j; k < i - 1; k++) {
                    if (snake[k] == '=') {
                        midcnt++;
                    }
                    else if (snake[k] != '=' && snake[k] != '#') nacnt++;
                }
                if (snake[i - 1] == '~' && snake[i - 2] != '~'){
                    endacnt++;
                }

            }
            else if (snake[1] == '^' && i % 2 == 0) {
                for (j = 2; j < i - 3; j+=2) {
                    if (snake[j] == 'Q' && snake[j + 1] == '=') {
                        bodybcnt++;
                    }
                    else /*if (snake[j] != 'Q' || snake[j + 1] != '=')*/ nacnt = 1;
                }
                if (snake[i - 2] == '~' && snake[i - 1] == '~' && snake[i - 3] != '~') {
                    endbcnt++;
                }
            }
        }
    
        //printf("%d %d %d %d %d\n", bodyacnt, bodybcnt, endacnt, midcnt, nacnt);
        if (bodybcnt > 0 && endbcnt == 1 && nacnt == 0){
            printf("B\n");
        }
        else if (bodyacnt == midcnt && endacnt == 1 && nacnt == 0 && bodyacnt > 0) {
            printf("A\n");
        }
        else if (l != 0)printf("NA\n");
    }
    
    return 0;
}

Measured memory_bytes: 580
import std.stdio, std.string, std.conv, std.algorithm;

void main()
{
    int n = readln.chomp.to!int;
    auto inp = readln.split.map!(to!int);
    int A = inp[0],
        B = inp[1];
    int C = readln.chomp.to!int;
    int[] cs = new int[](n);
    foreach(i; 0 .. n)
    {
        cs[i] = readln.chomp.to!int;
    }
    cs.sort!"a>b"();

    int[] sum = new int[](n + 1);
    real[] dp = new real[](n + 1);
    sum[0] = C;
    dp[0] = 1.0 * sum[0] / A;
    foreach(i; 1 .. n + 1)
    {
        if(dp[i - 1] < 1.0 * (sum[i - 1] + cs[i - 1]) / (A + i * B))
        {
            sum[i] = sum[i - 1] + cs[i - 1];
            dp[i] = 1.0 * sum[i] / (A + i * B);
        }
        else
        {
            sum[i] = sum[i - 1];
            dp[i] = dp[i - 1];
        }
    }
    writeln(cast(int)dp[n]);
}

Measured memory_bytes: 1064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll ama1[200010],ama2[200010];
int main() {
	ll n;
	cin>>n;
	string s;
	cin>>s;
	ll cnt=0;
	for(ll i=0;i<n;i++){
		if(s[i]=='1'){
			cnt++;
		}
	}
	ll cnt1=cnt+1;
	ll cnt2=cnt-1;
	string t=s;
	ama1[0]=1%cnt1;
	for(ll i=1;i<200010;i++){
		ll now=ama1[i-1]*2;
		ama1[i]=now%cnt1;
	}
	if(cnt2!=0){
	ama2[0]=1%cnt2;
	}
	for(ll i=1;i<200010;i++){
		if(cnt2==0){
			continue;
		}
		ll now=ama2[i-1]*2;
		ama2[i]=now%cnt2;
	}	
	reverse(t.begin(),t.end());
	ll ans1=0,ans2=0;
	for(ll i=0;i<n;i++){
		if(t[i]=='1'){
			ans1+=ama1[i];
			ans1%=cnt1;
		}
	}
	for(ll i=0;i<n;i++){
		if(cnt2==0){
			continue;
		}
		if(t[i]=='1'){
			ans2+=ama2[i];
			ans2%=cnt2;
		}
	}	
//	cout <<ans1;
	ll fi[200010];
	for(ll i=0;i<n;i++){
		ll now1=0;
		if(t[i]=='0'){
			now1=ans1;
			now1+=ama1[i];
			now1%=cnt1;
		}
		else{
			if(cnt2==0){
				fi[i]=0;
				continue;
			}
			now1=ans2;
			now1-=ama2[i];
			now1%=cnt2;
			if(now1<0){
				now1+=cnt2;
			}
		}
		if(now1==0){
			fi[i]=1;
			continue;
		}
		ll aa=1;
		while(now1!=0){
			ll cnnt=0;
			ll now=now1;
			while(now!=0){
				if(now%2!=0){
				cnnt++;
				}
				now/=2;
			}
			now1%=cnnt;
			aa++;
		}
		fi[i]=aa;
	}
	for(ll i=n-1;i>=0;i--){
		cout << fi[i]<<endl;
	}
//	cout <<cnt;
	// your code goes here
	return 0;
}

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

int main(){
  int N,count=0;
  cin >> N;
  int A=N;
  for(int i=0;i<9;i++){
    count+=A%10;
    A/=10;
  }
  
  if(N%count==0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

namespace kyoupuro {

    class MainClass {

        public static void Main() {
            var startX = Input.NextInt();
            var startY = Input.NextInt();
            var goalX = Input.NextInt();
            var goalY = Input.NextInt();

            Console.Write(Enumerable.Repeat('U', goalY - startY).ToArray());
            Console.Write(Enumerable.Repeat('R', goalX - startX).ToArray());
            Console.Write(Enumerable.Repeat('D', goalY - startY).ToArray());
            Console.Write(Enumerable.Repeat('L', goalX - startX).ToArray());
            Console.Write('L');
            Console.Write(Enumerable.Repeat('U', goalY - startY + 1).ToArray());
            Console.Write(Enumerable.Repeat('R', goalX - startX + 1).ToArray());
            Console.Write('D');
            Console.Write('R');
            Console.Write(Enumerable.Repeat('D', goalY - startY + 1).ToArray());
            Console.Write(Enumerable.Repeat('L', goalX - startX + 1).ToArray());
            Console.Write('U');
        }
    }

    class Input {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }

        public static void Skip(int line = 1) {
            enumerator.Reset();
            for (int i = 0; i < line; i++) Console.ReadLine();
        }

        public static void Reset() {
            enumerator.Reset();
        }
    }
}

Measured memory_bytes: 13268
n,x,y=map(int,input().split())

kdic={}
for a in range(1,n):
    kdic[a]=0
for i in range(1,n+1):
    for j in range(i+1,n+1):
        tmp=min(j-i,abs(j-x)+abs(y-i)+1,abs(j-y)+abs(i-x)+1)
        kdic[tmp]=kdic[tmp]+1

for i in range(1,n):
    print(kdic[i])




Measured memory_bytes: 3572
#include <stdio.h>

int main(void)
{
  int n, i;
  char a[100];
  char b[100];
  char c[100];
  int count = 0;

  scanf("%d", &n);
  scanf("%s", a);
  scanf("%s", b);
  scanf("%s", c);

  for (i = 0; i < n; i++) {
    if (a[i] == b[i] && b[i] == c[i]);
    else if (a[i] != b[i] && b[i] != c[i] && c[i] != a[i])
      count += 2;
    else
      count++;
  }

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

  return 0;
}


Measured memory_bytes: 128
n=gets.chomp.to_i
a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
c=gets.split.map(&:to_i)
sum=0
n.times do |i|
  sum += b[a[i]-1]
end
sum1=0
a.each_cons(2) do |k,m|
  if m-k==1 then
    sum1 += c[k-1]
  end
end
print sum+sum1


Measured memory_bytes: 1788
n = int(input())
MOD = 10**9+7
d = {"A":0, "C":1, "G":2, "T":3}
dic = {}
dic_r = {}
for i0 in "ACGT":
    for i1 in "ACGT":
        for i2 in "ACGT":
            v = 4**2*d[i2] + 4*d[i1] + d[i0]
            k = i2+i1+i0
            dic[k] = v
            dic_r[v] = k

dp = [[0] * 64 for i in range(n)]
for i in range(64):
    dp[0][i] = 1
dp[0][dic["AGC"]] = 0
dp[0][dic["ACG"]] = 0
dp[0][dic["GAC"]] = 0
for i in range(n-3):
    for j in range(64):
        v = dic_r[j]
        for s in "ACGT":
            # AG*C
            if v[0] == "A" and v[1] == "G":
                if s != "C":
                    new = v[1]+v[2]+s
                    dp[i+1][dic[new]] += dp[i][dic[v]]
            # A*GC
            elif v[0] == "A" and v[2] == "G":
                if s != "C":
                    new = v[1]+v[2]+s
                    dp[i+1][dic[new]] += dp[i][dic[v]]
            # *GAC
            elif v[1] == "G" and v[2] == "A":
                if s != "C":
                    new = v[1]+v[2]+s
                    dp[i+1][dic[new]] += dp[i][dic[v]]
            # *ACG
            elif v[1] == "A" and v[2] == "C":
                if s != "G":
                    new = v[1]+v[2]+s
                    dp[i+1][dic[new]] += dp[i][dic[v]]
            # *AGC
            elif v[1] == "A" and v[2] == "G":
                if s != "C":
                    new = v[1]+v[2]+s
                    dp[i+1][dic[new]] += dp[i][dic[v]]
            else:
                new = v[1] + v[2] + s
                dp[i+1][dic[new]] += dp[i][dic[v]]
    continue
print(sum(dp[n-3])%MOD)




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

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  if (n % 2) {
    cout << b[n / 2] - a[n / 2] + 1 << endl;
  } else {
    cout << (b[n / 2 - 1] + b[n / 2]) - (a[n / 2 - 1] + a[n / 2]) + 1 << endl;
  }
}


Measured memory_bytes: 4840
#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 int long long

bool solve() {
    int N;
    cin >> N;
    if (N == 0) return false;
    // int ok = 0, ng = 1e9;
    int x = 0, mx = 0;
    for (int d = 1; d * d <= 2 * N; d++) {
        if ((2 * N) % d != 0) continue;
        int t = (2 * N) / d;
        if (t - d + 1 <= 0) continue;
        if ((t - d + 1) % 2 == 0) {
            if (d > mx) {
                mx = d;
                x = (t - d + 1) / 2;
            }
        }
    }
    cout << x << " " << mx << endl;
    return true;
}
signed main() {
    while (solve())
        ;
}


Measured memory_bytes: 3048
# https://atcoder.jp/contests/abc146/tasks/abc146_d

n = int(input())

graph = [[] for _ in range(n)]
edges = {}
for i in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)
    edges[(a, b)] = i
    edges[(b, a)] = i

ans = [0] * (n - 1)
stack = [0]
visited = [-1] * n
visited[0] = 0
while stack:
    node = stack.pop()
    color = 1
    for p in graph[node]:
        if visited[p] < 0:
            if visited[node] == color:
                color += 1
            visited[p] = color
            t = edges[(p, node)]
            ans[t] = color
            stack.append(p)
            color += 1

print(max(ans))
for a in ans:
    print(a)


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

#define sz(x) int(x.size())
#define Task "abc"
#define For(i, a, b) for(int i = (a), _b = (b); i <= b; ++i)
#define All(x) (x).begin(), (x).end()
#define mp make_pair

typedef long long ll;

const int maxn = 2e5 + 10;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
//  freopen(Task".inp", "r", stdin);  freopen(Task".out", "w", stdout);
  ll ans = 0;
  int n; cin >> n;
  for (int i = 1; i <= n; ++i){
    if (i % 3 && i % 5) ans += i;
  }
  cout << ans;
}




Measured memory_bytes: 3616
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)2e5 + 5;

int a[4];
int b[4];

int main() {
	while (cin >> a[0]) {
		rep(i, 3) {
			cin >> a[i+1];
		}
		rep(i, 4) {
			cin >> b[i];
		}
		int hit_n = 0;
		rep(i, 4) {
			if (a[i] == b[i]) hit_n++;
		}
		int blow_n = 0;
		rep(i, 4) rep(j, 4) {
			if (i == j) continue;
			if (a[i] == b[j]) blow_n++;
		}
		cout << hit_n << " " << blow_n << endl;
	}
	return 0;
}

Measured memory_bytes: 2984
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
int c_cnt;
string s;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

void solve() {
    cin >> s;
    if (s.at(0) != 'A') {
        cout << "WA" << endl;
        return;
    }
    for (int i = 2; i < s.length() - 1; ++i) {
        if (s.at(i) == 'C') {
            c_cnt++;
        }
    }
    if (c_cnt != 1) {
        cout << "WA" << endl;
        return;
    }
    if (s.at(1) >= 'A' && s.at(1) <= 'Z') {
        cout << "WA" << endl;
        return;
    }
    for (int i = 3; i < s.length(); ++i) {
        if (s.at(i) >= 'A' && s.at(i) <= 'Z') {
            if (s.at(i) == 'C' && (i >= 3 && i <= s.length() - 2)) {
                continue;
            }
            cout << "WA" << endl;
            return;
        }
    }
    cout << "AC" << endl;
    return;
}
//逆元を求める関数
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(int args, char* argv[]) {
    solve();
}



Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"
int main()
{
	
	string s;
	cin>>s;
	int n = s.size();
	set<char>st;
	for0(i,n) st.insert(s[i]);
	if(st.size()<n) pf("no");
	else pf("yes");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <functional>
#include <queue>
//#include <stack>
#include <climits>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
using namespace std;
typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> P;

int n;
string w[110];

int main() {
    cin >> n;
    REP(i,n){
        cin >> w[i];
    }
    string res = "Yes";
    REP(i,n-1){
        int l = w[i].size();
        if(w[i][w[i].size()-1]!=w[i+1][0]){
            res = "No";
        }
    }
    REP(i,n){
        FOR(j,i+1,n){
            if(w[i]==w[j]){
                res = "No";
            }
        }
    }
    put(res);
    return 0;
}


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

typedef long long ll;
const ll MOD = 1e9+7;
int cnt[26];
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    string s;
    cin>>s;
    int n=s.length();
    if(s=="zyxwvutsrqponmlkjihgfedcba"){
        cout<<-1;
        return 0;
    }
    if(n<26){
        for(int i=0;i<n;i++)cnt[s[i]-'a']++;
        cout<<s;
        for(int i=0;i<26;i++){
            if(cnt[i]==0){
                char c=(char)'a'+i;
                cout<<c;
                return 0;
            }
        }
    }else{
        for(int i=0;i<n;i++){
            cnt[s[i]-'a']++;
        }
            for(int i=n-1;i>=0;i--){
                for(char c=s[i]+1;c<='z';c++){
                    if(cnt[c-'a']==0){
                        for(int j=0;j<i;j++){
                            cout<<s[j];
                        }
                        cout<<c;
                        return 0;
                    }
                }
                cnt[s[i]-'a']--;

            }
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){

	int t = 0;
	scanf("%d", &t);

	int h = t/3600;
	int m = (t-h*3600)/60;
	int s = t - (h*3600 + m * 60);

	printf("%d:%d:%d\n", h, m, s);

	return 0;
}


Measured memory_bytes: 2148
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

//定数
#define MOD 1000000007
//マクロ
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

#define vsort(v) sort((v).begin, (v).end);


typedef unsigned long long int ull;
typedef long long lint;

using namespace std;














int main(){
    int N;
    string S;
    int i=0;

    //入力
    cin >> N;
    cin >> S;

    while(i < S.length()){
        if(S[i]+N > 90) S[i] += N - 26;
        else            S[i] += N;
        i++;
    }
    cout << S << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a + b  == c + d){
    cout << "Balanced" << endl;
  }
  
  else if (a + b > c + d) {
  cout << "Left" << endl;
  }
  else if (a + b < c + d) {
  cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>



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

using namespace std;
string s;

int main(){
  cin >> s;
  REP(i,s.size()){
    if(i%2==0) cout << s[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int n, q;
    long long ans;
    ans = 0;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    for(int i=0; i<n; ++i){
        cin >> a[i];
    }
    for(int i=0; i<n; ++i){
        cin >> b[i];
    }
    for(int i=0; i<n; ++i){
        cin >> c[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    // search
    for(int i=0; i<n; ++i){
        q = b[i];
        auto p = upper_bound(a.begin(), a.end(), q-1) - a.begin();
        auto r = c.end() - lower_bound(c.begin(), c.end(), q+1);
        // cout << p << ":" << r << endl;
        ans += p * r;
    }
    cout << ans << endl;
}

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

using namespace std;



int main() {
	int n;
	ios::sync_with_stdio(0);
	cin >> n;
	bool flag = 0;
	int cnt = 0;
	for(int i = 0 ; i < n ; i++) {
		int a , b;
		cin >> a >> b;
		if(a == b) {
			cnt++;
		}
		else {
			cnt = 0; 
		}
		if(cnt >= 3) {
			flag = 1;
			break;
		}
	}
	if(flag)cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 3652
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

func main() {
    buf := make([]byte, 0)
    sc.Buffer(buf, 4000000)
    sc.Split(bufio.ScanWords)
    s := nextString()
    
    answer := true
    for i := 0; i < len(s); i++ {
        if i % 2 == 0 {
            switch s[i]{
            case 'R': 
            case 'U':
            case 'D':
            default: answer = false
            }
        } else {
            switch s[i]{
            case 'L': 
            case 'U':
            case 'D':
            default: answer = false
            }
        }
    }
    
    if answer == true {
        fmt.Println("Yes")
    } else {
        fmt.Println("No")
    }
}

Measured memory_bytes: 640
#include<stdio.h>

int main(void){
    int n;
    int i;

    scanf("%d",&n);

    int d[n];

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

    int num[1000000] = {};
    
    for(i=0;i<n;i++){
        num[d[i]] ++;
    }

    for(i=0;i<n-1;i++){
        num[d[i]*10 + d[i+1]] ++;
    }

    for(i=0;i<n-2;i++){
        num[d[i]*100 + d[i+1]*10 + d[i+2]] ++;
    }
    
    /*for(i=0;i<200;i++){
        printf("%d %d\n",i,num[i]);
    }*/

    for(i=0;i<1000000;i++){
        if(num[i] == 0){
            printf("%d\n",i);
            break;
        }
    }


    return 0;
}


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

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

    int a = 0, b = 0, c = 0;
    rep(i, S.size()) {
        if (S[i] == 'a') ++a;
        if (S[i] == 'b') ++b;
        if (S[i] == 'c') ++c;
    }
    if (max({a, b, c}) - min({a, b, c}) <= 1)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int ans = 0;
  for(int i = 1; i < N; i++) {
    if(N % i == 0) {
    ans += N / i - 1;
    }
    else {
      ans += N / i;
    }
  }
  cout << ans;
}

Measured memory_bytes: 3636
import sys
import math

#https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

ans = "Yes"
N = ini()
words = []
for _ in range(N):
    words.append(input())


if len(words) != len(set(words)):
    ans = "No"

for i in range(N-1):
    if words[i][len(words[i])-1] != words[i+1][0]:
        ans = "No"

print(ans)



Measured memory_bytes: 9208
import numpy as np

S = np.array(list(input()))
num_x = np.count_nonzero(S == 'x')
# print(f'{num_x=}')
A = [s for s in S if s != 'x']
# print(f'{S=}, {A=}')

if len(A) % 2 == 0:
    L = A[:len(A) // 2]
    R = A[len(A) // 2:][::-1]
else:
    L = A[:len(A) // 2]
    R = A[len(A) // 2 + 1:][::-1]
# print(f'{L=}, {R=}')
if not np.all(L == R):
    print(-1)
    exit()
# if len(L) == 0 and len(R) == 0:
#     print(0)
#     exit()

reverse_S = S[::-1]
i = 0
j = 0
# 真ん中までSとreverse_Sを進めていってXの数が足りない分それぞれ足す
# x以外の文字でsplitをする？'x' '' 'x' ''

T = []
subset = ''
for s in S:
    # print(f'{subset=}')
    if s == 'x':
        subset += 'x'
    else:
        T.append(subset)
        subset = ''
T.append(subset)
len_T = np.array([len(t) for t in T])
# print(f'{T=}, {len_T=}, {len_T - len_T[::-1]}')
ans = np.abs(len_T - len_T[::-1]).sum() // 2
print(ans)


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

int n;
int ary[200];

int main()
{
    cin >> n;
    for(int i=0;i<n;i++) cin >> ary[i];

    int res = 0;
    bool flag = true;
    int count = 0;

    while(true) {
        for (int i=0;i<n;i++) {
            if (ary[i]%2 == 0) {
                ary[i] /= 2;
            } else {
                flag = false;
                break;
            }
        }
        if (flag) {
            count ++;
        } else {
            break;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include <math.h>
#include<vector>
#include<stack>
#include<malloc.h>
#define INF 0x3f3f3f3f
#define maxn 2000006
using namespace std;
int vis1[26],vis2[27];
char a[maxn],b[maxn];
int maps[26][26];
int main()
{  int i;
       cin>>a>>b;
       int couts=0;
     int l=strlen(a);
     memset(vis1,0,sizeof(vis1));
      memset(vis2,0,sizeof(vis2));
     for(i=0;i<l;i++)
     {
        vis1[a[i]-'a']++;
        vis2[b[i]-'a']++;
     }
     sort(vis1,vis1+26);sort(vis2,vis2+26);
      for(i=0;i<26;i++)
      {
          if(vis1[i]!=vis2[i])
            break;
      }
      if(i==26)
        cout<<"Yes";
      else
        cout<<"No";
      cout<<endl;

 return 0;
}


Measured memory_bytes: 640
from sys import stdin 
s = stdin.readline().rstrip()
a = [0] * (len(s) + 1)
t = 1
for i in range(len(s)):
    if i == 0:
        if s[i] == '<':
            k = 0
        else:
            k = 1
    if s[i] == '<' and k == 0:
        a[i+1] = a[i] + 1
    elif s[i] == '<' and k == 1:
        if a[i] < 0:
            min = (-1) * a[i]
            a[i] = 0
            for j in range(t, i):
                a[j] += min
            if t > 1:
                if a[t-2] > a[t]:
                    a[t-1] = a[t-2] + 1
                else:
                    a[t-1] = a[t] + 1
            else:
                a[t-1] = a[t] + 1
        else:
            a[i] = 0
        a[i+1] = a[i] + 1
        k = 0
    elif s[i] == '>' and k == 1:
        a[i+1] = a[i] - 1
    elif s[i] == '>' and k == 0:
        a[i+1] = 0
        t = i+1
        k = 1
    if i == len(s)-1 and s[i] == '>':
        if a[i+1] < 0:
            min = (-1) * a[i+1]
            a[i+1] = 0
            for j in range(t, i+1):
                a[j] += min
        if t > 1:
            if a[t-2] > a[t]:
                a[t-1] = a[t-2] + 1
            else:
                a[t-1] = a[t] + 1
        else:
            a[t-1] = a[t] + 1
print(sum(a))

Measured memory_bytes: 48584
n = int(input())
a1 = input().split()
a2 = input().split()
a1 = [int(x) for x in a1]
a2 = [int(x) for x in a2]
ans = 0
for i in range(n):
    ans = max(ans, sum(a1[0:i+1]) + sum(a2[i:n]))
print(ans)

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

using namespace std;

int main(){
    int n;
    cin>>n;
    int cnt = 0;
    while (n--){
        int x , y;
        cin>>x>>y;
        if (x == y)
            cnt++;
        else
            cnt = 0;
        if (cnt>=3){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;

#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

int n, m, d[200000], t[200000];

int main(int argc, char **argv) {
	cin >> n;
	REP(i, n) cin >> d[i];
	cin >> m;
	REP(i, m) cin >> t[i];
	sort(d, d + n);
	sort(t, t + m);
	int a = 0, b = 0;
	REP(i, m) {
		while (a < n && d[a] < t[b]) ++a;
		if (a >= n || d[a] > t[b]) break;
		++a; ++b;
	}
	cout << (b == m ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <random>
#include <cassert>
#include <algorithm>    
#include <iostream>
#include <chrono>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <bitset>
#define pb push_back
#define mk make_pair
#define eb emplace_back
#define eps 1e-8
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
// #define int long long


using namespace std;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef tuple<int, int, int> tiii;
typedef vector<int> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const long long INF = 1e18;
const int M = 1e9 + 7;





signed main()
{
	char s[200];
	cin >> (s + 1);
	int n = strlen(s + 1);
	for(int i = 1; i <= n; ++i) {
		if(i & 1) {
			if(s[i] == 'L') {
				cout << "No" << endl;
				return 0;
			}
		} else {
			if(s[i] == 'R') {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;



    
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string>
#include<vector>
#include<tuple>
#include<stack>
#include<iomanip>
#include<map>
using namespace std;
//def lib
#define rep(i,n) for(int i=0;i<((int)n);i++)
#define drep(i,n) for(int i=((int)n)-1;i>-1;i--)
#define Rep(i,n0,n) for(int i=n0;i<((int)n);i++)
#define dRep(i,n0,n) for(int i=((int)n)-1;i>n0-1;i--)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<((int)n);j++)
#define W(x) cout<<x<<endl;
#define print(x) cout<<x<<endl;
#define Debug(x) cout<<"#DEBUG "<<x<<endl;
#define INF (1<<29)
#define INF2 (long long)8*(long long)INF*(long long)INF
#define mod 1000000007
//def end
typedef long long ll;
// lib
int min(int x,int y){if(y<x)return y;else return x;}
int max(int x,int y){if(y>x)return y;else return x;}
int fact(int x){int i=1;rep(j,x){i*=(j+1);} return i;}
int mfact(int x){int i=1;rep(j,x){i*=(j+1);} return i%mod;}
int modulo(int x){return x%mod;}
long long fact(long long x){long long i=1;rep(j,x){i*=(j+1);} return i;}
long long mfact(long long x){long long i=1;rep(j,x){i*=(j+1);} return i%mod;}
long long modulo(long long x){return x%mod;}
int gcd(int x, int y){if(x%y==0)return y;else if(y%x==0)return x;else return gcd(x%y,y%x);}
ll gcd(ll x, ll y){if(x%y==0)return y;else if(y%x==0)return x;else return gcd(x%y,y%x);}
void say(bool x){if(x){cout<<"Yes"<<endl;}else {cout<<"No"<<endl;}return;}
//lib end
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1};
int main()
{
    int n;
    cin >> n;
    vector<pair<int, int>> red(n);
    vector<pair<int, int>> blue(n);
    for(int i=0; i<n; i++){
        cin>>red[i].second>>red[i].first;
    }
    for(int i=0; i<n; i++){
        cin>>blue[i].first>>blue[i].second;
    }
    sort(red.begin(),red.end());
    sort(blue.begin(),blue.end());
    bool red_use[n], blue_use[n];
    int ans=0;
    for(int i=0; i<n; i++){
        red_use[i]=true;
        blue_use[i]=true;
    }
    for(int i=0; i<n; i++){
        for(int j=n-1; j>-1; j--)if(blue_use[i]){
            if(((red[j].first<blue[i].second)&&(red[j].second<blue[i].first))&&red_use[j]){
                red_use[j]=false;
                blue_use[i]=false;
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
ll dp[22][1<<21];
ll mod = 1e9+7;
int main(){
    int n;
    cin >> n;
    int a[21][21];
    rep(i,n){
        rep(j,n){
            cin >> a[i][j];
        }
    }
    dp[0][0] = 1;
    rep(i,n){
        rep(j,1<<n){
            if(dp[i][j]==0)continue;
            rep(k,n){
                if(a[i][k] == 1 and (j|1<<k)!=j){
                    dp[i+1][j|1<<k] = (dp[i][j] + dp[i+1][j|1<<k]) % mod;
                }
            }
        }
    }
    cout << dp[n][(1<<n)-1] << endl;
}

Measured memory_bytes: 309504
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

#define MAX_N 400

int n;
ll a[MAX_N];
ll sum[MAX_N + 1];
ll dp[MAX_N][MAX_N];

ll get(int l, int r){
    return sum[r + 1] - sum[l];
}

ll rec(int l, int r){
    if(dp[l][r] != -1) return dp[l][r];
    if(l == r) return dp[l][r] = 0;
    ll res = LINF;
    for(int i = l; i < r; i++){
        res = min(res, rec(l, i) + rec(i + 1, r) + get(l, r));
    }
    return dp[l][r] = res;
}

signed main(){
    cin >> n;
    REP(i,n){
        cin >> a[i];
    }
    sum[0] = 0;
    for(int i = 0; i < n + 1; i++){
        sum[i + 1] = sum[i] + a[i];
    }
    memset(dp, -1, sizeof(dp));
    cout << rec(0, n - 1) << endl;
    return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <cstring>
#include <tuple>
#include <vector>
#include <map>
#include <iterator>
#include <cmath>

using namespace std;
using lint = long long int;


int main() {
	int a;
	string s;

	cin >> a >> s;
	if (a >= 3200)
		cout << s;
	else
		cout << "red";

	return 0;
}

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

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

  if(a== b + c or b == c+a or c == a + b){
  cout << "Yes" << endl;
  }else{
  cout << "No" << endl;
  }
  return 0;
  }
int max(int x, int y){
  if(x < y){
  return y, x;
  }else{
  return x, y;
  }
}


Measured memory_bytes: 256