akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
const int INF = 1e9;

int main(){
  int H, W, h, w;
  cin >> H >> W >> h >> w;
  if(H % h == 0 && W % w == 0) {
    cout << "No" << endl;
    return 0;
  } 
  cout << "Yes" << endl;
  int a = (INF-1)/(h*w);
  rep(i,H) {
    rep(j,W) {
      if(i % h == h-1 && j % w == w-1) cout << -a*(h*w-1)-1 << " ";
      else cout << a << " ";
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 2816
n = int(input())
a = [input() for i in range(n)]
ac = 0
wa = 0
tle = 0
re = 0
for s in a:
  if s=='AC':
    ac+=1
  if s=='WA':
    wa+=1
  if s=='TLE':
    tle+=1
  if s=='RE':
    re+=1
print(f'AC x {ac}')
print(f'WA x {wa}')
print(f'TLE x {tle}')
print(f'RE x {re}')
    


Measured memory_bytes: 16184
N = int(input())
l = list(map(int,input().split()))

num_odd = 0
num_even = 0
num_four = 0

for i in l:
    if i % 2 == 1:
        num_odd += 1
    elif i % 4 == 0:
        num_four += 1
    else:
        num_even += 1

if num_four + 1 > num_odd:
    ans = "Yes"
elif num_four + 1 == num_odd and num_even == 0:
    ans = "Yes"
else:
    ans = "No"
print(ans)


Measured memory_bytes: 14252
#include <bits/stdc++.h>
#include<math.h>
#include <iostream>
#include <vector>
#include <queue>

using namespace std;
int main() {
  

  
  int N;
  cin>>N;
  vector<int>a(N);
  for(int i=0; i<N;i++){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int ans=0;
  for(int i=0; i<N;i++){
    if(i%2==0){
      ans+=a.at(i);
    }
    else{
      ans-=a.at(i);
    }
  }
  
 
    cout<<ans<<endl;
  
}






Measured memory_bytes: 256
MOD = 1000000007
L='0'+input()

pat1 = 1
pat2 = 0
for i in range(1, len(L)):
    if L[i] == '1':
        pat1, pat2 = pat1*2%MOD, (pat1+pat2*3)%MOD
    else:
        pat1, pat2 = pat1, pat2*3%MOD

print((pat1+pat2)%MOD)


Measured memory_bytes: 3188
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long i64;
typedef pair<i64,i64> P;


i64 gcd(i64 x, i64 y){
	if(y == 0) return x;
	return gcd(y, x%y);
}
i64 n, a[101010];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++){cin >> a[i];}
	
	i64 c = gcd(a[0], a[1]);
	for(int i = 2; i < n; i++){
		c = gcd(c, a[i]);
	}
	cout << c << endl;
	
	return 0;
}

Measured memory_bytes: 1024
n=int(input())
a=list(map(int,input().split()))
ans=1
c=[0,0,0]
for i in range(n):
  if a[i] not in c:
    ans=0
  else:
    ans*=c.count(a[i])
    ans%=1000000007
    c[c.index(a[i])]+=1
print(ans)

Measured memory_bytes: 20712
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

long long mod = 1000000007;

long long div(long long a, long long b, long long c){
    return b / c - (a - 1) / c;
}

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}

int main() {
    int n;
    string s, t, as;
    cin >> n >> s >> t;
    for (int i = 0; i < n; i++){
        as.push_back(s[i]);
        as.push_back(t[i]);
    }
    for (int i = 0; i < 2 * n; i++){
        cout << as[i];
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <sstream>

using namespace std;
const long long P = 1000000007;
const long long INF = 1LL << 60;

int main() {
  long long k,a,b;
  cin >> k >> a >> b;
  long long count = k;
  long long over = 0;
  if(b-a <= 1) {
    cout << k+1 << endl;
    return 0;
  }else {
    count -= (a-1);
  }
  if(count % 2 == 0) {
    cout << a + count*(b-a)/2 << endl;
  }else {
    cout << a + (count-1)*(b-a)/2 + 1 << endl;
  }
  return 0;
}


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

int main() {
  
  int N, M; cin >> N >> M;
  
  vector<int> vec(M, 0); int ans = 0;
  
  for (int i = 0; i < N; i++) {
    int K; cin >> K;
    for (int j = 0; j < K; j++) {
      int A; cin >> A;
      vec.at(A - 1)++;
    }
  }
  
  for (int x : vec) if (x == N) ans++;
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
N,M = map(int,input().split())
store = [list(map(int,input().split())) for _ in range(N)]

A = sorted(store)

sumQ = 0
sumP = 0
for k in range(N):
    p = A[k][0]
    q = A[k][1]
    sumQ = sumQ + q
    sumP = sumP + p * q
    if M < sumQ:
        print(sumP-(sumQ-M)*p)
        break
    elif M == sumQ:
        print(sumP)
        break


Measured memory_bytes: 28648
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>


struct Coordinate {
	long double x, y;
	long double distance(const Coordinate& that) const;
};
struct Angle {
	long double sin, cos;
	Angle operator-() const {
		return Angle{ -sin, cos };
	}
	static Angle from_cos(const long double cos);
};
struct Vector {
	long double dx, dy;
	Vector rotate(const Angle& angle) const {
		return Vector{ dx * angle.cos - dy * angle.sin, dy * angle.cos + dx * angle.sin };
	}
	long double length() const;
};
Coordinate operator+(const Coordinate& c, const Vector& v) {
	return Coordinate{ c.x + v.dx, c.y + v.dy };
}
Coordinate operator+(const Vector& v, const Coordinate& c) {
	return c + v;
}
Vector operator-(const Coordinate& a, const Coordinate& b) {
	return Vector{ a.x - b.x, a.y - b.y };
}
const long double EPS = 1e-9;
bool can_cover(const std::vector<Coordinate>& points, const long double radius, const Coordinate& center) {
	return std::all_of(points.begin(), points.end(), [radius, center](const Coordinate& c) {
		return c.distance(center) <= radius + EPS;
		});
}
bool can_cover(const std::vector<Coordinate>& points, const long double radius) {
	for (auto i = 0; i < points.size(); ++i) {
		for (auto j = i + 1; j < points.size(); ++j) {
			const auto dist = points[i].distance(points[j]);
			const auto angle = Angle::from_cos(dist / 2 / radius);
			auto vec = points[j] - points[i];
			vec.dx *= radius / dist;
			vec.dy *= radius / dist;
			if (can_cover(points, radius, points[i] + vec.rotate(angle)) || can_cover(points, radius, points[i] + vec.rotate(-angle))) return true;
		}
	}
	return false;
}
int main() {
	int n; std::cin >> n;
	std::vector<Coordinate> points(n); for (auto& p : points) std::cin >> p.x >> p.y;
	long double min = 0;
	long double max = 1000;
	while (min + EPS < max) {
		const auto mid = (min + max) / 2;
		if (can_cover(points, mid)) max = mid;
		else min = mid;
	}
	std::cout << std::setprecision(15) << std::fixed << max << std::endl;
}

Angle Angle::from_cos(const long double cos)
{
	return Angle{ std::sqrtl(1 - cos * cos), cos };
}

long double Coordinate::distance(const Coordinate& that) const
{
	return (*this - that).length();
}

long double Vector::length() const
{
	return std::sqrtl(dx * dx + dy * dy);
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;

using namespace std;
using Graph = vector<vector<int>>;
Graph G;

/*int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}

int n;
vll a;

ll solve(bool isp)
{
	ll sum = 0ll;
	ll ret = 0ll;

	for (int i = 0; i < n; i++)
	{
		sum += a[i];
		if (isp and sum <= 0)
		{
			ret += -sum + 1;
			sum = 1ll;
		}
		if (not isp and sum >= 0)
		{
			ret += sum + 1;
			sum = -1ll;
		}
		isp ^= 1;
	}
	return ret;
}

*/
int main()
{
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	
	
	/*ll N, K;
	cin >> N >> K;
	ll t1 = N%K;
	ll t2 = abs(t1 - K);

	ll ans = min(t1, t2);
	

	cout << ans << endl;*/
	int N, M;
	cin >> N >> M;
	vector<ll> data(N);
	ll sum = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> data[i];
		sum += data[i];
	}
	ll cnt = 0;
	for (auto& i : data)
	{
		if (i*4*M >= sum ) cnt++;
	}
	
	if (cnt>=M)
	{
		cout << "Yes" << endl;

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

}




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

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

    if (a + b == 15) {
        cout << "+" << endl;
    }
    else if (a * b == 15) {
        cout << "*" << endl;
    }

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

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define f first
#define s second
#define pb push_back
#define pp pop_back
#define mp make_pair
#define ll long long
#define ld double
#define ull unsigned long long
#define PI pair < int, int > 

const int N = 1e6 + 123;
const int M = 123;
const ld Pi = acos(-1);
const ll Inf = 1e18;
const int inf = 1e9;
const int mod = 1e9 + 7;
const int Sz = 501;
const int MOD = 1e9 + 7;

void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int mult(int a, int b) {
  return 1ll * a * b % mod;
}
int sum(int a, int b) {
  add(a, b);
  return a;
}

int n, a[N], b[N], e, ans;
vector < int > v1, v2, g[N];
int used[N], timer;

void dfs(int v, int p = -1) {
  used[v] = timer;
  e += g[v].size();
  for (auto to : g[v]) {
    if (!used[to]) {
      dfs(to, v);
    }
  }
}
void solve() {
  cin >> n;
  for (int i = 1;i <= n;i++) {
    cin >> a[i];
    v1.pb(a[i]);
    a[0] ^= a[i];
  }
  v1.pb(a[0]);
  for (int i = 1;i <= n;i++) {
    cin >> b[i];
    v2.pb(b[i]);
    b[0] ^= b[i];
  }
  v2.pb(b[0]);
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  for (int i = 0;i <= n;i++) {
    if (v1[i] != v2[i]) {
      cout << "-1\n";
      return;
    }
  }
  v1.resize(unique(v1.begin(), v1.end()) - v1.begin());
  for (int i = 0;i <= n;i++) {
    a[i] = lower_bound(v1.begin(), v1.end(), a[i]) - v1.begin();
    b[i] = lower_bound(v1.begin(), v1.end(), b[i]) - v1.begin();
    if (a[i] != b[i]) {
      g[a[i]].pb(b[i]);
      g[b[i]].pb(a[i]);
    }
  }
  /*for (int i = 0;i <= n;i++) cout << a[i] << " ";
  cout << endl;
  for (int i = 0;i <= n;i++) cout << b[i] << " ";
  cout << endl;
  for (auto i : v1) cout << i << " ";
  cout << endl;*/
  for (auto i = 0;i <= n;i++) {
    if (g[i].empty()) continue;
    if (used[i] == 0) {
      e = 0;
      timer++;
      dfs(i);
      e >>= 1;
    //  cout << "i = " << i << " e = " << e << " timer = " << timer << " used = " << used[a[0]] << endl;
     // for (auto j : v2) cout << j << " used = " << used[j] << "\n";
      if (used[a[0]] == timer) {
        if (a[0] == b[0]) ans += e;
        else ans += e - 1;
      } else {
        ans += e + 1;
      }
    }
  }
  cout << ans << endl;
}

int main() {
  #ifdef wws
   freopen("in", "r", stdin);
  // freopen("out", "w", stdout);
  #endif 
  ios_base::sync_with_stdio(0);
  int tt = 1; 
  while(tt--) solve();
  return 0;
}

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

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

	while ( 1 < a && 1 < c) {
		c -= b;
		a -= d;
	}
	string ans = "Yes";
	if (a < 1 && 1 <= c) {
		ans = "No";
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3624
// Approach 1 (Optimized) : O(3^N * N)

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
    out << '(' << p.first << ',' << p.second << ')';
    return out;
}

template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
    in >> p.first >> p.second;
    return in;
}

template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
    for (T &x : v)
        in >> x;
    return in;
}

template <class T>
ostream& operator << (ostream& out, const vector<vector<T>> &v)
{
    for (const vector<T> &x : v)
        out << x << '\n';
    return out;
}

template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
    for (const T &x : v)
        out << x << ' ';
    return out;
}

long long gcd (long long a, long long b)
{
    if (b > a)
        swap(a, b);
    return (b ? gcd(b, a % b) : a);
}

using ll   = long long;
using pii  = pair<int, int>;
using pll  = pair<long long, long long>;
using tiii = pair<pair<int, int>, int>;
using vi   = vector<int>;
using vl   = vector<long long>;
using vvi  = vector<vector<int>>;
using vvl  = vector<vector<long long>>;

#define F          first
#define S          second
#define First      first.first
#define Second     first.second
#define Third      second
#define mp         make_pair
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define per(i,b,a) for (int i = (b); i > (a); i--)
#define all(x)     x.begin(), x.end()
#define ret(x)     return cout << x, 0;
#define throwex    throw runtime_error ("Found the error.");

const int h = 1000000007;

signed main()
{ 
    ios::sync_with_stdio(false);
    #ifdef ONLINE_JUDGE
    cin.tie(nullptr);
    cout.tie(nullptr);
    cerr.setstate(ios::failbit);
    #endif

    int n;
    cin >> n;
    vl x(n), y(n), p(n);
    rep(i,0,n)
        cin >> x[i] >> y[i] >> p[i];
    vl default_dp(n);
    rep(i,0,n)
        default_dp[i] = min(abs(x[i]), abs(y[i]));
    vvl dpx((1 << n), default_dp), dpy((1 << n), default_dp);
    rep(i,0,(1 << n))
        rep(j,0,n)
            rep(k,0,n)
                if((i >> k) & 1)
                {
                    dpx[i][j] = min(dpx[i][j], abs(x[j] - x[k]));
                    dpy[i][j] = min(dpy[i][j], abs(y[j] - y[k]));
                }
    vl ans(n + 1, LLONG_MAX);
    rep(i,0,(1 << n))
    {
        int sb = bitset<15>(i).count();
        int mask = i;
        for(int j = mask; j >= 0; j--)
        {
            j &= mask;
            ll cost = 0;
            rep(i,0,n)
                cost += p[i] * min(dpx[j][i], dpy[mask - j][i]);
            ans[sb] = min(ans[sb], cost);
        }
    }
    for(ll x : ans)
        cout << x << '\n';
}


Measured memory_bytes: 12888
#include<bits/stdc++.h>
//using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define per(i,j,n) for(int i=(int)(j);(int)(n)<=i;i--)
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define pb push_back
#define mp make_pair
#define endl "\n"
using std::cin;
using std::cout;
using std::vector;
using std::pair;
using std::string;
using std::upper_bound;
using std::lower_bound;
using vi=vector<ll>;
using vii=vector<vi>;
using pii=pair<ll,ll>;
const ll MOD=1e9+7;
const int MAX=1e5+1;
const ll INF=(1ll<<62)-1;
signed main(){
    int N; cin>>N;
    vi A(N);
    rep(i,0,N) cin>>A[i];
    int siz=2+N%2;
    vii dp(N+1,vi(siz,-INF));
    dp[0][0]=0;
    REP(i,1,N){
        rep(j,0,siz){
            dp[i][j]=dp[i-1][j];
            if(j%2!=i%2){
                dp[i][j]+=A[i-1];
            }
        }
        rep(j,0,siz-1){
            if(i%2==j%2&&i>j+1){
                if(i==j+2) dp[i][j+1]=A[i-1];
                else dp[i][j+1]=std::max(dp[i][j+1],dp[i-j-2][j]+A[i-1]);
            }
        }
    }
    ll ans=dp[N-1][0];
    rep(i,1,siz) ans=std::max(dp[N][i],ans);
    cout<<ans<<endl;
}
 


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

using namespace std;
using ll = long long;


int main()
{
    ll n, m;
    cin >> n >> m;
    map<ll,ll, greater<ll>> mp;
    
    for(ll i = 0; i < n; i++){
        ll a; cin >> a; mp[a]++;
    }

    for(ll i = 0; i < m; i++){
        ll x, y; cin >> x >> y;
        mp[y] += x;
    }

    ll sum = 0;
    ll ind = 0;
    for(auto &i : mp) {


        if(i.second + ind < n)sum += (ll)i.second * i.first;
        else sum += (max(n - ind, 0LL)) * (ll)i.first;
        //cerr << i.first << " " << i.second << " " << sum << endl;
        ind += i.second;
    }
    cout << sum << endl;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
int main(){
	string a;
	cin>>a;
	if(a[0]==a[1]&&a[1]==a[2]){
		cout<<"Yes"<<endl;
	}
	else if(a[1]==a[2]&&a[2]==a[3]){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}


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

uint32_t to_index(char ch) {
    switch (ch) {
        case 'r': return 0;
        case 's': return 1;
        case 'p': return 2;
        default: return static_cast<uint32_t>(-1);
    }
}

int main() {
    uint32_t n, k, score[3];
    string t;
    cin >> n >> k >> score[0] >> score[1] >> score[2] >> t;

    uint32_t ret = 0;

    for (uint32_t i = 0; i < n; ++i) {
        auto should = to_index(t[i]) == 0 ? 2 : to_index(t[i]) - 1;
        if (i < k) { ret += score[should]; continue; }

        if (t[i - k] == t[i]) { t[i] = '\0'; continue; }
        ret += score[should];
    }

    cout << ret << endl;
}

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

int main() {
	string S;
	int C[3] = {};
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		C[S[i] - 97]++;
	}
	sort(C, C + 3);
	if (C[2] - C[0] <= 1) cout << "YES";
	else cout << "NO";
}

Measured memory_bytes: 512
// **** WHEN THE GOING GETS TOUGH, THE TOUGH GETS GOING. ****

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
//added two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set] 
//(2)set.order_of_key(k)[count of elements strictly less than k]
typedef vector< int > vi;
typedef vector< ll > lvi;
typedef vector< vi > vvi;
typedef vector< lvi > lvvi;
typedef pair< int,int > ii;
typedef pair< ll,ll > lii;
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)//remember i is an iterator
#define present(c,x) ((c).find(x) != (c).end())//for sets,maps,multimaps
#define cpresent(c,x) (find(all(c),x) != (c).end())//for vectors
#define tc(t) int (t); cin>>(t);while((t)--)
#define ff first
#define ss second
#define ld long double
#define ull unsigned long long int
#define mod 1000000007
ll modpow(ll x,ll y,ll M=mod)
{
	ll ans=1;
	while(y>0){
		if(y&1) ans=(ans*x)%M;
		y=y>>1;
		x=(x*x)%M;
	}
	return ans;
}
ll ncr(ll n,ll r)
{
	ll nmr=1,dnm=1;
	for(int i=0;i<r;i++)
	{
		nmr=(nmr*(n-i))%mod;
	}
	for(int i=1;i<=r;i++)
	{
		dnm=(dnm*i)%mod;
	}
	return (nmr*modpow(dnm,mod-2))%mod;
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
	ll n,a,b;
	cin>>n>>a>>b;
	ll ans=modpow(2,n)-1;
	ans-=ncr(n,a);
	ans=(ans+mod+mod)%mod;
	ans-=ncr(n,b);
	ans=(ans+mod+mod)%mod;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
 
stdin = sys.stdin
 
mod = 1000000007
inf = 1 << 60
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()
 
n = ni()
 
abc = [na() for i in range(n)]
dp = [3 * [0] for i in range(n)]
dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]
 
for i in range(n - 1):
    for j in range(3):
        for k in range(3):
            if k != j:
                dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + abc[i + 1][j])
 
ans = max(dp[n - 1][0], dp[n - 1][1], dp[n - 1][2])
print(ans)

Measured memory_bytes: 47356
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int x;
		String str = "";
		for (int i = 1; i <= n; i++) {
			x = i;
			if (x % 3 == 0) {
				str += " " + x;
			} else {
				while (x != 0) {
					if (x % 10 == 3) {
						str += " " + i;
						break;
					}
					x /= 10;
				}
			}
		}
		System.out.println(str);
	}

}

Measured memory_bytes: 184832
#include <stdio.h>

int main(int argc, char *args[])
{
	int h,w;
	int i,j;

	while(1) {

		scanf("%d %d", &h, &w);

		if( h==0 && w==0 ) break;

		for( i=0; i < h; i++ ) {

			for( j=0;  j < w; j++ ) {
				if( i==0 || j==0 || i==(h-1) || j==(w-1) ) {
					printf("#");
				}
				else {
					printf(".");
				}
			}
			printf("\n");

		}
		printf("\n");
	}

	return 0;

}

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

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  
  vector<int> ryokin(m);
  for (int i = 0; i < m; i++) {
    cin >> ryokin.at(i);
  }
  
  int count = 0;
  for (int i = 0; i < x; i++) {
    for (int y : ryokin) {
      if (i == y) {
        count++;
        break;
      }
    }
  }
  
  if (count * 2 < m) {
    cout << count << endl;
  }
  else {
    cout << m - count << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  int x,y;
  scanf("%d %d", &x, &y);
  if (x == 2) {
    printf("No\n");
  } else if (x == 4 || x == 6 || x == 9 || x == 11) {
    if (y == 4 || y == 6 || y == 9 || y == 11) {
      printf("Yes\n");
    } else {
      printf("No\n");
    }
  } else {
    if (y != 2 && y != 4 && y != 6 && y != 9 && y != 11) {
      printf("Yes\n");
    } else {
      printf("No\n");
    }
  }

  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1000003 ;

int main(){
  ll x;
  cin >> x;
  if(x%11>=1 && x%11<=6){
    cout << 2*((x+10)/11-1)+1 << endl;
  }else{
    cout << 2*((x+10)/11-1)+2 << endl;
  }
return 0;}

Measured memory_bytes: 256
k = int(input())
a = list()
old = list()
for i in range(1,10):
    a.append(i)
while(True):
    if k <= len(a):
        print(a[k - 1])
        break
    k -= len(a)
    old.clear()
    a,old = old,a
    for i in old:
        for d in range(-1,2):
            last_num = i % 10 + d
            if (last_num >= 0) and (last_num <= 9):
                new = 10 * i + last_num
                a.append(new)

Measured memory_bytes: 11028
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
	int x, t;
	cin >> x >> t;

	if (t >= x) cout << 0 << endl;
	else cout << x - t << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cassert>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <queue>
#define PIE 3.14159265358979
#define rep(i,n) for(int i = 0;i < (n);i++)
#define MOD 1000000007
using namespace std;
typedef long long ll;


struct matrix{
    int n;
    vector<vector<ll> > a;
    matrix(int n,ll x){
        this->n=n;
        a.resize(n);
        rep(i,n){
            a[i].resize(n,x);
        }
    }
    
    matrix operator +(matrix A){
        assert(n==A.n);
        matrix C(n,0);
        rep(i,n){
            rep(j,n){
                C.a[i][j]=a[i][j]+A.a[i][j];
                C.a[i][j]%=MOD;
            }
        }
        return C;
    }
    
    matrix operator *(matrix A){
        assert(n==A.n);
        matrix C(n,0);
        rep(i,n){
            rep(j,n){
                rep(k,n){
                    C.a[i][j]+=a[i][k]*A.a[k][j];
                    C.a[i][j]%=MOD;
                }
            }
        }
        return C;
    }
};

matrix mpow(matrix A,ll x){
    matrix ret(A.n,0);
    rep(i,A.n){
        ret.a[i][i]=1;
    }
    while(x>0){
        if((x&1)>0){
            ret = ret * A;
        }
        A=A*A;
        x >>= 1;
    }
    return ret;
}


int main(){
    int N;
    ll K;
    cin>>N>>K;
    matrix A(N,0);
    rep(i,N){
        rep(j,N){
            cin>>A.a[i][j];
        }
    }
    ll ans_int = 0;
    matrix ans = mpow(A,K);
    rep(i,N){
        rep(j,N){
            ans_int = (ans_int+ans.a[i][j])%MOD;
        }
    }
    cout<<ans_int<<endl;
}



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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int N;
    cin >> N;
    vector<int> h(N, 0);
    rep(i, N) cin >> h[i];

    // 状態 i : 足場 i にいる
    // mi(i) : 足場 i にいる時の最小コスト
    vector<int> mi(N + 4, INF);
    mi[0] = 0;

    for (int i = 0; i < N - 1; i++) {
        mi[i + 1] = min(mi[i + 1], mi[i] + abs(h[i + 1] - h[i]));
        mi[i + 2] = min(mi[i + 2], mi[i] + abs(h[i + 2] - h[i]));
    }

    // dump(mi);

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

    return 0;
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int n; cin >> n;
	int ans = 0;
	for(int i = 1; i <= n; ++i) {
		if(1 <= i and i < 10) ans++;
		if(100 <= i and i < 1000) ans++;
		if(10000 <= i and i < 100000) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const int INF = 2000000000;
using namespace std;

int main(){
    int n;
    cin >> n;
    
    long long ans = 0;
    long long a[100005];
    rep(i,n) cin >> a[i];

    long long s = 0;
    rep(i,n){
        if(a[i] == 0){
            ans += s / 2;
            s = 0;
        }
        s += a[i];
    }
    if(s != 0) ans += s / 2;
    cout << ans << endl;
}


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

int main(){
  bool p[1000000];
  memset(p, 1, sizeof(p));
  
  p[1] = p[0] = 0;
  for(int i = 0 ; i < 1000000 ; i++){
    if(p[i]){
      for(int j = 2 * i ; j < 1000000 ; j += i){
	p[j] = 0;
      }
    }
  }
  int n;
  while(cin >> n, n){
    int cnt = 0;
    for(int i = n+1 ; i <= 2 * n ; i++){
      if(p[i] == 1) cnt++;
    }
    cout << cnt << endl;
  }
  return 0;
}

 

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <cstring>
#include <algorithm>
#include <set>
#include <climits>
#include <numeric>

//usings
using namespace std;

//type def
typedef long long int64;
typedef pair<int, int> ii;

//consts
const int mod = 1e9 + 7;

//methods
template<typename T>
bool chmax(T& source, const T& compare_to) {
    if(source < compare_to) {
        source = compare_to;
        return true;
    }
    return false;
}

int modpow(int64 base, int n) {
    int64 ret = 1;
    while(n) {
        if(n & 1) ret = ret * base % mod;
        base = base * base % mod;
        n >>= 1;
    }
    return ret;
}

class Solution {
private:
public:
    int64 solve(int a, int b, int c, int x, int y,
    deque<int>& p, deque<int>& q, deque<int>& r) {
        sort(rbegin(r), rend(r));
        while(p.size() < x && !r.empty()) {
            p.push_front(r.front());
            r.pop_front();
        }
        while(q.size() < y && !r.empty()) {
            q.push_front(r.front());
            r.pop_front();
        }
        if(!r.empty()) {
            sort(rbegin(p), rend(p));
            sort(rbegin(q), rend(q));
            p.resize(x);
            q.resize(y);
            for(int rval = r.front(); rval > p.back() || rval > q.back(); rval = r.front()) {
                if(p.back() < q.back()) {
                    p.pop_back();
                    p.push_front(rval);
                }
                else {
                    q.pop_back();
                    q.push_front(rval);
                }
                r.pop_front();
                if(r.empty()) break;
            }
        }
        int64 ret = 0;
        // cout << "show dq\n";
        // for(const auto& i : p) cout << i << " ";
        // cout << endl;
        // for(const auto& i : q) cout << i << " ";
        // cout << endl;
        ret = accumulate(p.begin(), p.end(), ret);
        ret = accumulate(q.begin(), q.end(), ret);
        return ret;
    }
};

int main() {
    int a, b, c, x, y;
    cin >> x >> y >> a >> b >> c;
    deque<int> p(a), q(b), r(c);
    for(int i = 0; i < a; ++i) cin >> p[i];
    for(int i = 0; i < b; ++i) cin >> q[i];
    for(int i = 0; i < c; ++i) cin >> r[i];
    Solution sol;
    auto ret = sol.solve(a, b, c, x, y, p, q, r);
    cout << ret << endl;
}

Measured memory_bytes: 1536
#include "bits/stdc++.h"

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int>X(4);
	for (int n = 0;n<N;++n) {
		string S;
		cin >> S;
		if ("AC" == S) {
			X[0]++;
		}
		else if ("WA"== S) {
			X[1]++;
		}
		else if ("TLE" ==S) {
			X[2]++;
		}
		else {
			X[3]++;
		}
	}
	cout << "AC x " << X[0] << endl;
	cout << "WA x " << X[1] << endl; 
	cout << "TLE x " << X[2] << endl; 
	cout << "RE x " << X[3] << endl;

	return 0;
}

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

int main(){
    Init();
    ll n, m, cnt = 0;
    cin >> n >> m;
    vvi adj(n, vi(n, 0));
    rep(i, m){
        ll a, b;
        cin >> a >> b;
        a--; b--;
        adj[a][b] = 1;
        adj[b][a] = 1;
    }

    vi np(n-1);
    rep(i, n-1) np[i] = i+1;
    do{
        if(adj[0][np[0]] != 1) continue;
        bool chk = true;
        for(ll i=0; i<np.size()-1; i++){
            if(adj[np[i]][np[i+1]] != 1) chk = false;
        }
        if(chk) cnt++;
    } while(next_permutation(all(np)));
    cout << cnt << endl;
}

Measured memory_bytes: 3624
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    
    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();
    
    if((a+c)==b){
      System.out.println("Yes");
    }else if((a+b)==c){
       System.out.println("Yes");
    }else if((b+c)==a){
       System.out.println("Yes");
    }else if((a+b)<c){
       System.out.println("No");
    }else if((a+c)<b){
       System.out.println("No");
    }else if((b+c)<a){
       System.out.println("No");
    }else if((a+b)>c){
       System.out.println("No");
    }else if((b+c)>a){
       System.out.println("No");
    }else if((a+c)>b){
       System.out.println("No");
    }
  }
}

Measured memory_bytes: 21844
import sys
_ = sys.stdin.readline()
x=sys.stdin.readline()

arr=x.split()

arrInt=list()
#print(arr, type(arr))
for i in arr:
   # print(i)
    arrInt.append(int(i))

#print(arrInt,type(arrInt))
print(min(arrInt),max(arrInt),sum(arrInt))





Measured memory_bytes: 6516
// Vicfred
// https://atcoder.jp/contests/abc051/tasks/abc051_b
// simulation
import std.stdio;

void main() {
    int k, s;
    readf("%s %s\n", &k, &s);
    
    int answer = 0;
    for(int x = 0; x <= k; ++x) {
        for(int y = 0; y <= k; ++y) {
            int z = s - x - y;
            if(z >= 0 && z <= k)
                answer += 1;
        }
    }

    answer.writeln;
}



Measured memory_bytes: 256
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n,k] <- getIntList
    as <- VU.fromList . map pred <$> getIntList
    vec <- VUM.replicate n (-1 :: Int)
    let loop m a = do
            b <- VUM.read vec a
            if b < 0 then do
                VUM.write vec a m
                loop (m+1) (as VU.! a)
            else return (b,m)
    (s,t) <- loop 0 0
    let sim 0 a = a + 1
        sim m a = sim (m-1) (as VU.! a)
    print $ if k < t then sim k 0 else sim (s + (k-s) `mod` (t-s)) 0

Measured memory_bytes: 13172
#include <bits/stdc++.h>
#include<bitset>
using namespace std;
#define M 1000000007
#define rep(i, a, b) for(int i=a; i<b; i++)

typedef long long ll;
typedef unsigned long long int llt;
const int N = 2e5 + 10;


int main()
{
    int ans = 0;
    int n;
    cin>>n;
    vector<int> arr(n);
    rep(i, 0, n)
        cin>>arr[i];
    sort(arr.begin(), arr.end());
    
    rep(i, 0, n)
        rep(j, i+1, n)
        {
            rep(k, j+1, n)
            {
                if(arr[i] + arr[j] > arr[k]) ans++;
            }
        }
    cout<<ans<<endl;
    return 0;
}


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

typedef long long ll;

int main() {
    int N;
    cin >> N;
    
    vector<int> v(N);
    for (int i = 0; i < N; ++i) cin >> v[i];

    sort(v.begin(), v.end());

    ll ans = 0;

    //i < j < idx (i, j, k)
    for (int i = 0; i < N; ++i) {
        for (int j = i+1; j < N; ++j) {
            auto itr = lower_bound(v.begin(), v.end(), v[i]+v[j]);
            int idx = distance(v.begin(), itr);
            idx -= 1;
            if (idx > j) ans += idx - j;
        }
    }
    
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 1e9 + 7
#define pb push_back
#define all(v) v.begin(),v.end()
#define rall(v) v.begin(), v.end(), greater<ll>()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
int main() {
    ll n, m;
    cin >> n >> m;
    cout << (((m * (m - 1)) / 2) + ((n * (n - 1)) / 2));
}


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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

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; }
template<class T>
inline T GCD(T a, T b) { return b ? GCD(b, a % b) : a; }
template<class T>
inline T LCM(T a, T b) { return (a + (b - 1)) / b; }
template<class T>
inline T round_int(T a, T b) {return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

int main() {
	int k;
	cin >> k;
	
	vl a;
	for (int i = 1; i <= 9; ++i) a.push_back(i);
	while (true) {
		if (k < a.size()) {
			cout << a[k - 1] << endl;
			return 0;
		}

		k -= a.size();
		vl old;

		swap(old, a);
		for (ll x : old) {
			for (int i = -1; i <= 1; ++i) {
				int d = x % 10 + i;
				if (d < 0 || d > 9) continue;
				ll nx = x * 10 + d;
				a.push_back(nx);
			}
		}
	}
}

Measured memory_bytes: 1712
import java.util.*;
 
class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    String s = sc.next();
    
    int sLength = s.length();
    String s1 = s.substring(0, 1);
    String s2 = s.substring(sLength - 1, sLength);
    
    String num = String.valueOf(sLength - 2);
    
    String ans = s1 + num + s2;
    
    System.out.println(ans);
    
  }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

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

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl



int main(){
    int n;
    cin>>n;
    REP(i,n){
        char c;
        cin>>c;
        if(c=='Y'){
            cout<<"Four"<<endl;
            return 0;
        }
    }
    cout<<"Three"<<endl;
    return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for(int i=0;i<n;++i) cin >> a[i];
  int ans = 0;
  for(int i=0;i<n;++i) if(a[i]>=k) ans+=1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include<iostream>

using namespace std;

long long gcd(long long a,long long b){
  return a?gcd(b%a,a):b;
}

int main(){
  long long n,m;
  cin>>n>>m;
  long long a[20],p[20];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    cin>>p[i];
  }
  double e=0;
  for(int i=1;i<1<<n;i++){
    double pr=1;
    __int128 cm=1;
    int nb=0;
    for(int j=0;j<n;j++){
      if(!(i>>j&1)){
      }else{
	nb++;
	pr*=p[j]/100.;
	cm=cm*a[j]/gcd(cm,a[j]);
	if(cm>m)goto next;
      }
    }
    e+=m/cm*pr*((nb%2)?1:-1);
  next:
    ;
  }
  cout.precision(9);
  cout<<fixed<<e<<endl;
}

Measured memory_bytes: 1244
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define mod 1000000007
#define iP pair<int,int>
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define inf 1e15
#define mod1 998244353
#define pi 3.141592653589793238
#define lcm(a,b) a*(b/__gcd(a,b))
#define sz(x) (int)x.size()
#define cmp complex<double> 
int power(int x,int y){
    int res=1;
    x=x%mod1;
    while(y>0){
        if(y&1)res=(res*x)%mod1;
        x=(x*x)%mod1;
        y/=2;
    }
    return res;
}
void inline precompute(){
}
// void dfs(vector<int> adj[],int x,int par){
//     intime[x]=t++;
//     for(int i=1;i<=k;i++){
        
//     }
//     for(auto it: adj[x]){
//         if(it!=par){
//             dfs(adj,it,x);
//         }
//     }
//     outtime[x]=t++;
// }
void solve(int tc){
    int a,b;
    cin>>a>>b;
    cout<<a*b;
}
int32_t main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);cout<<fixed;cerr.tie(NULL);cout.precision(12);
    int t=1,ctr=0;
    // precompute();
    // cin>>t;
    while(t--){
        solve(ctr+1);
        ctr++;
    }
}

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

int main() {
  int n, C[3] = {0, 0, 0}, ans=0;
  cin >> n;
  string s[n];
  for(int i = 0; i < n; i++) {
    cin >> s[i];
    for(int j = 0; j < s[i].size()-1; j++) if(s[i][j] == 'A' && s[i][j+1] == 'B') ans++;
    if(s[i][0] == 'B' && s[i][s[i].size()-1] == 'A') C[0]++;
    else if(s[i][0] == 'B') C[1]++;
    else if(s[i][s[i].size()-1] == 'A') C[2]++;
  }
  if(C[0] == 0) cout << min(C[1], C[2]) + ans;
  else if(C[0] != 0 && C[1] + C[2] == 0) cout << C[0]-1 + ans;
  else cout << C[0] + min(C[1], C[2]) + ans;
}

Measured memory_bytes: 768
n, m = map(int, input().split(' '))
problem = [0] * n
ok=0
pen=0
i=0

while i < m:
    p, result = input().split(' ')
    p = int(p) - 1
    if problem[p] < 0:
        pass
    else:
        if result == 'WA':
            problem[p] += 1
        else:
            ok += 1
            pen += problem[p]
            problem[p] = -1
    i+=1
print('{} {}'.format(ok, pen))


Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
long long x[5],k,ans;
int main()
{
	for(k=0;k<5;k++)
	{
		cin>>x[k];
		if(x[k]==0)
		{
			ans=k+1;
		}
	}
	cout<<ans;
}

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

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> A(N), sum(N + 1);
    for(int i = 0;i < N;i++){
        cin >> A[i]; --A[i];
        sum[i + 1] = (sum[i] + A[i]) % K;
    }
    map<int, int> cnt;
    cnt[0] = 1;
    ll res = 0;
    for(int i = 0;i < N;i++){
        if(K <= i + 1){
            --cnt[sum[i + 1 - K]];
        }
        res += cnt[sum[i + 1]];
        ++cnt[sum[i + 1]];
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 11136
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n){
  for(int i=0; i<n; i++) cin >> x[i];
}

int main() {
  string s;
  cin >> s;
  for(int i=0; i<s.size(); i++){
    if(s[i] == '9') cout << '1';
    else cout << '9';
  }
  cout << endl;

  return 0;
}


//


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    int n,m;
    cin >> n >> m;
    Graph G(n);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    queue<P> q;
    q.push(make_pair(0,0));
    vi dis(n,-INF);
    dis[0] = 0;
    bool ok = false;
    while(q.size()){
        int t = q.front().first;
        int d = q.front().second;
        q.pop();
        if(t == n-1 && d==2){
            ok = true;
            break;
        }
        if(d==3) break;
        for(auto v : G[t]){
            if(dis[v]!=-INF) continue;
            dis[v] = dis[t] + 1;
            q.push(make_pair(v,dis[v]));
        }
    }
    cout << (ok? "POSSIBLE":"IMPOSSIBLE") << endl;
}

Measured memory_bytes: 13552
//
// Created by 伊東麻沙美 on 2019/10/22.
//

#include<iostream>
#include<algorithm>

using namespace std;


int main(){

    string s;
    int i,j;
    int count = 1;
    cin>>s;

    for(i=0;i<5;i++){
        for(j=0;j<5;j++){
            if(i==j){
                continue;
            }
            if(s[i]==s[j]&&i==j+1){
                count++;
            }
        }
    }
    if(count==1){
       std::cout<<"Good";
    }else{
        std::cout<<"Bad";
    }

        return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define N 1001
using namespace std;
struct d{
  int h;
  int p;
  int q;
};
int main(){
  int n,m,a,i,j,l;
  struct d data[N];
  while(1){
    cin >> n >> m >> a;
    if(n==0&&m==0&&a==0) break;
    for(i=0;i<m;i++){
      cin >> data[i].h >> data[i].p >> data[i].q;
    }
    for(i=0;i<m;i++){
      for(j=1;j<m;j++){
	if(data[j].h>data[j-1].h) swap(data[j],data[j-1]);
      }
    }
    l=a;
    for(i=0;i<m;i++){
      if(data[i].p==l-1) l-=1;
      else if(data[i].q==l+1) l+=1;
      if(i==m-1){
	cout << l << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1172