akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
using namespace std;

int N, D, T;
int speed;
int dp[1002][1000] ;
int num;
int box;
int ans;


int main() {
	cin >> N >> D >> T;
	for (int i = 0; i < N; i++) {
		cin >> speed;
		for (int j = 0; j < T; j++) {
			dp[j][(speed*(j + 1)) % D]++;
			dp[j + 2][speed*(j + 2) % D]--;
		}
	}
	for (int i = 0; i < D; i++) {
		num = 0;
		box = 0;
		for (int j = 0; j < T; j++) {
			num += dp[j][i];
			//cout << num << " ";
			if (box < num)box = num;
		}
		//cout << "\n";
		ans += box;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 6868
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
// typedef __int128_t Int;
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
using pii = pair<int, int>;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

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

  int W, H;
  cin >> W >> H;
  vector<int> p(W);
  rep(i, 0, W) { cin >> p[i]; }
  vector<int> q(H);
  rep(i, 0, H) { cin >> q[i]; }

  vector<pair<int, int>> v;
  rep(i, 0, W) { v.push_back(pii(p[i], 0)); }
  rep(i, 0, H) { v.push_back(pii(q[i], 1)); }
  sort(all(v));
  int w = 0, h = 0;
  int ans = 0;
  rep(i, 0, v.size()) {
    dump(v[i], W + 1 - w, H + 1 - h);
    if (v[i].second) {
      ans += v[i].first * (W + 1 - w);
      h++;
    } else {
      ans += v[i].first * (H + 1 - h);
      w++;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 8048
n,k=map(int, input().split())
a=list(map(int, input().split()))

mod=10**9+7
cnt_lst_before=[0]*n
cnt_lst_after=[0]*n
cnt_a=0
for i in range(n):
    for j in range(n):
        if i<j and a[i]>a[j]:
            cnt_lst_after[i]+=1
        elif i>j and a[i]>a[j]:
            cnt_lst_before[i]+=1
if k==1:
    print(sum(cnt_lst_after))
else:
    print((sum(cnt_lst_after)*(k*(k+1)//2)+sum(cnt_lst_before)*(k*(k-1)//2)%mod)%mod)


Measured memory_bytes: 3188
K,A,B=map(int,input().split())

if B<=A+2 or K<=A :
    print(K+1)
else:
    if (K-(A-1))%2==0:
        print(A+(B-A)*((K-(A-1))//2))
    else:
        print(A+(B-A)*((K-(A-1))//2)+1)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;

const int N = 2005;
const int md = 1e9 + 7;

int dp[N];

int add(int a, int b) {
	a += b;
	if(a >= md)
		a -= md;
	return a;
}

int solve(int n) {
	if(n < 3) return 0;
	if(dp[n] != -1)
		return dp[n];

	int res = 1;
	for(int i = 3; i <= n; ++i)
		res = add(res, solve(n - i));

	return dp[n] = res;
}

int main() {
	memset(dp, -1, sizeof dp);
	int n; cin >> n;
	cout << solve(n) << '\n';
	return 0;
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int[] a = new int[10];
			char[] s = sc.next().toCharArray();
			for(int i=0;i<10;i++)a[i]=s[i]-'0';
			for(int j=9;j>0;j--){
				int[] b = new int[j];
				for(int i=0;i<j;i++){
					b[i]=(a[i]+a[i+1])%10;
				}
				a = b;
			}
			System.out.println(a[0]);
		}
	}
}

Measured memory_bytes: 17132
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'

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

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);
    string s,t;
    cin>>s>>t;
    int a,b;
    cin>>a>>b;
    string p;
    cin>>p;
    if(s==p) 
        cout<<a-1<<" "<<b<<endl;
    else
        cout<<a<<" "<<b-1<<endl;
}

Measured memory_bytes: 256
import java.util.*;

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

    int n = sc.nextInt();
    String ans = "No";

    for(int i = 1; i < 10; i++){
      for(int j = 1; j < 10; j++){
        if(n == i * j){
          ans = "Yes";
        }
      }
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 23764
n = int(input())
ans = 0

if n >= 10000:
    ans += n - 9999
    ans += 909
    if n == 100000:
        ans -= 1
    print(ans)
    exit()

if n >= 100:
    ans += n - 99
    ans += 9
    if n >= 1000:
        ans -= n-999
    print(ans)
    exit()

if n > 9:
    print(9)
    exit()

print(n)

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

int main() {
 int n;
 cin >> n;
  vector<int> mochi(n);
 for(int i=0;i<n;i++){
   cin >> mochi[i];
 }
 int cnt=0;
 for(int i=0;i<n;i++){
   for(int j=i+1;j<n;j++){
       if(mochi[i]==mochi[j]){
       cnt++;
       mochi[j]=-j;//重複を避けるため適当な値を代入しておく
       }
     }
   }

  cout << n-cnt << endl;
}

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

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
	ll n{0};
	cin>>n;

	ll kyu{0};
	if(n>=400 && n<=599)
		kyu=8;
	else if(n>=600 && n<=799)
		kyu=7;
	else if(n>=800 && n<=999)
		kyu=6;
	else if(n>=1000 && n<=1199)
		kyu=5;
	else if(n>=1200 && n<=1399)
		kyu=4;
	else if(n>=1400 && n<=1599)
		kyu=3;
	else if(n>=1600 && n<=1799)
		kyu=2;
	else
		kyu=1;

	cout<<kyu<<endl;

	return 0;
}



Measured memory_bytes: 3648
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod   1000000007
#define PI 2*acos(0.0)
#define all(r)(r).begin(),(r).end()
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define inf 1000000000000000000
#define N 110
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};


//=============================================ASIFAZAD==============================================
vll pos, neg;
ll p_cnt, n_cnt, z_cnt;
ll n, k;

int nok(ll mid)
{
    mid *= -1;
    int j =0;
    ll s_cnt = 0;
    for(int i = p_cnt-1; i >= 0; i--)
    {
        while( j < n_cnt && neg[j]*pos[i] < mid)
            j++;
        if(j >= n_cnt)
            break;
        s_cnt += n_cnt - j;
    }

    //dbg(mid);
    //dbg(s_cnt);
    return s_cnt >= k;
}

int pok(ll mid)
{
    ll s_cnt = 0;
    int i = 0, j = p_cnt - 1;
    for(; ; i++)
    {
        while(j > i && pos[i]*pos[j] > mid)
            j--;
        if(i >= j)
            break;
        s_cnt += j - i;
    }

    i = 0, j = n_cnt - 1;
    for(; ; i++)
    {
        while(j > i && neg[i]*neg[j] > mid)
            j--;
        if(i >= j)
            break;
        s_cnt += j - i;
    }
    //dbg(mid);
    //dbg(s_cnt);

    return s_cnt >= k;
}


int32_t main()
{
   cin>>n>>k;
   for(int i =0 ; i< n;i++)
   {
       ll x;
       cin>>x;
       if(!x)
            z_cnt++;
       else if(x > 0)
       {
           p_cnt++;
           pos.pb(x);
       }
       else
       {
           n_cnt++;
           neg.pb(-1*x);
       }
   }

//   dbg(p_cnt);
//   dbg(n_cnt);
//   dbg(z_cnt);

    sort(pos.begin(), pos.end());
    sort(neg.begin(), neg.end());

   if(k <= p_cnt*n_cnt)
   {
       ll l = -1*inf, h =-1, mid, ans;

       while(l<=h)
       {
           mid = (l+h)/2;
           if(nok(mid))
           {
               ans = mid;
               h = mid - 1;
           }
           else
                l = mid + 1;
       }
       return cout<<ans, 0;
   }

   k -= p_cnt*n_cnt;

    z_cnt = n - z_cnt;
    ll zer = (n*(n-1)/2) - (z_cnt*(z_cnt-1)/2);
    if(k <= zer)
        return cout<<0, 0;

    k -= zer;


    ll l = 1, h = inf, mid, ans;

    while(l <= h)
    {
        mid = (l+h)/2;
        if(pok(mid))
        {
            ans = mid;
            h = mid - 1;
        }
        else
            l = mid + 1;
    }
    cout<<ans;
    return 0;

}


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

map<char,int>Cnt;
string s;

int main(){
	cin>>s;
	for(int i = 0; i < s.length(); i++) Cnt[s[i]]++;
	for(int i = 'a' ; i <= 'z'; i++){
		if( Cnt[i] % 2 == 1){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
# inputs
ori_text = []
shu_wlist = []
shu_num = 0
while True:
    s = input()
    if s == '-':
        break
    else:
        ori_text.append(s)
        shu_num = input()
        shu_list = []
        for i in range(int(shu_num)):
            shu_list.append(input())
    shu_wlist.append(shu_list)

# output
for j, text in enumerate(ori_text):
    for sh in shu_wlist[j]:
        text = text[int(sh):]+text[:int(sh)]
    print(text)


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

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

    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;
    cout << (e - a > k ? ":(" : "Yay!") << "\n";
}

Measured memory_bytes: 256
from collections import Counter
from itertools import accumulate


def solve(string):
    n, m, *a = map(int, string.split())
    a = list(accumulate(a))

    d = Counter(_a % m for _a in a)
    ans = d[0]
    for v in d.values():
        ans += v * (v - 1) // 2
    return str(ans)


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))


Measured memory_bytes: 69272
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

bool flug1,flug2,flug3,flug4,flug5,flug6,flug7,flug8;
int wild;

int color(int x)
{
  if(x<400) flug1 = true;
  else if(x<800) flug2 = true;
  else if(x<1200) flug3 = true;
  else if(x<1600) flug4 = true;
  else if(x<2000) flug5 = true;
  else if(x<2400) flug6 = true;
  else if(x<2800) flug7 = true;
  else if(x<3200) flug8 = true;
  else if(x>=3200) wild++;

  return 0;
}

int main() {
  int N;
  scanf("%d", &N);
  int a[N];

  // flug1 = false;
  // flug2 = false;
  // flug3 = false;
  // flug4 = false;
  // flug5 = false;
  // flug6 = false;
  // flug7 = false;
  // flug8 = false;


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

  int ans = 0;
  if(flug1 == true) ++ans;
  if(flug2 == true) ++ans;
  if(flug3 == true) ++ans;
  if(flug4 == true) ++ans;
  if(flug5 == true) ++ans;
  if(flug6 == true) ++ans;
  if(flug7 == true) ++ans;
  if(flug8 == true) ++ans;

  if(ans==0) cout << 1 << " ";
  else cout << ans << " ";

  cout << ans+wild << endl;

}



Measured memory_bytes: 256
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

int grid[105][105];

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

    int h, w;
    cin >> h >> w;
    int n;
    cin >> n;
    vector< int > v;
    for( int i = 0; i < n; ++i ) {
        int a;
        cin >> a;
        v.pb( a );

    }

    bool flg = true;
    int hpos = 0, wpos = 0;
    int pos = 0;
    while( pos < v.size() ) {
        grid[hpos][wpos] = pos + 1;
        if( flg ) {
            ++wpos;
            if( wpos == w ) {
                ++hpos;
                wpos = w - 1;
                flg = false;

            }
        } else {
            --wpos;
            if( wpos == -1 ) {
                ++hpos;
                wpos = 0;
                flg = true;

            }
        }

        --v[pos];
        if( v[pos] == 0 ) ++pos;

    }

    for( int i = 0; i < h; ++i ) {
        for( int j = 0; j < w; ++j ) {
            cout << grid[i][j] << " ";

        }
        cout << endl;

    }

    return 0;
}



Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
//	cout << fixed << setprecision(15);
	int n;
	cin >> n;
	string s;
	cin >> s;
	map<char, vector<int>> mp;
	rep(i, n) mp[s[i]].push_back(i);
	rep(i, 10) mp['0'+i].push_back(n);

	int ans = 0;
	for(int i = 0; i < 1000; i++) {
		string t = to_string(i);
		if(i < 10) t = "00" + t;
		else if(i < 100) t = "0" + t;
		int idx_s = 0;
//		int idx_s_pre = 0;
		bool ok = true;
		rep(j, 3) {
//			idx_s_pre = idx_s;
			idx_s = *lower_bound(mp[t[j]].begin(), mp[t[j]].end(), idx_s);
			if(idx_s >= n - (2 - j)) {
				ok = false;
				break;
			}
			else {
				idx_s++;
			}
		}
		if(ok) {
//			cout << t << endl;
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 512
//#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#define FOR(N) for(int i=0;i<N;i++)
#define FOR2(N) for(int j=0;j<N;j++)
using namespace std;
typedef long long ll;


int main() {
	int N;
	ll sum = 0;
	cin >> N;
	FOR(N+1) {
		if ((i % 3) && (i % 5))
			sum += i;
	}
	cout << sum << endl;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>

int main() {
  int n;
  scanf("%d", &n);
  char s[n][11];
  for(int i=0; i<n; i++) scanf("%s", s[i]);
  for(int i=0; i<n-1; i++) {
    if(s[i][strlen(s[i])-1] != s[i+1][0]) {
      printf("No\n");
      return 0;
    }
    for(int j=i+1; j<n; j++) {
      if(strcmp(s[i], s[j])==0){
        printf("No\n");
        return 0;
      }
    }
  }
  printf("Yes\n");
  return 0;
}


Measured memory_bytes: 128
N = int(input())
S = input()
P = []
for i in range(0,N-1) :
    L1 = list(S[:i+1])
    L2 = list(S[i+1:])
    L1 = list(set(L1))
    L2 = list(set(L2))
    p = 0
    for j in range(len(L1)) :
        p += L2.count(L1[j])
    P.append(p)
print(max(P))


Measured memory_bytes: 3064
# coding: utf-8
import sys


def main(argv=sys.argv):
  
    inputs_ = list(input())

    string_ = []

    for input_ in inputs_:

        if input_ == 'B':

            if not string_ == []:
              
                string_.pop(-1)

        else:

            string_.append(input_)

    print(''.join(string_))

    return 0


if __name__ == '__main__':
    sys.exit(main())


Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
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)++)
typedef long long ll;

int N,A,B,C;
int l[10];

int dfs(int n,int a,int b,int c){
    if(n==N){
        if(min(a,min(b,c))>0){
            return abs(a-A)+abs(b-B)+abs(c-C)-30;   
        }else return 1e9;
    }
    int res1 = dfs(n+1,a,b,c);
    int res2 = dfs(n+1,a+l[n],b,c)+10;
    int res3 = dfs(n+1,a,b+l[n],c)+10;
    int res4 = dfs(n+1,a,b,c+l[n])+10;
    return min({res1,res2,res3,res4});
}

int main(){
    cin >> N >> A >> B >> C;
    rep(i,N)cin >> l[i];
    cout << dfs(0,0,0,0) << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
期末試験の成績
https://onlinejudge.u-aizu.ac.jp/challenges/sources/ICPC/Prelim/1632

"""
import sys


def solve(n, m):
    scores = [[int(x) for x in input().split()] for _ in range(m)]
    return max([sum(z) for z in zip(*scores)])


def main(args):
    while True:
        n, m = map(int, input().split())
        if n == 0 and m == 0:
            break
        ans = solve(n, m)
        print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])



Measured memory_bytes: 7712
#include<bits/stdc++.h>
using namespace std;
int main(){
    int h,w;
    cin >> h >> w;
    char c[h][w];
    for(int i=0;i<h;i++)for(int j=0;j<w;j++)cin >> c[i][j];
    int dy[8]={-1,-1,-1,0,0,1,1,1};
    int dx[8]={-1,0,1,-1,1,-1,0,1};
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
        if(c[i][j]=='#')cout << "#";
        else{
            int tmp=0;
            for(int k=0;k<8;k++){
                if(i+dy[k]>=0 && i+dy[k]<h && j+dx[k]>=0 && j+dx[k]<w){
                    if(c[i+dy[k]][j+dx[k]]=='#')tmp++;
                }
            }
            cout << tmp;
        }
    }
    cout << endl;
}
}

Measured memory_bytes: 3600
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)

struct edge{int to,sound;};

int f(string s){
	if(s=="C")return 0;
	if(s=="C#")return 1;
	if(s=="D")return 2;
	if(s=="D#")return 3;
	if(s=="E")return 4;
	if(s=="F")return 5;
	if(s=="F#")return 6;
	if(s=="G")return 7;
	if(s=="G#")return 8;
	if(s=="A")return 9;
	if(s=="A#")return 10;
	if(s=="B")return 11;
	return -1;
}

bool isSame(vector<int> &a, vector<int> &b){
	rep(i,a.size()){
		if(a[i]!=b[i+1])return false;
	}
	return true;
}


int main(){
	int input;
	cin>>input;
	rep(loop,input){
		int n,m;
		scanf("%d %d",&n,&m);
		vector<int> step,song;
		step.pb(-1);	//1-index???????????????
		rep(i,n){
			string s;
			cin>>s;
			step.pb(f(s));
		}
		rep(i,m){
			string s;
			cin>>s;
			song.pb(f(s));
		}
		song.pb(-1);	//????????????????°???????????????????
		
		vector<edge> G[50010];
		rep(i,n)  G[i].pb( edge{(int)i+1,step[i+1]} );
		rep(i,n)  G[i+1].pb( edge{(int)i,(step[i]-1+12)%12} );
		rep(i,n-1)G[i].pb( edge{(int)i+2,(step[i+2]+1)%12} );
		G[n].pb(edge{n+1,-1});
		G[n-1].pb(edge{n+2,-1});
		
		bool f=true;
		
		queue<pii> que;
		que.push(make_pair(0,0));
		while(!que.empty()){
			int pos = que.front().first;
			int num = que.front().second;
			que.pop();
			
			if(n+1-pos>2*(m+1-num))continue;
			
			if(num==m+1){
				cout<<"Yes"<<endl;
				f=false;
				break;
			}
			
			rep(i,G[pos].size()){
				edge e = G[pos][i];
				if(e.sound == song[num]){
					que.push(make_pair(e.to,num+1));
				}
			}
		}
		if(f) cout<<"No"<<endl;
	}
}

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

int main()
{
string s;
cin>>s;
for(int i=0;i<s.size();i++)
{
    if((i+1)%2)
    {
        if(s[i]!='R'&&s[i]!='U'&&s[i]!='D')
        {
            cout<<"No";
            return 0;
        }
    }
    else  {
     if(s[i]!='L'&&s[i]!='U'&&s[i]!='D')
        {
            cout<<"No";
            return 0;
        }
    }
}
cout<<"Yes";
return 0;
}
 


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

int main(void)
{
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    
    for (int i = 1; i <= n; ++i) {
        pair<long long, long long> sg1, sg2;
        
        sg1 = make_pair(1LL * (i - 1) * c + a, 1LL * (i - 1) * d + a);
        sg2 = make_pair(1LL * (n - i) * c + b, 1LL * (n - i) * d + b);
        
        if (sg1.second < sg2.first or sg2.second < sg1.first)
            continue;
        
        cout << "YES";
        return 0;
    }
    
    cout << "NO";
    return 0;
}

Measured memory_bytes: 256
a, b, c, d = map(int, input())

if a + b + c + d == 7:
    print(a, '+', b, '+', c, '+', d, '=', 7, sep='')
elif a + b + c - d == 7:
    print(a, '+', b, '+', c, '-', d, '=', 7, sep='')
elif a + b - c + d == 7:
    print(a, '+', b, '-', c, '+', d, '=', 7, sep='')
elif a + b - c - d == 7:
    print(a, '+', b, '-', c, '-', d, '=', 7, sep='')
elif a - b + c + d == 7:
    print(a, '-', b, '+', c, '+', d, '=', 7, sep='')
elif a - b + c - d == 7:
    print(a, '-', b, '+', c, '-', d, '=', 7, sep='')
elif a - b - c + d == 7:
    print(a, '-', b, '-', c, '+', d, '=', 7, sep='')
elif a - b - c - d == 7:
    print(a, '-', b, '-', c, '-', d, '=', 7, sep='')


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <chrono>
#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define endl '\n'
#define ll long long
#define f first
#define fin cin
#define fout cout
#define int long long
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << endl
#define debug2(x, y) cout << "DEBUG " << x << " " << y << endl
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< endl
#define debug4(x, y, z, o) cout << "DEBUG " << x << " " << y << " " << z<< " " << o << endl
#define all(x) x.begin(), x.end()
#define left vadia
#define lb lower_bound
#define right puta
using namespace std;
using namespace __gnu_pbds;
void setIO(string s) {
  ios_base::sync_with_stdio(0); cin.tie(0); 
  freopen((s+".in").c_str(),"r",stdin);
  freopen((s+".out").c_str(),"w",stdout);
}
typedef pair<ll, ll> pii;
typedef vector<vector<char>> mat;
typedef pair<int, string> pis;
const ll mod = 1e9+7;
const int MAXN = 2e5+5;
const int MAXV = 1e6+5;
typedef vector<int> vi;
typedef pair<int, pair<int, int>> piii;

ll expo(ll a, ll b){
    if(b == 0) 
		return 1;
    ll x = expo(a, b/2);
    return (b & 1 ? ((x*x)%mod*a)%mod : (x*x) % mod);
}

int32_t main() {
	int n;
	cin >> n;
	int ans = expo(10, n);
	ans -=  expo(9, n);
	if(ans < 0)
		ans += mod;
	ans -=  expo(9, n);
	if(ans < 0)
		ans += mod;
	ans += expo(8, n);
	cout << ans%mod << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<unordered_map>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<unordered_set>
#include<set>
#include<map>
#include<queue>
#include<iomanip>
#include<tgmath.h>
#include<stdlib.h>
#include<assert.h>
#include<stdio.h>



#define ll long long
#define MAX_N 300001

/*
_
_._ _..._ . - ',     _.._(`))
'-. `     ' / -._. - '    ', /
)         \            '.
/ _    _ | \
| a    a    /              |
\   . - .;
'-('' ).-', '       ;
'-;           |      .'
\           \    /
| 7.__  _. - \   \
| |  |  ``/ / `  /
/, _|  |   /, _/   /
/, _ / '`-'
*/
using namespace std;





int main()
{
	int c;
	cin >> c;
	cout << 2 * 3.14159 * c;

}

		


Measured memory_bytes: 3792
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int solve(int a,int b,int c,int k)
{
	int sum=0;
	if(a>=k)
	return k;
	if(a<k)
	{
	k=k-a;
	sum=a;
}
if(k>b)
k=k-b;
else
k=b-k;
if(k>c)
{
	k=k-c;
	sum=sum-c;
}
else
{
	sum=sum-k;
}
	return sum;
}

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int l=solve(a,b,c,k);
	cout<<l;
}


Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <cmath> 
using namespace std;

int main()
{
    double a,b,sinB,c,C,S,L,h;
	cin>>a>>b>>C;
	S=0.5*a*b*sin(C*M_PI/180);
	c=sqrt(pow(a,2.0)+pow(b,2.0)-2*a*b*cos(C*M_PI/180));
	L=a+b+c;
	sinB=(2*S)/(a*c);
	h=c*sinB;
	
	printf("%10f\n%10f\n%10f\n",S,L,h);
    return 0;
}

Measured memory_bytes: 1296
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N, M; cin >> N >> M;
  vector<int> v (M+1);
  for(int i = 0; i < N; i++){
    int k; cin >> k;
    for(int j = 0; j < k; j++){
      int t; cin >> t;
      v[t]++;
    }
  }
  int c = 0;
  for(int i = 1; i < M+1; i++){
    if(v[i] == N) c++;
  }
  cout << c << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import static java.lang.System.*;

public class Main{
	public static void main(String[] args) {
		int r,d;
		ArrayList<Integer> x = new ArrayList<Integer>();
		Scanner sc = new Scanner(System.in);
		r = sc.nextInt();
		d = sc.nextInt();
		x.add(sc.nextInt());
		for (int i = 1; i <= 10; ++i) {
			x.add(r * x.get(i - 1) - d);
			out.println(x.get(i));
		}
		sc.close();
	}
}


Measured memory_bytes: 23124
from itertools import permutations
from functools import reduce
l=list(map(int,input().split()))
permutations_list=list(permutations(l))
ans=900
for i in permutations_list:
  ss=0
  for j in range(1,len(i)):
    ss+=abs(i[j]-i[j-1])
  ans=min(ans,ss)
print(ans)



Measured memory_bytes: 3572
// i/o example

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

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int x,y,z;
	cin >> x >> y >> z;
	if(x == y && x == z);
	else {
		int var1 = x;
		x = z;
		z = y;
		y = var1;
	}
	cout << x << ' ' << y << ' ' << z ;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ASC(x) sort(ALL((x)))
#define DESC(x) sort(ALL((x)),greater<ll>())
#define pb push_back



ll modpow(ll a, ll n, ll m)
{
    if(n == 0) return 1;
    ll t = modpow(a, n >> 1, m);
    t = t * t % m;
    if(n & 1) t = t * a % m;
    return t; 
}

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;

    vec inv(200010, 0);
    inv[1] = 1;
    REP(i,2,200010) inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;

    ll nCa = 1, nCb = 1, c;
    REP(i,1,a+1) nCa = (nCa * (n-i+1) % MOD) * inv[i] % MOD;
    REP(i,1,b+1) nCb = (nCb * (n-i+1) % MOD) * inv[i] % MOD;
    c = (modpow(2, n, MOD) - 1- nCa - nCb) % MOD;
    c = (c < 0) ? c + MOD : c;
    PR(c); 

    return 0;
}

/*

nC1 + ... + nCn - nCa - nCb
= 2^n - 1 - nCa - nCb

*/

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

using namespace std;



typedef long long ll;
const long long inf=100000000000000;

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

 ll n,s;
  cin >> n >> s;
  
  
  if(s==n) {
    cout << n+1 << endl; 
    return 0;
  }
  ll m=ceil(sqrt(double(n)));
  ll res=inf;
  for(long long b=2;(b-1)*(b-1)<=n-s;b++){
   ll sum=0,num=n;
    while(num>0){
     sum+=num%b;
     num/=b;
    }
    if(sum==s) res=min(res,b); 
    ll p=(n-s)/(b-1)+1;
     sum=0;
     num=n;
    while(num>0){
     sum+=num%p;
     num/=p;
    }
    if(sum==s) res=min(res,p); 
   }
  
  
  if(res==inf) cout << -1 << endl;
  else cout << res << endl;
}


Measured memory_bytes: 256
# include<stdio.h>

int main(){

  char forecast[3];
  char real[3];
  int res = 0;
  int i;

  scanf("%s", forecast);
  scanf("%s", real);

  for(i = 0; i < 3; i++){
  	if(forecast[i] == real[i]){
      res = res + 1;
    }
  }
  
  printf("%d", res);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll s,w;
    cin>>s>>w;
    if(w>=s)cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;
    return 0;
}


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

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

int main() {
  int n;
  cin >> n;
  int sum_n = findSumOfDigits(n);
  if (n % sum_n == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
x = int(input())
dp = [0]*(x + 105 + 1)
dp[100] = 1 
dp[101] = 1
dp[102] = 1
dp[103] = 1
dp[104] = 1
dp[105] = 1

for i in range(100,x-105+25):
    for j in range(100,106):
        dp[i+j] = max(dp[i] , dp[i+j])

print(dp[x])

Measured memory_bytes: 9504
from sys import stdin
input = stdin.readline
n=int(input())
b=[]
for i in range(n-1):b.append(list(map(int,input().split())))
def BFS(K,edges,N):
  roots=[ [] for i in range(N)]
  for a,b,c in edges:
    roots[a-1]+=[(b-1,c)]
    roots[b-1]+=[(a-1,c)]
  dist=[-1]*N
  stack=[]
  stack.append(K)
  dist[K]=0
  while stack:
    label=stack.pop(-1)
    for i,c in roots[label]:
      if dist[i]==-1:
        dist[i]=dist[label]+c
        stack+=[i]
  return dist
a=BFS(0,b,n)
for i in a:print(0 if i%2==0 else 1)

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

int main() {
  string strAry[6] = {"abc","acb","bac","bca","cab","cba"};
  string S;

  cin >> S;
  bool ok = false;
  for (int i = 0; i < 6; ++i) {
    if (strAry[i] == S) {
      ok = true;
      break;
    }
  }

  if (ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


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

int main(){
  int n,co=0,m=INT_MAX,max=0;
  cin >> n;
  vector <int> h(n);
  
  rep(i,n){
    cin >> h.at(i);
    if(m>h.at(i))
      m=h.at(i);
  }
  co+=m;
  rep(i,n){
    h.at(i)-=m;
    //cout << h.at(i) << endl;
    if(max<h.at(i))
      max=h.at(i);
  }
 // cout << max << endl;
  //cout << co <<endl;
  int i=0;

  
  
  
  rep(j,n){
    
    while(i<n){
      int s=i,f=s,m=INT_MAX;
    while(i<n && h.at(i)!=0){
      m=min(h.at(i),m);
      f=i;
      i++;
      
    }
    //f--;
    i++;
     // cout << "f=" << f << "s=" << s << "m="<< m << endl;
   if(m!=INT_MAX){   
     //cout << "f=" << f << "s=" << s << "m="<< m << endl;
    for(int k=f;k>=s;k--)
      h.at(k)-=m;
    co+=m;
   }
     
 //cout << co << endl;
      
    }
    i=0;
   /* rep(k,n)
     cout << h.at(k) << ' ' ;
   cout << endl;*/
    
  }
  cout << co << endl;
  
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <tuple>
#include <utility>
#include <stdlib.h>
typedef long long LL;
typedef unsigned long long ULL;
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define pb push_back
#define mp make_pair

int main() {
	double w, h, x, y;
	cin >> w >> h >> x >> y;
	double ans1 = w * h / 2.0;
	int ans2 = 0;
	if (x == w / 2 && y == h / 2) {
		ans2 = 1;
	}
	cout << ans1 << " " << ans2 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, l, ans;
int a[100021];
int f[100021];
int main () {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	reverse(a, a + n);
	memset(f, 0x3f, sizeof f);
	for (int i = 0; i < n; i++) {
		int p = upper_bound(f, f + n, a[i]) - f;
		f[p] = a[i];
	}
	l = lower_bound(f, f + n, 0x3f3f3f3f) - f;
	printf("%d", l);
	return 0;
}

Measured memory_bytes: 1024
#!/usr/bin/env ruby

N = gets.chomp.to_i

ac = 0
wa = 0
tle = 0
re = 0

N.times do
  case gets.chomp
  when 'AC' then ac += 1
  when 'WA' then wa += 1
  when 'TLE' then tle += 1
  when 'RE' then re += 1
  end
end

puts "AC x #{ac}"
puts "WA x #{wa}"
puts "TLE x #{tle}"
puts "RE x #{re}"


Measured memory_bytes: 14432
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

const int M=4005;

int sa,sb,sc;
string a,b,c;
vi ab,ac,bc;

int main(){
	cin>>a>>b>>c;
	sa=a.size(),sb=b.size(),sc=c.size();
	ab=ac=bc=vi(2*M,1);
	for(int i=0;i<2*M;i++) for(int j=0;j<sb;j++){
		int I=i-M+j;
		if(0<=I&&I<sa&&a[I]!=b[j]&&isalpha(a[I])&&isalpha(b[j])) ab[i]=0;
	}
	for(int i=0;i<2*M;i++) for(int j=0;j<sc;j++){
		int I=i-M+j;
		if(0<=I&&I<sa&&a[I]!=c[j]&&isalpha(a[I])&&isalpha(c[j])) ac[i]=0;
	}
	for(int i=0;i<2*M;i++) for(int j=0;j<sc;j++){
		int I=i-M+j;
		if(0<=I&&I<sb&&b[I]!=c[j]&&isalpha(b[I])&&isalpha(c[j])) bc[i]=0;
	}
	int res=inf;
	for(int i=0;i<2*M;i++) for(int j=0;j<2*M;j++){
		if(ab[i]&&ac[j]&&j-i<M&&bc[j-i+M]){
			res=min(res,max({sa,i-M+sb,j-M+sc})-min({0,i-M,j-M}));
		}
	}
	cout<<res<<endl;
}

Measured memory_bytes: 384
/*
AizuOnline A0000
Title
*/
#include <stdio.h>
// Select Below
#include <stdlib.h>
#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
#define TOWN 100
#define MAXBRIDGE (TOWN*(TOWN-1)/2)
int n,m;
struct b_st {int a;  //from
  int b;             //to
  int cost;} bridge[MAXBRIDGE];
int c_f[TOWN];
//
comp(void *a,void *b)
{
  return(((struct b_st *)a)->cost - ((struct b_st *)b)->cost);
}
int nearest(int * t_cost)
{
  int i;

  for(i=0;i<m;i++)
    if(c_f[bridge[i].a]+c_f[bridge[i].b]==1)
      {
	*t_cost += bridge[i].cost;
#ifdef DEBUG
	printf("%d %d %d\n",bridge[i].a,bridge[i].b,bridge[i].cost);
#endif
	if(c_f[bridge[i].a])
	  return(bridge[i].b);
	else
	  return(bridge[i].a);
     }
}
int total_cost()
{
  int i,t,t_cost;
  
  c_f[0]=1;t_cost=0;
  for(i=1;i<n;i++)
    {
      t=nearest(&t_cost);
      c_f[t]=1;
    }
  return(t_cost);
}
main()
{
  int i;
  int ret;

  while(EOF!=scanf("%d %d",&n,&m) && (n||m))
    {
      for(i=0;i<m;i++)
	scanf("%d %d %d",&(bridge[i].a),&(bridge[i].b),&(bridge[i].cost));
      memset(c_f,0,sizeof(c_f));
      qsort(bridge,m,sizeof(struct b_st),(__compar_fn_t)comp);
      ret=total_cost();
      printf("%d\n",ret);
    }
return(0);
}

Measured memory_bytes: 652
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

int main() {
  i64 n, x;
  vector<i64> l;
  cin >> n >> x;
  read_n(l, n);
  i64 y = 0;
  i64 ans = 0;
  for (i64 i = 0; i < n; ++i) {
    if (y <= x) ++ans;
    y += l[i];
  }
  if (y <= x) ++ans;
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
n,m = map(int,input().split())
dct = {}
for _ in range(n):
    a,b = map(int,input().split())
    if a in dct:
        dct[a] += b
    else:
        dct[a] = b
dct = sorted(dct.items())
ans,tmp = 0,0
for a,b in dct:
    for _ in range(b):
        if tmp < m:
            ans += a
            tmp += 1
        else:
            print(ans)
            exit()
print(ans)

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

#if __has_include(<local.h>)
#include <local.h>
#endif

using namespace std;

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())
#define ALL(x) (x).begin(),(x).end()

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define IPOW(x,y) LL(pow(x,y))

//Debug
#ifdef LOCAL_H
#define TEST cout << "OK\n"
#define DEBUG(a) a
#else
#define TEST
#define DEBUG(a)
#endif

#ifdef LOCAL_H
[[maybe_unused]]
#endif
const double PI = M_PI;
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const int INF = int(999999999);
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const long long MOD = int(1000000007);

//Settings
#ifdef LOCAL_H
const bool DO_BENCHMARK = true;
#endif
const int DOUBLE_ACCURACY = 15;

#ifndef LOCAL_H
    const bool DO_BENCHMARK = false;
#endif

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t clock_start = clock();
        solve();
        clock_t clock_end = clock();
        const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

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

void solve(){
    int A, B, C;
    cin >> A >> B >> C;
    if(A == B || B == C || A == C){
        if(A == B && B == C){
            cout << "No" << endl;
        }
        else{
            cout << "Yes" << endl;
        }
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
n,m=map(int,input().split())
A=list(map(int,input().split()))
s=sorted(A,reverse=True)[m-1]
t=sum(A)//(4*m)

if sum(A)%(4*m)!=0:
    if s>t:
        ans='Yes'
    else:
        ans='No'
else:
    if s>=t:
        ans='Yes'
    else:
        ans='No'
print(ans)

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

#define int long long
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)x.size())
template <class T> bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> using v = vector<T>;
using P = pair<int, int>;

/*
 *  */

signed main() {
  string s;
  cin >> s;
  int n = sz(s);

  int ans = 0;
  rep(i, 0, n-1){
    if(s[i] != s[i+1]) ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <queue>
#include <vector>
#include <stdint.h>
using namespace std;



int64_t h,w;
priority_queue< pair<int64_t,int64_t>,vector<pair<int64_t,int64_t>>,greater<pair<int64_t,int64_t>>> heap;
uint64_t ans=0;
int64_t oper[2];
int main()
{
    cin>>w>>h;
    oper[0]=w+1;
    oper[1]=h+1;
    for (int i=0;i<w;i++)
    {
     int64_t temp;
     cin>>temp;
     heap.push(make_pair(temp,0));
    }
    for (int i=0;i<h;i++)
    {
     int64_t temp;
     cin>>temp;
     heap.push(make_pair(temp,1));
    }
    while (!heap.empty())
    {
     auto f=heap.top();
     heap.pop();
     ans+=oper[1-f.second]*f.first;
     //cout<<f.first<<' '<<oper[1-f.second]<<' '<<oper[f.second]<<' '<<f.second<<' '<<ans<<endl;
     oper[f.second]--;
    // cout<<f.first<<endl;
    }
    cout<<ans<<endl;
    return 0;
}


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

#define all(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;

int main() {
    ll n; cin >> n;
    V<ll> c(n), s(n), f(n);
    for(int i = 0; i < n; i++) cin >> c[i] >> s[i] >> f[i];

    for(int i = 0; i < n - 1; i++){
        ll sum = 0;
        for(int j = i; j < n - 1; j++){
            if(sum < s[j]){
                sum = s[j];
            }else if(sum % f[j] == 0){
            }else{
                sum += f[j] - (sum % f[j]);
            }
            sum += c[j];
        }
        cout << sum << endl;
    }
    cout << 0 << endl;
}


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

int main()
{
	double x1,x2,y1,y2;
	double dis = 0;
	
	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
	
	dis = sqrt((double)((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)));
	
	printf("%.8f\n",(double)dis);
	
	return 0;
}


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

typedef long long ll;
typedef long double ld; 
typedef double db; 
typedef string str; 

typedef pair<int, int> pi;
typedef pair<ll,ll> pl; 
typedef pair<ld,ld> pd; 

typedef vector<int> vi; 
typedef vector<ll> vl;
typedef vector<ld> vd; 
typedef vector<str> vs; 
typedef vector<pi> vpi;
typedef vector<pl> vpl; 

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound 
#define ub upper_bound 

const int MOD = 998244353;
const ll INF = 1e18;
const int MX = 20;

int N;
int a[MX];
int x[MX][MX], y[MX][MX];

int counter(int X) {
    if (X == 0) return 0;
    return counter(X >> 1) + (X & 1);
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    cin >> N;
    FOR(i, 1, N + 1) {
        cin >> a[i];
        FOR(j, 1, a[i] + 1) {
            cin >> x[i][j] >> y[i][j];
        }
    }
    
    int ans = 0;
    
    for(int bits = 1; bits < (1 << N); bits++) {
        bool ok = true;
        for(int i = 1; i <= N; i++) {
            // Make sure that the honst one is included in the bit
            if(!(bits & (1 << (i - 1)))) continue;
            for(int j = 1; j <= a[i]; j++) {
                if (((bits >> (x[i][j] - 1)) & 1) ^ y[i][j]) ok = false;
            }
        }
        if (ok) ans = max(ans, counter(bits));
    }
    
    cout << ans;
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <array>
#include <string>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define eb emplace_back
#define f first
#define s second
#define sz(x) (ll)x.size()
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> osSet;

using pll = pair<ll, ll>;

const ll maxN = 1e7;
const ll INF = 1e17;
const ll MOD = 1e9 + 7;

ll xs[] = {-1, 1, 0, 0, -1, 1, 1, -1};
ll ys[] = {0, 0, -1, 1, -1, 1, -1, 1};

ll segtree[maxN << 2];
ll lazy[maxN << 2];
ll A[maxN];

inline ll left(ll x){
	return x << 1;
}

inline ll right(ll x){
	return (x<<1) + 1;
}

ll func(ll x){
	return (x*(x+1))/2;
}

ll _pow(ll b, ll p){
	if(p == 0) return 1;
	if(p == 1) return b;
	ll exB = b*b;
	if(p&1) return b*_pow(exB, p/2);
	return _pow(exB, p/2);
}

int main(){
	cin.sync_with_stdio(false);
	cin.tie(0);
	ll t;
	cin >> t;
	if(t >= 400 and t <= 599)
		cout << 8;
	else if(t >= 600 and t <= 799)
		cout << 7;
	else if(t >= 800 and t <= 999)
		cout << 6;
	else if(t >=1000 and t < 1200)
		cout << 5;
	else if(t >= 1200 and t < 1400)
		cout << 4;
	else if(t >= 1400 and t<1600)
		cout << 3;
	else if(t>=1600 and t<1800)
		cout << 2;
	else
		cout << 1;
	return 0;
}

Measured memory_bytes: 3632
using namespace std;
#include<bits/stdc++.h>
#define int long long
#define pb push_back 
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define repa(i,a,b) for (int i=a; i<=b; i++)
#define repd(i,b,a) for (int i=b; i>=a; i--)
#define endl "\n"
//debugging
#define debug1(a) cout<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

const int N = 1e+6+5;
int big = 1e+18+3;
int mod = 1e+9+7;

void debugVector(vector<int>&v)
{
    cout<<"###################"<<endl;
    cout<<"SIZE: "<<v.size()<<endl;
    for (auto it:v)
            cout<<it<<" ";
    cout<<endl;
    cout<<"################"<<endl;
}

signed main()
{
    IOS;
    int ans = 0;
    int rows,columns,k;
    cin>>rows>>columns>>k;

    char grid[rows+1][columns+1];

    repa(i,1,rows)
        repa(j,1,columns)
            cin>>grid[i][j];

    for (int i=0; i<(1LL<<rows); i++ )
    {
        vector<int>bitmaskRow;

        int buf = i;

        while(buf)
            bitmaskRow.pb(buf%2), buf/=2;
        int diff = rows - bitmaskRow.size();
        repa(ii,1,diff)
            bitmaskRow.pb(0);

        for (int j=0; j<(1LL<<columns); j++)
        {
            vector<int>bitmaskColumn;
            int cnt = 0;
            int buff = j;

            while(buff)
                bitmaskColumn.pb(buff%2), buff/=2;
            int difff = columns - bitmaskColumn.size();

            repa(ii,1,difff)
                bitmaskColumn.pb(0);

            char tempGrid[rows+1][columns+1];

            repa(iii,1,rows)
                repa(jjj,1,columns)
                    tempGrid[iii][jjj] = grid[iii][jjj];

            repa(iii,0,rows-1)
                if ( bitmaskRow[iii] )
                {
                    int index = iii + 1;

                    repa(jjj,1,columns)
                        tempGrid[index][jjj] = '2';
                }

            repa(iii,0,columns-1)
                if ( bitmaskColumn[iii] )
                {
                    int index = iii + 1;

                    repa(jjj,1,rows)
                        tempGrid[jjj][index] = '2';
                }

            repa(iii,1,rows)
                repa(jjj,1,columns)
                    cnt+=(tempGrid[iii][jjj]=='#');

            if (cnt==k)
            {
            //    debug2(i,j);
            //    debugVector(bitmaskRow);
            //    debugVector(bitmaskColumn);
                ans++;
            }
        }
    }   

    cout<< ans <<endl;
}

Measured memory_bytes: 3652