akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define FastIO      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define pb          push_back
#define inf         1e9+5
#define mp          make_pair
#define ll          long long
#define pii         pair<int,int >
#define fileout     freopen("output.txt","w",stdout)
#define filein      freopen("input.txt","r",stdin)
#define mem(x,i)    memset(x,i,sizeof x)
#define PI          acos(-1.0)
#define ff          first
#define ss          second
#define all(x)      x.begin(),x.end()
#define Case(t)     for(int ks=1;ks<=t;ks++)
#define sf          scanf
#define pf          printf
/*------------------------------Graph Moves----------------------------*/
//const int fx[]= {+1,-1,+0,+0};
//const int fy[]= {+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/
using namespace std;
//
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//
//template <typename T>  using orderedSet =
//    tree<T, null_type, less_equal<T>,
//    rb_tree_tag, tree_order_statistics_node_update>;//find_by_order,order_of_key
////

int main()
{
    int k;
    cin>>k;
    ll sum=0;
    for(ll i=1; i<=k; i++)
    {
        for(ll j=1; j<=k; j++)
        {
            for(ll t=1;t<=k;t++)
            {
                ll g=__gcd(i,j);
                g=__gcd(g,t);
                sum+=g;
            }
        }
    }
    cout<<sum<<endl;
}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  int32_t main()
  {        
      IOS


    int n;
    cin>>n;
    cout << ((n-1)*(n) )/2;

    return 0;
 
     }

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

#pragma GCC optimize "O3"
#define rep(i,a,n) for(int i=a; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const ll powll = 1LL<<1;

int main(void){
    int n; cin >> n;
    string s;
    map<string,int>mp;
    rep(i,0,n){
        cin >> s;
        mp[s]++;
    }
    cout << mp.size() << "\n";

}

Measured memory_bytes: 19224
import java.util.*;
public class Main {
   private static int dp[];
  public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		int sumw = sc.nextInt();
        int[] wgt = new int[n];
        int[] val = new int[n];
		long[][] dp = new long[n+1][sumw+1];
        for (int i = 0; i < n; i++) {
        	wgt[i] = sc.nextInt();
        	val[i] = sc.nextInt();
        }
		for (int i = 0; i < n; ++i) {
        	for (int w = 0; w <= sumw; ++w) {
        		if (w - wgt[i] >= 0) {
        			dp[i+1][w]=chmax(dp[i][w],dp[i][w - wgt[i]]+val[i]);
        		} else {
	        		dp[i+1][w]=chmax(dp[i+1][w],dp[i][w]);
	        	}
        	}
        }
		System.out.println(dp[n][sumw]);
	}

	private static long chmax(long i, long j) {
		return Math.max(i, j);
	}
}



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

int main() {
  	int n;cin>>n;
  	vector<string> s(n);
  	for (int i=0;i<n;i++) cin>>s.at(i);
  
  	int m;cin>>m;
  	vector<string> t(m);
  	for (int i=0;i<m;i++) cin>>t.at(i);
  	
  	int ans=0;
  	for(int i=0;i<n;i++){
      	int count=0;
    	//青いｶｰﾄﾞ
      	for(int j=0;j<n;j++){
          	if(s.at(i)==s.at(j)){
            	count++;
            }
        }
      	//赤いｶｰﾄﾞ
         for(int j=0;j<m;j++){
          	if(s.at(i)==t.at(j)){
            	count--;
            }
        } 
    	ans=max(ans,count);
    }
  		cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <chrono>
#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;

long long gcd(long long a, long long b) {
    long long l = max(a, b);
    long long s = min(a, b);
    while (l) {
        l %= s;
        if (l != 0) swap(l, s);
    }
    return s;
}

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

    vector<long long> gcd_S(N);
    vector<long long> gcd_S_rev(N);
    gcd_S[0] = A[0];
    gcd_S_rev[N - 1] = A[N - 1];
    for (int i = 1; i < N; i++) {
        gcd_S[i] = gcd(gcd_S[i - 1], A[i]);
    }

    for (int i = N - 2; i >= 0; i--) {
        gcd_S_rev[i] = gcd(gcd_S_rev[i + 1], A[i]);
    }

    long long max_gcd = gcd_S[N - 1];

    for (int i = 0; i < N; i++) {
        if (i == 0) {
            max_gcd = max(max_gcd, gcd_S_rev[i + 1]);
        } else if (i == N - 1) {
            max_gcd = max(max_gcd, gcd_S[i - 1]);
        } else {
            max_gcd = max(max_gcd, gcd(gcd_S[i - 1], gcd_S_rev[i + 1]));
        }
    }

    cout << max_gcd << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n-1;i>s;i--)
#define rep_re(i,s,n)for(ll i = n-1;i>=s;i--)
ll MOD = 1e9 + 7;

static const ll FACT_SIZE = 10000000;
ll fact[FACT_SIZE] = {};

ll Pow(ll n, ll p) {
	if (p == 0)return 1;
	if (p == 1)return n;
	ll t = Pow(n, p / 2);
	if (p & 1) return (t * t % MOD) * n % MOD;
	else return t * t % MOD;
}
void factorial(ll f) {
	fact[0] = fact[1] = 1;
	rep(i, 1, FACT_SIZE) fact[i] = fact[i - 1] * i % MOD;
}

ll nCr(ll n, ll r) {
	if (fact[0] == 0)	factorial(FACT_SIZE);
	return ((fact[n] * (Pow(fact[r], MOD - 2) % MOD)) % MOD * Pow(fact[n - r], MOD - 2)) % MOD;
}
int main() {
	ll x, y; cin >> x >> y;

	if ((x + y) % 3) {
		cout << 0 << endl;
		return 0;
	}
	ll m = (2 * x - y) / 3;
	ll n = (2 * y - x) / 3;

	if (m < 0 || n < 0) {
		cout << 0;
		return 0;
	}


	cout <<  nCr(m + n, m) << endl;

	
}


Measured memory_bytes: 78336
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;

//template
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

int main() {
    ll k;
    cin >> k;
    if (k == 0) {
        cout << "4" << endl;
        cout << "3 3 3 3" << endl;
        return 0;
    }
    if (k == 1) {
        cout << "3" << endl;
        cout << "1 0 3" << endl;
        return 0;
    }
    if (k == 2) {
        cout << "2" << endl;
        cout << "2 2" << endl;
        return 0;
    }
    if (k == 3) {
        cout << "7" << endl;
        cout << "27 0 0 0 0 0 0" << endl;
        return 0;
    }
    if (k == 1234567894848) {
        cout << "10" << endl;
        cout << "1000 193 256 777 0 1 1192 1234567891011 48 425" << endl;
        return 0;
    }
    V<ll> v(50);
    for (int i = 0; i < 50; i++) {
        v[i] = 49 - i;
        v[i] += k / 50;
        if (i < k % 50) v[i]++;
    }
    
    cout << 50 << endl;
    for (int i = 0; i < 50; i++) {
        cout << v[i];
        if (i != 50-1) cout << " ";
    }
    cout << endl;
    return 0;
}


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


int main () {
  int n, m;
  int a[100], b[100];
  int n_perm[10];
  int ans = 0;

  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> a[i] >> b[i];

  for (int i = 0; i < n; i++) {
    n_perm[i] = i;
  }

  do {
    if (n_perm[0] != 0) break;
    bool can2 = true;
    for (int i = 0; i < n-1; i++) {
      int pos1 = n_perm[i] + 1;
      int pos2 = n_perm[i+1] + 1;
      bool can = false;
      for (int k = 0; k < m; k++) {
        if ((a[k] == pos1 && b[k] == pos2) || (b[k] == pos1 && a[k] == pos2)) {
          can = true;
        }
      }
      if (!can) can2 = false;
    }
    if (can2) ans++;
  } while (next_permutation(n_perm, n_perm + n));

  cout << ans << endl;
}


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

void QSort(int x[ ], int left, int right);
void Swap(int x[ ], int i, int j);

void QSort(int x[ ], int left, int right)
{
    int i, j;
    int pivot;

    i = left;                      /* ソートする配列の一番小さい要素の添字 */
    j = right;                     /* ソートする配列の一番大きい要素の添字 */

    pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */

    while (1) {                    /* 無限ループ */

        while (x[i] < pivot)       /* pivot より大きい値が */
            i++;                   /* 出るまで i を増加させる */

        while (pivot < x[j])       /* pivot より小さい値が */
            j--;                   /*  出るまで j を減少させる */
        if (i >= j)                /* i >= j なら */
            break;                 /* 無限ループから抜ける */

        Swap(x, i, j);             /* x[i] と x[j]を交換 */
        i++;                       /* 次のデータ */
        j--;
    }
    //ShowData(x, 10);               /* 途中経過を表示 */

    if (left < i - 1)              /* 基準値の左に 2 以上要素があれば */
        QSort(x, left, i - 1);     /* 左の配列を Q ソートする */
    if (j + 1 <  right)            /* 基準値の右に 2 以上要素があれば */
        QSort(x, j + 1, right);    /* 右の配列を Q ソートする */
}

  /* 配列の要素を交換する */
void Swap(int x[ ], int i, int j)
{
    int temp;

    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

  /* n 個のデータを表示する */
void ShowData(int x[ ], int n)
{
    int i;

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


int main(){
    int num_city;
    int x_start;
    int i_start;
    int i_end;
    int d;
    int d_start;
    int bet;
    int y;
    int y_start;
    int i;
    int ans;

    cin >> num_city;
    cin >> x_start;

    int x[num_city];
    for(int n = 0 ; n < num_city ; n++ ) cin >> x[n];
    i_start = 0;
    i_end   = num_city - 1;
    QSort(x, i_start, i_end);

    d_start = 1000000000;
    if( x[i_start] < x_start ){
        d_start = x_start - x[i_start] ;
    }

    if( x[i_end]   > x_start ){
        bet = x[i_end] - x_start;
        if( d_start > bet ) d_start = bet ;
    }

     ans = 0;

    if(num_city == 1){
        if(x[i_start] > x_start) d = x[i_start] - x_start;
        else if(x[i_start] < x_start) d = x_start - x[i_start] ;
        ans = d;
        cout << ans;
        return 0;
    }

 
    y_start = x[i_start];

    for( d = d_start ; d > 0 ; d-- ){
        i = i_start;
        y = y_start;
        while(1){
            if ( x[i] < y ){
                //next d length
                break;
            }
            else if ( x[i] == y ){
                //next city
                //cout << "next_city" << endl;
                i = i + 1;
                if( i == num_city ){
                    ans = d;
                    cout << ans;
                    return 0;
                }
            }
            //next point
            y = y + d;
        }
    }

    cout << ans;
    return 0;
}

Measured memory_bytes: 640
N, M = map(int, input().split())
F = [True for _ in range(M)]
# print(F)
for _ in range(N):
    IN = input().split()
    # K = int(IN[0])
    A = [int(a) for a in IN[1:]]
    G = [i in A for i in range(1, M + 1)]
    F = [F[i] and G[i] for i in range(M)]
print(F.count(True))


Measured memory_bytes: 3060
import sys


class UnionFind():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x


N, M = map(int, input().split())
edge = [tuple(map(int, s.split())) for s in sys.stdin.readlines()]

cnt = 0
for i in range(M):
    uf = UnionFind(N)
    for j, (a, b) in enumerate(edge):
        if j == i:
            continue
        else:
            uf.union(a - 1, b - 1)
    if uf.parents[uf.find(0)] != -N:
        cnt += 1

print(cnt)


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

using ll = long long;
const ll INF = 1LL << 50;

int main(){

  int n,m;
  cin >> n >> m;

  const int nmax = 1000;
  const int mmax = 2000;
  int a[mmax],b[mmax];
  ll c[mmax];

  for(int i=0; i<m; i++){
    cin >> a[i] >> b[i] >> c[i];
    c[i] = -c[i];
  }

  ll d[nmax];

  for(int i=0; i<n; i++){
    d[i] = INF;
  }

  d[0] = 0;

  for(int loop = 0; loop < n-1; loop++){
    for(int i=0; i<m; i++){
      if(d[a[i]-1] == INF){
        continue;
      }
      if(d[b[i]-1] > d[a[i]-1] + c[i]){
        d[b[i]-1] = d[a[i]-1] + c[i];
      }
    }
  }

  ll ans = d[n-1];

  bool negative[nmax];

  for (int i = 0; i < n; ++i) {
    negative[i] = false;
  }

 for (int loop = 0; loop < n ; ++ loop) {
  for (int i = 0; i < m; ++i) {
    if (d[a[i] - 1] == INF) continue;
    if (d[b[i] - 1] > d[a[i] - 1] + c[i]) {
      d[b[i] - 1] = d[a[i] - 1] + c[i];
      negative[b[i] - 1] = true;
    }

    if (negative[a[i] - 1] == true) {
      negative[b[i] - 1] = true;
    }
 }
}

if(negative[n-1]){
  cout << "inf" << endl;
}
else{
  cout << -ans << endl;
}
  return 0;

}

Measured memory_bytes: 256
s = input()
t = input()
ls = len(s)
lt = len(t)


dp = [[0 for i in range(lt+1)] for j in range(ls+1)]
answer = ''

for i in range(ls):
    for j in range(lt):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])


i = ls-1
j = lt-1
while (0 <= i) & (0 <= j):
    if s[i] == t[j]:
        answer += s[i]
        i -= 1
        j -= 1
    elif dp[i+1][j+1] == dp[i+1][j]:
        j -= 1
    else:
        i -= 1
if len(answer) == 0:
  print('')
else:
  print(answer[::-1])


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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef int64_t Int;
typedef std::vector<Int> LI;
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

template<typename T>
struct Maybe {
   T x;
   bool valid;
   Maybe() : valid(false) {}
   Maybe(T x_) : x(x_), valid(true) {}
   operator T() const {
      assert( valid );
      return x;
   }
};


struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      Int n, m, x; scan(n, m, x);
      for(Int i = 0; i <= n; ++i) {
         for(Int k = 0; k <= m; ++k) {
            if( i * k + (n-i) * (m-k) == x ) {
               puts("Yes");
               return;
            }
         }
      }
      puts("No");
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}




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

const int64_t mod = 1e9 + 7;

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

  int n, m;
  cin >> n >> m;

  vector<int> a(n), b(m);

  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }

  set<int> rows, cols;
  for (int i = 0; i < n; i++) {
    if (rows.count(a[i])) {
      cout << 0 << endl;
      return 0;
    }
    rows.insert(a[i]);
  }
  for (int i = 0; i < m; i++) {
    if (cols.count(b[i])) {
      cout << 0 << endl;
      return 0;
    }
    cols.insert(b[i]);
  }

  int64_t ans = 1;
  int64_t R = 0, C = 0;
  for (int num = n * m; num >= 1; num--) {
    int64_t r = R, c = C;
    bool r_flag = false, c_flag = false;
    if (rows.count(num)) {
      R++;
      r_flag = true;
      r = 1;
    }
    if (cols.count(num)) {
      C++;
      c_flag = true;
      c = 1;
    }
    if (r_flag or c_flag) {
      ans *= r * c;
      ans %= mod;
      continue;
    }
    int64_t cand = R * C - (n * m - num);
    // cerr << "num " << num << " cand: " << cand << endl;
    if (cand <= 0) {
      cout << 0 << endl;
      return 0;
    }
    ans *= cand;
    ans %= mod;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s, t;
    cin >> s >> t;
    int d[s.length() - t.length() + 1];
    for (int i = 0; i <= s.length() - t.length(); i++)
    {
        d[i] = 0;
        for (int j = 0; j < t.length(); j++)
            if (t[j] != s[i + j]) d[i]++;
    }
    sort(d, d + s.length() - t.length());
    cout << d[0];
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  string s;
  cin >> s;
  
  ll n = s.size();
  bool flag = true;
  REP(i, n){
    if(i%2==0 && (s[i] == 'R' || s[i] == 'U' || s[i] == 'D'))
      continue;

    if(i%2==1 && (s[i] == 'L' || s[i] == 'U' || s[i] == 'D'))
      continue;
    flag = false;
  }

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


Measured memory_bytes: 256
from pprint import pprint
n,w=map(int,input().split())
V=[]
W=[]
for _ in range(n):
    x,y=map(int,input().split())
    V.append(x)
    W.append(y)

dp=[[0]*(w+1) for _ in range(n+1)]

for i in range(n):
    for j in range(w+1):
        if W[i]>j:
            dp[i+1][j]=dp[i][j]
        else:
            dp[i+1][j]=max(dp[i][j],dp[i][j-W[i]]+V[i])
# pprint(dp)
print(dp[n][w])


Measured memory_bytes: 26276
#include "iostream"
#include "algorithm"
#include "cstring"
#include "cstdio"
#include "cmath"
#include "vector"
#include "map"
#include "set"
#include "queue"
using namespace std;
#define MAXN 200006
#define int long long
#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define all(x) (x).begin() , (x).end()
#define mem( a ) memset( a , 0 , sizeof a )
typedef long long ll;
int n , m , q;
void solve() {
	cin >> n >> m >> q;
	rep( i , m , q ) if( i % n == 0 ) return void(puts("OK"));
	puts("NG");
}

signed main() {
//    int T;cin >> T;while( T-- ) solve();
    solve();
}

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

int main(){
    int N; cin>>N;
    int Amax;
    vector<int> A(N,0);
    for (int i = 0; i < N; i++){
        cin>>A[i];
        Amax=max(Amax,A[i]);
    }
    A.push_back(10000000);
    sort(A.begin(),A.end());
    vector<bool> not_divisible(Amax+1,true);
    int ans=0;
    for (int i = 0; i < N; i++){
        int x=A[i];
        if(A[i]==A[i+1]){
            if(not_divisible[x]){
                while(x<=Amax){
                    not_divisible[x]=false;
                    x+=A[i];
                }
            }
            while(A[i]==A[i+1]){
                i++;
            }
        }else{
            if(not_divisible[x]){
                while(x<=Amax){
                    not_divisible[x]=false;
                    x+=A[i];
                }
                ans++;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4828
#include <iostream>
using namespace std;
int main(void){
    int a;
    cin>>a;
    int b[a];
    for(int i=0;i<a;i++){
        cin>>b[i];
    }
    for(int i=0;i<a-1;i++){
        for(int j=1;j<a;j++){
            if(b[i]<b[j]){
                int x=b[i];
                b[i]=b[j];
                b[j]=x;
            }
        }
    }
    int c=0;
    for(int i=1;i<a;i++){
        c+=b[i];
    }
    
    if(b[0]<c){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    
    return 0;
    
}


Measured memory_bytes: 256
import copy

word = "753"


def dfs(n):
    ret = 0

    num = 0 if not n else int(''.join(n))

    if N < num:
        return ret

    ret += 1 if len(set(''.join(n)) & set(word)) == len(word) else 0

    for c in word:
        tmp = copy.deepcopy(n)
        n.append(c)
        ret += dfs(n)
        n = tmp

    return ret


N = int(input())

print(dfs([]))


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

using namespace std;
using ll = long long;
constexpr int mod = 1e9+7;
constexpr int md = mod;
vector<ll> ret;

int main(){
    int n,k;
    cin>>n>>k;
    k--;
    string str;
    cin>>str;
    str[k] = tolower(str[k]);
    cout << str << endl;
    return 0;
}



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

int main() {
    long long n, ret = 0;
    std::cin >> n;
    std::vector<long long> a(n + 1);
    a[0] = 0;
    for (auto i = 1ll; i <= n; i++) {
        std::cin >> a[i];
        if (a[i] > a[i - 1] + 1 || a[i] >= i) {
            std::cout << -1 << std::endl;
            return 0;
        }

        if (a[i] <= a[i - 1]) {
            ret += a[i - 1];
        }
    }

    std::cout << ret + a[n] << std::endl;

    return 0;
}

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

int h,w,n;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
string field[30];
string temp[30];
bool clear[30][30];
bool flag;

bool isClear(){
  for(int i=0 ; i < h ; i++){
    for(int j=0 ; j < w ; j++){
      if(temp[i][j] != '.')return false;
    }
  }
  return true;
}
void Search(int x,int y){
  
  for(int i=0 ; i < 4 ; i++){
    int cnt=0;
    for(int j=0 ; ; j++){
      if(y+(dy[i]*j) < 0 || y+(dy[i]*j) >= h ||
	 x+(dx[i]*j) < 0 || x+(dx[i]*j) >= w
	 ){
	break;
      }
      if(temp[y+(dy[i]*j)][x+(dx[i]*j)] == temp [y][x]){
	cnt++;
      }else{
	break;
      }
    }
    if(cnt >= n){
      for(int j=0 ; j < cnt ; j++){
	clear[y+(dy[i]*j)][x+(dx[i]*j)]=true;
      }
      flag=false;
    }
  }
  
}
void Fall(){
  
  for(int i=h-1 ; i >= 0 ; i--){
    for(int j=0 ; j < w ; j++){
      if(temp[i][j] == '.'){
	int cnt=0;
	for(int k=i ; k >= 0 ; k--){
	  if(temp[k][j] == '.'){
	    cnt++;
	  }else{
	    break;
	  }
	}
	for(int k = i ; k-cnt >= 0 ; k--){
	  temp[k][j]=temp[k-cnt][j];
	}
	for(int k = 0 ; k < cnt ; k++){
	  temp[k][j]='.';
	}
      }
    }
  }
  
}
void Reflect(){
  
  while(1){
    flag=true;
    for(int i=0 ; i < h ; i++){
      for(int j=0 ; j < w ; j++){
	clear[i][j]=false;
      }
    }
    for(int i=0 ; i < h ; i++){
      for(int j=0 ; j < w ; j++){
	if(temp[i][j] != '.')Search(j,i);
      }
    }
    if(flag)break;
    for(int i=0 ; i < h ; i++){
      for(int j=0 ; j < w ; j++){
	if(clear[i][j])temp[i][j]='.';
      }
    }
    Fall();
  }
  
}
bool Solve(){
  
  /*swap horizontal*/
  for(int i=0 ; i < h ; i++){
    for(int j=0 ; j < w-1 ; j++){   
      /*copy field*/
      for(int k=0 ; k < h ; k++)temp[k]=field[k];
      swap(temp[i][j],temp[i][j+1]);
      Fall();
      Reflect();
      if(isClear())return true;
    }
  }
  
  return false;
}

int main(){
  
  cin >>h>>w>>n;
  
  for(int i=0 ; i < h ; i++)cin >>field[i];
  
  if(Solve()){
    cout <<"YES"<<endl;
  }else{
    cout <<"NO"<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define for0(n) for(i=0; i<(n); i++)
#define for1(n) for(i=1; i<=(n); i++)


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll _,i,j,n,a,b,e,k,u,t,x=1,m,y,q,f=1,c=0,d=0,l,p,z,o,r,g;
    string ss,s;
    cin>>a>>b>>c>>n;
    if(a<b&&b<c)
    {
        cout<<"Yes"<<endl;
        return 0;
    }
    f=0;
    while(n--)
    {
        if(a>=b)b*=2;
        else c*=2;
        if(a<b&&b<c)
        {
            f=1;
            break;
        }
    }
    if(f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


signed main(void) 
{
    ll n;
    cin >>n;
    ll n2 = 0;
    ll r = 0;
    while(true) {
        n2 += n;
        r++;
        n2 %= 360;
        if (n2 % 360 == 0) break;
    }
    mes(r);
    
    
   
}


Measured memory_bytes: 3584
#include <iostream>

using namespace std;

int main()
{
	int r, b, g;
	int num;
	
	cin >> r >> b >> g;
	
	num = 100 * r + 10 * b + g;
	
	if (num % 4 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	
	return (0);
}

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

int main(){
  int n,flag;
  cin >> n;
  flag = 0;
  for (int i=1;i<10;i++){
    if ((n%i==0) && (n/i<10) && (0<n/i)){
      flag = 1;
      break;
    }
  }
  if (flag == 1){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    long double ans = v[0];
    for (int i = 1; i < n; i++) {
        ans += v[i];
        ans /= 2.0;
    }

    cout << fixed << setprecision(10) << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i];
  ll m=1000;
  ll k=0; 
  vll b(0);
  b.pb(a[0]);
  rep(i,n){
    if(i!=0){
      if(a[i]!=a[i-1]){
        b.pb(a[i]);
      }
    }
  }
  vll c(0);
  c.pb(a[0]);
  rep(i,sz(b)){
    if(i!=0&&i!=sz(b)-1){
      if(b[i]>b[i-1]&&b[i]>b[i+1]){
        c.pb(b[i]);
      }
      else if(b[i]<b[i-1]&&b[i]<b[i+1]){
        c.pb(b[i]);
      }
    }
  }
  c.pb(b[sz(b)-1]);
  PQ que;
  que.pu(1000);
  rep(i,sz(c)){
    if(i!=sz(c)-1){
      if(c[i]<c[i+1]){
        m=que.top();
        k+=m/c[i];
        m%=c[i];
      }
      else{
        m+=k*c[i];
        k=0;
        que.pu(m);
      }
    }
    else if(k!=0){
      m+=k*c[i];
      k=0;
      que.pu(m);
    }
  }
  COUT(que.top());
}

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

int main(void) {
  ll a, b ,x;
  cin >> a >> b >> x;
  if(a==0)
  cout << (b/x)-(-1) << endl;
  else
  cout << (b / x) - ((a-1)/x) << endl;
}

Measured memory_bytes: 3620
#include <stdio.h>
int main(){
  int x,y,c;

  scanf("%d%d",&x,&y);
  if(x<y){
    c = x;
    x = y;
    y = c;
  }
  while(x%y!=0){
    c = x%y;
    x = y;
    y = c;
  }
  printf("%d\n",y);

  return 0;
}

Measured memory_bytes: 592
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;

int main() {

	string N;
	cin >> N;

	string three = "3", zero = "0", one = "1", six = "6", eight = "8";
	if (N[N.length() - 1] == three[0]) {

		cout << "bon";
		return 0;
	}
	else if (N[N.length() - 1] == zero[0] || N[N.length() - 1] == one[0] || N[N.length() - 1] == six[0] || N[N.length() - 1] == eight[0]) {

		cout << "pon";
		return 0;

	}
	else {
		cout << "hon";
		return 0;
	}



}

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

int main(){
    string s;
    cin >> s;

    string a[7] = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
    int flag = 0;

    for(int i = 0; i < 6; i++){
        if(a[i] == s){
            cout << 6 - i << endl;
            flag = 1;
            break;
        }
    }

    if(flag == 0){
        cout << 7 << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
const int N=1e5+10;
int main(){
    int n,a[N],l,r,mid,q,temp;
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    scanf("%d",&q);
    while(q--){
        scanf("%d",&temp);
        if(a[n-1]<temp)printf("%d\n",n);
        else if(a[0]>=temp)printf("0\n");
        else{
            l=0;
            r=n-1;
            while(r-l>1){
                mid=(r+l)>>1;
                if(a[mid]>=temp)r=mid;
                else l=mid;
            }
            printf("%d\n",r);
        }
    }
}


Measured memory_bytes: 3144
//(・ω・)
#include <stdio.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, atoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
#include <sstream> //istringstream
#include <stdlib.h>
#include <list>
#include <iterator>//std::advance()
using namespace std;

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

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

class BinaryHeap {
public:
	vector<int> Keys;
	int Num;
	int Max;
public:
	BinaryHeap(int Max) : Num(0), Max(Max) {
		Keys = vector<int>(Max + 1, 0);
	};
	void Exchange(int i, int j) {
		int buf = Keys[i];
		Keys[i] = Keys[j];
		Keys[j] = buf;
	}
	
	int Parent(int Child) {
		return Child / 2;
	}

	int LesserChild(int Parent) {
		int Child = Parent * 2;
		if (HasBrother(Child) && Keys[Child] > Keys[Child + 1]) Child++;
		return Child;
	}

	bool HasParent(int i) {
		return i > 1;
	}
	bool HasChild(int i) {
		return i * 2 <= Num;
	}
	bool HasBrother(int i) {
		return i + 1 <= Num;
	}

	void Insert(int Key) {
		if (Num == Max) {
			if (Keys[1] < Key) DeleteRoot();
			else return;
		};
		Num++;
		Keys[Num] = Key;
		Keys[0] += Key;
		int Now = Num;
		while (HasParent(Now) && Keys[Now] < Keys[Parent(Now)]) {
			Exchange(Now, Parent(Now));
			Now = Parent(Now);
		}
	}
	void DeleteRoot() {
		Keys[0] -= Keys[1];
		Keys[1] = Keys[Num];
		Num--;
		int Now = 1;
		int Child = LesserChild(Now);
		while (HasChild(Now) && Keys[Now] > Keys[Child]) {
			Exchange(Now, Child);
			Now = Child;
			Child = LesserChild(Now);
		}
	}

	int Sum() {
		return Keys[0];
	}
};

int main() {

	int N, K;
	cin >> N >> K;

	BinaryHeap B(K);
	for (int i = 0; i < N; i++) {
		int l;
		cin >> l;
		B.Insert(l);
	}
	cout << B.Sum();
}

Measured memory_bytes: 384
N,L = map(int, input().split())
list = []
sum = 0
min = 10000
sign = 1
for i in range(1,N+1):
    sum += L+i-1
    list.append(L+i-1)
for num in list:
    if min > abs(num):
        min = abs(num)
        if num > 0:
            sign = 1
        else:
            sign = -1
print(sum-min*sign)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
deque < int > a; 
deque < int > sm;
int main()
{
	int n,k;
	cin>>n>>k;
	int u;
	for(int i=0;i<k;i++)
	{
		cin>>u;
		a.push_back(u);
	}	
	int y=0;
	sort(a.begin(),a.end());
	for(int i=0;i<k-1;i++)
	{
		y=a[i+1]-a[i];
		sm.push_back(y);
	}
	sm.push_back((n-a[k-1])+a[0]);
//	cout<<"sm:";
//	for(int i=0;i<k;i++) 
//		cout<<sm[i]<<" ";
//	cout<<endl;
	int max2=-1000;
	for(int i=0;i<k;i++)
	{
		if(max2<sm[i])
		{
			max2=sm[i];
		}
	}
	int ans=n-max2;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1920
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int a = arr[0];
        int b = arr[1];
        int c = arr[2];
        if (a < b && b < c)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 16368
#include<bits/stdc++.h>
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int X;
  int sum = 0;
  cin>>X;
  int a = X % 500;
  int b = X - a;
  X = X - b;
  sum += ((b / 500) * 1000);
  int c = a % 5;
  int d = X - c;
  X = X - d;
  sum += ((d / 5) * 5);
  cout<<sum<<'\n'; 
}

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

int n, A[1000100];
vector<int> G;
long long cnt;

void insertionSort(int g) {
    for (int i = g; i < n; i++) {
        int v = A[i];
        int j = i - g;
        while (j >= 0 && A[j] > v) {
            A[j + g] = A[j];
            j -= g;
            cnt++;
        }
        A[j + g] = v;
    }
    return;
}

void shellSort() {
    cnt = 0;
    int h = 1;
    while (h <= n) {
        G.push_back(h);
        h = 3 * h + 1;
    }
    reverse(G.begin(), G.end());
    for (int i = 0; i < (int)G.size(); i++) insertionSort(G[i]);
    return;
}

void print() {
    cout << G.size() << endl;
    for (int i = 0; i < (int)G.size(); i++) {
        if (i) cout << " ";
        cout << G[i];
    }
    cout << "\n" << cnt << endl;
    for (int i = 0; i < n; i++) cout << A[i] << endl;
    return;
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> A[i];
    shellSort();
    print();
    return 0;
}


Measured memory_bytes: 6992
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<cstring>
#include<bitset>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<numeric>
#include<set>
#include<math.h>
using namespace std;

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

#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)

long long INF=1e9;
const int mod=10007;
#define ll long long

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ans=n;
    for(int i=0;i<n;){
        while(s[i]==s[i+1]){
            ans--;
            i++;
        }
        i++;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> h(N);
  for(int i = 0; i < N; i++){
    cin >> h.at(i);
  }
  sort(h.begin(), h.end(), greater<int>());
  int result = 2147483647;
  for(int i = 0; i < (N-K+1); i++){
    int tmp = h.at(i) - h.at(i+K-1);
    if(result > tmp){
      result = tmp;
    }
  }
  cout << result << endl;
}


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

bool solve();

int main()
{
    if (solve()) printf("Yes\n");
    else printf("No\n");
    return 0;
}

bool solve()
{
    int n, count[3]{};
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        int a;
        scanf("%d", &a);
        if (!(a % 4)) count[0]++;
        else if (!(a % 2)) count[1]++;
        else count[2]++;
    }
    if (count[2] > count[0] + 1) return false;
    if (count[2] == count[0] + 1 && count[1]) return false;
    else return true;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
using namespace std;

int main(){
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;

  int res = A*X + B*Y;
  int tmp;

  if  (X == Y) {
    cout << ((res >= X*C*2)? X*C*2: res) << endl;
    return 0;
  }

  tmp = (min(X, Y) * 2 * C) + (((X>Y)? A: B) * abs(X-Y));
  if (tmp < res) res = tmp;

  tmp = max(X, Y) * 2 * C;
  if (tmp < res) res = tmp;



  cout << res << endl;
}


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

long int ar[100001];
int main(){
  
  int n,i;
  cin>>n;
  long int a=0;
  int sign = 1;
  for(i=0;i<n;i++){ 
                   cin>>ar[i];
                   if(sign)
                     a = a+ar[i]; else a = a-ar[i];sign  = 1-sign;}
  
  cout<<a<<" ";
  for(i=1;i<n;i++){
    a = (ar[i-1]-a/2)*2;
    cout<<a<<" ";
  }
  
    
 return 0;  
  
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
 
using namespace std;
 
signed main()
{
    fast;
    int n,m;
    cin>>n>>m;

    if ( n == m )
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
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;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 

vll dp(100100);

ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  st s;	
  ci(s)
    SORT(s);
  if(s[0]==s[1]&&s[2]==s[3]&&s[1]!=s[2]){
    co("Yes")
  }
  else{
    co("No")
  }
}

Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	if scanner.Scan() {
		if n, err := strconv.Atoi(scanner.Text()); err == nil {
			fmt.Println(n * n * n)
		} else {
			fmt.Println(err)
		}
	}
}


Measured memory_bytes: 1088
loop do
  a,b = gets.split.map(&:to_i)
  break if (a|b)==0
  dp = Array.new(a+1,0).map{Array.new(b+1,0)}
  dp[1][1] = 1
  n = gets.to_i
  n.times{
    x,y = gets.split.map(&:to_i)
    dp[x][y]=nil
  }
  (1..a).each{|i|
    (1..b).each{|j|
      next if dp[i][j]!=0
      dp[i][j] = dp[i-1][j].to_i+ dp[i][j-1].to_i
    }
  }
  puts dp[a][b].to_i
end

Measured memory_bytes: 5788
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        int a = 1;
        for(int i=0; i<n; i++) {
            if(a < k) a *= 2;
            else a += k;
        }
        System.out.println(a);
    }
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int N;
  set<int> a;
  cin >> N;
  int A;
  rep(i, N){
    cin >> A;
    if(a.count(A)){
      a.erase(A);
    }else{
      a.insert(A);
    }
  }
  //int ans = 0;
  //sort(a.begin(), a.end(), greater<int>());
  cout << a.size() << endl;
  return 0;
}


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

int main() {
  string s;
  cin >> s;
  int a = 0, b = 0, c = 0, d = 0;
  for (int i = 0; i < s.size(); i++) {
    if (i%2 == 0) {
      if (s[i] == '0') {
        a++;
      }
      else {
        b++;
      }
    }
    else {
      if (s[i] == '0') {
        c++;
      }
      else {
        d++;
      }
    }
  }
  int ans = min(b + c, a + d);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include<vector>
#include<climits>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<functional>
#include <numeric>
using namespace std;
using ll = long long;
int main(){
  ll N,M;
  cin>>N>>M;
  vector<bool> like(M,true);
  for(ll i=0;i<N;++i){
    ll K;
    cin>>K;
    vector<bool> l(M,false);
    for(ll j=0;j<K;++j){
      ll A;
      cin>>A;
      l[A-1]=true;
    }
    for(int ii=0;ii<l.size();++ii){
      if(l[ii]==false){
        like[ii]=false;
      }
    }
  }
  ll num =0;
  for(auto l:like){
    if(l==true)num++;
  }
  cout<<num<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int n,c,t=0;
string itos(ll a)
{
	string s;
	while(a>0)
	{
		int e=a%10ll;
		s+=e+'0';
		a/=10ll;
	}
	reverse(s.begin(),s.end());
	return s;
}
int rev(int k)
{
	int res=0;
	while(k>0)
	{
		res+=k%10;
		k/=10;
		res*=10;
	}
	return res/10;
}
bool is_palindrome(ll p)
{
	string s=itos(p);
	if(s[n]!=(c+'0'))return false;
	for(int i=0;i<((int)s.size())/2;i++)
	{
		if(s[i]!=s[s.size()-1-i])return false;
	}
	return true;
}
bool is_prime(ll x)
{
	for(ll i=2;i*i<=x;i++)
	{
		if(x%i==0)return false;
	}
	return true;
}
int main()
{
	cin >> n >> c;
	if(c>=0)t=1;
	if(n==1&&c<0)
	{
		cout << 11 << endl;
		return 0;
	}
	if(c<0)
	{
		for(int i=0;i<2*n;i++)cout << 9;
		cout << endl;
		return 0;
	}
	int mx=((int)pow(10,n))-1,mi=(mx+1)/10;
	for(int i=mx;i>=mi;i--)
	{
		int v=i*100*mi+c*10*mi+rev(i);
		if(!is_palindrome(v))continue;
		if(!is_prime(v))continue;
		cout << v << endl;
		return 0;
	}
	cout << ((int)pow(10,n))-1;
	cout << c;
	cout << ((int)pow(10,n))-1;
	return 0;
}

Measured memory_bytes: 1244
#include <stdio.h>

#include <string.h>

#include <math.h>

#define pi acos(-1)

char s[1005];

int main(){

	int a,b,h,m;
	scanf("%d%d%d%d",&a,&b,&h,&m);

	double are=30.0*h-5.5*m;

	double c=sqrt(1.0*a*a+1.0*b*b-2.0*a*b*cos(are/180*pi));

	printf("%.11lf\n",c);

	return 0;

}

Measured memory_bytes: 2596