akhauriyash/Code-Regression huggingface dataset:
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int N = 1e7 + 5;

vector<int> s(N);

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        
    int T = 1; 
    // cin >> T; 
    while (T--) {
        
        for(int i = 1; i < N; i++) {
            for(int j = i; j < N; j += i)
                s[j]++;
        }

        int n;
        cin >> n;
        int ans = 0;
        for(int i = 1; i <= n; i++)
            ans += i * s[i];
        cout << ans << '\n';
    }
    
    return 0;
}



Measured memory_bytes: 81248
using System;

class Program
{
    static void Main(string[] args)
    {
        var A = int.Parse(Console.ReadLine());
        var B = int.Parse(Console.ReadLine());
        var C = int.Parse(Console.ReadLine());
        var X = int.Parse(Console.ReadLine());
        var count = 0;
        var value = 0;

        for(int i=0; i<=A; i++)
        {
            for(int j=0; j<=B; j++)
            {
                for(int k=0; k<=C; k++)
                {
                    value = 500*i + 100*j + 50*k;
                    if(value == X) { ++count; }
                }
            }
        }
        Console.WriteLine(count);
    }
}

Measured memory_bytes: 11092
T = input()
ans = ''
for i in range(len(T)):
  if T[i] != '?':
    ans += T[i]
    continue
  if i != 0 and ans[i-1] == 'P':
    ans += 'D'
  else:
    if i == len(T)-1:
      ans += 'D'
    elif T[i+1] == '?' or T[i+1] == 'D':
      ans += 'P'
    else:
      ans += 'D'
print(ans) 

Measured memory_bytes: 9412
/*
??????????????????????????´??° a ??¨ b ??????????????°???????????????????????°?????????????????????????????????
???????????????????????° <= 200
*/

#include <iostream>
#include <string>

using namespace std;
 
int main()
{

	int a, b, calc, strCount = 0;
	string str = "";

	for ( int i = 0; i < 200;  i++ ) {
		a = b = 0;
		
		cin >> a >> b;

		if ( a == 0 && b == 0 ) {
			break;
		}

		calc = a + b;
		str = to_string( calc );
		strCount = str.size();
		
		cout << strCount << endl;
	}

    return 0;
}

Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

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;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;


signed main(){
	int h1,m1,h2,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	int a=h1*60+m1,b=h2*60+m2;
	cout<<b-a-k<<endl;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    map<char, int> t;
    string s, s_trans;
    int n;
    char m[26];
    string suuti;
    cin >> n;
    getline(cin, s);
    rep(i, 26)
    {
        m[i] = char('a' + i);
        t[m[i]] = i;
    }

    rep(i, n)
    {
        bool flag = 0;
        getline(cin, s);
        s_trans = s;
        rep(a, 26)
        {
            rep(b, 26)
            {
                rep(k, s.size())
                {
                    if (s[k] == ' ')
                        s_trans[k] = ' ';
                    else
                        s_trans[k] = m[a * (t[s[k]] - b + 26) % 26];
                }
                if (s_trans.find("this") != string::npos || s_trans.find("that") != string::npos)
                {
                    flag = 1;
                    break;
                }
            }
            if (flag == 1)
                break;
        }
        OP(s_trans)
    }

    return 0;
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define inf 1e18L+5
using namespace std;
int32_t main(){
      ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,W;
    cin>>n>>W;
  ll i, w; 
   ll x;
   ll wt[n],v[n];
  for(int i=0;i<n;i++)cin>>wt[i]>>v[i];
  ll sum=0;
   for(int i=0;i<n;i++){
       sum+=v[i];
   }
   vector<ll> dp(sum+1,inf);
   dp[0]=0;
   for(int i=0;i<n;i++){
       for(int value_already=sum-v[i];value_already>=0;value_already--){
           dp[value_already+v[i]]=min( dp[value_already+v[i]],dp[value_already]+wt[i]);
       }
   }
   ll ans=0;
   for(ll i=0;i<=sum;i++){
       if(dp[i]<=W){
           ans=max(ans,i);
       }
   }
   cout<<ans;
}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,n) for(int i=1; i<=(n); i++)

int main() {
    int n;
    cin>>n;
    vector<pair<string,int>>r(n);
    rep(i,n)cin>>r[i].first>>r[i].second;
    vector<pair<string,int>>l(n);
    rep(i,n)l[i]=r[i];
    rep(i,n)r[i].second*=-1;//-1
    sort(r.begin(),r.end());
    rep(i,n)r[i].second*=-1;//-1
    
    rep(i,n){
        rep(j,n){
            if(r[i]==l[j])cout<<j+1<<endl;
        }
    }
    return 0;
}



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

int main() {
    long N;
    cin >> N;
    long H[N];
    for(int i = 0;i < N;i++)
    {
        cin >> H[i];
    }

    long number = 0;
    for(int i = 0;i < N - 1; i++)
    {
        if(H[i] - H[i + 1] == 1)
        {
            if(number == H[i])
            {
                cout << "No" << endl; 
                return 0;
            }
            number = H[i] - 1;
        }
        else if(H[i] - H[i + 1] > 1)
        {
            cout << "No" << endl; 
            return 0;
        }
    }
    cout << "Yes" << endl;
}


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

int main(){
int n;
cin>>n;
int g,l,m;
	for(int i=1;i<=n;i++){
	g=i%100;
	l=i%1000;
	m=i%10000;
if(3000<=m && m<4000){g=m/100;}
if(300<=l && l<400){g=l/10;}
	if(i%3==0){cout<<" "<<i;}
	else if(i%10==3){cout<<" "<<i;}
	if(30<=g && g<40 && i%3!=0 && i%10!=3){cout<<" "<<i;}
	}

cout<<endl;
return 0;
}


Measured memory_bytes: 3100
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1'000'000'007;
template <class T>
bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T>
bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

template <typename T = int>
struct WeightedTree {
    vector<vector<pair<T, int>>> edges;

    WeightedTree(int n_) : edges(n_){};

    void addEdge(T from, T to, int weight) {
        edges[from].emplace_back(to, weight);
        edges[to].emplace_back(from, weight);
    }

    // return {cost, farthest node idx} from idx
    pair<T, int> dfs(int idx, int prev) {
        pair<T, int> ret(0, idx);
        for (auto &edge : edges[idx]) {
            if (edge.first == prev)
                continue;
            auto cost = dfs(edge.first, idx);
            cost.first += edge.second;
            ret = max(ret, cost);
        }
        return ret;
    }

    T diameter() {
        auto p = dfs(0, -1);
        auto q = dfs(p.second, -1);
        return q.first;
    }
};

int main() {
    int N;
    cin >> N;
    WeightedTree<int> t(N);
    for (int i = 0; i < N - 1; ++i) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        t.addEdge(a, b, 1);
    }
    int diameter = t.diameter();
    if (diameter % 3 == 1) {
        cout << "Second" << endl;
    } else
        cout << "First" << endl;
    return 0;
}

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

#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(v) v.begin(), v.end()
using ll = long long;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
	mint operator+(const mint a) const { return mint(*this) += a; }
	mint operator-(const mint a) const { return mint(*this) -= a; }
	mint operator*(const mint a) const { return mint(*this) *= a; }
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const { return pow(mod - 2); }
	mint& operator/=(const mint a) { return *this *= a.inv(); }
	mint operator/(const mint a) const { return mint(*this) /= a; }
};

mint ch(int n, int a) {
	mint x = 1, y = 1;
	rep(i, a) {
		x *= n - i;
		y *= i + 1;
	}
	return x / y;
}

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	mint sum = mint(2).pow(n);
	sum -= 1;
	sum -= ch(n, a);
	sum -= ch(n, b);
	cout << sum.x << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, x, i, ans=0;
    cin >> n;
    for(i=1;i<=n;i++)
    {
        cin >> x;
        if(i%2==1 && x%2==1)
            ans++;
    }
    cout  << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <string>
#include <vector>
/* 変数i を n回繰り返すマクロ */
#define rep(i,n) for (int i = 0;i < (n);i++)
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
/* map_for : mapでfor文を回す */
/* gcd_lcm : 最大公倍数 & 最小公約数 */
int main()
{
    cout << fixed << setprecision(10);//小数点以下10桁出力
    string tmp_s;
    cin >> tmp_s;
    deque<char> s;
    rep(i,tmp_s.size()){
        s.push_back(tmp_s.at(i));
    }
    int n;
    cin >> n;
    int flag = 1;
    rep(i,n){
        int t;
        cin >> t;
        if(t == 1){
            flag *= -1;
        }else{
            int f;
            char c;
            cin >> f >> c;
            if(flag == 1){//普通
                if(f == 1){
                    s.push_front(c);
                }else{
                    s.push_back(c);
                }
            }else{//反転中
                if(f == 2){
                    s.push_front(c);
                }else{
                    s.push_back(c);
                }
            }
        }
    }

    if(flag == 1){
        rep(i,s.size()){
            cout << s[i];
        }
    }else{
        for(int i = s.size() - 1;i >= 0;i--){
            cout << s[i];
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>

int main()
{
    int n, d, x, a[100], choco = 0;
    std::cin >> n >> d >> x;
    for (int i = 0;i < n;i++){
        std::cin >> a[i];
    }

    for (int i = 0;i < n;i++){
        for (int j = 1;j <=d;j = j + a[i]){
            choco++;
        }
    }

    std::cout << choco + x;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr = ds.begin(); itr != ds.end(); ++itr)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 2000000000
#define INFL 2000000000000000000LL
#define EPS 1e-9
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;
typedef priority_queue<Edge, vector<Edge>, greater<Edge> > pqlE;

int calc(vs math, int depth, int &l) {
	if (math[l][depth] == '+') {
		int ans = 0;
		l++;
		while (l < math.size() && math[l].length() > depth + 1) {
			ans += calc(math, depth + 1, l);
		}
		return ans;
	}
	else if (math[l][depth] == '*') {
		int ans = 1;
		l++;
		while (l < math.size() && math[l].length() > depth + 1) {
			ans *= calc(math, depth + 1, l);
		}
		return ans;
	}
	else {
		l++;
		return (int)(math[l - 1][depth] - '0');
	}
}

int main() {
	while (true) {
		int N;
		cin >> N;
		if (N == 0)break;
		vs math(N);
		rep(i, N) {
			cin >> math[i];
		}
		int l = 0;
		cout << calc(math, 0, l) << endl;
	}

	return 0;
}

Measured memory_bytes: 3144
#include <iostream>
#include <vector>

using namespace std;

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

    string ans;
    vector<vector<string>> s(h, vector<string>(w));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> s[i][j];
            if (s[i][j] == "snuke") {
                ans = (char)('A' + j) + to_string(i + 1);
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
// Problem : E - Multiplication 4
// Contest : AtCoder - AtCoder Beginner Contest 173
// URL : https://atcoder.jp/contests/abc173/tasks/abc173_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
 
#include<bits/stdc++.h>
#include<set>
#define lli long long int
#define ma 1000000007
using namespace std;
int main()
{
	lli n,k,i,ans=1;
	cin>>n>>k;
	lli a[n];
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	if(k&1&&a[n-1]==0){
		cout<<"0";
		return 0;
	}
	if(k&1&&a[n-1]<0){
		for(i=n-1;i>=n-k;i--){
			ans=(ans*a[i])%ma;
			if(ans<0) ans+=ma;
		}
		cout<<ans;
		return 0;
	}
	lli high=n-1,low=0;
	if(k&1 && a[n-1]>0){
		ans=ans*a[n-1];
		high--;
	}
	k=k/2;
	for(i=0;i<k;i++){
		if(a[low]*a[low+1]>a[high]*a[high-1]){
			ans*=a[low];
			ans=ans%ma;
			if(ans<0) ans+=ma;
			low++;
			ans*=a[low];
			ans=ans%ma;
			if(ans<0) ans+=ma;
			low++;
		}
		else{
			ans=(ans*a[high])%ma;
			if(ans<0) ans+=ma;
			high--;
			ans=(ans*a[high])%ma;
			if(ans<0) ans+=ma;
			high--;
		}
	}
	ans=ans%ma;
	if(ans<0) ans+=ma;
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 5076
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
k = int(input())

l = [A, B, C, D, E]

for i in range(5):
    for j in range(i, 5):
        if abs(l[i] - l[j]) > k:
            print(":(")
            exit()

print("Yay!")


Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
 
//priority_queue<long long, vector<long long>, greater<long long>> pq;

const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define clr(x, y) memset(x, y, sizeof(x))
#define forn(i, n) for (int i = 0; i < n; i++)
#define LL long long
const double pi = acos(-1.0);


string s, t;

int main() {
  //auto start_clock = clock();
#ifdef LOCAL
  freopen("in", "r", stdin);
#endif
  cin >> s >> t;
  bool flag = true;
  if (s.size() + 1 != t.size()) {
    flag = false;
  } else {
    for (int i = 0; i < (int)s.size(); i++) {
      if (s[i] != t[i]) {
        flag = false;
      }
    }
  }
  if (flag) puts("Yes");
  else puts("No");

  return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> p(n), q(n);
	rep(i,n) cin >> p[i];
	rep(i,n) cin >> q[i];
	vector<int> v(n);
	rep(i,n) v[i] = i+1;
	int a = 0, b = 0, cnt = 1;
	do{
		bool P = true, Q = true;
		rep(i,n){
			if(v[i] != p[i]) P = false;
			if(v[i] != q[i]) Q = false;
		}
		if(P) a = cnt;
		if(Q) b = cnt;
		++cnt;
	} while(next_permutation(v.begin(), v.end()));
	int ans = abs(a - b);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
S = input()

targets = ("A", "C", "G", "T")
max_length = 0
current_length = 0
for s in S:
    if s in targets:
        current_length += 1
    else:
        current_length = 0
    if max_length <= current_length:
        max_length = current_length
print(max_length)


Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int main(){
    int H, W, N;
    cin >> H >> W >> N;
    int sr, sc;
    cin >> sr >> sc;
    string S, T;
    cin >> S;
    cin >> T;
    int cur = sc;
    if(S[0] == 'L') {
        cur--;
    }
    for(int i = 0; i < N-1; i++){
        if(cur < 1){
            cout << "NO" << endl;
            return 0;
        }
        if(T[i] == 'R' && cur < W) cur++;
        if(S[i+1] == 'L') cur--;
    }
    if(cur < 1){
        cout << "NO" << endl;
        return 0;
    }
    cur = sc;
    if(S[0] == 'R') {
        cur++;
    }
    for(int i = 0; i < N-1; i++){
        if(cur > W){
            cout << "NO" << endl;
            return 0;
        }
        if(T[i] == 'L' && cur > 1) cur--;
        if(S[i+1] == 'R') cur++;
    }
    
    if(cur > W){
        cout << "NO" << endl;
        return 0;
    }
    cur = sr;
    if(S[0] == 'U') {
        cur--;
    }
    for(int i = 0; i < N-1; i++){
        if(cur < 1){
            cout << "NO" << endl;
            return 0;
        }
        if(T[i] == 'D' && cur < H) cur++;
        if(S[i+1] == 'U') cur--;
    }
    if(cur < 1){
        cout << "NO" << endl;
        return 0;
    }
    cur = sr;
    if(S[0] == 'D') {
        cur++;
    }
    for(int i = 0; i < N-1; i++){
        if(cur > H){
            cout << "NO" << endl;
            return 0;
        }
        if(T[i] == 'U' && cur > 1) cur--;
        if(S[i+1] == 'D') cur++;
    }
    if(cur > H){
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 1020
//
//  popular_vote.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>

int main(int argc, const char* argv[]) {
  int m, n;
  std::cin >> n >> m;
  int a[n];
  int sum = 0;
  for (int i=0; i<n; i++) {
    std::cin >> a[i];
    sum += a[i];
  }

  int num_of_popular = 0;
  for (int i=0; i<n; i++) {
    if (a[i]*(4*m) >= sum) {
      num_of_popular++;
    }
  }
  if (num_of_popular >= m) {
    std::cout << "Yes" << std::endl;
  }
  else {
    std::cout << "No" << std::endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <queue>
#include <stack>
#include <string.h>
#include <list>
using namespace std;
typedef long long ll;
#define all(a)  (a).begin(), (a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i = 0; i < n; i++)
#define repR(i,n) for(int i = n-1; i >= 0; i--)
#define FOR(i,m,n) for(int i = m; i < n; i++)
#define PB push_back
#define MP make_pair
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))


int main() {
    string s;
    cin >> s;
    int l = s.length();
    bool f1 = false, f2 = false, f3 = false;
    if(s[0] == 'A') f1 = true;
    FOR(i,2,l-1){
        if(s[i] == 'C'){
            f2 = true;
            break;
        }
    }
    int cnt = 0;
    rep(i,l){
        if(isupper(s[i])) cnt++;
    }
    if(cnt == 2) f3 = true;
    if(f1&&f2&&f3) cout << "AC" << endl;
    else cout << "WA" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#pragma once
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
typedef pair<double,double> P;
const ll INF = 1e16;
const int MOD = 1000000007;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 



///////////////////////___modpow___////////////////////

////////////////////////////////////////////////////////////////////


signed main(){
  string s;cin>>s;
  bool a = false, b = false;
  rep(i,s.length()){
    if(s[i] == 'A')a = true;
    else b = true;
  }
  if(a && b)cout << "Yes" << endl;
  else cout << "No" << endl;
}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static int[][] table;

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

		while (true) {
			int w = 0;
			int h = 0;
			int count = 0;

			w = scan.nextInt();
			h = scan.nextInt();

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

			table = new int[h][w];

			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					table[i][j] = scan.nextInt();
				}
			}

			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (table[i][j] == 1)
						count += check(table, w, h, i, j);
				}
			}
			System.out.println(count);
		}

		scan.close();
	}

	public static int check(int table[][], int w, int h, int a, int b) {
		table[a][b] = 0;

		if (a != 0 && b != 0) {
			if (table[a - 1][b - 1] != 0) {
				check(table, w, h, a - 1, b - 1);
			}
		}
		if (a != 0) {
			if (table[a - 1][b] != 0) {
				check(table, w, h, a - 1, b);
			}
		}
		if (b != 0) {
			if (table[a][b - 1] != 0) {
				check(table, w, h, a, b - 1);
			}
		}
		if (a != 0 && b != (w - 1)) {
			if (table[a - 1][b + 1] != 0) {
				check(table, w, h, a - 1, b + 1);
			}
		}
		if (a != (h - 1) && b != 0) {
			if (table[a + 1][b - 1] != 0) {
				check(table, w, h, a + 1, b - 1);
			}
		}
		if (a != (h - 1) && b != (w - 1)) {
			if (table[a + 1][b + 1] != 0) {
				check(table, w, h, a + 1, b + 1);
			}
		}
		if (a != (h - 1)) {
			if (table[a + 1][b] != 0) {
				check(table, w, h, a + 1, b);
			}
		}
		if (b != (w - 1)) {
			if (table[a][b + 1] != 0) {
				check(table, w, h, a, b + 1);
			}
		}
		return 1;
	}

}

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

int n, m;
bool G[50][50], used[50];

void DFS(int now){
    if(used[now]) return;
    used[now] = true;
    REP(i, n){
        if(i == now) continue;
        if(G[now][i]) DFS(i);
    }
}

int main(){
    cin >> n >> m;
    vector<pair<int, int>> A(m);
    REP(i, m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a][b] = true;
        G[b][a] = true;
        A[i] = make_pair(a, b);
    }
    int cnt = 0;
    for(auto x : A){
        int a, b;
        a = x.first;
        b = x.second;
        G[a][b] = false; G[b][a] = false;
        REP(i, n) used[i] = false;
        DFS(0);
        int sum = 0;
        REP(i, n) if(used[i]) sum++;
        if(sum != n) cnt++; 
        G[a][b] = true; G[b][a] = true;        
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
class SegmentTree(object):
    def __init__(self, sequence, function, identity):
        N = len(sequence)
        self.length = (1 << (N - 1)).bit_length()
        self.function = function
        self.data = [identity] * (self.length << 1)
        self.identity = identity
        # set values
        for i in range(N):
            self.data[i + self.length - 1] = sequence[i]
        # build
        for i in range(self.length - 2, -1, -1) :
            self.data[i] = self.function(self.data[(i << 1) + 1], self.data[(i << 1) + 2])

    def update(self, idx, x):
        idx += self.length - 1
        self.data[idx] = x
        while idx:
            idx = (idx - 1) >> 1
            self.data[idx] = self.function(self.data[(idx << 1) + 1], self.data[(idx << 1) + 2])

    def query(self, p, q):
        if q <= p:
            return self.identity
        p += self.length - 1
        q += self.length - 2
        res = self.identity
        while q - p > 1:
            if not p & 1:
                res = self.function(res, self.data[p])
            if q & 1:
                res = self.function(res, self.data[q])
                q -= 1
            p >>= 1
            q = (q - 1) >> 1
        return self.function(res, self.data[p]) if p == q else self.function(self.function(res, self.data[p]), self.data[q])

def popcount(n):
  n = (n & 0x5555555555555555) + ((n & 0xAAAAAAAAAAAAAAAA) >> 1)
  n = (n & 0x3333333333333333) + ((n & 0xCCCCCCCCCCCCCCCC) >> 2)
  n = (n & 0x0F0F0F0F0F0F0F0F) + ((n & 0xF0F0F0F0F0F0F0F0) >> 4)
  n = (n & 0x00FF00FF00FF00FF) + ((n & 0xFF00FF00FF00FF00) >> 8)
  n = (n & 0x0000FFFF0000FFFF) + ((n & 0xFFFF0000FFFF0000) >> 16)
  n = (n & 0x00000000FFFFFFFF) + ((n & 0xFFFFFFFF00000000) >> 32)
  return n

N = int(input())
S = input()
atoi = {chr(ord("a") + d): 1 << d for d in range(26)}
data = [atoi[c] for c in (S)]
seg_tree = SegmentTree(data, lambda a, b: a | b, 0)
Q = int(input())
for _ in range(Q):
    q, a, b = input().split()
    if q == "1":
        idx = int(a) - 1
        seg_tree.update(idx, atoi[b])
    else:
        print(popcount(seg_tree.query(int(a) - 1, int(b))))

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

int main() {
  
  int a,b;
  cin >> a;
  cin >> b;
  
  if((a+b)%2 == 1)
    cout << (a+b)/2+1 << endl;
  else
    cout << (a+b)/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

double dp[105][105];

int main(){
	while(1){
		int n,t,l,b; cin >> n >> t >> l >> b;
		if(n+t+l+b == 0) break;
		rep(i,t+1) rep(j,n+1) dp[i][j] = 0.0;
		vector<int> event(n+1,0);
		rep(i,l){
			int z; cin >> z;
			event[z] = 1;
		}
		rep(i,b){
			int z; cin >> z;
			event[z] = 2;
		}
		dp[0][0] = 1.0;
		rep(i,t){
			rep(j,n){
				REP(k,1,7){
					int nxt = j+k;
					if(nxt > n) nxt = n - (nxt - n);
					if(!event[nxt]) dp[i+1][nxt] += dp[i][j] / 6.0;
					else{
						if(event[nxt] == 1) dp[i+2][nxt] += dp[i][j] / 6.0;
						else dp[i+1][0] += dp[i][j] / 6.0;
					}
				}
			}
		}
		double ans = 0.0;
		rep(i,t+1) ans += dp[i][n];
		printf("%.10f\n",ans);
	}
}


Measured memory_bytes: 3176
N,M=map(int,input().split())

ans=[0]*N
pen=[0]*N
AC=[0]*N

for i in range(M):
    p,s=input().split()
    p=int(p)
    if s=="WA":
        pen[p-1]+=1
    else:
        if AC[p-1]==0:
            ans[p-1]+=pen[p-1]
        AC[p-1]=1

print(AC.count(1),sum(ans))


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

using namespace std;

const int inf=1000000000;

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

int main(){
 int n,m;
  cin >> n >> m;
 int a[m],b[m],c[m];
  rep(i,m){ cin >> a[i] >> b[i] >> c[i];
    a[i]--;
    b[i]--;
  }
  
  int dis[n][n];
  rep(i,n){
    rep(j,n){
     if(i==j) dis[i][j]=0;
     else dis[i][j]=inf;
    }
  }
 
  rep(i,m){
   dis[a[i]][b[i]]=min(dis[a[i]][b[i]],c[i]);
   dis[b[i]][a[i]]=dis[a[i]][b[i]];
  }
  
  rep(k,n){
   rep(i,n){
    rep(j,n){
     dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
    }
   }
  }
  
  int res=m;
  rep(i,m){
   bool flag=false;
    rep(j,n){
     if(dis[j][a[i]]+c[i]==dis[j][b[i]]) flag=true;
    }
    if(flag) res--;
  }


  cout << res << endl;
}

Measured memory_bytes: 256
use proconio::input;


fn main() {
    input! {
        n: usize,
        v: [usize; n]
    }

    let ans = {
        let mut ans = 0;
        let mut max = v[0];
        for &a in &v[1..] {
            if a < max {
                ans += max-a;
            } else {
                max = a;
            }
        }
        ans
    };

    println!("{}",ans)
}

Measured memory_bytes: 5560
// BEGINNING WITH NAME OF ALMIGHTY GOD ALLAH
// AUTHOR:: MOHAMMAD FAISAL
// ATCODER BEGINNERS PROBLEMS 
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.flush();
	int a,b,c;
    cin >> a >> b >>c;
 	(b-a==c-b) ? cout<<"YES" : cout<<"NO";
	return 0;
	// Bye Bye 2019
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <numeric>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<((x))<<endl
#define fi first
#define se second

#define INF 2147483600
#define long long long

int solve(vector<int> &vec){
  int n=vec.size();
  rep(i,n-1){
    if(vec[i]==INF && vec[i+1]==INF) return -INF;
    if(vec[i]!=INF && vec[i+1]!=INF){
      if(i%2==0) if(vec[i] >= vec[i+1]) return -INF;
      if(i%2==1) if(vec[i] <= vec[i+1]) return -INF;
    }
  }
  int lb=-INF, ub=INF;
  rep(i,n) if(vec[i]==INF){
    if(i%2==0){
      if(i>0) ub = min(ub, vec[i-1]-1);
      if(i+1<n) ub = min(ub, vec[i+1]-1);
    } else {
      lb = max(lb, vec[i-1]+1);
      if(i+1<n) lb = max(lb, vec[i+1]+1);
    }
  }
  if(lb==ub) return lb;
  else if(lb<ub) return INF;
  else return -INF;
}

int main(){
  int n;
  while(cin>>n, n){
    char tmp[15];
    vector<int> vec(n);
    rep(i,n){
      scanf("%s", tmp);
      if(tmp[0]=='x') vec[i]=INF;
      else vec[i] = atoi(tmp);
    }
    int ret = solve(vec);
    if(ret==INF) cout<<"ambiguous"<<endl;
    else if(ret==-INF) cout<<"none"<<endl;
    else cout<<ret<<endl;
  }

  return 0;
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define x real()
#define y imag()
using namespace std;
typedef complex<double> point;
vector <point> pl;

double dot(point a,point b){return a.x*b.x+a.y*b.y;}
double cross(point a,point b){return a.x*b.y-a.y*b.x;}
int ccw(point a,point b,point c){
  point d = b-a,e = c-a;
  if(cross(d,e)>0) return 1;//"COUNTER_CLOCKWISE"
  if(cross(d,e)<0) return -1;//"CLOCKWISE"
  if(dot(d,e)<0) return 2;//"ONLINE_BACK"
  if(abs(d) < abs(e)) return -2;//"ONLINE_FRONT"
  return 0;//"ON_SEGMENT"
}

point crosspoint(point a,point b,point c,point d){
  a-=d;b-=d;c-=d;
  return d+a+(b-a)*imag(a/c)/imag(a/c-b/c);
}

bool intersection(point a,point b,point c,point d){
  return (ccw(a,b,c)*ccw(a,b,d)<=0&&ccw(c,d,a)*ccw(c,d,b)<=0);
}

vector<point> ConvexCut(vector<point> &polygon,point a,point b){
  vector <point> res;
  for(int i=0;i<polygon.size();i++){
    point A=polygon[i],B=polygon[(i+1)%polygon.size()];
    if(ccw(a,b,A)!=-1)res.push_back(A);
    if(ccw(a,b,A)*ccw(a,b,B)==-1)res.push_back(crosspoint(a,b,A,B));
  }
  return res;
}

double get_area(vector <point> &polygon){
  if(polygon.size()<3)return 0;
  double res=0;
  for(int i=0;i<polygon.size();i++)
    res+=cross(polygon[i],polygon[(i+1)%polygon.size()])/2;
  return res;
}


int main(){
  int n;
  cin>>n;
  for(int i=0,a,b;i<n;i++) cin>>a>>b,pl.push_back(point(a,b));

  int m;
  cin>>m;
  for(int i=0,c,d;i<m;i++){
    cin>>c>>d;
    point a,b;
    a=point(c,d);
    cin>>c>>d;
    b=point(c,d);
    vector<point> res=ConvexCut(pl,a,b);
    printf("%.8f\n",get_area(res));
  }


  return 0;
}

Measured memory_bytes: 3228
import itertools
from collections import Counter
import math

N = int(input())

def generate_prime_numbers():
    search_range = 150
    search_list = [True for i in range(0, search_range+1)]
    search_list[0] = False
    search_list[1] = False
    search_list[2] = True
    for i in range(2, search_range+1):
        for j in range(i*2, search_range+1, i):
            search_list[j] = False
    prime_numbers = [i for i in range(search_range+1) if search_list[i] == True]
    return prime_numbers[:27]

def combination(n, r):
    return math.factorial(n) // math.factorial(r) // math.factorial(n-r)

prime_numbers = generate_prime_numbers()
encoded_strings = []
for i in range(N):
    S = input()
    encoded_string = 1
    for c in S:
        char_to_int = ord(c) - ord('a')
        encoded_string *= prime_numbers[char_to_int]
    encoded_strings.append(encoded_string)
# print(encoded_strings)

ans = 0
# for comb in itertools.combinations(encoded_strings, 2):
#     if comb[0] == comb[1]:
#         ans += 1
counter = Counter(encoded_strings)
for i in counter.values():
    if i > 1:
        ans += combination(i, 2)

print(ans)


Measured memory_bytes: 17456
#include <iostream>
#include <string>

using namespace std;



int main(){
    string s;
    cin >> s;
    int i = 2;
    int ans = 1000;
    for(; i < s.size(); ++i){
        int x = 0;
        x += (s[i-2] - '0') * 100;
        x += (s[i-1] - '0') * 10;
        x += (s[i-0] - '0') * 1;
        ans = min(ans, abs(753 - x));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
         
        int n = sc.nextInt();
        int m = sc.nextInt();
        int l = sc.nextInt();
         
        long[][] A = new long[n][m];
        long[][] B = new long[m][l];
        long[][] C = new long[n][l];
         
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < m; j++) {
                A[i][j] = sc.nextInt();
            }
        }
         
        for(int i = 0; i < m; i++) {
            for(int j = 0; j < l; j++) {
                B[i][j] = sc.nextInt();
            }
        }
         
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < l; j++) {
                for(int k = 0; k < m; k++) {
                    C[i][j] += A[i][k] * B[k][j];
                }
            }
        }
         
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < l-1; j++) {
                System.out.print(C[i][j] + " ");
            }
            System.out.println(C[i][l-1]);
        }
    }
}



Measured memory_bytes: 53504
n, k = map(int, input().split())
l = (n-1)*(n-2)//2
d = l-k
if d < 0:
  print(-1)
else:
  m = n-1+d
  print(m)
  A = [(i, j) for i in range(1, n) for j in range(i+1, n+1)]
  for i in range(m):
    print(*A[i])

Measured memory_bytes: 3992
// ※※※ 解答不能 ※※※
// 解き直し.
// scott_wu氏.
// https://atcoder.jp/contests/arc102/submissions/3114772
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const LL MOD = 998244353;
const int MAXN = 4100;

int K, N;
LL pascal[MAXN][MAXN];

int main(){

    pascal[0][0] = 1;
    for(int i = 1; i < MAXN; i++){
        for (int j = 0; j < MAXN; j++){
            pascal[i][j] = pascal[i - 1][j];
            if(j) pascal[i][j] = (pascal[i][j] + pascal[i - 1][j - 1]) % MOD;
        }
    }

    scanf("%d %d", &K, &N);
    for(int i = 2; i <= 2 * K; i++){
        int n2 = 0, n1 = 0;
        for(int j = 1; j <= K; j++){
            if(j * 2 == i) continue;
            if((i - j) <= K && (i - j) >= 1) n2++;
            else                             n1++;
        }
        n2 /= 2;
        LL res = 0;
        LL p2 = 1;
        for(int j = 0; j <= n2; j++){
            if(j) p2 = (p2 * 2) % MOD;
            if(j > N) continue;
            if(j == 0 && n1 == 0) continue;
            res = (res + pascal[n2][j] * (p2 * pascal[N + n1 - 1][j + n1 - 1] % MOD)) % MOD;
            if(i % 2 == 0) res = (res + pascal[n2][j] * (p2 * pascal[N+n1-2][j+n1-1] % MOD)) % MOD;
        }
        printf("%lld\n", res);
    }
    
    return 0;

}

Measured memory_bytes: 131584
while True :
  try :
    g, y, m, d = map(str, input().split())
    y = int(y)
    m = int(m)
    d = int(d)
    if(y <= 30) :
      print('HEISEI', y, m, d)
    elif(y == 31 and m <= 4):
      print('HEISEI',y , m, d)
    else:
      y = y - 30
      print('?', y, m, d)
  except :
      break



Measured memory_bytes: 5604
#include <iostream>
#include <queue>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

#define _overload3(_1,_2,_3,name,...) name
#define _all1(a) (a).begin(),(a).end()
#define _all2(a,n) (a),(a)+n
#define all(...) _overload3(__VA_ARGS__,42,_all2,_all1,)(__VA_ARGS__)
#define _rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define in(v) cin>>v;
#define out(v) cout<<v<<"\n"

const char BLACK = '#', WHITE = '.';
const int di[4] = {0, 1, 0, -1},
      dj[4] = {1, 0, -1, 0};
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int H, W; in(H); in(W);

  char s[H][W];
  int group[H][W];
  rep(i, H) rep(j, W) {
    group[i][j] = 0;
    in(s[i][j]);
  }
  queue<pii> q;
  int groups = 0;
  rep(i, H) rep(j, W) {
    if (group[i][j] != 0)
      continue;
    ++groups;
    q.push(pii(i, j));
    while (!q.empty()) {
      int i = q.front().first,
          j = q.front().second;
      q.pop();
      if (group[i][j] != 0)
        continue;
      group[i][j] = groups;
      rep(d, 4) {
        if (!(0 <= i + di[d] && i + di[d] < H && 0 <= j + dj[d] && j + dj[d] < W))
          continue;
        if (s[i][j] != s[i + di[d]][j + dj[d]])
          q.push(pii(i + di[d], j + dj[d]));
      }
    }
  }
  ll count_black[groups], count_white[groups];
  fill(all(count_black, groups), 0);
  fill(all(count_white, groups), 0);
  rep(i, H) rep(j, W) {
    if (s[i][j] == BLACK)
      ++count_black[group[i][j]-1];
    else
      ++count_white[group[i][j]-1];
  }
  ll ans = 0;
  rep(i, groups)
    ans += count_black[i] * count_white[i];
  out(ans);

  return 0;
}


Measured memory_bytes: 3072
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/abc155/tasks/abc155_a>
 問題文============================================================
 A - Poor
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll A,B,C; cin >> A >> B >> C;
    set<ll> st{A,B,C};
    if(st.size()==2) return "Yes";
    else return "No";
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<string>() << endl;
    return 0;
}


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

#define FOR(i, a, b) for(int i=a; i<b; i++)
typedef long long ll;
typedef vector<int> vi;

int main(){
    ios_base::sync_with_stdio(false);
    int n, k, c=1000000007;
    cin>>n>>k;
    int a[n];
    FOR(i, 0, n){
        cin>>a[i];
    }
    int dp[k+1];
    memset(dp, 0, sizeof(int)*(k+1));
    FOR(i, 0, a[0]+1){
        dp[i]=1;
    }
    FOR(i, 1, n){
        int temp=dp[k];
        for(int j=k-a[i]; j<k; j++){
            dp[k]=(dp[j]+dp[k])%c;
        }
        for(int j=k-1; j>=0; j--){
            swap(dp[j], temp);
            dp[j]=c-dp[j];
            dp[j]=(dp[j]+dp[j+1])%c;
            if(j>=a[i]){
                dp[j]=(dp[j]+dp[j-a[i]])%c;
            }
        }
    }
    cout<<dp[k]<<endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0; i<N; i++) cin >> A.at(i);

  int ansg35=0;
  int ansg2=0;
  int ansk=0;

  for(int i=0; i<N; i++){
    if(A[i]%2!=0) ansk++;
    else if(A[i]%2==0 && A[i]%3==0)ansg35++;
    else if(A[i]%2==0 && A[i]%5==0)ansg35++;
    else ansg2++;
  }
  
  if(ansg2>0) cout << "DENIED"  << endl;
   else if(ansg2==0 && ansg35==0) cout << "APPROVED"  << endl;
   else cout << "APPROVED" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main() {
  int a, b;

  cin >> a >> b;
  double S = a*b/(3.305785);
  printf("%.6lf\n", S); 
}

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

int main(){
  int n;
  cin >> n;
  long long int ans = 0;
  for(int i=1; i<=n; i++){
    if(i % 3 != 0 && i % 5 != 0){
      ans += i;
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>
#include <utility>
#include <map>
#include <set>
#include <ios>
#include <iomanip>
#include <functional>
#include <queue>

#define int long long

int inf = (1LL <<  62);

using namespace std;

signed main(){
    int n;
    cin >> n;
    vector<int> v;
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        v.push_back(x);
    }
    int max1 = 0;
    int max2 = 0;
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    for(int i = 0; i <= n - 2; i++){
        if(v[i] == v[i + 1]){
            if(max1 == 0){
                max1 = v[i];
                i++;
            }else{
                max2 = v[i];
                break;
            }
        }
    }
    cout << max1 * max2;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
void chmin(int &a, int b) {if(a > b) a = b;}
void chmax(int &a, int b) {if(a < b) a = b;}

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};


int main(){
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;

    vi a(n+1, 0);
    for(int i = 0 ; i < n ; i++){
        if(i == 0) continue;
        if(s[i-1] =='A' && s[i] == 'C') a[i+1] = a[i] + 1;
        else a[i+1] = a[i];
    }

    for(int i = 0 ; i < q ; i++){
        int x, y;
        cin >> x >> y;
        printf("%d\n", a[y]-a[x-1]+(x>=2&&s[x-2]=='A'&&s[x-1]=='C'? -1:0));
    }
    
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <tuple>

#define INF 100100100
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
using namespace std;

#define mod 998244353
 
int main(){
    int n; cin >> n;
    vector<int> x(n), y(n);
    rep(i, n) cin >> x[i];
    rep(i,n) y[i] = x[i];

    sort(y.begin(), y.end());
    
    int m1 = y[n/2 - 1], m2 = y[n/2];

    rep(i,n){
        if(x[i]<=m1){
            cout << m2 << endl;
            continue;
        }
        cout << m1 << endl;
        continue;
        
    }


}


Measured memory_bytes: 3712