akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <limits.h>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <string>
#define ll long long
#define ull unsigned long long
#define ms(a) memset(a,0,sizeof(a))
#define pi acos(-1.0)
#define INF 0x7f7f7f7f
#define lson o<<1
#define rson o<<1|1
const double E=exp(1);
const int maxn=1e6+10;
const int mod=1e9+7;
using namespace std;
int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	cout<<(1+n)*n/2<<endl;
	return 0;
}

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

#if DEBUG
template <typename Iter>
void debug_iter(Iter begin, Iter end);
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T>
void debug(const std::vector<T>& v) {
  debug_iter(v.begin(), v.end());
}
template <typename T>
void debug(const std::set<T>& s) {
  debug_iter(s.begin(), s.end());
}
template <typename T, typename U>
void debug(const std::map<T, U>& m) {
  debug_iter(m.begin(), m.end());
}
template <typename T, typename U>
void debug(const std::pair<T, U>& p) {
  std::cerr << "{";
  debug(p.first);
  std::cerr << ", ";
  debug(p.second);
  std::cerr << "}";
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  debug(value);
  std::cerr << ", ";
  debug(args...);
}
template <typename Iter>
void debug_iter(Iter begin, Iter end) {
  std::cerr << "{";
  for (Iter it = begin; it != end; ++it) {
    if (it != begin) std::cerr << ", ";
    debug(*it);
  }
  std::cerr << "}";
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define wt(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& v) {
  for (T& vi : v) is >> vi;
  return is;
}

template <typename T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

#include <boost/hana/functional/fix.hpp>
auto Fix = [](auto&& f) { return boost::hana::fix(f); };

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

int main() {
  rd(string, s);
  if (s == "RRR") {
    wt(3);
  } else if (s == "SRR" || s == "RRS") {
    wt(2);
  } else if (s == "SSS") {
    wt(0);
  } else {
    wt(1);
  }
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
#define _GLIBCXX_DEBUG
using namespace std;

int main(){
  int64_t n,x,y;
  cin >> n >> x >> y;
  x--;
  y--;
  vector<int64_t> d(n-1);
  for(int64_t i=0;i < n;i++){
    for(int64_t j=i+1;j < n;j++){
      int64_t k = min(abs(i-x)+abs(y-j),abs(i-y)+abs(x-j));
      d[min(k,abs(j-i-1))]++;
    }
  }
  rep(i,n-1){
    cout << d[i] << endl;
  }
  
  
}

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

constexpr int nlim = 500, clim = 30;

int d[clim+1][clim+1], c[nlim+1][nlim+1];
int cost[clim+1][3];

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

  for(int i=1; i<=C; i++)
    for(int j=1; j<=C; j++) cin >> d[i][j];

  for(int i=1; i<=n; i++)
    for(int j=1; j<=n; j++) cin >> c[i][j];

  for(int i=1; i<=n; i++){
    for(int j=1; j<=n; j++){
      for(int k=1; k<=C; k++){
        cost[k][(i+j)%3] += d[c[i][j]][k];
      }
    }
  }

  int ans = INT_MAX;
  for(int i=1; i<=C; i++){
    for(int j=1; j<=C; j++){
      for(int k=1; k<=C; k++){
        if(i == j || j == k || k == i) continue;
        ans = min(ans, cost[i][0] + cost[j][1] + cost[k][2]);
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1280
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
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; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};
 
 
void solve(){
    ll h,w;
    cin>>h>>w;
    string s[1010];
    rep(i,h){
        cin>>s[i];
    }
    rep(i,w+2) cout<<"#";
    cout<<endl;
    rep(i,h){
        cout<<"#"<<s[i]<<"#"<<endl;
    }
    rep(i,w+2) cout<<"#";
    cout<<endl;

    
} 
 
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
     
    ll Q=1;
    // cin>>Q;
    rep(_,Q){
 
        solve();
 
    }
   
 
 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
vector<int> nodes[100100];
int pre[100100] = {0};
int post[100100] = {0};
int ith = 0;
stack<int> re;
void topo(int s)
{
   pre[s] = ++ith;
   for (auto i : nodes[s])
   {
      if (!pre[i])
      {
         topo(i);
      }
   }
   re.push(s);
}
int main()
{
   int e, n;
   cin >> n >> e;
   for (int i = 0; i < e; ++i)
   {
      int x, y;
      cin >> x >> y;
      nodes[x].push_back(y);
   }
   for (int i = 0; i < n; ++i)
   {
      if (!pre[i])
      {
         topo(i);
      }
   }
   while(!re.empty()){
      cout << re.top() << "\n";
      re.pop();
   }
}


Measured memory_bytes: 5900
h, w = map(int, input().split())
s = ""
cnt = [0] * 26
for _ in range(h):
    s = input()
    for i in range(len(s)):
        cnt[ord(s[i]) - ord("a")] += 1
#print(cnt)
c4=0
c2=0
c1=0
if h&1 == 1:
    c2 += w // 2
if w&1 == 1:
    c2 += h // 2
if (h&1 == 1) and (w&1 == 1):
    c1 = 1
c4 += (h//2) * (w//2)
#print(c1,c2,c4)

for i in range(26):
    if c4 <= 0:
        continue
    while cnt[i] >= 4:
        cnt[i] -= 4
        c4 -= 1
for i in range(26):
    if c2 <= 0:
        continue
    while cnt[i] >= 2:
        cnt[i] -= 2
        c2 -= 1
for i in range(26):
    if c1 <= 0:
        continue
    while cnt[i] % 4 == 1 or cnt[i] % 4 == 3:
        cnt[i] -= 1
        c1 -= 1

#print(c1,c2,c4)
if c1==0 and c2==0 and c4==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 64432
a,b,c,k = map(int, input().split())

aa, bb, cc = 0, 0, 0

if a >= k:
    aa = k
else:
    aa = a
    k = k - a
    
    if b >= k:
        bb = k
    else:
        bb = b
        k = k -b

        if c >= k:
            cc = k
        else:
            cc = c
            k = k -c

print(aa -cc)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull; 
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define SQ(a) (a)*(a)

template <class T, class U> ostream& operator<< (ostream &out, pair<T,U> c) { out << "(" << c.first << " "; out << c.second << ")"; return out; }
template <class T> ostream& operator<< (ostream &out, vector<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
template <class T> ostream& operator<< (ostream &out, set<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
const double PI  = 3.141592653589793238463;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vi d(n);
    FOR(i,0,n){
        cin >> d[i];
    }
    set<int> positions;
    int curr = 0, press;
    if(d[0] == 1){
        press = 0;
    }
    else
    {
        press = 1;
    }
    while(true){
        if(d[curr] == 2){
            cout << press;
            break;
        }
        else if(positions.find(d[curr]) == positions.end()){
            positions.insert(d[curr]);
            press++;
            curr = d[curr] -1;
        }
        else{
            cout << -1;
            break;
        }
    }
    cout << endl;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
int n, a[100005], A, x, y;
int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", a + i);
	sort(a + 1, a + n + 1);
	x = a[n];
	A = (x + 1) / 2;
	y = lower_bound(a + 1, a + n, A) - a;
	if (y == n) y--;
	if (y != 1 && abs(x - a[y - 1] * 2) < abs(a[y] * 2 - x)) y--;
	printf("%d %d\n", a[n], a[y]);
	return 0;
}

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

int a[12][12] = { 0 };
void remove(int y, int x) {
	if (y > 11 || x > 11 || y < 0 || x < 0 || a[y][x] == 0) return;
	a[y][x] = 0;
	remove(y + 1, x);
	remove(y - 1, x);
	remove(y, x + 1);
	remove(y, x - 1);
}

int main() {
	string s;
	do {
		for (int i = 0; i < 12; i++) {
			getline(cin, s);
			for (int j = 0; j < 12; j++) {
				a[i][j] = s[j] - '0';
			}
		}

		int count = 0;
		for (int i = 0; i < 12; i++) {
			for (int j = 0; j < 12; j++) {
				if (a[i][j] == 1) {
					remove(i, j);
					count++;
				}
			}
		}
		cout << count << endl;
		getline(cin, s);
	} while (cin);
	return 0;
}

Measured memory_bytes: 3152
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long MOD = 1000000007;
using namespace std;
typedef long long ll;
map<ll, int> mp;
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int m, f, b;
	cin >> m >> f >> b;
	if (m > b) {
		cout << 0 << endl;
	}
	else if (m + f < b) {
		cout << "NA" << endl;
	}
	else {
		cout << b - m << endl;
	}
	return 0;
}


Measured memory_bytes: 3212
A, B, C = list(map(int, input().split()))

cnt = 0
while cnt < 27:
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        break
    tmpA = int(B / 2) + int(C / 2)
    tmpB = int(A / 2) + int(C / 2)
    tmpC = int(A / 2) + int(B / 2)

    cnt += 1
    if tmpA == A and tmpB == B and tmpC == C:
        print("-1")
        quit()
    A = tmpA
    B = tmpB
    C = tmpC

if cnt == 28:
    print("-1")
else:
    print(str(cnt))


Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
	static void Main(string[] args) {
		new Calc().calc();
	}
	public class Calc {
		public Calc() { }
		public void calc() {
			string x = ReadLine<string>();
			int a = x.IndexOf('A');
			int z = x.LastIndexOf('Z');
			(z - a+1).WriteLine();
			return;
		}
	}

	public static T ReadLine<T>() {
		return (T)Convert.ChangeType(Console.ReadLine(), typeof(T));
	}

	public static T[] ReadLine<T>(params char[] separators) {
		return Console.ReadLine()
			.Split(separators)
			.Select(_ => (T)Convert.ChangeType(_, typeof(T)))
			.ToArray();
	}

	public static List<T> ReadLines<T>(int readCount) {
		List<T> rt = new List<T>();
		for (int i = 0; i < readCount; i++) {
			rt.Add(ReadLine<T>());
		}
		return rt;
	}
}
public static class Utils {
	public static string Docking<T>(this IEnumerable<T> s, int sequenceRange, Func<T, string> filter = null) {
		string str = "";
		int c = 0;
		foreach (var item in s) {
			str += filter == null ? item.ToString() : filter(item);
			c++;
			if (c == sequenceRange) break;
		}
		return str;
	}

	public static string Docking<T>(this IEnumerable<T> s, Func<T, string> filter = null) {
		return s.Docking(s.Count(), filter);
	}

	public static string RangeDocking<T>(this IEnumerable<T> s, int start, int end, Func<T, string> filter = null) {
		string str = "";
		end = end < s.Count() ? end : s.Count();
		var items = s.ToArray();
		for (int i = start; i < end; i++) {
			str += filter == null ? items[i].ToString() : filter(items[i]);
		}
		return str;
	}
	public static int IntParse(this string n) {
		return int.Parse(n);
	}
	public static void WriteLine<T>(this IEnumerable<T> list) {
		foreach (var item in list) {
			item.WriteLine();
		}
	}
	public static void WriteLine(this object obj) {
		Console.WriteLine(obj);
	}
	public static void AddTo<T>(this T obj,List<T> list) {
		list.Add(obj);
	}
}

Measured memory_bytes: 11744
#include <iostream>

using namespace std;

#define ll long long int

int main()
{
	int n;
	cin >> n;
	ll sum = 0;
	while(n--) {
		int x = n + 1;
		if(x % 3 == 0 || x % 5 == 0) continue;
		sum += x;
	}
	cout << sum;
	return 0;
}


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

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

    auto lowest = l + 0;
    auto highest = l + n - 1;
    auto eat = 0;
    if (highest < 0)
        eat = highest;
    else if (lowest > 0)
        eat = lowest;
    else
        eat = 0;

    auto sum = (n * l) + (n - 1) * n / 2;

    cout << (sum - eat);
    return 0;
}


Measured memory_bytes: 256
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7

A = LIST()
ans = A.index(0) + 1
print(ans)


Measured memory_bytes: 9188
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstdlib>
#define PI acos(-1)
#define fs first
#define sc second
#define debug freopen("1.in","r",stdin),freopen("1.out","w",stdout);
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const ll maxn = 1e6 + 10, N = 105;
int arr[N][N],a[N],n;
bool test[N][N];

int main() {
	ios;
    for(int i = 0;i < 3; i ++)
        for(int j = 0;j < 3; j ++)
            cin >> arr[i][j];
    cin >> n;
    for(int i = 0;i < n; i ++)
        cin >> a[i];
    for(int i = 0;i < 3; i ++) {
        for(int j = 0;j < 3; j ++) {
            for(int k = 0;k < n; k ++) {
                if(a[k] == arr[i][j]) test[i][j] = 1;
            }
        }
    }
    bool flag = 0;
    for(int i = 0;i < 3; i ++) {
        if(test[i][0] && test[i][1] && test[i][2]) flag = 1;
        if(test[0][i] && test[1][i] && test[2][i]) flag = 1;
    }
    if(test[0][0] && test[1][1] && test[2][2]) flag = 1;
    if(test[0][2] && test[1][1] && test[2][0]) flag = 1;
    if(flag) cout << "Yes";
    else cout << "No";

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main (){
    int n;
    cin >> n;
    float x[n];
    string u[n];
    for( int i=0; i<n; i++){
        cin >> x[i] >> u[i];
    }
    float btc;
    btc = 380000.0;
    float sum;
    sum = 0.0;
    for( int i=0; i<n; i++){
        if(u[i] == "JPY"){
            sum += x[i];
        }else{
            sum += x[i]*btc;
        }
    }
    cout << sum << endl;
}



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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define trep(i, n) for(int i = 0; i <= (n); i++)
#define mfor(i, s, t) for(int i = (s); i < (t); i++)
#define tfor(i, s, t) for(int i = (s); i <= (t); i++)

int d[114514];

int main() {
  int n;
  cin >> n;
  int k = 0;
  int l = 0;
  rep(i, n) {
    int w;
    cin >> w;
    if(i + 1 == w) {
      l++;
    }
    else if(l) {
      k += (l + 1) / 2;
      l = 0;
    }
  }
  if(l == n) {
    k = 1 + (n - 1) / 2;
  }
  else if(l) {
    k += (l + 1) / 2;
  }
  cout << k << endl;
}


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

int main () {
  int m, t, p, r;
  while(true) {
    cin >> m >> t >> p >> r;
    if (m == 0) break;
    vector<vector<int>> b(t);
    vector<vector<int>> c(t);
    for (int i = 0; i < t; i++) {
      b[i].resize(p);
      c[i].resize(p);

      for (int j = 0; j < p; j++) b[i][j] = 10000000;
    }
    for (int i = 0; i < r; i++) {
      int m2, t, p, j;
      cin >> m2 >> t >> p >> j;
      if (j == 0 && m2 <= m) {
        b[t - 1][p - 1] = min(b[t - 1][p - 1], m2);
      } else {
        if (b[t - 1][p - 1] == 10000000)
          c[t - 1][p - 1]++;
      }
    }
    vector<pair<int, int>> ps(t);
    for (int i = 0; i < t; i++) {
      ps[i].first = i;
      for (int j = 0; j < p; j++) {
        ps[i].second += b[i][j];
        if (b[i][j] < 1000) ps[i].second += 20 * c[i][j];
      }
    }
    sort(ps.begin(), ps.end(), [](const pair<int, int> &l, const pair<int, int> &r) {
      if (l.second == r.second) return l.first > r.first;
      return l.second < r.second;
    });
    cout << ps[0].first + 1;
    for (int i = 1; i < t; i++) {
      if (ps[i - 1].second == ps[i].second) cout << "=";
      else cout << ",";
      cout << ps[i].first + 1;
    }
    cout << endl;
  }
  return 0;
}


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

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

  cout << max(a,max(b,c))*9+a+b+c<<endl;
}


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  string s;
  cin >> s;

  if(s == "AAA" || s == "BBB"){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }

  

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX 33
#define inf 1<<29
#define linf (1e16)
#define eps (1e-8)
#define Eps (1e-15)
#define mod 1000000007
#define pi acos(-1.0)
#define phi (1.0+sqrt(5.0))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define pld(a) printf("%.10Lf\n",(ld)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define Unique(v) v.erase(unique(all(v)),v.end())
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<pii> vpi;

int h,w,s,sum=0;
int u[MAX][MAX];
pii mem[MAX][MAX][MAX][MAX];

pii rec(int a,int b,int c,int d){
  if(mem[a][b][c][d].f!=-1)return mem[a][b][c][d];
  int r=0;
  FOR(i,a,c)FOR(j,b,d)r+=u[i][j];
  if(r<sum){
    mem[a][b][c][d]=mp(0,inf);
    return mp(0,inf);
  }
  pii res(1,r);
  FOR(i,a+1,c){
    pii l=rec(a,b,i,d);
    pii r=rec(i,b,c,d);
    l.f+=r.f;
    l.s=min(l.s,r.s);
    res=max(res,l);
  }
  FOR(i,b+1,d){
    pii l=rec(a,b,c,i);
    pii r=rec(a,i,c,d);
    l.f+=r.f;
    l.s=min(l.s,r.s);
    res=max(res,l);
  }
  mem[a][b][c][d]=res;
  return res;
}

int main()
{
  while(cin>>h>>w>>s && h){
    memset(mem,-1,sizeof(mem));
    sum=0;
    FOR(i,0,h){
      FOR(j,0,w){
        cin>>u[i][j];
        sum+=u[i][j];
      }
    }
    sum-=s;
    pii res=rec(0,0,h,w);
    cout<<res.f<<" "<<res.s-sum<<endl;
  }
  return 0;
}

Measured memory_bytes: 12292
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	ll n, k, x;
	cin >> n >> k;
	x = n  % k;
	if(x > k/2){
		x = k - x;
	}
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 384
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

#n = int(input())
#n,k = [int(i) for i in readline().split()]

s = input()

s1 = s[::2]
s2 = s[1::2]

ok = 1
for i in s1:
    if i == "L": ok = 0
for i in s2:
    if i == "R": ok = 0


if ok:
    print("Yes")
else:
    print("No")










Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
long long n;
long long k;
long long a[2000005];
int main()
{
	cin >> n;
    cin >> k;
    int b;
    b = (n+k)/2;
    if(abs(n-b) == abs(k-b)) {
        cout << b;
    } else {
        cout << "IMPOSSIBLE";
    }
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/dp/tasks/dp_b
#include <bits/stdc++.h>
using namespace std;

#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
const ll INF = 1LL << 60;
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; }

int main() {
    // 入力
    ll N,K;cin>>N>>K;
    vector<ll> height(110000);
    vector<ll> dp(110000,INF);
    for( ll i = 0; i < N; i++ ) cin >> height.at(i);

    dp.at(0) = 0;
    for (ll i = 0; i < N; ++i) {
        for (ll j = 1; j <= K ; j++) {
            chmin(dp.at(i+j),dp.at(i)+abs(height.at(i) - height.at(i+j)) );
        }
    }

    cout << dp[N-1] << endl;

    return 0;
}



Measured memory_bytes: 5068
#include <bits/stdc++.h>
#define MAX 100005
using namespace std;

typedef long long ll;

int cs[MAX];

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    string str;
    int n, q, l, r;

    cin>>n>>q;
    cin>>str;

    for(int i = 1; i < n; i++){
        if(str[i] == 'C' && str[i-1] == 'A'){
            cs[i+1] = cs[i] + 1;
        }
        else{
            cs[i+1] = cs[i];
        }
    }

    for(int i = 0; i < q; i++){
        cin>>l>>r;
        cout<<cs[r] - cs[l]<<endl;
    }

    return 0;
}

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

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

int main(){
	int n,i;
	long a[200000],b[200000];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%ld",&a[i]);
		b[i]=a[i];
	}
	qsort(b,n,sizeof(long),compare_int);
	for(i=0;i<n;i++){
		if(a[i]<=b[n/2-1])printf("%ld\n",b[n/2]);
		else printf("%ld\n",b[n/2-1]);
	}
	return 0;
}

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

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

    long long int K, N;

    cin>>K>>N;

    long long int A[N+5];
    for(int i = 0; i < N; i++)
        cin>>A[i];

    priority_queue<long long int> mypq;
    for(int i = 1; i < N; i++)
        mypq.push(A[i] - A[i-1]);

    mypq.push(K - A[N-1] + A[0] - 0);

    long long int ans = 0;
    mypq.pop();
    while(!mypq.empty())
    {

         ans += mypq.top();
         mypq.pop();
    }
    //
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(auto i = (a); i < (b); i++)
#define pb push_back
#define fs first
#define sc second
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

const double EPS = 1e-9;


int main() {
    cin.sync_with_stdio(false);
    int n;
    cin >> n;
    vii A(n);
    rep(i,0,n) cin >> A[i].fs >> A[i].sc;
    vii B;
    int at = 0;
    rep(i,0,n) if(A[i].fs + A[i].sc > A[at].fs + A[at].sc) at = i;
    B.pb(A[at]);
    rep(i,0,n) if(A[i].fs - A[i].sc > A[at].fs - A[at].sc) at = i;
    B.pb(A[at]);
    rep(i,0,n) if(-A[i].fs + A[i].sc > -A[at].fs + A[at].sc) at = i;
    B.pb(A[at]);
    rep(i,0,n) if(-A[i].fs - A[i].sc > -A[at].fs - A[at].sc) at = i;
    B.pb(A[at]);
    int mx = 0;
    rep(i,0,n) rep(j,0,4) {
        mx = max(mx, abs(A[i].fs - B[j].fs) + abs(A[i].sc - B[j].sc));
    }
    cout << mx << endl;
}


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    int n;cin >> n;
    vector<int> h(n);
    int min_h = 100;
    REP(i, n) {
        cin >> h[i];
        min_h = min(min_h, h[i]);
    }
    int ans=min_h;
    REP(i,n){
        h[i] -= min_h;
    }
    int l = 0, r = 0;
    while(true){
        FOR(i,l, n)
        {
            if(h[i]!=0){
                l = i;
                break;
            }
            if(i==n-1){
                l = -1;
            }
        }
        FOR(i,l,n)
        {
            if (h[i] == 0)
            {
                r = i-1;
                break;
            }
            if (i == n - 1)
            {
                r = i;
                break;
            }
        }
        if(l==-1){
            break;
        }
        FOR(i,l,r+1){
            h[i]--;
        }
        //cout << l << " " << r << "\n";
        ans++;
    }



    cout << ans <<"\n";

    return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<LL> a(N);
    for(int i = 0;i < N;i++)    cin >> a[i];
    LL ans = 0;
    sort(a.rbegin(), a.rend());
    for(int i = 0;i < N;i++){
        if(i < N/2) ans += a[i];
        else    ans -= a[i];
    }
    ans *= 2;
    if(N&1){
        LL ans1 = ans+a[N/2]+a[N/2+1];
        LL ans2 = ans-a[N/2-1]+3*a[N/2];
        ans = max(ans1, ans2);
    }else{
        ans += a[N/2]-a[N/2-1];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
/*
 *  author : Atul Anand   
 *  created on : Tue Mar 31 2020
 */

import java.io.*;
import java.util.*;

public class Main{

    public static void main(String[] args) throws IOException {
        int N = in.nextInt();
        int K = in.nextInt();
        int ans = 1;            // 1 digit can store number till K - 1
        long pow = K;
        while((pow - 1) < N){
            pow = pow * K;
            ans++;
        }
        /*
        # Solution 2 -
        int ans = 0;
        while(N > 0){
            N = N/K;
            ans++;
        }
        */
        println(ans);
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);

    static void read(int arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextInt(); 
    	} 
    }
    
    static void read(long arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextLong(); 
    	} 
    }
    
    static void read(String arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.next(); 
    	} 
    }
    
    static void print(Object O) {  
    	out.print(O); 
    }
    
    static void println(Object O) { 
    	out.println(O); 
    }
    
    static void println(int arr[]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		print(arr[i]+" "); 
    	} 
    	println(""); 
    }

    static void println(int arr[][]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		println(arr[i]); 
    	}
    }
    
    static void debug(Object O) { 
    	System.out.println(O); 
    }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    }
    
    double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    }
    
    long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    }
    
    String nextLine() throws IOException { 
        return reader.readLine(); 
    }
    
    void close() throws IOException { 
        reader.close(); 
    }
}

Measured memory_bytes: 23124
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string sS = System.Console.ReadLine().Trim();
            int iK = int.Parse(sS);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iOut = (iK / 2) * ((iK / 2) + iK % 2);

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


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

int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < s.length()/2; i++){
        if(s[i] != s[s.length()-1-i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;

#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) (in),(in)+(K)

#define INF 1e18
#define MOD 1000000007
#define SIZE 10005
#define PI 	3.14159265358979323846

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a, b)*b; } //最小公倍数

ll input(){
  ll a;
  cin >> a;
  return a;
}

vi sub(vector<bool> fin,ll n) {
  vi ret;
  REP(i,n) {
    if(fin.at(i))continue;
    vector<bool> cp = fin;
    cp.at(i) = true;
    vi result = sub(cp,n);
    ret.insert(ret.end(),result.begin(),result.end());
  }
  return ret;
}

int main() {
  ll n;
  cin >> n;
  vi x(n);
  ll minx=INF,maxx=0;
  REP(i,n) {
    cin >>x.at(i);
    minx=min(minx,x.at(i));
    maxx=max(maxx,x.at(i));
  }
  ll ans=INF;
  FOR(i,minx,maxx+1) {
    ll sum=0;
    for(auto j:x) sum+=pow(i-j,2);
    ans = min(ans,sum);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int dp_pos[3000];
int dp_neg[3000];

int main() {
    int n, a; cin >> n >> a;
    vint pos, neg;
    int zeros = 0;
    rep(i,n) {
        int x; cin >> x;
        x -= a;
        if (x > 0) pos.push_back(x);
        if (x < 0) neg.push_back(x);
        if (x == 0) zeros++;
    }
    dp_pos[0] = dp_neg[0] = 1;
    rep(i,pos.size()) {
        for (int j = 2700; j >= 0; j--) {
            dp_pos[j+pos[i]] += dp_pos[j];
        }
    }
    rep(i,neg.size()) {
        for (int j = 2700; j >= 0; j--) {
            dp_neg[j-neg[i]] += dp_neg[j];
        }
    }
    ll ans = 0;
    REP(i,3000) {
        ans += (ll)dp_pos[i] * dp_neg[i] * pow(2,zeros);
    }
    ans += pow(2,zeros) - 1;
    cout << ans << endl;
}

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

int main () {
  string s;
  cin>>s;
  
  int count = 0;
  if (s[0]=='1') {
    count++;
  }
  if (s[1]=='1') {
    count++;
  }
  if (s[2]=='1') {
    count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
#define INF 1e9

static const int seed=6;
static const int D=365;
static const int ntype=26;
static const double swap_rate=0.8;
static const double change_rate=1-swap_rate;
static int ans[D+1];
static int max_score=0;
static int t=1050000;

class Contest{
public:
    Contest(){
        last=0;
    }
    int s[D+1];
    int c;
    int last;
};

static Contest contest[ntype+1];

void Input(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int d;
    cin>>d;
    for(int i=1;i<=ntype;++i){
        int t;
        cin>>t;
        contest[i].c=t;
    }
    for(int day=1;day<=D;++day){
        for(int type=1;type<=ntype;++type){
            int t;
            cin>>t;
            contest[type].s[day]=t;
        }
    }
}

int Score(int type){
    int sum=0;
    contest[type].last=0;
    for(int day=1;day<=D;++day){
        if(ans[day]==type){
            sum+=contest[type].s[day];
            int n=day-contest[type].last;
            sum-=contest[type].c*(n*(n-1)/2);
            contest[type].last=day;
        }
    }
    if(ans[D]!=type){
        int n=D-contest[type].last;
        sum-=contest[type].c*(n*(n+1)/2);
    }
    return sum;   
}

void Output(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    for(int d=1;d<=D;++d) cout<<ans[d]<<'\n';
}

void Init(){
    for(int d=1;d<=D;++d) ans[d]=rand()%ntype+1;
}

void Greedy(){
    vector<int> l(ntype+1,0);
    int score=0;
    for(int d=1;d<=D;++d){
        for(int i=1;i<=ntype;++i) score-=contest[i].c*(d-l[i]);
        int temp=score;
        int t=-1;
        for(int i=1;i<=ntype;++i){
            int k=contest[i].s[d]+contest[i].c*(d-l[i])+score;
            if(k>temp){
                temp=k;
                t=i;
            }
        }
        ans[d]=t;
        l[t]=d;
    }
}

void change(){
    int p=rand()%D+1;
    int before=ans[p];
    int after=rand()%ntype+1;
    int before_score=Score(before)+Score(after);
    ans[p]=after;
    int delta=Score(before)+Score(after)-before_score;
    if(delta>0){ 
        max_score+=delta;
    }
    else ans[p]=before;
}

void swap(){
    int p1=rand()%D+1;
    int p2=rand()%D+1;
    while(p1==p2) p2=rand()%D+1;
    int temp_score=Score(ans[p1])+Score(ans[p2]);
    int temp=ans[p1];
    ans[p1]=ans[p2];
    ans[p2]=temp;
    int delta=Score(ans[p2])+Score(ans[p1])-temp_score;
    if(delta>0){
        max_score+=delta;
    }
    else{
        ans[p2]=ans[p1];
        ans[p1]=temp;
    }
}

void Solve(int times){
    Greedy();
    for(int i=1;i<=ntype;++i) max_score+=Score(i);
    for(int i=0;i<times;++i){
        double p=(double)rand()/RAND_MAX;
        if(p<swap_rate) swap();
        else change();
    }
}

int main(){
    srand(seed);
    Input();
    Solve(t);
    Output();
}


Measured memory_bytes: 3668
import math
N,K = map(int,input().split())
L = [i for i in map(int,input().split())]
#if (N-1) % (K-1) != 0:
  #print(((N-1)//(K-1))+1)
#else:
  #print((N-1) % (K-1)) #equivalent to ceil.
print(math.ceil((N-1)/(K-1)))

Measured memory_bytes: 13812
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

   String nyuA=sc.nextLine();
  // String nyuB=sc.nextLine();
 
  //   String[] s=sc.nextLine().split(" ");
//     String[] e=sc.nextLine().split(" ");

int n=Integer.parseInt(nyuA);

//int N=Integer.parseInt(s[0]);
//int K=Integer.parseInt(s[1]);
int max=0;
int res=0;
for(int i=1;i<=n;i++){
int temp=i;
int count=0;
while(true){
if(temp%2!=0){


if(count>max){
max=count;
res=i;
//System.out.println(count+"--"+res);
}
break;
}//if
temp/=2;
count++;

}//while

}

if(res==0)res=1;

System.out.println(res);

//long H=Long.parseLong(t[0]);
//long W=Long.parseLong(t[1]);
//long C=Long.parseLong(t[2]);


	}
}

Measured memory_bytes: 23508
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define pi pair<ll,ll>
using namespace std;
int main(){
	//	freopen("in.txt","r",stdin);
	ll N,T;
	ll t[200100];
	ll ans=0;
	scanf("%lld%lld",&N,&T);
	for (int i = 0; i < N; ++i)
	{
		scanf("%lld",&t[i]);
	}
	for (int i = 1; i < N; ++i)
	{
		ll tmp = t[i]-t[i-1];
		if(tmp > T) tmp = T;
		ans += tmp;
	}
	ans += T;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int[][] array = new int[3][3];
    String ans = "No";
    for(int i = 0; i < 3; i++){
      array[i][0] = Integer.parseInt(sc.next());
      array[i][1] = Integer.parseInt(sc.next());
      array[i][2] = Integer.parseInt(sc.next());
    }
    int n = Integer.parseInt(sc.next());
    
    for(int k = 0; k < n; k++){
     int bin = Integer.parseInt(sc.next());
      for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
          if(array[i][j] == bin){
            array[i][j] = 0;
          }
        }
      }
    }
    if((array[0][0]==0&&array[0][1]==0&&array[0][2]==0)||(array[1][0]==0&&array[1][1]==0&&array[1][2]==0)||(array[2][0]==0&&array[2][1]==0&&array[2][2]==0)){
    ans = "Yes";
  }
    if((array[0][0]==0&&array[1][0]==0&&array[2][0]==0)||(array[0][1]==0&&array[1][1]==0&&array[2][1]==0)||(array[0][2]==0&&array[1][2]==0&&array[2][2]==0)){
    ans = "Yes";
  }
  if((array[0][0]==0&&array[1][1]==0&&array[2][2]==0)||(array[0][2]==0&&array[1][1]==0&&array[0][2]==0)){
    ans ="Yes";
  }
  System.out.println(ans);
}
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  long long a, b, n;
  cin >> a >> b >> n;
  long long x = min(n, b - 1);
  long long ans = (a * x) / b - a * (x / b);
  cout << max(ans, 0LL) << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int f[305][305][305],n,m,ans,l,r,x;const int P=1e9+7;vector<pair<int,int> >v[305];
bool chk(int r,int g,int b)
{
    for(int t=max(r,max(g,b)),i=0;i<v[t].size();i++)
    {
        int l=v[t][i].first,x=v[t][i].second,tot=(r>=l)+(g>=l)+(b>=l);
        if(tot!=x) return 0;
    }
    return 1;
}
int main()
{
    scanf("%d%d",&n,&m);f[0][0][0]=1;
    for(int i=1;i<=m;i++) scanf("%d%d%d",&l,&r,&x),v[r].push_back(make_pair(l,x));
    for(int r=0;r<=n;r++) for(int g=0;g<=n;g++) for(int b=0;b<=n;b++)
    {
        if(!f[r][g][b]) continue;
        if(!chk(r,g,b)){f[r][g][b]=0;continue;}
        int t=max(r,max(g,b))+1;if(t==n+1) ans=(ans+f[r][g][b])%P;
        (f[t][g][b]+=f[r][g][b])%=P;(f[r][t][b]+=f[r][g][b])%=P;(f[r][g][t]+=f[r][g][b])%=P;
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 110848
N=int(input())
cnt = {}
for _ in range(N):
  s = input()
  if s not in cnt:cnt[s]=0
  cnt[s]+=1
max_val = max([cnt[v] for v in cnt])
l = [v for v in cnt if cnt[v]==max_val]
l.sort()

print('\n'.join(l))

Measured memory_bytes: 34140
N, K = map(int, input().split())
x = list(map(int, input().split()))

ret = float('inf')
for i in range(0, N - K + 1):
    ret = min(ret,
              abs(x[K + i - 1] - x[i]) + min(abs(x[i]), abs(x[K + i - 1]))
              )
print(ret)


Measured memory_bytes: 14252
function Main(input){
	var xs = input.trim().split(' ').map(v=>parseInt(v,10));
    if(xs[1] >= xs[0]){
    console.log(xs[0]);
    }else if(xs[1] < xs[0]){
   console.log(xs[0]-1);
    }
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5,mod=1e9+7,low=1;
int n,m,tot,cnt,a[N],b[N],d[N];
ll t[N],dp[N];
struct node
{
    int x,y;
    bool operator==(const node&o)const
    {
        return x==o.x&&y==o.y;
    }
    bool operator<(const node&o)const
    {
        return x==o.x?y<o.y:x<o.x;
    }
}c[N];
void add(int x,ll v)
{
    x+=low;
    while(x<=cnt+low)
    {
        t[x]+=v;
        x+=x&-x;
    }
}
ll query(int x)
{
    ll ans=0;
    x+=low;
    while(x)
    {
        ans=(ans+t[x])%mod;
        x-=x&-x;
    }
    return ans;
}
vector<int>v;
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<=m;i++) scanf("%d",&b[i]);
    for(int i=1;i<=n;i++)
    {
        int p1=lower_bound(b+1,b+1+m,a[i])-b-1;
        int p2=lower_bound(b+1,b+1+m,a[i])-b;
        if(p1<1||p2>m) continue;
        c[++tot]={a[i]-b[p1],b[p2]-a[i]};
    }
    sort(c+1,c+1+tot);
    tot=unique(c+1,c+1+tot)-c-1;
    for(int i=1;i<=tot;i++)
        d[i]=c[i].y;
    sort(d+1,d+1+tot);
    cnt=unique(d+1,d+1+tot)-d-1;
    for(int i=1;i<=tot;i++)
        c[i].y=lower_bound(d+1,d+1+cnt,c[i].y)-d;
    dp[0]=1;
    v.push_back(0);
    for(int i=1;i<=tot;i++)
    {
        if(c[i].x!=c[i-1].x)
        {
            for(int j=0;j<v.size();j++)
                add(c[v[j]].y,dp[v[j]]);
            v.clear();
        }
        dp[i]=query(c[i].y-1);
        v.push_back(i);
    }
    ll ans=0;
    for(int i=0;i<=tot;i++)
        ans=(ans+dp[i])%mod;
    printf("%d\n",ans);
}


Measured memory_bytes: 3456
#include<iostream>
using namespace std;
int main(){
int a,b;
string op;
while(1){
cin >>a>>op>>b;
if(op=="?")break;
if(op=="+"){
cout<<a+b<<endl;
}else if(op=="-"){
cout<<a-b<<endl;
}else if(op=="*"){
cout<<a*b<<endl;
}else if(op=="/"){
cout<<a/b<<endl;
}
}
return 0;
}




Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
# define PI  3.14159265358979323846
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
map<int,int>mp;
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n,k;
		cin >> n >> k;
		int ans = 1e18;
		int prev =0;
		if(abs(n-k)%k==0){
			return cout <<0,0;
		}
		ans = min(ans,abs(n-k));
		map<int,int>mp;
		int f =n/k;
		ans = min(ans,n);
		mp[n]++;
		if(n>=k){
			ans=min(ans,n-(f*k));
			n-=(f*k);
		}
		while(f){
			mp[n]++;
			n= abs(n-k);
			ans = min(ans,n);
			if(mp[n]>=2)break;
		}
		cout<<ans<<endl;
	
	
	}
	cerr << "Time Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <math.h>
#include <queue>
using namespace std;
typedef long long int lli;
const long long int MaxN=200005;
const lli mod=1e9+7;
#define fst first
#define snd second
#define mp make_pair
const float pi=3.1415926535897932384626433832795028;
	lli mcd(lli a,lli b){
		if(a==0)return b;
		return mcd(b%a,a);
	}
	void solve(){
		lli N,i,j,p,q;
		for(i=1;i<=5;i++){
			cin>>p;
			if(p==0){
				cout<<i;
				return;
			}
		}
	}
int main(){
	//cin.tie(0),ios_base::sync_with_stdio(0);
	lli i,j,t;
	t=1;
	for(i=1;i<=t;i++){
		solve();
	}
	
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;




bool f(ll div, ll a[], int n, int k) {
    ll b[n];
    for (int i = 0; i < n; i++) {
        b[i] = a[i] % div;
    }

    sort(b, b + n);
    for (int i = 1; i < n; i++) {
        b[i] += b[i - 1];
    }

    for (int i = 0; i < n; i++) {
        if (b[i] == (n - 1 - i) * div - (b[n - 1] - b[i]) && b[i] <= k) {
            return true;
        }
    }

    return false;
}



int main() {
//    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    ll n, k;
    cin >> n >> k;
    ll a[500];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    ll ans = 0;
    ll sum = accumulate(a, a + n, (ll) 0);

    for (ll div = 1; div * div <= sum; div++) {
        if (sum % div == 0) {
            if (f(div, a, n, k)) {
                ans = max(ans, div);
            }

            if (f(sum / div, a, n, k)) {
                ans = max(ans, sum / div);
            }
        }
    }

    cout << ans;

}

Measured memory_bytes: 256