akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n;
  cin>>n;
  long long int ans=0;
  for(long long int i=1;i<=n;i++)
  {
    if(i%3==0 || i%5==0)
    {
      ans=ans;
    }
    else
    {
      ans=ans+i;
  }
  }
  cout<<ans;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
 
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
int h,w;
string s[60]={};
int cnt[60][60];

int main(){
    for(int i=0; i<60; i++){
        for(int j=0; j<60; j++){
            cnt[i][j]=0;
        }
    }
        
    cin>>h>>w;
    for(int i=0; i<h; i++)cin>>s[i];
 
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            for(int k=-1; k<=1; k++){
                for(int l=-1; l<=1; l++){
                    if(i+k<0||i+k>h||j+l<0||j+l>w)continue;
                    if(s[i+k][j+l]=='#'){
                        cnt[i][j]++;
                    }
                }
            }
        }
    }
 
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(s[i][j]=='#'){
                cout<<s[i][j];
            }else{
                cout<<cnt[i][j];
            }
        }
        cout<<endl;
    }
}

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

int N;
int A[210];   
int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> A[i];
    int res = 0;
    while (true) {
        bool exist_odd = false;
        for (int i = 0; i < N; ++i) {
            if (A[i] % 2 != 0) exist_odd = true;
        }

        if (exist_odd) break;
        for (int i = 0; i < N; ++i) {
            A[i] /= 2;
        }
        ++res;
    }

    cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <ctime>
using namespace std;
#define _LL long long
#define rep(i, n) for (_LL i = 0; i < (_LL)(n); i++)
#define vecrep(itr, v) for (auto itr = (v).begin(); itr != (v).end(); itr++)

int main()
{
    int n; cin >> n;
    vector<int> b(n);
    rep(i, n - 1) cin >> b[i];
    _LL ans = 0;
    rep(i, n)
    {
        if( i == 0 )
        {
            ans += b[i];
        }
        else if( i == n - 1)
        {
            ans += b[i - 1];
        }
        else
        {
            ans += min(b[i], b[i - 1]);
        }
    }
    cout << ans << endl;
    return 0;    
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <cstdio>
#include <deque>
#include <algorithm>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <stack>

using namespace std;
long long n;
int ans = 0;
void go(long long x) {
	long long t = x;
	bool th = false;
	bool fi = false;
	bool se = false;
	while (t > 0) {
		if (t % 10 == 7)se = true;
		else if (t % 10 == 5)fi = true;
		else if (t % 10 == 3)th = true;
		t /= 10;
	}
	if (th && fi && se)ans += 1;
	if (x * 10 + 3 <= n) {
		go(x * 10 + 3);
	}
	if (x * 10 + 5 <= n) {
		go(x * 10 + 5);
	}
	if (x * 10 + 7 <= n) {
		go(x * 10 + 7);
	}
}
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	cin >> n;
	go(3); go(5); go(7);
	cout << ans << '\n';



}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<stack>
#include<set>
#include<queue>
#include<algorithm>
using namespace std;
const long long mod=1000000007;
const long long max_=1000000000;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b)
        cout<<c<<endl;
    else if(a==c)
        cout<<b<<endl;
    else if(b==c)
        cout<<a<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
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 (b<a) {a=b; return 1;} return 0;}

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...)
#define print(...)
#endif

map<int, int> prime_factors(int n) {
	map<int, int> res;
	if(n == 1) { // n=1 の素因数分解は n^1
		res[n] = 1;
		return res;
	}
	for(int i = 2, _n = n; i*i <= _n; ++i) {
		while(n % i == 0) {
			++res[i]; // 素因数i^{res[i]}
			n /= i;
			}
		}
	if(n != 1) res[n] = 1; // nが素数のとき
	return res;
}

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;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    // 全ての要素を素因数分解し、各素因数の次数の最大値を記録
    map<int, int> factors;
    rep(i, n) {
        map<int, int> mp = prime_factors(a[i]);
        for(const auto& m: mp) {
            int num = m.fi, cnt = m.se;
            if (!factors.count(num)) factors[num] = cnt;
            else factors[num] = max(factors[num], cnt);
        }
    }
    // 素因数ごとの次数の最大値をかけ合わせたものがLCM
    // 乗算の途中でMODを取って良い
    mint lcm = 1;
    for(const auto& f: factors) {
        mint num = f.fi;
        ll cnt = f.se;
        lcm *= num.pow(cnt);
    }
    // modlcm / a[i]を足し合わせる
    // MODを取った割り算なのでa[i]の逆元をかける
    mint ans = 0;
    rep(i, n) ans += lcm / a[i];
    
    cout << ans << endl;
}

Measured memory_bytes: 768
m, d = map(int, input().split())
ans = 0

if d < 22:
    print('0')
else:
    for i in range(22, d+1):
        s = str(i)
        if int(s[0]) < 2 or int(s[1]) < 2:
            continue
        k = int(s[0]) * int(s[1])
        if k >= 2 and k <= m:
            #print(i)
            ans += 1
    print(ans)


Measured memory_bytes: 3060
#include <stdio.h>

int main(void) {
	int n, m, l;
	int i, j, k;
	int a[100][100], b[100][100];
	
	scanf("%d %d %d", &n, &m, &l);
	
	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			scanf("%d", &a[i][j]);
		}
	}
	
	for (i = 0; i < m; i++) {
		for (j = 0; j < l; j++) {
			scanf("%d", &b[i][j]);
		}
	}
	
	for (i = 0; i < n; i++) {
		for (j = 0; j < l; j++) {
			long long sum = 0;
			
			for (k = 0; k < m; k++) sum += a[i][k] * b[k][j];
			
			printf("%s%lld", j ? " " : "", sum);
		}
		puts("");
	}
	
	return 0;
}

Measured memory_bytes: 688
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793

int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(auto c:s)
        if(c == '1')
            ans++;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int n; cin >> n;
    int maxv = 0;
    int ans = 0;

    for(int i=0; i<n; i++){
        int p; cin >> p;
        maxv = max(maxv, p);
        ans += p;
    }

    cout << ans-maxv/2 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#define ll long long
using namespace std;
int primes[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097};
//186

ll gcd(ll a, ll b){
	ll c = a%b;
	while(c){
		a = b;
		b = c;
		c = a%b;
	}
	return b;
}
vector<ll> v;
bool _prime(ll a){
	for(ll i=2; i<a; i++){
		if(a%i==0){
			return false;
		}
	}
	return true;
}
bool prime(ll a){
	for(ll i=0; primes[i]*primes[i]<=a && i < sizeof(primes)/sizeof(primes[0]); i++){
		if(a%primes[i]==0){
			return false;
		}
	}
	return true;
}
int main(){
	ll cnt = 0;
	for(ll i=2; i<1100000; i++){
		if(prime(i)){
			v.push_back(i);
		}
	}
//	cout << v[v.size()-1] << endl;
//	cout << v.size() << endl;
	ll a,b;
	cin>>a>>b;
	ll c = gcd(a, b);
	if(c>1000000000000){
		*(int *)0 = 0;
	}
	for(int i=0; i<v.size(); i++){
//		cout << v[i] << ' ';
		if(c%v[i]==0){
			cnt++;
			while(c%v[i]==0){
				c /= v[i];
			}
		}
	}
	
	if(c!=1){
		cnt++;
	}
	cout << cnt+1 << endl;
}
/*
60
1*2*2*3*5


*/


Measured memory_bytes: 1400
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

			int[] A=new int[100];

			Scanner scan = new Scanner(System.in);
			int n = scan.nextInt();

			for(int i = 0;i < n;i++){
				A[i] = scan.nextInt();
			}
			for(int i = n-1;i >= 0;i--){
				if(i != n-1){
					System.out.print(" ");
				}
				System.out.print(A[i]);
			}
			System.out.println();
		}
	}

Measured memory_bytes: 26200
#include <bits/stdc++.h>
using namespace std;
int main(){
    vector<string> chk = {"maerd","remaerd","esare","resare"};
    string s;
    cin>>s;
    reverse(s.begin(), s.end());
    int i=0;
    while(i<s.size()){
        for(int j=0; j<4; j++){
            if(chk[j]==s.substr(i,chk[j].size())){
                i+=chk[j].size();
                break;
            }
            else if(j==3){
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  LL N, M;
  cin >> N >> M;

  LL ans = 0;
  VL idx = {0ll};
  for(LL i=1,j=1;i<=N;++i){
	ans += i*i*i;
	idx.PB(j);
	j += i;
  }

  VVL qs(3);
  REP(i,M){
	LL Q, K;
	cin >> Q >> K;
	qs[Q].PB(K);
  }
  REP(q,3) SORT(qs[q]);

  VL blk_x;
  REP(i,N+1) blk_x.PB(i);

  for(LL x: qs[0]){
	if(x > N*(N+1)/2) continue;
	LL ix = (--upper_bound(ALL(idx), x)) - begin(idx);
	blk_x[ix]--;
	ans -= ix*ix;
  }

  VL blk_y(N+1);
  for(LL i=1;i<=N;++i)
	blk_y[i] = blk_y[i-1] + i * blk_x[i];

  VL del_y(N+1);
  for(LL y:qs[1]){
	if(y > N) continue;
	ans -= blk_y[N] - blk_y[y-1];
	++del_y[y];
  }

  LL acc = 0;
  VL blk_z(N+1);
  for(LL i=1;i<=N;++i){
	acc += del_y[i];
	blk_z[i] = blk_z[i-1] + (i - acc) * blk_x[i];
  }
  for(LL z: qs[2]){
	if(z > N) continue;
	ans -= blk_z[N] - blk_z[z-1];
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 5664
S = input()
Q = int(input())
Query = [input() for _ in range(Q)]
inv = False
add = ['','']
for query in Query:
    if query[0]=='1':
        inv = not inv
    else:
        add[(query[2] == '1') ^ inv] += query[-1]
ans = add[1][::-1] + S + add[0]
if inv:
    ans = ans[::-1]
print(ans)


Measured memory_bytes: 24296
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum[5000][5], k, q;

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

  cin >> n >> s;
  rep(i, n) {
    if (s[i] == 'R')
      sum[i][0]++;
    else if (s[i] == 'G')
      sum[i][1]++;
    else
      sum[i][2]++;
  }

  rep(i, 3) {
    rrrep(j, n - 2, 0) { sum[j][i] += sum[j + 1][i]; }
  }

  rep(i, n) {
    rrep(j, i + 1, n) {
      if (s[i] == s[j]) continue;
      cnt = 0;
      if ((s[i] == 'R' && s[j] == 'G') || (s[i] == 'G' && s[j] == 'R'))
        cnt += sum[j + 1][2];
      else if ((s[i] == 'R' && s[j] == 'B') || (s[i] == 'B' && s[j] == 'R'))
        cnt += sum[j + 1][1];
      else
        cnt += sum[j + 1][0];

      ll nex = 2 * j - i;
      if (nex < n && s[i] != s[nex] && s[j] != s[nex]) {
        cnt--;
      }
      ans += cnt;
    }
    // debug(ans);
  }
  Cout(ans);
  return 0;
}

Measured memory_bytes: 3768
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define sz(x) ((x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(ll a, ll b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmax(T &a, const T &b){ if(a < b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(a > b){ a=b; return 1; } return 0; }

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  char a, b, c, d;
  cin >> a >> b >> c >> d;

  rep(i, 0, 2) rep(j, 0, 2) rep(k, 0, 2){
    ll sum = a - '0';
    if(i == 0) sum += b - '0';
    else sum -= b - '0';

    if(j == 0) sum += c - '0';
    else sum -= c - '0';

    if(k == 0) sum += d - '0';
    else sum -= d - '0';

    if(sum == 7){
      cout << a << (i==0?'+':'-') << b << (j==0?'+':'-') << c << (k==0?'+':'-') << d << "=7" << endl;
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int ll;

int ans[100200];
int mult[100200];

int main(){
	int n,m; cin >> n >> m;
	ans[0]=1;
	for(int i=0;i<n;i++){
		mult[i]=1;
	}
	for(int i=0;i<m;i++){
		int x,y; cin >> x >> y;
		x--; y--;
		if(mult[x]==1){
			mult[x]=0;
			mult[y]++;
			if(ans[x]){
				ans[x]=0;
				ans[y]=1;
			}
		}
		else{
			if(ans[x]==0){
				mult[x]--;
				mult[y]++;
			}
			else{
				mult[x]--;
				ans[y]=1;
				mult[y]++;
			}
		}
	}
	int cnt=0;
	for(int i=0;i<n;i++){
		if(ans[i])cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 1024
n=int(input());s=input()
for p in range(4):
  l=[p//2,p%2]+[0]*(n-2)
  for i in range(1,n):l[(i+1)%n]=[l[i-1],1-l[i-1]][::(-1)**(s[i]=="o")][l[i]]
  for i in range(n):
    if s[i]!="ox"[int(l[(i-1)%n]==l[(i+1)%n])-l[i]]:break
  else:print("".join("WS"[x]for x in l));exit()
print(-1)


Measured memory_bytes: 11096
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Text;

class Program
{

    static void Main(string[] args)
	{
        // 整数の入力
        int N = int.Parse(Console.ReadLine());
        // スペース区切りの整数の入力
        string[] input = Console.ReadLine().Split(' ');

        List<int> intList = new List<int>();

        for(var i = 0;i < input.Length;i++)
        {
            intList.Add(int.Parse(input[i]));
        }

        int count = 0;


        for(var i = 0;i < intList.Count - 2; i++)
        {
            for(var j = i + 1;j < intList.Count - 1; j++)
            {
                if (intList[i] == intList[j]) continue;
                for (var k = j + 1; k < intList.Count; k++)
                {
                    if (intList[j] == intList[k]) continue;
                    if (
                        (intList[i] + intList[j] > intList[k]) &&
                        (intList[j] + intList[k] > intList[i]) &&
                        (intList[k] + intList[i] > intList[j]) &&
                        intList[i] != intList[j] &&
                        intList[j] != intList[k] &&
                        intList[k] != intList[i]
                     )
                    {
                        count++;
                        //Console.WriteLine((i+1) + " " + (j+1) + " " + (k+1));
                    }
                }
            }
        }

        Console.WriteLine(count);
    }
}

Measured memory_bytes: 17880
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  int ans = 1000;
  int s1 = 0,s2 = 0;
  vector<int> w(n);
  for(int i = 0; i < n; i++)
    cin >> w.at(i);
  
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      if(j <= i)
        s1 += w.at(j);
      else
        s2 += w.at(j);
    }
    if(ans > abs(s1-s2)) ans = abs(s1-s2);
    
    s1 = 0;
    s2 = 0;
  }
  
  cout << ans;
  
}


Measured memory_bytes: 3556
N = int(input())

AC = []
WA = []
TLE = []
RE = []
for i in range(N):
  inp = input()
  if inp == "AC":
  	AC.append(1)
  elif inp == "WA":
    WA.append(1)
  elif inp == "TLE":
    TLE.append(1)
  elif inp == "RE":
    RE.append(1)
  
  
print ("AC x {}".format(len(AC)))
print ("WA x {}".format(len(WA)))
print ("TLE x {}".format(len(TLE)))
print ("RE x {}".format(len(RE)))

Measured memory_bytes: 10056
#At coder 2020/2/16 B

# スペース区切りのサイズNの配列の入力
# スペース区切りのサイズNの配列の入力
N = int(input())
A = list(map(float, input().split())) 

U='APPROVED'


jj=0
for jj in range(len(A)):
    #jj=jj+1
    A2=A[jj]%2
    A3=A[jj]%3
    A5=A[jj]%5
    if A2==0:
        if A3!=0 and A5!=0:
            U='DENIED'
            break


print(U)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll MV = 1e6;
    ll n;
    cin >> n;
    vector<ll> a(n), cnt(MV + 1, 0);
    rep(i, n) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    reps(i, 1, MV + 1) {
        ll cv = i;
        while((cv + i) <= MV) {
            cnt[cv + i] += cnt[i];
            cv += i;
        }
    }
    ll ans = 0;
    rep(i, n) {
        if (cnt[a[i]] == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 12696
#include <math.h>
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
	double x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	double ret;
	if (x1 - x2 == 0) {
		ret = fabs((y1 - y2));
	} else if (y1 - y2 == 0) {
		ret = fabs((x1 - x2));
	} else {
		ret = sqrt((x1 - x2)*(x1 - x2)+(y1 - y2)*(y1 - y2));
	}

	cout << setprecision(10) << ret << endl;
	return 0;
}



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

halls = {}
for i in range(M):
    index = int(input())
    halls[index] = True

dp = [1] * (N + 1)

for i in range(1, N + 1):
    if i in halls:
        dp[i] = 0
        continue
    if i == 1:
        continue
    dp[i] = dp[max(0, i - 1)] + dp[max(0, i - 2)]
    
print(dp[N] % 1000000007)

Measured memory_bytes: 460020
def main():
  H,W,K = map(int,input().split())
  import numpy as np
  from collections import deque
  ans = 10000
  S = np.array([list(map(int,list(input()))) for _ in range(H)])
  cum = [[0]*W for _ in range(H+1)]
  for j in range(W):
    for i in range(1,H+1):
      cum[i][j] = cum[i-1][j]+S[i-1][j]

  cum = np.array(cum)
  for i in range(2**(H-1)):
    j = 0
    q = deque([0])
    for h in range(H):
      if (i>>h)&1:
        q.append(h+1)
    q.append(H)
    t_a = len(q)-2
    if t_a>=ans:
      continue
    p = deque()
    judge = False
    for a in range(len(q)-1):
      x = cum[q[a+1]]-cum[q[a]]
      if (x>K).any():
        judge = True
        break
      else:
        p.append(list(x))

    if judge:
      continue
    n = len(p)
    l = [0]*n
    for w in range(W):
      y = [l[j]+p[j][w] for j in range(n)]
      if max(y)>K:
        t_a+=1
        l = [p[j][w] for j in range(n)]
        if t_a>=ans:
          judge = True
          break
      else:
        l = y
    if judge:
      continue
    ans = min(ans,t_a)

  print(ans)
  
main()

Measured memory_bytes: 12964
h, w = map(int, input().split())

from collections import deque

q = deque([])

field = [input() for _ in range(h)]
black = [[0 for j in range(w)] for i in range(h)]

for i in range(h):
    for j in range(w):
        if field[i][j] == "#":
            black[i][j] = 1
            q.append((i, j, 0))

dir = [[-1, 0], [1, 0], [0, -1], [0, 1]]
ans = 0
while q:
    i, j, dist = q.popleft()
    for di, dj in dir:
        ni = i + di
        nj = j + dj
        if (0 <= ni and ni <= h-1) and (0 <= nj and nj <= w-1) and black[ni][nj] == 0:
            black[ni][nj] = 1
            ans = dist + 1
            q.append((ni, nj, dist + 1))

print(ans)



Measured memory_bytes: 136540
from collections import defaultdict


def solve(string):
    n, *s = string.split()
    d = defaultdict(int)
    for _s in s:
        d["".join(sorted(_s))] += 1
    return str(sum([v * (v - 1) // 2 for v in d.values() if v > 1]))


if __name__ == '__main__':
    n = int(input())
    print(solve('{}\n'.format(n)+'\n'.join([input() for _ in range(n)])))


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

int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  for(int i=0; i<n; i++) {
    bool f = true;
    for(int j=0; j<n; j++) {
      int temp = i+j;
      if(temp >= n) {
        temp -= n;
      }
      if(s.at(j) != t.at(temp)) {
        f = false;
      }
    }
    if(f) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import deque
n,q = map(int,input().split())
deq = deque([])
for i in range(n):
    A = input().split()
    s = A[0]
    m = int(A[1])
    deq.append([s,m])
ans = 0
while deq:
    p = deq.popleft()
    if 0 < p[1] <= q:
        ans += p[1]
        print(p[0],ans)
    else:
        ans += q
        p[1] -= q
        deq.append([p[0],p[1]])


Measured memory_bytes: 13272
#include <bits/stdc++.h>
#define MOD 1000000007
#define ll long long int
#define db double
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define endl "\n"
#define mp make_pair
#define f first
#define se second
#define pi 3.14159265358979
//ll string_inp() {cin.get(); for(int i =0;i<n;i++){ getline(cin,s[i]);}}
ll gcd(ll a, ll b){ if (a == 0) return b;  return gcd(b % a, a);  }
ll power(ll x, ll y, ll mod = 2e18) {ll ans = 1;x %= mod;while(y){if(y&1) ans = (x * ans) % mod;x = (x * x) % mod;y >>= 1;}return ans;}
ll modInverse(ll a, ll m) { ll m0 = m; ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) { ll q = a / m; ll t = m; m = a % m,a = t; t = y; y = x - q * y; x = t; } if(x < 0) x += m0;return x;}
int takemod(int a, int mod = MOD){a%=mod;if(a<0)a+=mod;return a;}
ll binsearch(std::vector<ll>& nums, ll target) {ll n = nums.size();ll l = 0;ll r = n-1;while(l<=r){ll mid = l+ (r-l)/2;if(nums[mid]==target)return mid;else if(nums[mid]>target)r = mid-1;else l = mid+1;}return -1;}
bool isPowerOfTwo (int x) {return x && (!(x&(x-1))); }

using namespace std;

int main()
{
   fastio
   ll a,b,c;
   cin>>a>>b>>c;
   ll ans =0;
   while(a>0)
   {
       ans+=c;
       a-=b;

   }
   cout<<ans<<endl;



}




Measured memory_bytes: 3644
#include <stdio.h>
#include <limits.h>

#define M 101
#define WHITE 0
#define GRAY 1
#define BLACK 2


void bfs(int);
void enqueue(int);
int dequeue(void);
int isEmpty(void); 

int g[M][M];
int Q[M];
int d[M];
int color[M];

int n, head = 0, tail = 0;


int main(){
  int u, k, v;
  int i, j;

  for(i = 0; i < M; i++) Q[i] = 0;

  scanf("%d", &n);

  for(i = 0; i <= n; i++){
    for(j = 0; j <= n; j++){
      g[i][j] = 0;
    }
  }

  for(i = 1; i <= n; i++){
    scanf("%d", &u);
    scanf("%d", &k);

    for(j = 1; j <= k; j++){
      scanf("%d", &v);

      g[u][v] = 1;
    }
  }

  bfs(1);

  for(i = 1; i <= n; i++) printf("%d %d\n", i, d[i]);

  
  return 0;
}


void bfs(int s){
  int i;
  int u, v;

  for(i = 1; i <= n; i++){
    color[i] = WHITE;
    d[i] = -1;
  }

  color[i] = GRAY;
  d[s] = 0;

  enqueue(s);

  while(isEmpty() != 1){
    u = dequeue();

    for(v = 1; v <= n; v++){
      if(color[v] == WHITE && g[u][v] == 1){
	color[v] = GRAY;
	d[v] = d[u] + 1;
	enqueue(v);
      }
    }

    color[u] = BLACK;
  }
}


void enqueue(int x){
  Q[tail] = x;

  if(tail + 1 == M) tail = 0;

  else tail++;
}


int dequeue(){
  int x;

  x = Q[head];

  if(head + 1 == M) head = 0;

  else head++;

  return x;
}


int isEmpty(){
  int sta = 0;

  if(head == tail) sta = 1;

  return sta;
}



Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int D; cin >>D;
  if(D==25){
    cout<<"Christmas"<<endl;
  }else if(D==24){
    cout<<"Christmas Eve"<<endl;
  }else if(D==23){
    cout<<"Christmas Eve Eve"<<endl;
  }else if(D==22){
    cout<<"Christmas Eve Eve Eve"<<endl;
  }
  return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll N,M;
ll mo;
ll dp[6020][12040];


void solve() {
	int i,j,k,l,r; string s;
	
	cin>>N>>M;
	mo=M;
	dp[0][6005]=1;
	int x,y,z;
	FOR(x,3*N+1) FOR(y,12021) if(dp[x][y]) {
		// 1
		(dp[x+1][y+1]+=dp[x][y])%=mo;
		// 2
		(dp[x+2][y-1]+=dp[x][y]*(x+1))%=mo;
		// 3
		(dp[x+3][y]+=dp[x][y]*(x+2)*(x+1))%=mo;
	}
	
	ll ret=0;
	for(y=6005;y<=12010;y++) ret+=dp[3*N][y];
	cout<<ret%mo<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 563584
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
#pragma GCC optimize("Os")
#pragma GCC target("avx2,fma")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("Os")
*/
 
#include <bits/stdc++.h>
//#include <windows.h>
 
#define ll long long
#define X first
#define Y second
#define MP make_pair
 
using namespace std;
 
const int N = 5e5 + 123;
const ll mod = 1e9 + 7;

int n, k, f[N], b[N], Aybar_gde_F[N];
pair<int, int> a[N];

void fupd(int v, int val){
	for(;v <= n;v = (v | (v + 1)))
		f[v] += val;
}

int fget(int v){
	int val = 0;
	for(;v >= 0;v = (v & (v + 1)) - 1)
		val += f[v];
   	return val;
}

int t[N * 4], tt[N * 4];

void build(int v, int tl, int tr){
	if(tl == tr){
		t[v] = b[tl];
		return;
	}
	int tm = (tl + tr) / 2;
	build(v * 2, tl, tm);
	build(v * 2 + 1, tm + 1, tr);
	t[v] = min(t[v * 2], t[v * 2 + 1]);
}

void push(int v){
	if(tt[v] == 0)
		return;
	t[v * 2] = max(0, t[v * 2] + tt[v]);
	t[v * 2 + 1] = max(0, t[v * 2 + 1] + tt[v]);
	tt[v * 2] += tt[v], tt[v * 2 + 1] += tt[v];
	tt[v] = 0;
}

void upd(int v, int tl, int tr, int l, int r, int val){
	if(tl > r || l > tr)	
		return;
	if(tl >= l && tr <= r){
		t[v] = max(0, t[v] + val);
		tt[v] += val;
		return;
	}
	push(v);
	int tm = (tl + tr) / 2;
	upd(v * 2, tl, tm, l, r, val);
	upd(v * 2 + 1, tm + 1, tr, l, r, val);
	t[v] = min(t[v * 2], t[v * 2 + 1]);
}

int get_solve(int v, int tl, int tr){
	if(tl == tr){
		return tl;
	}
	push(v);
	int tm = (tl + tr) / 2;
	if(t[v * 2] < t[v * 2 + 1]){
		return get_solve(v * 2, tl, tm);
	}
	else{
		return get_solve(v * 2 + 1, tm + 1, tr);
	}
}

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

    cin >> n >> k;
    for(int i = 1;i <= n;i++){
    	cin >> a[i].X;
    	a[i].X *= -1;
    	a[i].Y = i;
    }
                /*
    for(int i = 1;i <= n;i++){
    	for(int j = 1;j <= n;j++){
    		if(abs(i - j) < k && -a[i].X < -a[j].X)
    			cout << i << " " << j << "\n";
    	}
    }             */
    
    sort(a + 1, a + n + 1);

    for(int i = 1;i <= n;i++){
    	int pos = a[i].Y;
    	b[pos] = fget(min(n, pos + k - 1)) - fget(max(0, pos - k));
    	fupd(pos, 1);	
    }

    build(1, 1, n);

    for(int i = n;i >= 1;i--){
    	int pos = get_solve(1, 1, n);
    	//cerr << b[pos] << " " << pos << "\n";
    	//cerr << pos << "\n";
    	Aybar_gde_F[pos] = i;
    	upd(1, 1, n, max(1, pos - k + 1), min(n, pos + k - 1), -1);
    	upd(1, 1, n, pos, pos, N);
    	//debug(1, 1, n);
    }

    for(int i = 1;i <= n;i++)
    	cout << Aybar_gde_F[i] << "\n"; 
	return 0;
}


Measured memory_bytes: 26880
#include <algorithm>
 #include <iostream>
 #include <vector>
 using namespace std;
 typedef long long ll;
 const int INF = 1 << 30;
 const ll INFll = 1ll << 60;
 
 int main() {
   string s;
   cin >> s;
   string ans = "No";
   if(s[0] == s[1] && s[1] == s[2]) ans = "Yes";
   if(s[2] == s[3] && s[1] == s[2]) ans = "Yes";
   cout << ans << endl;
 	return 0;
 }

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    k,n = LI()
    a = LI()
    a += [a[0]+k]
    ans = k
    for i in range(n):
        m = a[i+1]-a[i]
        s = k-m
        if s < ans:
            ans = s
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 71884
x, y = input().split()
A = ['1', '3', '5', '7', '8', '10', '12']
B = ['4', '6', '9', '11']
if x == y == '2':
    print('Yes')
elif (x in A) and (y in A):
    print('Yes')
elif (x in B) and (y in B):
    print('Yes')
else:
    print('No')

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

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    int s = 0;
    for (int i = 1; i < n; i++) s += i;
    for (int i = 1; i < m; i++) s += i;
    cout << s << endl;
}


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

int main()
{
int a,b,c;
  cin>>a>>b>>c;
  
 bool ans=false;
    
  if(a==b&&a!=c)
    ans=true;
  
  else if(b==c&&b!=a)
    ans=true;
  
  else if(a==c&&b!=a)
    ans=true;
  
  else ans=false;  
  
  if(ans)
    cout<<"Yes";
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
def checkRow(x)
    x.each do |a|
        if a.length == a.count{|b|b=='.'} then
            return true
        end
    end
    false
end
def checkCol(x)
    x.transpose.each do |a|
        if a.length == a.count{|b|b=='.'} then
            return true
        end
    end
    false
end
def check(x)
    checkRow(x) || checkCol(x)
end
H,W = gets.split.map(&:to_i)
x = Array.new(H).map{Array.new(W)}
H.times{|i| x[i] = gets.chomp.split('')}
while check(x) do
    if checkRow(x) then
        y = []
        x.each do |a|
            y.push a if a.length != a.count{|b|b=='.'}
        end
        x = y
    end
    if checkCol(x) then
        y = []
        x.transpose.each do |a|
            y.push a if a.length != a.count{|b|b=='.'}
        end
        x = y.transpose
    end
end

x.each{|a| puts a.join('')}

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

int main()
{

        std::string s;
        cin >> s;
        int len = s.length();
        int check[26];
        for (int i = 0; i < 26; ++i) {
                check[i] = 0;
        }
        for (int i = 0; i < len; ++i) {

                char c = s[i] - 'a';
                check[c]++;

        }
        for (int i = 0; i < 26; ++i) {

                if (check[i] % 2) {
                        cout << "No" << endl;
                        return 0;
                }
        }
        cout << "Yes" << endl;

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;



//1-indexedに注意！！！
struct BIT{
    private:
    int n,n_;
    vector<long long> bit;

    public:
    BIT(int n):n(n){
        bit.resize(n+1);
        n_ = 1;
        while(n_<=n) n_<<=1;
        n_ >>= 1;
    }
    //1-index
    long long sum(int i){
        long long res = 0;
        while(i > 0){
            res += bit[i];
            i -= i&-i;
        }
        return res;
    }
    //1-index
    void add(int i,long long val){
        while(i <= n){
            bit[i] += val;
            i += i&-i;
        }
    }
    //return 1-index
    int lowerbound(long long w){
        if(w <= 0) return 0;
        int x = 0;
        for(int k=n_;k>0;k>>=1){
            if(x+k<=n&&bit[x+k]<w){
                w -= bit[x+k];
                x += k;
            }
        }
        return x+1;
    }
};



int main(){
    int n;
    cin >> n;
    int q;
    cin >> q;
    vector<int> c(n);
    rep(i,n) cin >> c[i],--c[i];
    vector<vector<P>> r(n);
    rep(i,q){
        int left,right;
        cin >> left >> right;
        --left;--right;
        r[right].push_back(P(left,i));
    }

    vector<int> queryans(q,0);

    vector<int> color(n,-1);
    BIT bit(n);

    rep(i,n){
        if(color[c[i]]==-1){
            bit.add(i+1,1);
            color[c[i]] = i+1;
        }
        else{
            bit.add(color[c[i]],-1);
            bit.add(i+1,1);
            color[c[i]] = i+1;
        }

        rep(j,r[i].size()){
            queryans[r[i][j].second] = bit.sum(i+1) - bit.sum(r[i][j].first);
        }
    }

    rep(i,q) cout << queryans[i] << endl;

    return 0;
}

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

using namespace std;

int main(void)
{
	int sx,sy,tx,ty; cin>>sx>>sy>>tx>>ty;
	
	for(int i = sx; i < tx; i++) cout<<"R";
	for(int i = sy; i < ty; i++) cout<<"U";
	for(int i = tx; i > sx; i--) cout<<"L";
	for(int i = ty; i > sy-1; i--) cout<<"D";
	for(int i = sx; i < tx+1; i++) cout<<"R";
	for(int i = sy-1; i < ty; i++) cout<<"U";
	cout<<"L"<<"U";
	for(int i = tx; i > sx-1; i--) cout<<"L";
	for(int i = ty+1; i > sy; i--) cout<<"D";
	cout<<"R"<<endl;
	
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(){
   int a, b, c, d;
   scanf("%d %d %d %d", &a, &b, &c, &d);

   int judge = 1;
   while(a>0 && c>0){
      if(judge > 0){
         c -= b;
      }	else {
         a -= d;
      }
      judge *= -1;
   }

   if(a>0){
      printf("Yes\n");
   } else {
      printf("No\n");
   }

   return 0;
}


Measured memory_bytes: 1648
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for i in range(1, H+1):
        if i == 1 or i == H:
            print('#'*W)
        else:
            print('#', '.'*(W-2), '#', sep='')
    print()



Measured memory_bytes: 5632
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#define MOD 1000000007
typedef long long ll;

using namespace std;

int main() {
    string s;
    cin >> s;
    
    if(s == "Sunny") {
        cout << "Cloudy" << endl;
    }
    else if(s == "Cloudy") {
        cout << "Rainy" << endl;
    }
    else {
        cout << "Sunny" << endl;
    }
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int a, b;
  cin >> a >> b;
  if ((a) % 3 == 0 || (b) % 3 == 0 || (a + b) % 3 == 0) {
    cout << "Possible" << endl;
  } else {
    cout << "Impossible" << endl;
  }
}


Measured memory_bytes: 256
n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)
i = 0
count = 0
correct_arr = (1..n).to_a
while i < n
  if arr[i] != correct_arr[i]
    count += 1
  end
  i += 1
end
if count == 0 || count == 2
  puts "YES"
else
  puts "NO"
end

Measured memory_bytes: 14384
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) rep(i,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vout(v) VOUT(v,z);
#define vdbg(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
// template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
// template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
bool is_palindrome(string s){return s == string(s.rbegin(),s.rend());}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}



int main(){
    char a;
    cin >> a;
    if(a >= 'A' && a <= 'Z'){
        cout << 'A' << endl;
    }else{
        cout << 'a' << endl;
    }

    return 0;
}


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

#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

void solve()
{
  string s;
  cin>>s;
  int l = (int)(s.length());
  string t;
  for (int i=0; i<l-1; i++) {
    if (s[i]=='B'&&s[i+1]=='C') {
      t.push_back('D');
      i++;
    } else {
      t.push_back(s[i]);
    }
  }
  ll a=0;
  ll ans=0;
  for (auto& c: t) {
    if (c=='A') { a++; continue; }
    if (c=='D') { ans += a; continue; }
    a=0;

  }
  cout << ans << endl;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 776
#include <iostream>

using namespace std;

int main() {
  int H, W;
  char C[100][100];
  cin >> H >> W;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> C[i][j];
    }
  }

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++)
      cout << C[i][j];
    cout << '\n';
    for (int j = 0; j < W; j++)
      cout << C[i][j];
    cout << '\n';
  }

  return 0;
}


Measured memory_bytes: 256
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

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

#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
#define MAX_N (100001)
typedef long long ll;

using namespace std;

vector<int> v(100001,INF);
int i = 1;

void solve(int res,int k) {
	if (res == 0) {
		rep(j, 9) {
			v[i] = j+1;
			i++;
			solve(j + 1, j + 1);
		}
		return;
	}
	for (int x = max(0LL, k - 1); x <= min(9LL, k + 1); x++) {
		int res2 = res * 10 + x;
		if (res2 > 3234566667) continue;
		v[i] = res2;
		i++;
		solve(res2, x);
	}
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	v[0] = 0;
	solve(0, 0);
	sort(all(v));
	int k; cin >> k;
	cout << v[k] << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int[] hs = new int[n];
        long[] dp = new long[n+1];
        for (int i = 0; i < n; i++) {
            hs[i] = std.nextInt();
        }

        dp[0] = 0;
        dp[1] = 0;
        dp[2] = Math.abs(hs[1] - hs[0]);
        for (int i = 2; i < n; i++) {
            long one = dp[i] + Math.abs(hs[i] - hs[i-1]);
            long two = dp[i - 1] + Math.abs(hs[i] - hs[i - 2]);
            dp[i + 1] = Math.min(one, two);
        }

        System.out.println(dp[n]);
    }
}


Measured memory_bytes: 58880
#include<stdio.h>

// If prime, return 1, else return 0.
int isPrime(int num){
    int rtn = 1;
    int i;
    
    for(i=2; i*i <= num; i++){
        if(num%i == 0){
            rtn = 0;
            break;
        }
    }
    return rtn;
}

int main(void){
    int sum, num;
    int i;
    int ans = 0;
    
    scanf("%d", &sum);
    
    for(i=0; i<sum; i++){
        scanf("%d", &num);
        if(isPrime(num)) ans++;
    }
    
    printf("%d\n",ans);
    
    return 0;
}

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

using namespace std;

int ans,a,b,c,ta,tb,tc;

int main(){
	int i,t;
	scanf("%d%d%d",&a,&b,&c);
	if(a&1||b&1||c&1){puts("0"); return 0;} 
	if(a==b&&b==c){puts("-1"); return 0;}
	
	ta=a&(-a); tb=b&(-b); tc=c&(-c);
	while(ta==tb && tb==tc){
		t=a+b>>1; b=b+c>>1; c=c+a>>1; a=t;
		ans++;
		ta=a&(-a); tb=b&(-b); tc=c&(-c);
	}
	t=min(ta,min(tb,tc));
	for(;(t&1)==0;t>>=1) ans++;
	printf("%d\n",ans);
	return 0;
} 

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

#define ll      long long
#define MAX     1000007
#define inf     99999999999999
#define MOD     1000000007
#define pii     pair<int,int>
#define FIN     freopen("input.txt","r",stdin);
#define FOUT    freopen("output.txt","w",stdout);

int main ()
{
    ll x,y;
    scanf("%lld",&x);
    printf("%lld\n",48-x);
}


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

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;

void mainmain(){
  int a,b;
  char op;
  while(cin>>a>>op>>b,op!='?'){
    if(op=='+'){
      a+=b;
    }
    else if(op=='-'){
      a-=b;
    }
    else if(op=='*'){
      a*=b;
    }
    else{
      a/=b;
    }
    cout<<a<<endl;
  }
}



}
main() try{
    mainmain();
}
catch(...){
}

Measured memory_bytes: 1160